/* ==========================================================================
   HelloDesk, back-office
   --------------------------------------------------------------------------
   Un outil de travail, pas une page de vente. Le back-office est consulté
   plusieurs fois par jour par les mêmes personnes : il doit être lisible,
   dense et silencieux. Rien ne doit attirer l'œil sauf la donnée.

   Six règles, tenues partout. Elles sont ce qui distingue un système d'une
   accumulation de composants :

   1.  AUCUN DÉGRADÉ.  Une surface est d'une seule couleur.
   2.  AUCUNE OMBRE, sauf pour ce qui flotte réellement au-dessus du document
       (menu déroulant, fenêtre modale, toast). Partout ailleurs, la séparation
       se fait par un filet de 1px. Une carte ne lévite pas.
   3.  AUCUN FLOU. `backdrop-filter` coûte cher à la machine et ne dit rien.
   4.  RIEN NE BOUGE AU SURVOL. Pas de `translateY`, pas d'agrandissement. Le
       survol change une couleur de fond ou de filet, en 90 ms. Une interface
       où les cibles se déplacent sous le curseur est une interface fatigante.
   5.  AUCUNE ANIMATION D'ENTRÉE. Le contenu est là ou il ne l'est pas.
   6.  LE VERT EST RARE.  Il ne sert qu'à trois choses : l'action principale
       d'un écran, l'élément de navigation actif, un état positif. Jamais en
       décoration, jamais dans une pastille derrière une icône. Sa rareté est
       ce qui le rend lisible.

   La charte reste celle du produit : Inter, encre ardoise, vert HelloDesk.
   Ce qui change, c'est l'exécution.
   ========================================================================== */

/* ── Jetons ───────────────────────────────────────────────────────────────
   Une seule échelle d'espacement (multiples de 4), une seule échelle de
   rayons (4 et 6, au-delà, un formulaire prend un air de widget).        */

:root {
  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Encre, trois niveaux suffisent. Un quatrième finit toujours en gris
     illisible sur fond blanc.                                             */
  --ink:       #0F172A;
  --ink-soft:  #475569;
  --ink-faint: #94A3B8;

  /* Surfaces */
  --paper:     #F6F8FA;   /* fond de l'application */
  --surface:   #FFFFFF;   /* cartes, tableaux, formulaires */
  --sunken:    #F1F5F9;   /* en-têtes de tableau, champs désactivés */

  /* Filets, c'est le seul outil de séparation, d'où deux graisses. */
  --line:        #E3E8EF;
  --line-strong: #CDD5E0;

  /* Accent, le vert HelloDesk. Voir règle 6. */
  --accent:      #10B981;
  --accent-deep: #059669;  /* survol de l'action principale, uniquement */
  --accent-ink:  #FFFFFF;
  --accent-wash: #ECFDF5;  /* fond d'un état positif, jamais décoratif */

  /* Sémantique, mêmes contraintes : un fond lavé, une encre lisible. */
  --danger:      #DC2626;
  --danger-wash: #FEF2F2;
  --warn:        #B45309;
  --warn-wash:   #FFFBEB;
  --info:        #1D4ED8;
  --info-wash:   #EFF6FF;

  /* Barre latérale, ardoise pleine, pas un dégradé. */
  --rail:        #0F172A;
  --rail-ink:    #E2E8F0;
  --rail-faint:  #7A899E;
  --rail-line:   #1E293B;
  --rail-hover:  #1B2537;

  --radius-sm: 4px;
  --radius:    6px;

  /* La seule ombre du système. Réservée à ce qui flotte. */
  --lift: 0 8px 24px -8px rgba(15, 23, 42, 0.24), 0 2px 6px -2px rgba(15, 23, 42, 0.12);

  --rail-w: 264px;
}

/* ── Réinitialisation ─────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

/* Tous les chiffres sont alignés verticalement. Une colonne de nombres qui
   ne s'aligne pas ne se lit pas, c'est vrai d'un tableau comme d'un compteur. */
.num, td .num, .metric-value, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* Visible pour un lecteur d'écran, invisible à l'œil. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Ossature ─────────────────────────────────────────────────────────── */

.layout { display: flex; min-height: 100vh; }

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  background: var(--rail);
  color: var(--rail-ink);
  z-index: 40;
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--rail-w);
  display: flex;
  flex-direction: column;
}

