/* Panneau équipe (admin) : préfixe adm-. Jetons de tokens.css seulement, aucune valeur changée ; rien ne s'applique
   hors des routes #/admin (Banque comprise) : toutes les classes sont propres au panneau. */

/* Carte du compte dans le cadre : pas de réglages runner pour l'équipe, donc pas d'effet de bouton. */
.user.adm-user, .user.adm-user:hover { background: var(--card); border-color: var(--line); cursor: default; }

/* ---------- Texte, liens, chiffres ---------- */
.adm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 0.92em; letter-spacing: 0; }
.adm-break { overflow-wrap: anywhere; word-break: break-all; }
.adm-text { margin: 0; color: var(--ink-2); font-size: var(--t-sm); line-height: 1.55; }
.adm-text strong { color: var(--ink); }
.adm-textlink { padding: 0; border: 0; background: none; color: var(--accent-ink); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; overflow-wrap: anywhere; }
.adm-textlink:hover { color: var(--accent); }
.adm-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: var(--sp-3); color: var(--muted); font-size: var(--t-sm); font-weight: 600; transition: color var(--dur-fast); }
.adm-back:hover { color: var(--ink); }
.adm-back svg { width: 15px; height: 15px; }
.adm-count { margin-left: 4px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); font-size: var(--t-2xs); font-style: normal; font-weight: 700; }
.adm-amount { display: block; font-size: var(--t-base); font-weight: 700; white-space: nowrap; }
.adm-amount__sub { display: block; color: var(--muted); font-size: var(--t-xs); white-space: nowrap; }
.adm-big { margin: 0 0 var(--sp-4); font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.adm-offscreen { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- Message de retour (après chaque action) : en surimpression, il ne décale jamais la page ---------- */
.adm-flash {
  position: fixed; inset: auto var(--sp-5) var(--sp-5) auto; z-index: 60; width: min(440px, calc(100vw - 32px)); height: auto; margin: 0;
  display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: var(--r-md); overflow: visible;
  color: var(--ink); background: var(--card-hover); border: 1px solid var(--line-strong); box-shadow: var(--highlight), var(--shadow-pop);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); font-size: var(--t-sm); font-weight: 600;
  animation: adm-drop var(--dur) var(--ease);
}
.adm-flash:not(:popover-open)[popover] { display: none; }
.adm-flash.is-reopened { animation: none; }
.adm-flash > svg { width: 18px; height: 18px; flex: none; }
.adm-flash span { flex: 1; min-width: 0; }
.adm-flash--ok { border-left: 3px solid var(--ok); }
.adm-flash--ok > svg { color: var(--ok); }
.adm-flash--bad { border-left: 3px solid var(--bad); }
.adm-flash--bad > svg { color: var(--bad); }
@keyframes adm-drop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) {
  .adm-flash { inset: auto max(var(--sp-4), env(safe-area-inset-right)) calc(84px + env(safe-area-inset-bottom)) max(var(--sp-4), env(safe-area-inset-left)); width: auto; }
}

/* ---------- Encarts ---------- */
.adm-note { display: flex; gap: 10px; margin: 0; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink-2); font-size: var(--t-sm); line-height: 1.5; }
.adm-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.adm-note--warn { background: var(--warn-soft); }
.adm-note--warn svg { color: var(--warn); }
.adm-note--ok { background: var(--ok-soft); }
.adm-note--ok svg { color: var(--ok); }
.adm-note--bad { background: var(--bad-soft); }
.adm-note--bad svg { color: var(--bad); }
.adm-note + .adm-note, .adm-note + .adm-grid { margin-top: var(--sp-3); }
.content > .adm-note { margin-bottom: var(--sp-3); }
.adm-form-error { display: flex; gap: 8px; margin: 0; color: var(--bad); font-size: var(--t-sm); font-weight: 600; }
.adm-form-error svg { width: 15px; height: 15px; flex: none; margin-top: 3px; }

