/* =====================================================================
 * WasserKraft Agents — Design system « Chrome & Eau »
 * ---------------------------------------------------------------------
 * Couche unique chargée par includes/pwa-head.php, donc présente dans le
 * <head> de TOUTES les pages (agent/*, admin/*, publiques). Elle redéfinit
 * les tokens de agents.css puis affine les composants partagés : les pages
 * existantes héritent du nouveau design sans être modifiées une par une.
 *
 * Direction : graphite profond + minéral cassé + hairlines neutres,
 * turquoise réservé aux accents, chrome réservé aux récompenses.
 * Aucun dégradé décoratif, aucune ombre lourde, aucune animation gadget.
 *
 * Ordre de chargement : agents.css → wk-ui.css → CSS de page.
 * Les règles ci-dessous montent d'un cran en spécificité (préfixe body/
 * .wk-app) là où un CSS de page doit être neutralisé.
 * ===================================================================== */

:root {
  /* ---- Encres & surfaces ---- */
  --wk-ink: #0F1A1D;
  --wk-ink-2: #33474D;
  --wk-ink-3: #5A6B70;
  --wk-shell: #16262B;
  --wk-shell-2: #1E3238;

  --wk-canvas: #F4F6F6;
  --wk-surface: #FFFFFF;
  --wk-surface-2: #FAFBFB;
  --wk-surface-sunken: #EFF2F2;

  /* ---- Filets (neutres, jamais teintés) ---- */
  --wk-line: rgba(15, 26, 29, 0.10);
  --wk-line-strong: rgba(15, 26, 29, 0.18);
  --wk-line-invert: rgba(255, 255, 255, 0.14);

  /* ---- Marque ---- */
  --wk-brand: #0E7C8E;
  --wk-brand-deep: #0A5C6A;
  --wk-brand-bright: #12A0B6;
  --wk-brand-wash: #EAF3F5;
  --wk-brand-wash-2: #DCEBEE;

  /* ---- Chrome / métal : réservé aux récompenses et à l'anneau ---- */
  --wk-chrome: linear-gradient(135deg, #A8B6B9 0%, #EEF2F3 38%, #C2CDCF 62%, #94A4A8 100%);
  --wk-brass: #A07A2C;
  --wk-brass-wash: #F7F1E3;

  /* ---- États (toujours accompagnés d'une icône + d'un libellé) ---- */
  --wk-ok: #2E8B2F;
  --wk-ok-ink: #1B5E20;
  --wk-ok-wash: #E7F3E8;
  --wk-warn: #B06E00;
  --wk-warn-ink: #7A4A00;
  --wk-warn-wash: #FBF0DC;
  --wk-crit: #B32318;
  --wk-crit-ink: #8C1D18;
  --wk-crit-wash: #FBE9E7;

  /* ---- Compat : anciens tokens de agents.css remappés ---- */
  --wk-main: var(--wk-brand);
  --wk-main-dark: var(--wk-brand-deep);
  --wk-main-soft: var(--wk-brand-wash);
  --wk-main-border: var(--wk-line);
  --wk-bg: var(--wk-canvas);
  --wk-text: var(--wk-ink);
  --wk-muted: var(--wk-ink-3);
  --wk-card: var(--wk-surface);
  --wk-red: var(--wk-crit);
  --wk-green: var(--wk-ok-ink);
  --wk-green-bg: var(--wk-ok-wash);
  --wk-green-text: var(--wk-ok-ink);
  --wk-orange-bg: var(--wk-warn-wash);
  --wk-orange-text: var(--wk-warn-ink);
  --wk-red-bg: var(--wk-crit-wash);
  --wk-red-text: var(--wk-crit-ink);

  /* ---- Élévation : discrète, jamais colorée ---- */
  --wk-shadow: 0 1px 2px rgba(15, 26, 29, 0.04), 0 8px 24px rgba(15, 26, 29, 0.05);
  --wk-shadow-sm: 0 1px 2px rgba(15, 26, 29, 0.05);
  --wk-shadow-lg: 0 2px 4px rgba(15, 26, 29, 0.04), 0 18px 48px rgba(15, 26, 29, 0.10);

  /* ---- Rayons : échelle, pas une valeur unique ---- */
  --wk-r-xs: 6px;
  --wk-r-sm: 10px;
  --wk-r-md: 14px;
  --wk-r-lg: 20px;
  --wk-r-xl: 28px;
  --wk-radius: var(--wk-r-lg);

  /* ---- Typographie ---- */
  --wk-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
             "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wk-font-num: "Segoe UI Variable Display", "SF Pro Display", -apple-system,
                 BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  /* ---- Rythme ---- */
  --wk-gap: 18px;
  --wk-pad: 22px;
}

/* =====================================================================
 * 1. Socle
 * ===================================================================== */

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--wk-font);
  background: var(--wk-canvas);
  color: var(--wk-ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Chiffres alignés partout où un montant est lu en colonne. */
.wk-amount, .wk-card-value, .wk-kpi-value, .wk-stat-value,
.wk-money, .wk-table td, .wk-ring-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

h1, h2, h3, h4 {
  font-family: var(--wk-font);
  color: var(--wk-ink);
  text-wrap: balance;
}

body h1 {
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -0.025em;
}

body .wk-panel h2,
body .wk-panel-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.3;
}

