/* ============================================================================
   HR-SKILLS ID — Identité visuelle "Clear Grid" (thème clair)
   Refonte lumineuse : surfaces blanches, fond bleuté très doux, accent bleu
   pour l'action et le vérifié, monospace réservé aux données d'identité
   (id, token, hash, code). Sobre, intuitif, élégant — light by design.
   ========================================================================== */
:root {
  /* Fonds & surfaces */
  --bg: #eef2f9;
  --bg-2: #e7edf7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #f1f4fa;

  /* Traits */
  --line: #e2e8f2;
  --line-soft: #edf1f7;

  /* Marque & signaux */
  --primary: #3b6ef5;          /* action principale */
  --primary-600: #2f5fe0;
  --primary-700: #2450c7;
  --primary-soft: rgba(59, 110, 245, .10);
  --primary-ring: rgba(59, 110, 245, .18);

  --gold: #3b6ef5;             /* rétrocompat : l'ancien "or" devient le bleu */
  --gold-soft: #2f5fe0;

  --signal: #12a06a;           /* vérifié / actif */
  --signal-dim: rgba(18, 160, 106, .12);
  --danger: #e05260;
  --danger-dim: rgba(224, 82, 96, .12);
  --warn: #c98a1e;

  /* Texte */
  --text: #16203a;
  --muted: #64708a;
  --muted-2: #9aa6bd;

  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 34, 70, .05), 0 1px 3px rgba(20, 34, 70, .04);
  --shadow-md: 0 6px 20px rgba(30, 50, 100, .08);
  --shadow-lg: 0 24px 60px rgba(30, 50, 100, .16);

  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 15px/1.55 var(--sans);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(59, 110, 245, .06), transparent 60%),
    radial-gradient(880px 480px at 100% 0%, rgba(18, 160, 106, .05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }

/* ---- Grille technique de fond : quasi imperceptible ---- */
.grid-field {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(30, 50, 100, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 50, 100, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 72%);
}

.mono { font-family: var(--mono); }

/* ---- Ticker des primitives cryptographiques (bandeau discret, clair) ---- */
.crypto-ticker {
  position: relative; z-index: 1; overflow: hidden; white-space: nowrap;
  border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .7);
  backdrop-filter: blur(6px);
  padding: 8px 0; font-family: var(--mono); font-size: 11px; letter-spacing: 2px;
  color: var(--muted-2); text-transform: uppercase;
}
.crypto-ticker span { padding: 0 26px; }
.crypto-ticker span::before { content: "◆"; color: var(--primary); margin-right: 10px; font-size: 9px; opacity: .7; }

/* ---- Barre supérieure ---- */
.topbar {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  color: var(--text); display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
}
.brand { font-weight: 700; letter-spacing: .6px; color: var(--text); text-decoration: none; font-size: 16px; }
.brand::before { content: "◈ "; color: var(--primary); }
.brand small { color: var(--muted); font-weight: 400; letter-spacing: .3px; margin-left: 10px; font-family: var(--mono); font-size: 12px; }
.topbar .who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 12px; }

/* ---- Mire de login : fond dégradé bleu, carte blanche flottante ---- */
.auth-wrap {
  position: relative; z-index: 1; min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(94, 140, 255, .9), transparent 55%),
    radial-gradient(1100px 800px at 90% 90%, rgba(43, 91, 224, .9), transparent 55%),
    linear-gradient(140deg, #4f7cf7 0%, #3b6ef5 45%, #2b53d6 100%);
}
.auth-card {
  position: relative; background: var(--surface);
  border-radius: var(--radius-lg); width: 100%; max-width: 430px; padding: 40px 38px;
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: var(--shadow-lg);
}
/* Liseré signature : un trait bleu balaie une fois le contour à l'ouverture.
   pointer-events:none impératif : couche décorative au-dessus des champs. */
.auth-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: conic-gradient(from 0deg, var(--primary), transparent 18%, transparent 82%, var(--primary));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: sig-scan 1.4s ease-out 1 forwards;
  pointer-events: none;
}
@keyframes sig-scan { from { transform: rotate(0deg); opacity: .9; } to { transform: rotate(360deg); opacity: 0; } }

.auth-card .logo { text-align: center; margin-bottom: 6px; font-size: 24px; font-weight: 800;
  color: var(--text); letter-spacing: .5px; }
.auth-card .logo span { color: var(--primary); }
.auth-card .tagline { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.auth-card .kid-line {
  text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--muted-2);
  letter-spacing: 1px; margin-bottom: 26px; text-transform: uppercase;
}
.auth-card .kid-line b { color: var(--signal); font-weight: 600; }

/* ---- Formulaires ---- */
label { display: block; font-size: 12.5px; font-weight: 600; margin: 16px 0 6px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; }
input, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: var(--surface-2); color: var(--text);
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
input::placeholder { color: var(--muted-2); }
input:hover, select:hover { border-color: #cfd8e8; }
input:focus, select:focus { outline: none; border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-ring); }
select option { background: var(--surface); }
input[type="file"] { padding: 10px 12px; background: var(--surface-2); cursor: pointer; }