.canvas {
  flex: 1;
  padding: 28px 32px 64px;
  max-width: 1180px;
  width: 100%;
}

/* ── Barre latérale ───────────────────────────────────────────────────── */

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rail-line);
}

.rail-brand img { height: 22px; width: auto; display: block; }

/* Sélecteur d'app, la bascule entre les deux métiers du produit. C'est le
   premier élément de la barre : on choisit ce qu'on vient faire, puis où. */

.app-switch { position: relative; padding: 12px; border-bottom: 1px solid var(--rail-line); }

.app-switch-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--rail-hover);
  border: 1px solid var(--rail-line);
  border-radius: var(--radius);
  color: var(--rail-ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 90ms linear;
}

.app-switch-button:hover { border-color: #33415A; }

.app-switch-button > i:first-child { font-size: 13px; color: var(--accent); width: 14px; }

.app-switch-label { flex: 1; min-width: 0; }

.app-switch-kicker {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rail-faint);
}

.app-switch-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-switch-button > i:last-child { font-size: 10px; color: var(--rail-faint); }

.app-menu {
  display: none;
  position: absolute;
  left: 12px; right: 12px; top: calc(100% - 4px);
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  z-index: 50;
}

.app-menu.open { display: block; }

.app-menu a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: background-color 90ms linear;
}

.app-menu a:hover { background: var(--sunken); }
.app-menu a[aria-current='true'] { background: var(--accent-wash); }

.app-menu i { font-size: 12px; color: var(--ink-faint); width: 14px; }
.app-menu a[aria-current='true'] i { color: var(--accent); }

.app-menu-name { font-weight: 600; }
.app-menu-desc { display: block; font-size: 12px; color: var(--ink-soft); }

/* Navigation, l'élément actif est marqué par un filet vert à gauche, pas
   par un fond coloré : le repère reste lisible sans peindre la barre.     */

.rail-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--rail-faint);
  font-size: 13.5px;
  font-weight: 500;
  transition: color 90ms linear, background-color 90ms linear;
}

.rail-nav a i { font-size: 13px; width: 16px; text-align: center; }

.rail-nav a:hover { color: var(--rail-ink); background: var(--rail-hover); }

.rail-nav a[aria-current='page'] {
  color: #FFFFFF;
  background: var(--rail-hover);
  border-left-color: var(--accent);
  font-weight: 600;
}

.rail-nav a.is-locked { opacity: 0.45; cursor: not-allowed; }
.rail-nav a.is-locked:hover { background: none; color: var(--rail-faint); }

/* Pied de barre : l'organisation, puis l'utilisateur. */

.rail-foot { border-top: 1px solid var(--rail-line); }

.rail-org {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rail-line);
}

.rail-org img {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  object-fit: contain;
  flex-shrink: 0;
}

.rail-org-text { min-width: 0; }

.rail-org-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-org-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--rail-faint);
}

.rail-user { position: relative; }

.rail-user-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: none;
  border: 0;
  color: var(--rail-ink);
  cursor: pointer;
  text-align: left;
  transition: background-color 90ms linear;
}

.rail-user-button:hover { background: var(--rail-hover); }

.rail-user-name { font-size: 13px; font-weight: 600; }
.rail-user-role { font-size: 11.5px; color: var(--rail-faint); }
.rail-user-button > i { margin-left: auto; font-size: 10px; color: var(--rail-faint); }

.rail-user-menu {
  display: none;
  position: absolute;
  left: 12px; right: 12px; bottom: calc(100% - 4px);
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--lift);
}

.rail-user-menu.open { display: block; }

.rail-user-menu a,
.rail-user-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background-color 90ms linear;
}

.rail-user-menu a:hover,
.rail-user-menu button:hover { background: var(--sunken); }
.rail-user-menu i { font-size: 12px; color: var(--ink-faint); width: 14px; }

/* ── En-tête de page ──────────────────────────────────────────────────── */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.page-head p { margin-top: 3px; color: var(--ink-soft); }

.page-head-actions { display: flex; gap: 8px; }

/* ── Blocs ────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.panel-head p {
  flex-basis: 100%;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.panel-body { padding: 18px; }
.panel-foot {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--sunken);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Le titre de groupe qui sépare deux blocs dans une même page. */
.group-title {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 28px 0 10px;
}