body .wk-topbar p,
body .wk-panel-intro,
body .wk-panel-header p {
  color: var(--wk-ink-3);
  font-size: 14px;
  line-height: 1.55;
}

/* Focus visible unifié : anneau turquoise sur fond clair, blanc sur shell. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--wk-brand);
  outline-offset: 2px;
  border-radius: var(--wk-r-xs);
}

.wk-sidebar a:focus-visible,
.wk-mobile-nav a:focus-visible {
  outline-color: #FFFFFF;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================================
 * 2. Shell applicatif : rail graphite + canvas minéral
 * ===================================================================== */

body .wk-app {
  grid-template-columns: 272px 1fr;
  background: var(--wk-canvas);
}

body .wk-sidebar {
  width: 272px;
  background: var(--wk-shell);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
}

/* Filet chrome vertical : le seul rappel « métal » du shell. */
body .wk-sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.22) 22%,
    rgba(18, 160, 182, 0.35) 50%,
    rgba(255, 255, 255, 0.18) 78%,
    rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

body .wk-logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #FFFFFF;
  margin: 0;
  padding: 2px 8px 0;
}

body .wk-sidebar-subtitle { display: none; }

body .wk-main {
  padding: 26px 30px 40px;
  max-width: 1320px;
}

body .wk-topbar {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--wk-line);
}

/* =====================================================================
 * 3. Navigation
 * ===================================================================== */

body .wk-nav { gap: 2px; }

body .wk-nav-group {
  gap: 1px;
}

body .wk-nav-group + .wk-nav-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

body .wk-nav-group-label {
  padding: 0 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7E9399;
}

body .wk-nav a {
  position: relative;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--wk-r-sm);
  color: #9FB3B8;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 0.15s ease, color 0.15s ease;
}

body .wk-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #E8EFF0;
}

body .wk-nav a.active {
  background: rgba(18, 160, 182, 0.14);
  color: #FFFFFF;
  font-weight: 600;
}

/* Marqueur actif : trait turquoise à gauche, pas un aplat. */
body .wk-nav a.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--wk-brand-bright);
}

body .wk-nav a.active svg { stroke: var(--wk-brand-bright); }

body .wk-nav svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
  opacity: 0.95;
}

/* Compteur discret à droite d'une entrée de menu (ex : relances). */
.wk-nav-count {
  margin-left: auto;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wk-nav-count--alert { background: var(--wk-crit); }

/* =====================================================================
 * 4. Bloc profil du rail : identité + statut + commission
 * ===================================================================== */

body .wk-agent-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--wk-r-md);
  padding: 13px;
  margin-bottom: 0;
}