.btn {
  display: inline-block; border: 1px solid var(--line); border-radius: 10px; padding: 11px 20px;
  font-size: 14.5px; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--text);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, background .12s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: #cbd6ea; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-gold {
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: #fff; border: 0; font-weight: 700;
  box-shadow: 0 6px 16px rgba(59, 110, 245, .28);
}
.btn-gold:hover { background: linear-gradient(180deg, var(--primary-600), var(--primary-700));
  box-shadow: 0 10px 22px rgba(59, 110, 245, .34); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(224, 82, 96, .28); box-shadow: none; }
.btn-danger:hover { background: rgba(224, 82, 96, .18); border-color: rgba(224, 82, 96, .4); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-block { width: 100%; margin-top: 24px; text-align: center; }

.msg { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-top: 16px; display: none;
  border: 1px solid transparent; font-family: var(--mono); }
.msg.err { background: var(--danger-dim); color: var(--danger); border-color: rgba(224, 82, 96, .28); display: block; }
.msg.ok { background: var(--signal-dim); color: var(--signal); border-color: rgba(18, 160, 106, .28); display: block; }
.msg.info { background: var(--primary-soft); color: var(--primary-700); border-color: var(--primary-ring); display: block; }

/* ---- OTP segmenté : 6 cases façon jeton matériel de sécurité ---- */
.otp-segments { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }
.otp-segments input {
  width: 46px; height: 56px; text-align: center; font-size: 24px; font-weight: 700;
  font-family: var(--mono); padding: 0; background: var(--surface-2);
}
.otp-segments input:nth-child(3) { margin-right: 6px; }
.otp-hint { font-size: 12px; color: var(--muted-2); margin-top: 12px; text-align: center; font-family: var(--mono); }

/* ---- Panel admin ---- */
.container { position: relative; z-index: 1; max-width: 1140px; margin: 28px auto; padding: 0 20px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tab { padding: 11px 18px; cursor: pointer; border: 0; background: none; font-size: 14px;
  font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; letter-spacing: .2px;
  transition: color .12s ease; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 26px; }
.card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); transition: box-shadow .14s ease, transform .14s ease; }
.card:hover { box-shadow: var(--shadow-md); }
.card .big { font-size: 30px; font-weight: 800; color: var(--text); font-family: var(--mono); }
.card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px; }

.panel { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.panel h3 { margin: 0 0 16px; color: var(--text); font-weight: 700; font-size: 17px; }
.panel code { font-family: var(--mono); color: var(--primary-700); background: var(--primary-soft);
  padding: 1px 6px; border-radius: 5px; font-size: .92em; }

.table-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 12px 14px; background: var(--surface-3); color: var(--muted);
  font-weight: 600; text-transform: uppercase; font-size: 11.5px; letter-spacing: .6px; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-family: var(--mono); font-size: 13px; color: var(--text); }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s ease; }
tr:hover td { background: var(--surface-2); }

/* ---- Badges "LED" : un point de statut + libellé ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  font-family: var(--sans); color: var(--muted); letter-spacing: .2px;
  background: var(--surface-3); padding: 3px 10px; border-radius: 999px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.badge.internal::before { background: #3b6ef5; }
.badge.internal { color: #2450c7; background: rgba(59, 110, 245, .1); }
.badge.stagiaire::before { background: var(--warn); }
.badge.stagiaire { color: #9a6a10; background: rgba(201, 138, 30, .12); }
.badge.external::before { background: #9061e0; }
.badge.external { color: #6d40bd; background: rgba(144, 97, 224, .12); }
.badge.on::before { background: var(--signal); box-shadow: 0 0 6px rgba(18, 160, 106, .6); }
.badge.on { color: var(--signal); background: var(--signal-dim); }
.badge.off::before { background: var(--danger); }
.badge.off { color: var(--danger); background: var(--danger-dim); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- Révélation de secret : bloc "terminal" (code bypass, client_secret) ---- */
.code-reveal {
  font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: 5px; color: var(--signal);
  background: var(--surface-2); border: 1px dashed rgba(18, 160, 106, .45); border-radius: 10px;
  padding: 16px; text-align: center; margin-top: 12px; word-break: break-all;
}
.code-reveal::before { content: "$ "; color: var(--muted-2); }

/* ---- Tuiles d'accès applicatif (portail collaborateur) ---- */
.app-tile { display: flex; flex-direction: column; gap: 10px; }
.app-tile:hover { transform: translateY(-2px); }
.app-tile .tile-head { display: flex; align-items: center; justify-content: space-between; }
.app-tile .tile-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 8px rgba(18, 160, 106, .6); }
.app-tile a { font-family: var(--mono); font-size: 13px; color: var(--text); text-decoration: none; }
.app-tile a:hover { color: var(--primary); }

/* ---- Journal d'audit : rendu façon flux de log ---- */
.log-row td { font-size: 12.5px; }
.log-action { color: var(--primary-700); }