/* ---------- À traiter (accueil) ---------- */
.adm-todo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.adm-todo__item {
  position: relative; display: flex; align-items: center; gap: 14px; min-width: 0; padding: var(--sp-5); border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--highlight), var(--shadow-card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transition: transform var(--dur) var(--ease), border-color var(--dur-fast);
}
.adm-todo__item:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.adm-todo__ic { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 13px; background: var(--chip); color: var(--muted); }
.adm-todo__ic svg { width: 20px; height: 20px; }
.adm-todo__text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.adm-todo__n { font-size: var(--t-kpi); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; color: var(--muted); }
.adm-todo__label { margin-top: 2px; font-size: var(--t-base); font-weight: 650; }
.adm-todo__sub { color: var(--muted); font-size: var(--t-xs); }
.adm-todo__go { color: var(--faint); }
.adm-todo__go svg { width: 18px; height: 18px; }
.adm-todo__item.is-on { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.adm-todo__item.is-on .adm-todo__ic { background: var(--accent-soft); color: var(--accent); }
.adm-todo__item.is-on .adm-todo__n { color: var(--ink); }
.adm-todo__item.is-on .adm-todo__go { color: var(--accent); }
@media (max-width: 1000px) { .adm-todo { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); } .adm-todo__item { padding: var(--sp-4); } }