body .wk-agent-mini > span:first-child { display: none; }

.wk-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.wk-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, var(--wk-brand-bright) 0%, var(--wk-brand-deep) 100%);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wk-identity-text { min-width: 0; }

body .wk-agent-mini strong,
.wk-identity-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wk-identity-code {
  font-size: 11.5px;
  color: #7E9399;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

body .wk-agent-code {
  margin-top: 0;
  padding: 0;
  background: none;
  font-size: 11.5px;
  font-weight: 500;
  color: #7E9399;
  letter-spacing: 0.04em;
}

/* Statut (pack) + commission : deux lignes de faits, pas des badges criards. */
body .wk-agent-pack {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body .wk-agent-pack span {
  font-size: 11.5px;
  color: #7E9399;
}

body .wk-agent-pack strong { color: #FFFFFF; font-weight: 600; }

.wk-pack-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(18, 160, 182, 0.18);
  border: 1px solid rgba(18, 160, 182, 0.32);
  color: #BEEAF2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.wk-pack-chip--none {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: #9FB3B8;
}

.wk-commission-line {
  font-size: 11.5px;
  color: #7E9399;
  white-space: nowrap;
}

.wk-commission-line b { color: #E8EFF0; font-weight: 600; }

/* =====================================================================
 * 5. Anneau de progression « objets démo » (jauge du rail)
 * ---------------------------------------------------------------------
 * Forme retenue : anneau + vignette produit. Un anneau lit un ratio d'un
 * coup d'œil dans un bloc étroit, là où une barre pleine largeur se
 * confondrait avec la jauge d'objectifs quotidiens.
 * Rampe séquentielle à teinte unique (turquoise clair → profond).
 * ===================================================================== */

body a.wk-demo-gauge {
  display: block;
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--wk-r-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #E8EFF0;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

body a.wk-demo-gauge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(18, 160, 182, 0.42);
}

body .wk-demo-gauge-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7E9399;
}

body .wk-demo-gauge-title em {
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 600;
  color: #BEEAF2;
  background: none;
  padding: 0;
}

.wk-ring-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wk-ring {
  position: relative;
  flex-shrink: 0;
  width: 58px;
  height: 58px;
}

.wk-ring svg { width: 58px; height: 58px; transform: rotate(-90deg); display: block; }

.wk-ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.13);
  stroke-width: 5;
}

.wk-ring-fill {
  fill: none;
  stroke: url(#wkRingGrad);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.wk-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}

.wk-ring-side { min-width: 0; }

.wk-ring-figures {
  font-size: 12.5px;
  font-weight: 600;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.wk-ring-figures span { color: #7E9399; font-weight: 500; }

.wk-ring-next {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  line-height: 1.35;
  color: #9FB3B8;
}

.wk-ring-next img {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #FFFFFF;
  object-fit: contain;
  padding: 2px;
  box-sizing: border-box;
}

.wk-ring-next b { color: #E8EFF0; font-weight: 600; display: block; }

.wk-ring-done {
  margin-top: 6px;
  font-size: 11.5px;
  color: #BEEAF2;
  font-weight: 600;
}

/* =====================================================================
 * 6. Pied du rail
 * ===================================================================== */

body .wk-sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 6px;
}

body .wk-sidebar-icon-link {
  width: 36px;
  height: 36px;
  border-radius: var(--wk-r-sm);
  background: rgba(255, 255, 255, 0.05);
  color: #9FB3B8;
}

body .wk-sidebar-icon-link:hover,
body .wk-sidebar-icon-link.active {
  background: rgba(255, 255, 255, 0.11);
  color: #FFFFFF;
}

body .wk-sidebar-icon-link--danger:hover {
  background: rgba(179, 35, 24, 0.28);
  color: #FFC9C4;
}

/* =====================================================================
 * 7. Surfaces : panneaux, cartes
 * ===================================================================== */

body .wk-panel {
  background: var(--wk-surface);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-r-lg);
  padding: var(--wk-pad);
  box-shadow: var(--wk-shadow-sm);
  margin-bottom: var(--wk-gap);
}

body .wk-panel-header { margin-bottom: 16px; }

body .wk-app .wk-card {
  background: var(--wk-surface);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-r-md);
  box-shadow: none;
  padding: 16px;
}

/* Le liseré turquoise décoratif de dashboard.css est retiré. */
body .wk-app .wk-card::before { display: none; }

body .wk-app .wk-card-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--wk-ink-3);
  text-transform: none;
}