/* ── Compteurs ────────────────────────────────────────────────────────── */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

/* Les compteurs sont séparés par un filet, pas espacés en cartes flottantes :
   ils forment une seule barre de mesure, et se lisent d'un coup d'œil.     */
.metric { padding: 16px 18px; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }

.metric-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.metric-note { font-size: 12px; color: var(--ink-faint); }

/* ── Boutons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 90ms linear, border-color 90ms linear;
}

.btn i { font-size: 12px; }

.btn:hover { background: var(--sunken); border-color: var(--ink-faint); }

.btn:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.theme-card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* L'action principale, une par écran. */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-wash); border-color: var(--danger); }

.btn-quiet { border-color: transparent; background: none; color: var(--ink-soft); }
.btn-quiet:hover { background: var(--sunken); border-color: var(--line); color: var(--ink); }

.btn-icon { padding: 7px 9px; }
.btn-icon i { font-size: 12.5px; }

.btn[disabled], .btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Formulaires ──────────────────────────────────────────────────────── */

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

.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.field-hint { font-size: 12px; color: var(--ink-soft); }

.field input[type='text'],
.field input[type='email'],
.field input[type='password'],
.field input[type='tel'],
.field input[type='url'],
.field input[type='number'],
.field select,
.field textarea {
  width: 100%;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: border-color 90ms linear;
}

.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-faint); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }

.field input::placeholder, .field textarea::placeholder { color: var(--ink-faint); }

.field input[readonly], .field input[disabled],
.field select[disabled], .field textarea[disabled] {
  background: var(--sunken);
  color: var(--ink-soft);
  cursor: not-allowed;
}

.field textarea { min-height: 74px; resize: vertical; }

.field select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}

.field input[type='file'] {
  width: 100%;
  padding: 7px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--sunken);
}

/* Sélecteur de couleur : la pastille et sa valeur hexadécimale, côte à côte.
   La valeur est lisible et copiable, un client la donne souvent par mail. */
.color-field { display: flex; align-items: center; gap: 8px; }

.color-field input[type='color'] {
  width: 38px; height: 34px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.color-field output {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* ── Interrupteur ─────────────────────────────────────────────────────── */

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
  position: relative;
  width: 34px; height: 20px;
  flex-shrink: 0;
  background: var(--line-strong);
  border-radius: 10px;
  transition: background-color 90ms linear;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: left 90ms linear;
}

.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { left: 16px; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.45; }
.switch input:disabled ~ .switch-text { color: var(--ink-faint); }

.switch-text { font-size: 13.5px; font-weight: 500; }

/* ── Tableaux ─────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data th {
  padding: 9px 14px;
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  white-space: nowrap;
}

table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--sunken); }

table.data td.actions { text-align: right; white-space: nowrap; }
table.data td.actions form { display: inline; }

/* Identité d'une personne dans une cellule : initiales + nom. Les initiales
   sont sur fond neutre, ce ne sont pas des données, seulement un repère.  */
.identity { display: flex; align-items: center; gap: 10px; }

.initials {
  width: 30px; height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.identity-name { font-weight: 600; }
.identity-sub { font-size: 12.5px; color: var(--ink-soft); }

/* ── Étiquettes d'état ────────────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.tag i { font-size: 9px; }

.tag-neutral { background: var(--sunken); border-color: var(--line); color: var(--ink-soft); }
.tag-ok      { background: var(--accent-wash); border-color: #A7F3D0; color: var(--accent-deep); }
.tag-warn    { background: var(--warn-wash);   border-color: #FDE68A; color: var(--warn); }
.tag-danger  { background: var(--danger-wash); border-color: #FECACA; color: var(--danger); }
.tag-info    { background: var(--info-wash);   border-color: #BFDBFE; color: var(--info); }

/* ── Encarts ──────────────────────────────────────────────────────────── */

/* Un message dans le flux du document. Le filet de gauche porte le sens ;
   le fond reste très pâle pour ne pas dominer la page.                    */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-faint);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 16px;
}

.notice i { margin-top: 2px; font-size: 12.5px; color: var(--ink-faint); }
.notice-body { flex: 1; font-size: 13px; }
.notice-body strong { display: block; margin-bottom: 2px; }
.notice-body p { color: var(--ink-soft); }
.notice-actions { display: flex; gap: 8px; margin-top: 10px; }

