/* admin-fixes-v13.css — 17.11.2026
   1. Les fenêtres Modal (confirmation, erreur, succès) passent AU-DESSUS des
      fiches latérales (fiche client z-index 9999, fiche licence 9001). Avant :
      z-index 1000 → la confirmation s'ouvrait derrière la fiche et le bouton
      semblait ne rien faire.
   2. Fenêtre de saisie « a13 » (créer une licence, créer un client). */

.modal-overlay { z-index: 100000 !important; }
.ec-d-floating-toast { z-index: 100010 !important; }

.a13-ovl {
  position: fixed; inset: 0; z-index: 99990;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--modal-overlay, rgba(20, 18, 12, 0.45));
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: a13Fade .14s ease-out;
}
@keyframes a13Fade { from { opacity: 0 } to { opacity: 1 } }

.a13-dlg {
  --a13-bg: #14161c; --a13-bg-2: #1c1f27; --a13-text: #f3f4f6; --a13-text-2: #a8afbd;
  --a13-line: rgba(255,255,255,.12); --a13-red: #DC2626; --a13-red-2: #B91C1C;
  width: min(560px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--a13-bg); color: var(--a13-text);
  border: 1px solid var(--a13-line); border-radius: 16px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.55);
  font-size: 14px; line-height: 1.5;
}
[data-theme="light"] .a13-dlg {
  --a13-bg: #FFFEF8; --a13-bg-2: #F5F1E8; --a13-text: #1A1A1F; --a13-text-2: #5c5c63;
  --a13-line: rgba(20,18,12,.14);
  box-shadow: 0 30px 80px -24px rgba(60,40,20,.35);
}
.a13-dlg__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--a13-line);
}
.a13-dlg__head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--a13-text); }
.a13-dlg__x {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--a13-text-2); cursor: pointer; font-size: 15px;
}
.a13-dlg__x:hover { background: var(--a13-bg-2); color: var(--a13-text); }
.a13-dlg__body { padding: 18px 20px 6px; overflow-y: auto; }
.a13-dlg__foot {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px 18px;
}
.a13-dlg__err {
  margin: 4px 20px 0; padding: 10px 12px; border-radius: 10px;
  background: rgba(220,38,38,.12); border: 1px solid rgba(220,38,38,.35);
  color: #f87171; font-size: 13px; font-weight: 600;
}
[data-theme="light"] .a13-dlg__err { color: #B91C1C; }

.a13-field { margin: 0 0 14px; min-width: 0; }
.a13-field > label { display: block; margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--a13-text-2); }
.a13-field > label em { font-style: normal; font-weight: 500; opacity: .75; margin-left: 4px; }
.a13-dlg input[type=text], .a13-dlg input[type=email], .a13-dlg input[type=tel],
.a13-dlg input[type=search], .a13-dlg input[type=number], .a13-dlg select {
  width: 100%; height: 42px; padding: 0 12px;
  background: var(--a13-bg-2); color: var(--a13-text);
  border: 1px solid var(--a13-line); border-radius: 10px;
  font: inherit; font-size: 14px;
}
.a13-dlg input:focus, .a13-dlg select:focus {
  outline: 2px solid var(--a13-red); outline-offset: 1px; border-color: var(--a13-red);
}
.a13-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.a13-inline { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--a13-text-2); font-size: 13px; }
.a13-inline input { width: 110px !important; }
.a13-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.a13-chips button {
  height: 34px; padding: 0 12px; border-radius: 99px; cursor: pointer;
  background: transparent; color: var(--a13-text-2);
  border: 1px solid var(--a13-line); font: inherit; font-size: 13px; font-weight: 600;
}
.a13-chips button:hover { color: var(--a13-text); border-color: var(--a13-text-2); }
.a13-chips button.is-on { background: var(--a13-red); border-color: var(--a13-red); color: #fff; }
.a13-hint { margin: 2px 0 12px; font-size: 12.5px; color: var(--a13-text-2); }
.a13-lead { margin: 0 0 14px; color: var(--a13-text-2); }
.a13-lead strong { color: var(--a13-text); }
.a13-check { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; cursor: pointer; font-size: 13.5px; }
.a13-check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--a13-red); flex: none; cursor: pointer; }
.a13-check small { color: var(--a13-text-2); }