body .wk-app .wk-card-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--wk-ink);
}

body .wk-app .wk-card-note { font-size: 12.5px; color: var(--wk-ink-3); }

body .wk-app .wk-card-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--wk-r-xs);
  background: var(--wk-brand-wash);
  color: var(--wk-brand);
}

body .wk-empty {
  background: var(--wk-surface-sunken);
  border: 1px dashed var(--wk-line-strong);
  border-radius: var(--wk-r-md);
  color: var(--wk-ink-3);
  padding: 26px;
}

/* =====================================================================
 * 8. Tuiles d'indicateurs (hiérarchie : primaire vs secondaire)
 * ---------------------------------------------------------------------
 * Un chiffre-clé est un « hero number », pas un graphique : pas d'axe,
 * pas de couleur de série, l'encre porte le texte et l'accent reste rare.
 * ===================================================================== */

.wk-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--wk-line);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-r-lg);
  overflow: hidden;
  margin-bottom: var(--wk-gap);
  box-shadow: var(--wk-shadow-sm);
}

/* Tuiles jointives séparées par un filet d'1px : une seule surface lue
   comme un bandeau, au lieu de quatre cartes flottantes identiques. */
.wk-kpi {
  background: var(--wk-surface);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.wk-kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wk-ink-3);
}

.wk-kpi-value {
  font-size: clamp(22px, 2.2vw, 29px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--wk-ink);
}

.wk-kpi-note {
  font-size: 12px;
  color: var(--wk-ink-3);
  line-height: 1.4;
}

.wk-kpi--accent .wk-kpi-value { color: var(--wk-brand-deep); }

.wk-kpi-spark {
  margin-top: 7px;
  height: 5px;
  border-radius: 999px;
  background: var(--wk-surface-sunken);
  overflow: hidden;
}

.wk-kpi-spark i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--wk-brand);
}

/* =====================================================================
 * 9. Pastilles d'état — couleur + icône + libellé, jamais couleur seule
 * ===================================================================== */

body .wk-status-pill,
body .wk-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--wk-r-xs);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.wk-status-pill::before,
.wk-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

body .wk-status-pill--validated,
body .wk-status-pill--paid,
body .wk-status-pill--delivered,
body .wk-status.active {
  background: var(--wk-ok-wash);
  color: var(--wk-ok-ink);
  border-color: rgba(46, 139, 47, 0.22);
}

body .wk-status-pill--pending,
body .wk-status-pill--requested,
body .wk-status-pill--preparing,
body .wk-status.inactive {
  background: var(--wk-warn-wash);
  color: var(--wk-warn-ink);
  border-color: rgba(176, 110, 0, 0.22);
}

body .wk-status-pill--cancelled,
body .wk-status-pill--rejected,
body .wk-status.blocked {
  background: var(--wk-crit-wash);
  color: var(--wk-crit-ink);
  border-color: rgba(179, 35, 24, 0.22);
}

body .wk-status-pill--invoiced,
body .wk-status-pill--payment_sent,
body .wk-status-pill--shipped {
  background: var(--wk-brand-wash);
  color: var(--wk-brand-deep);
  border-color: rgba(14, 124, 142, 0.22);
}

/* =====================================================================
 * 10. Boutons
 * ===================================================================== */

