/* Le guichet de Strapontin : sombre, rouge Strapontin, la police du système. Aucune ressource tierce. */

:root {
  --fond: #0b0b10;
  --surface: #15151c;
  --surface-2: #1d1d26;
  --surface-3: #262632;
  --trait: #2c2c38;
  --texte: #ffffff;
  --doux: #a3a3b2;
  --pale: #6f6f80;
  --accent: #e5233a;
  --accent-fonce: #b81a2d;
  --accent-voile: rgba(229, 35, 58, 0.14);
  --ok: #3ecf8e;
  --ok-voile: rgba(62, 207, 142, 0.14);
  --info: #6ea8ff;
  --info-voile: rgba(110, 168, 255, 0.14);
  --warn: #f5b942;
  --warn-voile: rgba(245, 185, 66, 0.14);
  --rayon: 14px;
  --rayon-petit: 9px;
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 var(--police);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--texte); text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 3px; }
a:hover { color: #fff; text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 28px 0 12px; }
.adm-card h2 { margin-top: 0; }
.adm-h1--mail { word-break: break-all; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Le logo ------------------------------------------------------------------------------------------- */

.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--texte); }
.logo i {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; flex: none;
}
.logo i::after {
  content: ""; position: absolute; left: 8px; top: 6px;
  border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}

/* --- La barre, le menu, la page ------------------------------------------------------------------------ */

.adm-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; background: rgba(11, 11, 16, 0.92);
  border-bottom: 1px solid var(--trait);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.adm-brand { text-decoration: none; }
.adm-ref { color: var(--doux); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.adm-out { margin: 0 0 0 auto; }
.adm-out button {
  background: none; border: 1px solid var(--trait); color: var(--doux); border-radius: 999px;
  padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
.adm-out button:hover { color: var(--texte); border-color: var(--doux); }

.adm-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 57px); }

.adm-nav { display: flex; flex-direction: column; gap: 2px; padding: 22px 14px; border-right: 1px solid var(--trait); }
.adm-nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--rayon-petit); color: var(--doux); text-decoration: none; font-weight: 500;
}
.adm-nav a:hover { color: var(--texte); background: var(--surface); }
.adm-nav a.is-here { color: var(--texte); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }

.adm-badge {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 12px; text-align: center;
}

.adm-main { padding: 30px 32px 60px; max-width: 1280px; width: 100%; }
.adm-lead { color: var(--doux); margin: 0 0 22px; max-width: 75ch; }
.adm-soft { color: var(--doux); }
p.adm-soft { font-size: 13.5px; max-width: 80ch; }
.adm-code { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0.02em; }

/* --- Annonces ------------------------------------------------------------------------------------------ */

.adm-done, .adm-error, .adm-alert {
  padding: 11px 14px; border-radius: var(--rayon-petit); margin: 0 0 18px; border: 1px solid transparent;
}
.adm-done { background: var(--ok-voile); border-color: rgba(62, 207, 142, 0.35); }
.adm-error { background: var(--accent-voile); border-color: rgba(229, 35, 58, 0.45); }
.adm-alert { background: var(--warn-voile); border-color: rgba(245, 185, 66, 0.4); }
.adm-empty { color: var(--doux); padding: 26px; text-align: center; background: var(--surface); border-radius: var(--rayon); border: 1px dashed var(--trait); }

/* --- Vignettes ----------------------------------------------------------------------------------------- */

.adm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.adm-tile { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px 18px; }
.adm-tile__name { margin: 0; color: var(--doux); font-size: 13px; }
.adm-tile__value { margin: 4px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; word-break: break-word; }
.adm-tile__note { margin: 6px 0 0; color: var(--doux); font-size: 13px; }
.adm-tile--hot { border-color: rgba(229, 35, 58, 0.5); background: linear-gradient(160deg, rgba(229, 35, 58, 0.16), var(--surface) 60%); }
.adm-tile--ko .adm-tile__value { color: var(--accent); }

/* --- Cartes, formulaires ------------------------------------------------------------------------------- */

.adm-card { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 20px; margin-bottom: 18px; }
.adm-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.adm-two > .adm-card { margin-bottom: 0; }
.adm-two + * { margin-top: 18px; }

.adm-form { display: flex; flex-direction: column; gap: 12px; }
.adm-form label { display: flex; flex-direction: column; gap: 6px; color: var(--doux); font-size: 13px; }
.adm-form--row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-items: end; gap: 14px; }
.adm-form--row h2 { grid-column: 1 / -1; margin-bottom: 0; }
.adm-form__wide { grid-column: span 2; }