.a13-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--a13-text);
  border: 1px solid var(--a13-line); font: inherit; font-size: 14px; font-weight: 650;
}
.a13-btn:hover { background: var(--a13-bg-2); }
.a13-btn--primary { background: var(--a13-red); border-color: var(--a13-red); color: #fff; }
.a13-btn--primary:hover { background: var(--a13-red-2); }
.a13-btn.is-busy { opacity: .6; pointer-events: none; }
.a13-link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--a13-red); font: inherit; font-size: 13px; font-weight: 650; }
.a13-link:hover { text-decoration: underline; }

.a13-picker__list {
  margin-top: 8px; max-height: 232px; overflow-y: auto;
  border: 1px solid var(--a13-line); border-radius: 10px;
}
.a13-picker__list:empty { display: none; }
.a13-picker__row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  width: 100%; padding: 9px 12px; text-align: left; cursor: pointer;
  background: transparent; color: var(--a13-text); border: 0;
  border-bottom: 1px solid var(--a13-line); font: inherit;
}
.a13-picker__row:last-child { border-bottom: 0; }
.a13-picker__row:hover, .a13-picker__row:focus-visible { background: var(--a13-bg-2); outline: none; }
.a13-picker__row strong { font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
.a13-picker__row span { font-size: 12.5px; color: var(--a13-text-2); }
.a13-picker__msg { padding: 12px; font-size: 13px; color: var(--a13-text-2); }
.a13-picked {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--a13-bg-2); border: 1px solid var(--a13-line); font-size: 13.5px;
}
.a13-picked span { overflow-wrap: anywhere; }
.a13-key { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.a13-key code {
  flex: 1; min-width: 220px; padding: 11px 12px; border-radius: 10px;
  background: var(--a13-bg-2); border: 1px solid var(--a13-line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px;
  overflow-wrap: anywhere; user-select: all;
}

@media (max-width: 560px) {
  .a13-ovl { align-items: flex-end; padding: 0; }
  .a13-dlg { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .a13-grid { grid-template-columns: 1fr; }
  .a13-dlg__foot .a13-btn { flex: 1; }
}

/* 3. Menu « ⋮ » d'une licence, rattaché à <body> le temps de son ouverture. */
body > .eclic-menu { display: block; }
body > .eclic-menu .eclic-menu__item--danger { color: #f87171; }
[data-theme="light"] body > .eclic-menu .eclic-menu__item--danger { color: #b91c1c; }

/* 4. Admin sur grand écran : la colonne de contenu plafonnait à 984 px, le
      tableau des licences (1150 px) défilait et cachait la colonne « Clé ». */
.admin-root-section > .max-w-7xl { max-width: min(1560px, 100%); }
@media (max-width: 1560px) {
  .eclic-table thead th:nth-child(6), .eclic-table tbody td:nth-child(6):not([colspan]) { display: none; }   /* HWID : dans la fiche */
}
@media (max-width: 1380px) {
  .eclic-table thead th:nth-child(5), .eclic-table tbody td:nth-child(5):not([colspan]) { display: none; }   /* Activations : dans la fiche */
}

/* Un élément marqué « hidden » reste caché même s'il porte un display. */
.a13-dlg [hidden] { display: none !important; }

/* ═══ 5. Admin sur téléphone (17.11.2026) ═══ */
@media (max-width: 768px) {
  /* En-tête général : il prenait ~580 px avant le contenu de CHAQUE onglet.
     Les indicateurs passent sur une ligne défilante, les raccourcis aussi. */
  .admin-root-section > div > header { margin-bottom: 8px !important; }
  .admin-root-section > div > header h1 { font-size: 1.55rem !important; line-height: 1.15 !important; }
  .admin-root-section > div > .aov-stats-grid {
    display: flex !important; grid-template-columns: none !important;
    overflow-x: auto; gap: 8px !important; padding-bottom: 4px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .admin-root-section > div > .aov-stats-grid::-webkit-scrollbar { display: none; }
  .admin-root-section > div > .aov-stats-grid > * {
    flex: 0 0 132px !important; min-height: 0 !important; padding: 10px 12px !important; scroll-snap-align: start;
  }
  .admin-root-section > div > .aov-stats-grid .aov-stat__value { font-size: 1.35rem !important; line-height: 1.1 !important; }
  .admin-root-section > div > .aov-quick-actions {
    display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; gap: 8px !important;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .admin-root-section > div > .aov-quick-actions::-webkit-scrollbar { display: none; }
  .admin-root-section > div > .aov-quick-actions > * { flex: 0 0 auto !important; white-space: nowrap; min-height: 44px; }

  /* Clients : la règle « min-width: 760px » (≤1024) cassait les cartes —
     chaque client faisait 470 px de haut et sortait de l'écran. */
  #ec-clients-shell .ec-clients-table-wrap { overflow: visible; }
  #ec-clients-shell .ec-clients-table { min-width: 0 !important; width: 100% !important; }
  #ec-clients-shell .ec-clients-table tbody tr {
    display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px;
    align-items: center; width: auto !important; padding: 12px !important; margin-bottom: 10px; position: relative;
  }
  #ec-clients-shell .ec-clients-table td { margin: 0 !important; min-width: 0; width: auto !important; }
  #ec-clients-shell .ec-clients-table td.col-checkbox { display: none !important; }
  #ec-clients-shell .ec-clients-table td.col-identity { grid-column: 1 / -1; }
  #ec-clients-shell .ec-clients-table td.col-company { grid-column: 1; }
  #ec-clients-shell .ec-clients-table td.col-status { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; }
  #ec-clients-shell .ec-clients-table td.col-revenue { grid-column: 1; }
  #ec-clients-shell .ec-clients-table td.col-date { grid-column: 2; justify-self: end; text-align: right; }
  #ec-clients-shell .ec-clients-table td.col-actions { grid-column: 1 / -1; }
  #ec-clients-shell .ec-clients-table td.col-company::before,
  #ec-clients-shell .ec-clients-table td.col-status::before { display: none !important; }
  #ec-clients-shell .ec-clients-table td .ec-pill { display: inline-flex !important; width: auto !important; }
  #ec-clients-shell .ec-cell-identity__email, #ec-clients-shell .ec-cell-company { overflow-wrap: anywhere; }
  #ec-clients-shell .ec-clients-head__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  #ec-clients-shell .ec-clients-head__actions > * { width: 100%; justify-content: center; min-height: 44px; }
  #ec-clients-shell .ec-fab { display: none !important; }   /* doublon du bouton « Nouveau client » */

  /* Licences */
  #eclic-shell .eclic-stats .aov-stat__label {
    white-space: normal !important; overflow: visible !important; text-overflow: clip !important;
    letter-spacing: .03em !important; line-height: 1.25 !important;
  }
  #eclic-shell .eclic-search input { padding-left: 38px !important; }
  #eclic-shell .eclic-head__actions { width: 100%; align-items: stretch; }
  #eclic-shell .eclic-head__actions .eclic-btn { min-height: 44px; }
  #eclic-shell .eclic-head__actions .eclic-btn--primary { flex: 1; justify-content: center; }
  #eclic-shell .eclic-fab { display: none !important; }      /* doublon de « Créer licence » */
  #eclic-shell .eclic-mob-card__actions .eclic-btn { min-height: 44px; flex: 1; justify-content: center; }
  #eclic-shell .eclic-kebab { min-width: 44px; min-height: 44px; }

  /* Fiche client (plein écran) : actions accessibles au pouce */
  .ec-drawer .ec-license-card__actions { flex-wrap: wrap; gap: 8px; }
  .ec-drawer .ec-btn-mini { min-height: 40px; }
  .ec-drawer .ec-extend-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
  .ec-drawer .ec-extend-form .sep { grid-column: 1 / -1; text-align: center; }
  .ec-drawer .ec-extend-form input { width: 100%; min-height: 42px; font-size: 16px; }
  .ec-drawer .ec-drawer__foot { flex-wrap: wrap; gap: 8px; }
  .ec-drawer .ec-drawer__foot .ec-btn-mini { flex: 1 1 140px; justify-content: center; min-height: 44px; }
  .ec-drawer .ec-drawer__create-sub-row { grid-template-columns: 1fr !important; }

  /* Menu « ⋮ » : cibles tactiles */
  body > .eclic-menu .eclic-menu__item { min-height: 44px; }

  /* Fenêtres de saisie : champs à 16 px (pas de zoom automatique sur iPhone) */
  .a13-dlg input, .a13-dlg select { font-size: 16px !important; min-height: 44px; }
  .a13-dlg { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-overlay .modal-box { max-width: calc(100vw - 24px); }
  .modal-overlay .modal-actions .btn { min-height: 44px; }
}

@media (max-width: 768px) {
  .admin-root-section > div > .aov-stats-grid { align-items: flex-start !important; }
  .admin-root-section > div > .aov-stats-grid > * { flex-basis: 144px !important; height: auto !important; align-self: flex-start !important; }
  .admin-root-section > div > .aov-stats-grid [class*="label"] { letter-spacing: .04em !important; white-space: nowrap !important; font-size: .62rem !important; }
  .admin-root-section > div > .aov-stats-grid [class*="delta"], .admin-root-section > div > .aov-stats-grid [class*="trend"] { font-size: .58rem !important; white-space: nowrap; }

  #ec-clients-shell .ec-clients-head { flex-direction: column; align-items: stretch; gap: 10px; }
  #ec-clients-shell .ec-clients-head__actions { display: grid !important; grid-template-columns: 1fr 1fr !important; overflow: visible !important; }
  #ec-clients-shell .ec-clients-head__actions > * { min-width: 0; padding-left: 8px; padding-right: 8px; }
  #ec-clients-shell .ec-clients-table td { padding: 0 !important; border: 0 !important; min-height: 0 !important; height: auto !important; }
  #ec-clients-shell .ec-clients-table td.col-actions { margin-top: 2px !important; }
  #ec-clients-shell .ec-clients-table td.col-actions .ec-btn-detail { height: 40px !important; min-height: 40px !important; }
  #ec-clients-shell .ec-clients-table td.col-revenue, #ec-clients-shell .ec-clients-table td.col-date { flex-direction: row !important; align-items: baseline; gap: 6px !important; }

  #eclic-shell .eclic-head__actions { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; gap: 8px; }
  #eclic-shell .eclic-head__actions .eclic-btn--ghost { flex: 0 0 44px; justify-content: center; padding: 0; }
}

@media (max-width: 768px) {
  .admin-root-section > div > .aov-stats-grid { height: auto !important; min-height: 0 !important; margin-bottom: 10px !important; }

  /* Pied de la fiche client : deux boutons côte à côte (ils s'étiraient en hauteur). */
  .ec-drawer .ec-drawer__foot { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .ec-drawer .ec-drawer__foot .ec-btn-mini { flex: none; height: 44px; min-height: 44px; width: 100%; padding: 0 8px; font-size: .8rem; white-space: nowrap; }
  .ec-drawer .ec-drawer__section-head { flex-wrap: wrap; gap: 8px; }

  /* Carte licence : les deux actions sur une ligne. */
  #eclic-shell .eclic-mob-card__actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* 6. Bouton principal de la vue Clients (« Nouvel abonnement », « Nouveau client », « Créer ») :
      texte blanc sur fond presque blanc en thème clair → illisible. */
.ec-drawer .ec-clients-toolbar__btn--primary,
#ec-clients-shell .ec-clients-toolbar__btn--primary {
  background: #DC2626 !important; background-image: none !important;
  border-color: #DC2626 !important; color: #fff !important;
}
.ec-drawer .ec-clients-toolbar__btn--primary:hover,
#ec-clients-shell .ec-clients-toolbar__btn--primary:hover { background: #B91C1C !important; border-color: #B91C1C !important; }
.ec-drawer .ec-clients-toolbar__btn--primary i,
#ec-clients-shell .ec-clients-toolbar__btn--primary i { color: #fff !important; }
[data-theme="light"] .ec-drawer .ec-license-card__btn-copy { color: #B91C1C !important; }