body .wk-btn {
  min-height: 40px;
  padding: 10px 17px;
  border-radius: var(--wk-r-sm);
  background: var(--wk-brand);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

body .wk-btn:hover {
  background: var(--wk-brand-deep);
  filter: none;
  transform: none;
}

body .wk-btn:active { transform: translateY(0.5px); }

body .wk-btn-secondary {
  background: var(--wk-surface);
  color: var(--wk-ink);
  border: 1px solid var(--wk-line-strong);
}

body .wk-btn-secondary:hover {
  background: var(--wk-surface-2);
  border-color: var(--wk-ink-3);
  color: var(--wk-ink);
}

body .wk-btn-danger {
  background: var(--wk-surface);
  color: var(--wk-crit-ink);
  border: 1px solid rgba(179, 35, 24, 0.3);
}

body .wk-btn-danger:hover { background: var(--wk-crit-wash); }

body .wk-btn-small { min-height: 32px; padding: 6px 12px; font-size: 12.5px; }

body .wk-btn-ghost {
  background: transparent;
  color: var(--wk-brand-deep);
  border: 1px solid transparent;
  box-shadow: none;
}

body .wk-btn-ghost:hover { background: var(--wk-brand-wash); }

body .wk-pill {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: var(--wk-r-sm);
  background: var(--wk-surface);
  border: 1px solid var(--wk-line);
  color: var(--wk-ink-2);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: none;
}

/* =====================================================================
 * 11. Formulaires
 * ===================================================================== */

body label {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--wk-ink-2);
  letter-spacing: -0.003em;
}

body input,
body select,
body textarea {
  border: 1px solid var(--wk-line-strong);
  border-radius: var(--wk-r-sm);
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: var(--wk-font);
  background: var(--wk-surface);
  color: var(--wk-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body input::placeholder,
body textarea::placeholder { color: #93A2A6; }

body input:hover,
body select:hover,
body textarea:hover { border-color: var(--wk-ink-3); }

body input:focus,
body select:focus,
body textarea:focus {
  border-color: var(--wk-brand);
  box-shadow: 0 0 0 3px rgba(14, 124, 142, 0.14);
  outline: none;
}

body input[aria-invalid="true"],
body select[aria-invalid="true"],
body textarea[aria-invalid="true"] {
  border-color: var(--wk-crit);
  box-shadow: 0 0 0 3px rgba(179, 35, 24, 0.12);
}

/* Message d'erreur au plus près du champ. */
.wk-field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--wk-crit-ink);
}

.wk-field-error::before {
  content: "!";
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--wk-crit);
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

body .wk-helper { font-size: 12.5px; color: var(--wk-ink-3); }

body .wk-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--wk-r-md);
  font-size: 13.5px;
  border-width: 1px;
  border-style: solid;
}

body .wk-alert.success {
  background: var(--wk-ok-wash);
  color: var(--wk-ok-ink);
  border-color: rgba(46, 139, 47, 0.24);
}

body .wk-alert.error {
  background: var(--wk-crit-wash);
  color: var(--wk-crit-ink);
  border-color: rgba(179, 35, 24, 0.24);
}

/* =====================================================================
 * 12. Tableaux & listes
 * ===================================================================== */

body .wk-table-scroll {
  border-radius: var(--wk-r-md);
  border: 1px solid var(--wk-line);
}

body .wk-table thead th {
  background: var(--wk-surface-2);
  color: var(--wk-ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--wk-line);
  padding: 11px 14px;
}

body .wk-table tbody td {
  border-bottom: 1px solid var(--wk-line);
  padding: 12px 14px;
  font-size: 13.5px;
}

body .wk-table tbody tr:hover td { background: var(--wk-surface-2); }

body .wk-list-item {
  border-radius: var(--wk-r-sm);
  padding: 12px 13px;
  border: 1px solid transparent;
  transition: background 0.15s ease;
}

body .wk-list-item:hover {
  background: var(--wk-surface-2);
  border-color: var(--wk-line);
}

body .wk-list-title { font-size: 14px; font-weight: 600; color: var(--wk-ink); }
body .wk-list-meta { font-size: 12.5px; color: var(--wk-ink-3); }