.notice-ok     { border-left-color: var(--accent); background: var(--accent-wash); }
.notice-ok i   { color: var(--accent-deep); }
.notice-warn   { border-left-color: var(--warn); background: var(--warn-wash); }
.notice-warn i { color: var(--warn); }
.notice-danger { border-left-color: var(--danger); background: var(--danger-wash); }
.notice-danger i { color: var(--danger); }
.notice-info   { border-left-color: var(--info); background: var(--info-wash); }
.notice-info i { color: var(--info); }

/* État vide, une ligne, pas une illustration. */
.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.empty i { display: block; font-size: 20px; color: var(--ink-faint); margin-bottom: 10px; }

/* ── Thèmes de borne ──────────────────────────────────────────────────── */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
}

.theme-card {
  position: relative;
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 90ms linear;
}

.theme-card:hover { border-color: var(--ink-faint); }
.theme-card input { position: absolute; opacity: 0; width: 0; height: 0; }

/* Le thème retenu est cerné d'un double filet vert : un contour de 2px
   déplacerait le contenu d'un pixel au changement de sélection.           */
.theme-card:has(input:checked),
.theme-card.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* La miniature est rendue avec les vrais jetons du thème (voir la variable
   --swatch-* posée en ligne) : le client voit la typographie et le rayon,
   pas seulement une palette. Deux thèmes ne diffèrent jamais par la seule
   couleur, c'est la police et l'angle qui portent le caractère.          */
/* La miniature n'imite pas une palette : elle reproduit la vraie DISPOSITION
   d'accueil du thème (centrée, deux colonnes, liste, pavés) avec ses vrais
   jetons, police, rayon, accent. Le titre, le filet et deux blocs d'action
   suffisent à lire la mise en page d'un coup d'œil. */
.theme-preview {
  display: flex;
  flex-direction: column;
  min-height: 108px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--swatch-paper, #F7F8FA);
  font-family: var(--swatch-font, var(--font-ui));
}