input, select, textarea {
  font: inherit; color: var(--texte); background: var(--fond); border: 1px solid var(--trait);
  border-radius: var(--rayon-petit); padding: 9px 11px; width: 100%; min-height: 40px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-voile); }
input:disabled { color: var(--doux); background: var(--surface-2); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); margin: 0; }
.adm-form label.adm-check { flex-direction: row; align-items: center; gap: 9px; color: var(--texte); font-size: 14px; min-height: 40px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 22px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; min-height: 40px;
}
.btn:hover { background: var(--accent-fonce); color: #fff; }
.btn--small { padding: 8px 18px; font-size: 14px; }
.btn--ghost { background: var(--surface-3); }
.btn--ghost:hover { background: #30303e; }
.btn--danger { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.btn--danger:hover { background: var(--accent); color: #fff; }
.adm-form .btn { justify-self: start; align-self: flex-start; }
.adm-form--row .btn { align-self: end; }

.adm-link {
  background: none; border: 0; padding: 0; font: inherit; color: var(--doux); cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.25); text-underline-offset: 3px;
}
.adm-link:hover { color: var(--texte); }
.adm-link--danger { color: #ff6b7d; }
.adm-link--danger:hover { color: var(--accent); }

.adm-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 0; }
.adm-row-actions { display: inline-flex; gap: 14px; align-items: center; white-space: nowrap; }
.adm-row-actions form, td form { margin: 0; display: inline; }

.adm-search { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; max-width: 640px; }
.adm-search input { flex: 1; }

/* --- Codes tout neufs ---------------------------------------------------------------------------------- */

.adm-new-codes { border-color: rgba(229, 35, 58, 0.55); }
.adm-codes { font-family: var(--mono); font-size: 15px; line-height: 1.7; letter-spacing: 0.04em; resize: vertical; }

/* --- Tableaux ------------------------------------------------------------------------------------------ */

.adm-table { overflow-x: auto; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 600; color: var(--doux); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 12px 14px; border-bottom: 1px solid var(--trait); white-space: nowrap; background: var(--surface-2);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }

.adm-tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--doux); white-space: nowrap;
}
.adm-tag--ok { background: var(--ok-voile); color: var(--ok); }
.adm-tag--info { background: var(--info-voile); color: var(--info); }
.adm-tag--warn { background: var(--warn-voile); color: var(--warn); }
.adm-tag--ko, .adm-tag--hot { background: var(--accent-voile); color: #ff6b7d; }

/* --- Classements --------------------------------------------------------------------------------------- */

.adm-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.adm-rank li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.adm-rank b { font-variant-numeric: tabular-nums; }
.adm-rank svg { grid-column: 1 / -1; width: 100%; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.adm-rank rect { fill: var(--accent); }

/* --- Connexion ----------------------------------------------------------------------------------------- */

.adm-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.adm-login .adm-card { width: 100%; max-width: 380px; padding: 30px 28px; }
.adm-login h1 { margin: 6px 0 0; }
.adm-login__logo { margin: 0; }
.adm-login .btn { align-self: stretch; }
.adm--login { background: radial-gradient(900px 500px at 50% -10%, rgba(229, 35, 58, 0.18), transparent 70%), var(--fond); }

/* --- Petits écrans ------------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .adm-shell { grid-template-columns: minmax(0, 1fr); }
  .adm-nav {
    flex-direction: row; overflow-x: auto; gap: 4px; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--trait); scrollbar-width: none;
  }
  .adm-nav a { white-space: nowrap; flex: none; gap: 6px; }
  .adm-nav a.is-here { box-shadow: inset 0 -2px 0 var(--accent); }
  .adm-main { padding: 22px 16px 48px; }
  .adm-two { grid-template-columns: minmax(0, 1fr); }
  .adm-bar { padding: 10px 16px; }
  h1 { font-size: 23px; }
}

@media (max-width: 640px) {
  .adm-form__wide { grid-column: auto; }
  .adm-search { flex-wrap: wrap; }
  /* Les tableaux deviennent des fiches : chaque cellule porte le nom de sa colonne. */
  .adm-table { background: none; border: 0; overflow: visible; }
  .adm-table table, .adm-table tbody, .adm-table tr, .adm-table td { display: block; width: 100%; }
  .adm-table thead { display: none; }
  .adm-table tr { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 8px 14px; margin-bottom: 10px; }
  .adm-table td { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--trait); text-align: right; word-break: break-word; }
  .adm-table td::before { content: attr(data-titre); color: var(--doux); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  .adm-table td[data-titre=""]::before { content: none; }
  .adm-table td:last-child { border-bottom: 0; }
  tbody tr:hover td { background: none; }
}