/* =====================================================================
 * 13. Barres de progression génériques (rampe séquentielle turquoise)
 * ===================================================================== */

body .wk-progress {
  height: 7px;
  border-radius: 999px;
  background: var(--wk-surface-sunken);
  overflow: hidden;
}

body .wk-progress-fill {
  background: var(--wk-brand);
  border-radius: 999px;
}

body .wk-progress--done .wk-progress-fill { background: var(--wk-ok); }

/* =====================================================================
 * 14. Navigation mobile
 * ===================================================================== */

@media (max-width: 980px) {
  body .wk-app { grid-template-columns: 1fr; }

  body .wk-main {
    padding: 18px 16px 88px;
    max-width: none;
  }

  body h1 { font-size: 24px; }

  .wk-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .wk-kpi { padding: 14px 15px; }
}

body .wk-mobile-nav {
  background: rgba(22, 38, 43, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body .wk-mobile-nav-item {
  color: #8FA5AB;
  font-size: 10.5px;
  font-weight: 500;
  gap: 3px;
  padding: 9px 4px;
}

body .wk-mobile-nav-item.active { color: #FFFFFF; }

body .wk-mobile-nav-item.active svg { stroke: var(--wk-brand-bright); }

body .wk-mobile-nav-item svg { width: 20px; height: 20px; stroke-width: 1.7; }

/* Bouton menu du rail : discret, aligné sur le reste. */
body .wk-sidebar-toggle {
  border-radius: var(--wk-r-sm);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #E8EFF0;
  font-size: 13px;
  font-weight: 600;
}

/* =====================================================================
 * 15. Utilitaires partagés
 * ===================================================================== */

.wk-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 26px 0 12px;
}

.wk-section-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wk-ink-3);
}

.wk-section-head a {
  font-size: 13px;
  font-weight: 600;
  color: var(--wk-brand-deep);
  text-decoration: none;
}

.wk-section-head a:hover { text-decoration: underline; }

.wk-stack { display: grid; gap: var(--wk-gap); }

.wk-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================================================================
 * Bandeau d'échéance d'adhésion
 *
 * Affiché sur les trente derniers jours, puis après expiration. Il vit
 * en haut du contenu, pas en position fixe : un bandeau collant sur un
 * écran de travail que l'agent consulte tous les jours devient vite une
 * nuisance qu'on apprend à ne plus voir.
 * ===================================================================== */

.wk-subbanner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: var(--wk-gap, 20px);
  padding: 14px 18px;
  border-radius: var(--wk-r-lg, 14px);
  background: #FDF3E7;
  border: 1px solid rgba(176, 110, 0, 0.28);
  color: #5C3B00;
}

.wk-subbanner--urgent {
  background: #FDECE9;
  border-color: rgba(179, 35, 24, 0.30);
  color: #6B1C15;
}