.tp-head {
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  color: var(--swatch-ink, #14181F);
  text-transform: var(--swatch-transform, none);
  letter-spacing: var(--swatch-tracking, -0.02em);
}

.tp-rule {
  flex: 0 0 auto;
  height: 2px;
  width: 22px;
  margin: 7px 0;
  background: var(--swatch-accent, #2563EB);
}

.tp-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: auto;
}

.tp-action {
  height: 13px;
  border-radius: calc(var(--swatch-radius, 8px) / 2);
  background: var(--swatch-surface, #FFFFFF);
  border: 1px solid var(--swatch-line, #E4E7EC);
}

.tp-action--primary {
  background: var(--swatch-accent, #2563EB);
  border-color: var(--swatch-accent, #2563EB);
}

/* Centrée, contemporain, nuit */
.theme-preview[data-layout="centered"] {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.theme-preview[data-layout="centered"] .tp-actions { width: 72%; margin-top: 12px; }

/* Deux colonnes, éditorial : texte à gauche, actions à droite */
.theme-preview[data-layout="split"] {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  column-gap: 12px;
}
.theme-preview[data-layout="split"] .tp-head { grid-column: 1; grid-row: 1; }
.theme-preview[data-layout="split"] .tp-rule { grid-column: 1; grid-row: 2; }
.theme-preview[data-layout="split"] .tp-actions { grid-column: 2; grid-row: 1 / 3; margin-top: 0; }

/* Liste directe, industriel : filet retiré, actions bord à bord */
.theme-preview[data-layout="list"] .tp-rule { display: none; }
.theme-preview[data-layout="list"] .tp-actions {
  margin-top: 11px;
  gap: 0;
  border-top: 1px solid var(--swatch-line, #E4E7EC);
}
.theme-preview[data-layout="list"] .tp-action {
  height: 16px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--swatch-line, #E4E7EC);
}

/* Pavés, chaleureux : deux tuiles côte à côte, coins généreux */
.theme-preview[data-layout="tiles"] .tp-actions {
  flex-direction: row;
  gap: 7px;
  margin-top: 11px;
}
.theme-preview[data-layout="tiles"] .tp-action {
  flex: 1;
  height: 34px;
  border-radius: var(--swatch-radius, 16px);
}

.theme-meta { padding: 10px 12px; }

.theme-layout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
}

.theme-layout i { font-size: 10px; }

.theme-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
}

.theme-name i { color: var(--accent); font-size: 12px; opacity: 0; }
.theme-card:has(input:checked) .theme-name i,
.theme-card.is-selected .theme-name i { opacity: 1; }

.theme-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.45; margin-top: 2px; }

/* Choix segmenté, densité. Trois options qui s'excluent : des onglets
   valent mieux qu'une liste déroulante, la comparaison est immédiate.     */
.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.segmented label {
  position: relative;
  padding: 6px 14px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 90ms linear, color 90ms linear;
}

.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label:has(input:checked),
.segmented label.is-selected { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

/* ── Aperçu de la borne ───────────────────────────────────────────────── */

.preview-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1120px) {
  .preview-split { grid-template-columns: minmax(0, 1fr); }
}

.preview-dock { position: sticky; top: 20px; }

.preview-frame {
  padding: 12px;
  background: var(--ink);
  border-radius: 10px;
}

.preview-screen {
  aspect-ratio: 3 / 4;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

.preview-screen iframe { width: 100%; height: 100%; border: 0; display: block; }

.preview-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ── Fenêtre modale ───────────────────────────────────────────────────── */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.5);
  padding: 24px;
  overflow-y: auto;
}

.modal.open { display: flex; align-items: flex-start; justify-content: center; }

.modal-box {
  width: 100%;
  max-width: 640px;
  margin: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--lift);
}

.modal-box-wide { max-width: 900px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 { font-size: 15px; font-weight: 650; }
.modal-body { padding: 20px; }

/* ── Procédures pas-à-pas ─────────────────────────────────────────────── */

/* Les numéros sont dans la marge, en chiffres tabulaires : la colonne de
   texte reste alignée quel que soit le nombre d'étapes.                   */
.steps { counter-reset: step; }

.steps li {
  position: relative;
  padding: 0 0 16px 34px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 1px;
  width: 21px; height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--surface);
}

.steps li:last-child { padding-bottom: 0; }
.steps strong { display: block; font-weight: 600; margin-bottom: 2px; }
.steps p { color: var(--ink-soft); }

.faq dt { font-weight: 600; margin-top: 14px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 3px 0 0; color: var(--ink-soft); }

code.inline {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 1px 5px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* ── Employés : lignes repliables ─────────────────────────────────────── */

.host {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.host[open] { border-color: var(--line-strong); }

.host-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  transition: background-color 90ms linear;
}

.host-head::-webkit-details-marker { display: none; }
.host-head:hover { background: var(--sunken); }
.host[open] .host-head { border-bottom: 1px solid var(--line); }

.host-ident { min-width: 0; }
.host-ident .identity-name,
.host-ident .identity-sub { display: block; }

.host-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: auto;
  justify-content: flex-end;
}

.host-caret { font-size: 11px; color: var(--ink-faint); flex-shrink: 0; }
.host[open] .host-caret,
details[open] > .host-head .host-caret { transform: rotate(180deg); }

.host-body { padding: 16px; }

.host-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

/* ── Canaux ───────────────────────────────────────────────────────────── */

.channel-list { display: flex; flex-direction: column; }

.channel { padding: 10px 0; border-top: 1px solid var(--line); }
.channel:first-child { border-top: 0; padding-top: 0; }

.channel .switch-text i { width: 16px; color: var(--ink-faint); margin-right: 4px; }
.channel.is-on .switch-text i { color: var(--ink); }

.channel-detail { margin: 8px 0 0 44px; max-width: 420px; }
.channel-detail input { width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 13px; }
.channel-detail input[readonly], .channel-detail input[disabled] { background: var(--sunken); color: var(--ink-soft); }
.channel-detail .field-hint { display: block; margin-top: 4px; }
.channel-detail a { color: var(--info); text-decoration: underline; }

.channel.is-locked .switch-text { color: var(--ink-faint); }

/* ── Divers ───────────────────────────────────────────────────────────── */

.logo-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.logo-current img { max-width: 88px; max-height: 44px; object-fit: contain; }

.included li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.included li:first-child { border-top: 0; padding-top: 0; }
.included i { margin-top: 4px; font-size: 11px; color: var(--accent); }

/* ── Toast ────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 200;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  padding: 12px 16px;
  background: var(--ink);
  color: #FFFFFF;
  border-radius: var(--radius);
  box-shadow: var(--lift);
  font-size: 13.5px;
}

.toast.show { display: flex; }
.toast i { font-size: 13px; color: var(--accent); }
.toast.is-error i { color: #FCA5A5; }

/* ── Graphique ────────────────────────────────────────────────────────── */

.chart-box { height: 260px; padding: 4px 2px; }

/* ── Mise en service ──────────────────────────────────────────────────── */
/* Un guide de démarrage, pas un tableau de bord bis. Chaque étape est vérifiée
   dans les données : la barre avance quand la borne avance, l'encart s'efface
   quand tout est fait. */

.onboard-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px 16px;
}

.onboard-bar {
  flex: 1;
  height: 5px;
  background: var(--sunken);
  border-radius: 999px;
  overflow: hidden;
}

.onboard-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 260ms ease;
}