.adm-figures .strip { box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--well); }
/* Chiffres en bandeau : 2 colonnes pour la fiche runner ; sur téléphone, une ligne par chiffre (aucun montant rogné). */
@media (max-width: 760px) { .adm-strip--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .adm-strip:not(.adm-strip--2) { grid-template-columns: minmax(0, 1fr); }
  .adm-strip:not(.adm-strip--2) > div { flex-direction: row; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
  .adm-strip:not(.adm-strip--2) > div + div { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Onglets en liens (dans .seg) ---------- */
.adm-seg-link {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--r-pill); color: var(--ink-2);
  font-size: var(--t-sm); font-weight: 500; white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast);
}
.adm-seg-link:hover { color: var(--ink); }
.adm-seg-link[aria-current="page"], .adm-seg-link[aria-current="true"] { background: var(--seg-on-bg); color: var(--seg-on-ink); font-weight: 600; box-shadow: var(--seg-on-shadow); }
.adm-head-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------- Tableaux : colonnes secondaires masquées selon la largeur réelle de la carte ---------- */
.adm-rowlink { color: inherit; }
.adm-rowlink:hover strong { color: var(--accent-ink); }
.adm-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.adm-row--off td { opacity: 0.6; }
.adm-table--tight td, .adm-table--tight th { padding-top: 8px; padding-bottom: 8px; }
.adm-table .link { white-space: nowrap; }
.adm-table .cust__avatar svg { width: 15px; height: 15px; color: var(--muted); }
@container table-wrap (max-width: 879px) { .adm-table .col-a { display: none; } }
@container table-wrap (max-width: 679px) { .adm-table .col-b { display: none; } }
@container table-wrap (max-width: 539px) {
  .adm-table .col-c { display: none; }
  .adm-table th, .adm-table td { padding-left: 10px; padding-right: 10px; }
  .adm-table :is(th, td):first-child { padding-left: var(--sp-4); }
  .adm-table :is(th, td):last-child { padding-right: var(--sp-4); }
  .adm-table .cust div :is(strong, span) { white-space: normal; overflow-wrap: anywhere; }
  .adm-table .cust__avatar { display: none; }
  .adm-table .adm-amount__sub { white-space: normal; }
  .adm-table td.nowrap { white-space: normal; }
  .adm-table .col-go { display: none; }
  .adm-table .adm-go-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- Grille des fiches ---------- */
.adm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
@media (max-width: 1000px) { .adm-grid { grid-template-columns: minmax(0, 1fr); } }
.adm-card__body { display: flex; flex-direction: column; gap: var(--sp-4); padding-top: var(--sp-4); }
.adm-card--focus { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.adm-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.adm-form > .btn { align-self: flex-start; }
.adm-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); align-items: start; }
.adm-card { container: adm-card / inline-size; }
@container adm-card (max-width: 419px) { .adm-two { grid-template-columns: minmax(0, 1fr); } }
.adm-inline { flex-direction: row; align-items: flex-end; gap: var(--sp-2); }
.adm-inline .field { flex: 1; min-width: 0; }
.adm-inline > .btn { align-self: flex-end; height: 40px; }
@container adm-card (max-width: 419px) { .adm-inline { flex-direction: column; align-items: stretch; } }
.adm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.adm-actions--end { justify-content: flex-end; flex-wrap: nowrap; }
.adm-select, .adm-dialog .select { width: 100%; height: 40px; font-size: 16px; }
.adm-select--compact { height: 36px; font-size: var(--t-sm); }
.adm-sub { display: flex; flex-direction: column; gap: var(--sp-3); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.adm-sub__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.adm-sub > .btn { align-self: flex-start; }

.adm-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.adm-list li + li { border-top: 1px solid var(--line); }
.adm-list__link { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-3); align-items: center; padding: 10px 0; }
.adm-list__link strong { font-weight: 600; }
.adm-list__link span { grid-column: 1; color: var(--muted); font-size: var(--t-xs); overflow-wrap: anywhere; }
.adm-list__link svg { grid-column: 2; grid-row: 1 / span 2; width: 16px; height: 16px; color: var(--faint); }
.adm-list__link:hover strong { color: var(--accent-ink); }

/* Faits (définitions) */
.adm-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); margin: 0; }
.adm-facts div { min-width: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line); }
.adm-facts dt { color: var(--muted); font-size: var(--t-xs); }
.adm-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.adm-facts--rows { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 var(--sp-5) var(--sp-4); }
.adm-facts--rows div { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: var(--sp-3); padding: 9px 0; border: 0; border-radius: 0; background: none; }
.adm-facts--rows div + div { border-top: 1px solid var(--line); }
.adm-facts--rows dd { margin: 0; font-weight: 500; }
.wz-body .adm-facts--rows { padding: 0; }
@media (max-width: 520px) { .adm-facts--rows div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.adm-secret { font-size: var(--t-lg); font-weight: 700; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.adm-creds { grid-template-columns: minmax(0, 1fr); }
.adm-creds dd { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.adm-creds .adm-secret { font-size: var(--t-base); }

/* Blocs à copier */
.adm-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.adm-copy__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.adm-copy__label { margin: 0; color: var(--muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.adm-code, .adm-msg {
  margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line); color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: var(--t-sm); line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-height: 260px; overflow: auto;
}
.adm-code--tall { max-height: 46vh; }
.adm-msg { font-family: var(--font); white-space: pre-wrap; }
.link.is-copied, .btn.is-copied { color: var(--ok); }
.adm-steps { display: flex; flex-direction: column; gap: 8px; margin: 0; padding-left: 20px; color: var(--ink-2); font-size: var(--t-sm); line-height: 1.5; overflow-wrap: anywhere; }
.adm-steps li::marker { color: var(--accent); font-weight: 700; }

/* ---------- Branchements ---------- */
.adm-reqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: var(--sp-4); }
.adm-req { display: flex; flex-direction: column; min-width: 0; }
.adm-req__head { display: flex; align-items: center; gap: 12px; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
.adm-req__title { flex: 1; min-width: 0; line-height: 1.3; }
.adm-req__title strong { display: block; font-size: var(--t-base); font-weight: 650; overflow-wrap: anywhere; }
.adm-req__title span { display: block; color: var(--muted); font-size: var(--t-xs); }
.adm-req .adm-facts--rows { padding-top: var(--sp-2); }
.adm-req__foot { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: auto; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); }
.adm-req__log { margin: 0; color: var(--muted); font-size: var(--t-xs); }
.adm-req__log:empty { display: none; }
@media (max-width: 520px) { .adm-req__head { flex-wrap: wrap; } }

/* ---------- Ventes à confirmer ---------- */
.adm-check { width: 44px; padding-right: 0 !important; }
.adm-checkbox { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.adm-table tbody tr.is-selected { background: var(--accent-soft); }
.adm-bar {
  position: sticky; bottom: var(--sp-3); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin: var(--sp-3); padding: 10px 10px 10px 16px; border-radius: var(--r-md); background: var(--card-hover); border: 1px solid var(--line-strong);
  box-shadow: var(--highlight), var(--shadow-pop); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.adm-bar__text { min-width: 0; color: var(--ink-2); font-size: var(--t-sm); font-weight: 600; }
@media (max-width: 860px) { .adm-bar { bottom: calc(84px + env(safe-area-inset-bottom)); flex-wrap: wrap; } .adm-bar .btn { flex: 1 0 auto; } }

/* ---------- Boutons ---------- */
.adm-btn--danger { border-color: transparent; background: var(--bad); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.adm-btn--danger:hover { background: var(--bad); filter: brightness(1.08); }
.btn[aria-busy="true"] { cursor: progress; }

/* ---------- Fenêtre (dialog natif, au-dessus de tout) ---------- */
body:has(dialog.adm-dialog[open]) { overflow: hidden; }
.adm-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border-radius: 20px; color: var(--ink);
  background: var(--card-hover); border: 1px solid var(--line-strong); box-shadow: var(--highlight), var(--shadow-pop);
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); overflow: hidden;
}
.adm-dialog[open] { display: flex; flex-direction: column; animation: adm-pop var(--dur) var(--ease); }
.adm-dialog.is-reopened[open] { animation: none; }
.adm-dialog::backdrop { background: rgba(8, 12, 22, 0.42); backdrop-filter: blur(4px); }
:root[data-theme="dark"] .adm-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.adm-dialog--danger { border-top: 3px solid var(--bad); }
.adm-dialog__form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.adm-dialog .wz-body { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; min-height: 0; overflow-y: auto; }
.adm-dialog .wz-body > * { flex-shrink: 0; }
.adm-dialog .wz-body .field + .field { margin-top: 0; }
.adm-dialog .wz-head span { color: var(--muted); }
.adm-dialog .wz-foot .btn { min-width: 0; }
@keyframes adm-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) {
  .adm-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); }
  .adm-dialog .wz-foot { flex-wrap: wrap; }
  .adm-dialog .wz-foot .btn { flex: 1 0 auto; }
}

/* ---------- Mobile : cibles de 40 px ---------- */
@media (max-width: 860px) {
  .adm-seg-link { height: 36px; }
  .adm-tabs { width: 100%; overflow-x: auto; }
  .adm-tabs .adm-seg-link { flex: 1 0 auto; justify-content: center; }
  .adm-card .btn, .adm-req .btn, .adm-dialog .btn, .page-head .btn { height: 40px; }
  .adm-select--compact { height: 40px; font-size: 16px; }
  .adm-table .link, .adm-copy .link { height: 36px; }
  .tools .select { font-size: 16px; }
  /* Libellés de la barre d'onglets de l'équipe (« Branchements ») : coupés proprement plutôt que débordants. */
  .layout:has(.adm-user) .tabbar__link { min-width: 0; }
  .layout:has(.adm-user) .tabbar__link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 520px) {
  .adm-facts:not(.adm-facts--rows) { grid-template-columns: minmax(0, 1fr); }
  .page-head .strip { width: 100%; }
}

/* « Chargement… » montré seulement si la réponse tarde (au-delà de 300 ms) : pas de clignotement à chaque page. */
.adm-state--loading { animation: adm-late-appear 0.2s ease 0.3s both; }
@keyframes adm-late-appear { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .adm-state--loading { animation-duration: 0s; } }