.wk-subbanner--expired {
  background: var(--wk-shell, #16262B);
  border-color: rgba(255, 255, 255, 0.14);
  color: #E8EFF0;
}

.wk-subbanner-txt {
  flex: 1 1 320px;
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
}

.wk-subbanner-txt strong { display: block; }
.wk-subbanner-txt span { opacity: 0.85; }

.wk-subbanner-cta {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--wk-brand, #0E7C8E);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
}

.wk-subbanner-cta:hover { background: var(--wk-brand-bright, #12A0B6); }

.wk-subbanner--expired .wk-subbanner-cta { background: var(--wk-brand-bright, #12A0B6); }

/* =====================================================================
 * La marque
 *
 * Le portail n'affichait que le mot « WasserKraft ». La marque déposée
 * existe : on la pose partout où le nom apparaît, sans toucher au HTML —
 * les trois emplacements portent déjà une classe stable.
 *
 * Sur fond sombre, le disque du logo se confondrait avec le rail : il est
 * porté par une pastille blanche, qui est la façon dont la marque est
 * appliquée sur les supports foncés.
 * ===================================================================== */

body .wk-logo,
.wk-auth-logo,
.wk-pub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

body .wk-logo::before,
.wk-auth-logo::before,
.wk-pub-brand::before {
  content: '';
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: url('/assets/icons/wk-icon-192.png') center / contain no-repeat;
}

/* Rail sombre : pastille blanche sous la marque. */
body .wk-logo::before {
  background-color: #fff;
  background-size: 30px 30px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* En-tête public : le nom est sur deux lignes, la marque s'aligne en haut. */
.wk-pub-brand { align-items: center; }
.wk-pub-brand::before { width: 34px; height: 34px; }

/* Rail replié sur mobile : la pastille tient lieu de logo, le mot passe
   à la ligne et serait tronqué. */
@media (max-width: 1024px) {
  body .wk-logo::before { width: 26px; height: 26px; background-size: 26px 26px; }
}

/* =====================================================================
 * L'attribut hidden gagne toujours
 *
 * Le navigateur applique display:none aux éléments [hidden] depuis sa
 * feuille par défaut — que la moindre règle d'auteur fixant display écrase.
 * .wk-exam est en display:flex et .wk-btn en inline-flex : l'examen de
 * certification et son bouton d'envoi s'affichaient donc dès l'ouverture
 * de la page, examen ouvert mais sans question révélée.
 *
 * Un composant qui se cache par l'attribut ne doit jamais dépendre de
 * l'ordre des feuilles de style : la règle est posée une fois, pour tous.
 * ===================================================================== */

[hidden] { display: none !important; }

/* =====================================================================
 * Prise en main d'un compte agent
 *
 * Un administrateur qui dépanne voit l'écran d'un autre. Le bandeau est
 * volontairement voyant et permanent : confondre cet écran avec le sien
 * conduirait à décider sur les chiffres de quelqu'un d'autre.
 * ===================================================================== */

.wk-impersonation {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: #7A2E12;
  color: #FFEDE4;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.wk-impersonation p { margin: 0; flex: 1; min-width: 0; }
.wk-impersonation strong { color: #fff; }

.wk-impersonation-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FF8A5B;
  box-shadow: 0 0 0 4px rgba(255, 138, 91, 0.25);
}

.wk-impersonation form { margin: 0; flex-shrink: 0; }

.wk-impersonation button {
  min-height: 34px;
  padding: 7px 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: none;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.wk-impersonation button:hover { background: rgba(255, 255, 255, 0.16); }

/* Le bandeau est fixe : le contenu doit lui laisser sa place. */
body:has(.wk-impersonation) .wk-app { padding-top: 54px; }

@media (max-width: 640px) {
  .wk-impersonation { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .wk-impersonation p { flex: 1 1 100%; font-size: 12.5px; }
  body:has(.wk-impersonation) .wk-app { padding-top: 92px; }
}

/* =====================================================================
 * Reprise d'examen depuis le tableau de bord
 *
 * Une copie commencée puis quittée n'existe nulle part ailleurs à l'écran :
 * sans ce rappel, l'agent croit devoir tout recommencer et repousse.
 * ===================================================================== */

.wk-resume-exam {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: var(--wk-gap, 20px);
  padding: 16px 20px;
  border: 1px solid var(--wk-line, #E2E8E9);
  border-left: 3px solid var(--wk-brand, #0E7C8E);
  border-radius: var(--wk-r-lg, 14px);
  background: #fff;
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.wk-resume-exam:hover {
  border-color: var(--wk-brand-bright, #12A0B6);
  border-left-color: var(--wk-brand, #0E7C8E);
  box-shadow: 0 2px 12px rgba(15, 26, 29, 0.07);
}

.wk-resume-exam-label {
  flex-basis: 100%;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wk-brand, #0E7C8E);
}

.wk-resume-exam strong {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  color: var(--wk-ink, #0F1A1D);
}

.wk-resume-exam-count {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--wk-ink-3, #5A6B70);
  font-variant-numeric: tabular-nums;
}