.onboard-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.onboard-steps { border-top: 1px solid var(--line); }

.onboard-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.onboard-step:last-child { border-bottom: 0; }

.onboard-check {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--ink-faint);
  font-size: 12px;
}

.onboard-step.is-done .onboard-check {
  background: var(--accent-wash);
  border-color: #A7F3D0;
  color: var(--accent-deep);
}

.onboard-text { flex: 1; min-width: 0; }
.onboard-label { font-weight: 600; font-size: 13.5px; }
.onboard-step.is-done .onboard-label { color: var(--ink-soft); }
.onboard-hint { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.onboard-step .btn { flex: 0 0 auto; }

/* ── Conseil ──────────────────────────────────────────────────────────── */
/* Un conseil, pas un statut. Plus discret qu'un encart : il accompagne un
   champ ou un panneau sans l'alarmer, et ne porte jamais d'action. */

.tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--sunken);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.tip i { margin-top: 1px; font-size: 12px; color: var(--accent-deep); }
.tip strong { font-weight: 600; color: var(--ink); }

/* ── Pages autonomes ──────────────────────────────────────────────────── */
/* Connexion, inscription, mots de passe et éditeurs servis hors du tableau
   de bord : une carte posée au centre du fond de l'application. Le
   vocabulaire ne change pas, champs, boutons et encarts sont ceux du reste
   du back-office ; seule la mise en page diffère.                          */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--paper);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  padding: 32px 30px;
}

/* Les éditeurs (hôte, employé…) portent plus de champs : plus large, ce qui
   laisse `.form-grid` repasser à deux colonnes quand la place le permet. */
.auth-card-wide { max-width: 640px; }

/* Le vrai logo, version sombre (logo_w.png) sur le fond clair de la carte.
   `max-width` protège le rendu même si la hauteur ne contraint pas (image de
   1500 px de large à l'origine). */
.auth-brand { display: block; margin-bottom: 2px; }
.auth-brand img {
  display: block;
  height: 30px;
  width: auto;
  max-width: 100%;
}

.auth-head { margin: 18px 0 22px; }
.auth-head h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.auth-head p { margin-top: 4px; color: var(--ink-soft); font-size: 13.5px; }

.auth-actions { display: flex; gap: 8px; margin-top: 22px; }
.auth-actions .btn { flex: 1; }

.auth-links {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.auth-links a { color: var(--accent-deep); font-weight: 550; }
.auth-links a:hover { color: var(--accent); text-decoration: underline; }

/* ── Écrans étroits ───────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .rail {
    position: static;
    width: 100%;
    height: auto;
  }
  .layout { flex-direction: column; }
  .main { margin-left: 0; }
  .rail-nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .rail-nav a { border-left: 0; border-bottom: 2px solid transparent; border-radius: var(--radius-sm); }
  .rail-nav a[aria-current='page'] { border-left: 0; border-bottom-color: var(--accent); }
  .canvas { padding: 20px 16px 48px; }
  .metric { border-left: 0; border-top: 1px solid var(--line); }
  .metric:first-child { border-top: 0; }
}

/* Respecte le réglage système. Le peu qui bouge ici doit pouvoir s'arrêter. */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
