/* MDTED — finition v5 : champs, listes, cases, boutons, filtres, menus, adaptation.
   Extrait mécanique de style.css (aucune règle modifiée). */

/* ---------- champs de saisie ---------- */
input[type="text"], input[type="search"], input[type="password"], input[type="number"],
input[type="email"], input[type="url"], input[type="tel"], input[type="date"],
input[type="datetime-local"], textarea {
  color: var(--ink);
  background-color: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  font: inherit;
  transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease), background-color var(--motion-fast) var(--ease);
}
input[type="text"], input[type="search"], input[type="password"], input[type="number"],
input[type="email"], input[type="url"], input[type="tel"], input[type="date"],
input[type="datetime-local"] {
  min-height: var(--control-h);
  padding: 8px 12px;
}
textarea { padding: 10px 12px; line-height: 1.5; }
input[type="text"]::placeholder, input[type="search"]::placeholder,
input[type="password"]::placeholder, input[type="number"]::placeholder,
textarea::placeholder { color: var(--text-3); }

input[type="text"]:hover:not(:disabled), input[type="search"]:hover:not(:disabled),
input[type="password"]:hover:not(:disabled), input[type="number"]:hover:not(:disabled),
input[type="email"]:hover:not(:disabled), input[type="date"]:hover:not(:disabled),
textarea:hover:not(:disabled) { border-color: var(--control-border-hover); }

input[type="text"]:focus, input[type="search"]:focus, input[type="password"]:focus,
input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus,
input[type="tel"]:focus, input[type="date"]:focus, input[type="datetime-local"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background-color: var(--control-focus-bg);
}

input:disabled, textarea:disabled, select:disabled {
  background-color: var(--control-disabled-bg);
  color: var(--ink-faint);
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- listes déroulantes (toutes les <select>) ----------
   Le chevron vient des jetons --select-chevron : une URL par thème, posée
   dans 00-tokens.css. Survol et focus basculent sur la variante accent. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  min-height: var(--control-h);
  padding: 8px 38px 8px 12px;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background-color: var(--control-bg);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 8px;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease), background-color var(--motion-fast) var(--ease);
}
select:not([multiple]):not([size]):hover:not(:disabled) {
  border-color: var(--control-border-hover);
  background-color: var(--control-hover-bg);
  background-image: var(--select-chevron-accent);
}
select:not([multiple]):not([size]):focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background-color: var(--control-focus-bg);
  background-image: var(--select-chevron-accent);
}
select option, select optgroup { color: var(--ink); background: var(--menu-option-bg); }
select optgroup { font-weight: 700; font-size: var(--text-xs); }
select[multiple], select[size] {
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  padding: 6px;
  background: var(--control-bg);
  font: inherit;
}
select[multiple] option { padding: 4px 6px; border-radius: 5px; }

/* Petites listes intégrées (pagination, sélecteur de jeu de données). */
.page-size select:not([multiple]), .dataset-switch select:not([multiple]),
.result-filter select:not([multiple]) {
  min-height: 32px;
  padding: 4px 30px 4px 10px;
  font-size: var(--text-xs);
  background-position: right 10px center;
  background-size: 11px 7px;
}

/* Les explications et messages occupent leur propre ligne. */
.filter-row > .hint, .filter-row > .alert, .filter-row > p { flex: 1 1 100%; order: 10; margin: 2px 0 0; }
.filters .filter-row label { flex: 0 1 190px; }
.filters .filter-row label:has(input[type="date"]) { flex: 0 0 160px; }

/* ---------- cases et boutons radio ---------- */
input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: -2px;
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- boutons ---------- */
.btn {
  min-height: var(--control-h);
  padding: 8px 16px;
  border-radius: var(--control-radius);
  border: 1px solid var(--control-border);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: .005em;
  box-shadow: 0 1px 1px rgba(20, 22, 26, .04);
  transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease);
}
.btn:hover { background: var(--btn-hover-bg); border-color: var(--control-border-hover); box-shadow: 0 2px 4px rgba(20, 22, 26, .06); }
.btn:focus-visible { box-shadow: var(--focus-ring-lg); border-color: var(--accent); }
/* Une seule encre plate, une ombre colorée qui porte : le dégradé + reflet
   intérieur faisait bouton « site vitrine » dans une console de données. */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 1px 2px rgba(76, 29, 149, .22), 0 6px 14px -8px rgba(76, 29, 149, .45);
}
.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 1px 2px rgba(76, 29, 149, .26), 0 9px 18px -8px rgba(76, 29, 149, .5);
}
.btn-primary:focus-visible { box-shadow: var(--focus-ring-lg), 0 1px 2px rgba(76, 29, 149, .28); }
.btn-danger {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--surface);
  box-shadow: none;
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-line-hover); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: var(--text-xs); border-radius: 7px; }
.btn[disabled], .btn:disabled { opacity: .48; box-shadow: none; transform: none; }
.icon-btn {
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--ink-soft);
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- barres de filtres / formulaires en ligne ---------- */
.filter-row { gap: 12px 14px; align-items: flex-end; }
.filter-row label {
  font-size: var(--text-2xs);
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--ink-soft);
  gap: 6px;
}
.filter-row label > input, .filter-row label > select { width: 100%; }
.filter-row input[type="text"], .filter-row input[type="search"],
.filter-row input[type="date"], .filter-row select { min-width: 150px; }
.filter-row label:has(input[type="search"]) { flex: 1 1 240px; max-width: 340px; }
.filter-row > .btn, .filter-row > .inline-form { margin-bottom: 0; }
.rule-form { gap: 12px 14px; }
.rule-form .field-select { flex: 0 1 340px; min-width: 240px; max-width: 380px; }
.rule-form .field-select select { width: 100%; min-width: 0; }
.rule-form label:not(.field-select) { flex: 0 1 200px; min-width: 160px; }
.rule-form input[type="text"] { width: 100%; }
.field-select { min-width: 0; }
.field-select select { min-width: 0; }

/* ---------- cartes d'entrées de sources : deux lignes lisibles ---------- */
.entry-card-grid { grid-template-columns: 1.5fr 1.2fr 1.1fr 1.3fr; }
.entry-card-grid.entry-card-grid--params { grid-template-columns: 1.1fr 2.1fr .6fr; }
.entry-card-grid input, .entry-card-grid select { min-height: 34px; }
.entry-card-grid select:not([multiple]):not([size]) {
  min-height: 34px;
  padding: 6px 32px 6px 9px;
  font-size: var(--text-xs);
  background-position: right 10px center;
  background-size: 11px 7px;
}
@media (max-width: 1080px) {
  .entry-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-card-grid.entry-card-grid--params { grid-template-columns: 1fr 1.5fr .7fr; }
}
@media (max-width: 720px) {
  .entry-card-grid, .entry-card-grid.entry-card-grid--params { grid-template-columns: 1fr; }
}

/* ---------- onglets en pastilles ---------- */
.tabs .tab-headers {
  display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 0; margin-bottom: 10px;
}
.tab-header {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: var(--text-xs);
  font-weight: 650;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease);
}
.tab-header:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.tab-header.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 2px 6px rgba(91, 33, 182, .22);
}
.tab-header:focus-visible { box-shadow: var(--focus-ring); }
.tab-header.active .tab-count { background: rgba(255, 255, 255, .22); color: var(--text-on-accent); }
.tab {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
.tab.active { display: block; }
.tab > .grid { margin-top: 4px; }

/* ---------- tableaux ----------
   Rien ici : la hiérarchie d'élévation, le cadre, le survol et la barre de
   défilement appartiennent à la feuille des tableaux. Une finition qui
   redessine une grille page par page est exactement ce qui faisait deux
   « Exécutions » dans l'application. */

/* ---------- surfaces : une seule onde, un seul rayon ----------
   14 px sur les cartes et 12 px sur les tableaux, c'est deux systèmes dans
   le même écran. Tout remonte sur --radius ; les modales gardent --radius-lg. */
.panel { padding: 22px 24px; box-shadow: var(--shadow-card); }
.panel-title { font-size: var(--text-lg); font-weight: 700; letter-spacing: -.015em; }
/* Un seul cran de titre de page dans toute l'application : h1 valait déjà
   1.5rem en base, le surplomber de 1.62/rem faisait deux hiérarchies qui ne
   se recoupaient pas d'une page à l'autre. */
.page-head h1, .toolbar h1, .form-box > h1 { font-size: var(--text-2xl); letter-spacing: -.022em; }
.form-box > h1 { margin-bottom: var(--s-5); }
.page-lead { font-size: var(--text-md); line-height: 1.55; color: var(--text-2); }
.toolbar { margin-bottom: 20px; }
.form-box { box-shadow: var(--shadow-card); }

/* ---------- menus déroulants (compte, export) ---------- */
.user-menu, .export-menu-panel {
  border-radius: 11px;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-menu);
  padding: 7px;
}
.user-menu.open, .export-menu[open] .export-menu-panel { animation: menuDrop .14s ease-out; }
.user-menu a, .export-menu-panel a {
  border-radius: 7px;
  padding: 8px 10px;
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.user-menu a:hover, .export-menu-panel a:hover { background: var(--accent-soft); color: var(--accent-strong); }
.export-menu > summary { min-height: var(--control-h); }
@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-5px) scale(.99); }
  to { opacity: 1; transform: none; }
}

/* ---------- barre haute : le chrome s'efface ---------- */
.appbar {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(10px);
  border-bottom-color: color-mix(in srgb, var(--line) 80%, transparent);
}
/* ---------- messages et pastilles ----------
   La géométrie des pastilles d'état appartient à la feuille des tableaux :
   « badge » et « state » sont le même objet, et deux pages ne peuvent pas en
   donner deux tailles. */

/* ---------- adaptation ---------- */
@media (max-width: 900px) {
  .rule-form .field-select { flex: 1 1 100%; max-width: none; }
  .rule-form label:not(.field-select) { flex: 1 1 200px; }
}
@media (max-width: 720px) {
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-row label, .filter-row input, .filter-row select,
  .filter-row .btn, .filter-row .inline-form { width: 100%; max-width: none; }
  .filter-row > .btn { margin-top: 2px; }
  .rule-form .field-select { flex: 1 1 100%; }
  .tab-header { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* =============================================================
   v7 — humanisation : une interface qui respire et qui répond.
   Tout passe par les jetons : aucun littéral de couleur d'encre,
   le contrôle de contraste reste l'arbitre.
   ============================================================= */

/* ---------- canvas : une respiration verticale ---------- */
.canvas { padding: var(--s-8) var(--s-10) var(--s-12); }
.canvas-inner { max-width: 1360px; }
.page-head, .toolbar { margin-bottom: var(--s-6); }
.page-lead { max-width: 72ch; }

/* ---------- titres : le trait d'accent, signature discrète ---------- */
.page-head h1, .toolbar h1, .auth-panel h1, .form-box > h1 {
  position: relative;
  padding-left: 14px;
}
.page-head h1::before, .toolbar h1::before, .auth-panel h1::before, .form-box > h1::before {
  content: "";
  position: absolute; left: 0; top: .18em; bottom: .18em;
  width: 4px; border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
}

/* ---------- cartes chiffres : la géométrie et le survol appartiennent à la
   feuille des composants. Le survol ne répond que sur une carte cliquable :
   une carte statique qui se soulève ment sur ce qu'elle est. ---------- */

/* ---------- panneaux : entrée douce à l'apparition ----------
   fill-mode « backwards » : après l'animation, aucune propriété ne reste
   appliquée — un transform résiduel ferait du panneau le repère des popups
   fixed (menus déroulants) et les positionnerait hors écran. */
@media (prefers-reduced-motion: no-preference) {
  .panel, .result-card, .tab.active { animation: panelIn .24s var(--ease) backwards; }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- barres de progression : la vie pendant l'attente ---------- */
.progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 999px;
}
@media (prefers-reduced-motion: no-preference) {
  .progress-bar { position: relative; overflow: hidden; }
  .progress-bar::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent);
    transform: translateX(-100%);
    animation: progressSheen 1.6s var(--ease) infinite;
  }
}
@keyframes progressSheen {
  to { transform: translateX(100%); }
}

/* ---------- états vides : on accompagne, pas on constate ---------- */
.empty-state {
  border-radius: var(--radius-sm);
}
.empty-state {
  padding: var(--s-10) var(--s-6);
  text-align: center;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
}
.empty-state p { margin: 6px auto 0; color: var(--text-2); }

/* ---------- boutons en attente : la réponse est en route ---------- */
.btn.is-loading {
  pointer-events: none;
  opacity: .85;
}
.btn.is-loading::before {
  content: "";
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- squelettes : une forme qui promet du contenu ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, var(--line), transparent);
    transform: translateX(-100%);
    animation: skeletonSheen 1.4s var(--ease) infinite;
  }
}
@keyframes skeletonSheen { to { transform: translateX(100%); } }

/* ---------- barre haute : le chrome s'efface ---------- */
.appbar {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(10px);
  border-bottom-color: color-mix(in srgb, var(--line) 80%, transparent);
}
.brand-mark {
  border-radius: 10px;
  box-shadow: 0 2px 8px -2px rgba(91, 33, 182, .45);
}

/* ---------- menu latéral : l'élément actif se reconnaît de loin ---------- */
.nav-item {
  position: relative;
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.nav-item.is-active::before {
  content: "";
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 999px 999px 0;
  background: var(--accent);
}
.nav-item.is-active { font-weight: 700; }

/* ---------- écran de connexion : la porte d'entrée mérite un tapis ---------- */
.auth-body {
  background:
    radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, color-mix(in srgb, var(--accent-alt-soft) 60%, transparent), transparent 55%),
    var(--paper);
}
.auth-panel .form-box, .signin-box { border-radius: var(--radius-lg); }

/* ---------- tableaux : la transition de ligne est réglée par la feuille des
   tableaux, elle n'a pas de raison d'être reprise ici. ---------- */

/* ---------- alertes : mêmes angles que les cartes ---------- */
.alert, .banner { border-radius: var(--radius); }

/* ---------- modales et menus : profondeur cohérente ---------- */
.modal-card, .modal { border-radius: var(--radius-lg); }

/* ---------- thème sombre : deux finitions propres à la nuit ---------- */
[data-theme="dark"] .brand-mark { box-shadow: 0 2px 10px -2px rgba(167, 139, 250, .55); }
[data-theme="dark"] .auth-body {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(167, 139, 250, .12), transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, rgba(125, 178, 255, .09), transparent 55%),
    var(--paper);
}
[data-theme="dark"] ::selection { background: var(--accent); color: var(--text-on-accent); }

/* ---------- impression : les accents superflus reviennent au plat ---------- */
@media print {
  .page-head h1::before, .toolbar h1::before, .auth-panel h1::before { display: none; }
}

/* =============================================================
   v7.1 — combobox : le menu ouvert devient un composant maison.
   Le <select> natif reste dans le formulaire (valeur, validation,
   handlers « change »), recouvert d'un champ habillé et d'une liste
   en position fixe : coins, ombre, survol accent, coche, groupes.
   ============================================================= */
.combo { position: relative; display: flex; width: 100%; min-width: 0; }
/* Le select natif recouvre le champ : la bulle de validation native et les
   outils d'accessibilité tombent au bon endroit. */
.combo > select {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; border: 0; padding: 0; z-index: 0;
}
.combo-field {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: var(--control-h); min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--control-border); border-radius: var(--control-radius);
  background-color: var(--control-bg);
  background-image: var(--select-chevron);
  background-repeat: no-repeat; background-position: right 13px center; background-size: 12px 8px;
  color: var(--ink); font: inherit; font-size: var(--text-sm); text-align: left;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease),
    background-color var(--motion-fast) var(--ease);
}
.combo-field:hover { border-color: var(--control-border-hover); background-color: var(--control-hover-bg); }
.combo.is-open .combo-field, .combo-field:focus-visible {
  border-color: var(--accent); box-shadow: var(--focus-ring);
  background-color: var(--control-focus-bg);
  background-image: var(--select-chevron-accent);
}
.combo-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.combo.is-empty .combo-value { color: var(--text-3); }
.combo.is-disabled .combo-field {
  background-color: var(--control-disabled-bg); color: var(--ink-faint);
  cursor: not-allowed; background-image: var(--select-chevron); opacity: .8;
}
.combo-list {
  position: fixed; z-index: var(--z-menu); margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 0;
  border-radius: 12px; box-shadow: var(--shadow-menu); overflow: auto;
  overscroll-behavior: contain;
  /* Le calage vient de variables écrites par le script : la feuille reste
     maître de la mise en page, y compris sur petit écran. */
  left: var(--combo-left, 0px); min-width: var(--combo-min-width, 0px);
}
/* Le popup est déplacé dans <body> à l'ouverture (au-delà de tout ancêtre
   transformé) ; masqué par l'attribut hidden, pas par le contexte du wrap. */
.combo-option {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px;
  font-size: var(--text-sm); color: var(--ink); cursor: pointer;
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.combo-option:hover, .combo-option.is-active { background: var(--accent-soft); color: var(--accent-strong); }
.combo-option.is-selected { color: var(--accent-strong); font-weight: 700; }
.combo-option.is-selected::after { content: "✓"; margin-left: auto; font-weight: 800; }
.combo-option.is-disabled { color: var(--text-3); opacity: .55; cursor: not-allowed; }
.combo-group {
  font-size: var(--text-2xs); font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3);
  padding: 9px 10px 4px; cursor: default;
}
.combo-group:first-child { padding-top: 5px; }

/* Variantes compactes : là où l'ancien select était petit, le champ l'est aussi. */
.page-size .combo, .dataset-switch .combo { width: auto; display: inline-flex; }
.dataset-switch .combo { max-width: 320px; }
.page-size .combo-field, .dataset-switch .combo-field, .result-filter .combo-field,
.pagination-links .combo-field {
  min-height: 32px; padding: 4px 26px 4px 10px; font-size: var(--text-xs);
  background-position: right 10px center; background-size: 11px 7px;
}
.entry-card-grid .combo-field {
  min-height: 34px; padding: 6px 30px 6px 9px; font-size: var(--text-xs);
  background-position: right 10px center; background-size: 11px 7px;
}

/* Petits écrans : la liste occupe la largeur utile, comme un sélecteur natif. */
@media (max-width: 720px) {
  .combo-list { left: 8px; right: 8px; min-width: 0; }
}

/* ---------- détails : l'erreur compte, le bouton discret s'efface ---------- */
.meta-error { color: var(--danger); font-weight: 700; white-space: nowrap; }
.meta-warn { color: var(--amber-strong); font-weight: 700; white-space: nowrap; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--btn-hover-bg); border-color: var(--line); color: var(--text-1); }

/* ---------- dépôt : stepper d'étapes (numéros, connecteurs, états) ---------- */
.deposit-flow {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center;
  gap: 0; margin: 2px 0 18px; padding: 0; counter-reset: step;
}
.deposit-flow li {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--text-2xs); font-weight: 650; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 6px 13px;
  transition: border-color var(--motion-fast) var(--ease),
              background var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease);
}
.deposit-flow li + li { margin-left: 30px; }
.deposit-flow li::before {
  counter-increment: step; content: counter(step);
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-size: var(--text-2xs); font-weight: 800; color: var(--ink-soft);
  transition: background var(--motion-fast) var(--ease),
              border-color var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease);
}
.deposit-flow li::after {
  content: "";
  position: absolute; left: 100%; top: 50%;
  width: 30px; height: 2px; transform: translateY(-50%);
  background: var(--line-strong);
}
.deposit-flow li:last-child::after { display: none; }
.deposit-flow li.is-current {
  background: var(--accent); border-color: var(--accent);
  color: var(--text-on-accent); font-weight: 700;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.deposit-flow li.is-current::before {
  background: rgba(255, 255, 255, .22); border-color: transparent; color: var(--text-on-accent);
}
.deposit-flow li.is-done { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.deposit-flow li.is-done::before {
  content: "✓"; background: var(--ok); border-color: var(--ok); color: var(--text-on-accent);
}
.deposit-flow li.is-done::after { background: var(--ok); }
@media (max-width: 600px) {
  .deposit-flow li::after { display: none; }
  .deposit-flow li + li { margin-left: 8px; }
  .deposit-flow { gap: 8px; }
}

/* ---------- dépôt : zone de dépôt plus large et vivante ---------- */
.dropzone { min-height: 190px; padding: 40px 24px; gap: 8px; }
.dropzone:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dropzone.drag { border-style: solid; }
.dropzone-icon { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 6px; transition: transform var(--motion-fast) var(--ease); }
.dropzone-icon svg { width: 26px; height: 26px; }
.dropzone:hover .dropzone-icon { transform: translateY(-2px); }
.dropzone.drag .dropzone-icon { background: var(--accent); color: var(--text-on-accent); transform: translateY(-2px); }
@media (max-width: 480px) {
  .dropzone { min-height: 150px; padding: 28px 16px; }
}

/* ---------- dépôt : progression avec pourcentage et rayures ---------- */
.progress { position: relative; padding-top: 20px; }
.progress-pct {
  position: absolute; right: 0; top: 0;
  font-size: var(--text-2xs); font-weight: 800; color: var(--ink-soft);
}
.progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  position: relative; overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .progress-bar::after {
    content: "";
    position: absolute; inset: 0;
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .28) 0 8px, transparent 8px 16px);
    animation: progressStripes 1s linear infinite;
  }
}
@keyframes progressStripes { to { background-position: 22.62px 0; } }

/* ---------- dépôt : contrôles avec retour d'état doux ---------- */
.check-mark { transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease); }
.hint.hint-ok { color: var(--ok); font-weight: 650; }

.config-tabs { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-4); }
.config-tabs .btn { border-radius: var(--radius-pill); }
.config-tabs button[aria-selected="true"] { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
.config-target {
  margin-bottom: var(--s-4);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
/* Barre d'actions : dernière ligne du formulaire, jamais superposée aux
   champs (un position:sticky flottait par-dessus le panneau actif). */
.savebar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  margin-top: var(--s-4); padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.unsaved-badge {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--amber); font-weight: 700; margin: 0;
}
.unsaved-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft);
}
@keyframes unsavedPulse {
  50% { box-shadow: 0 0 0 5px var(--amber-soft); }
}
@media (prefers-reduced-motion: no-preference) {
  .unsaved-dot { animation: unsavedPulse 1.6s var(--ease) infinite; }
}
.switch { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-2) 0; }
.switch input { width: 44px; height: 24px; margin-top: 2px; }
.field-help { display: block; margin-top: 4px; color: var(--text-3); font-size: var(--text-xs); font-weight: 400; }
.sql-shell { display: grid; grid-template-columns: 2.6rem 1fr; min-height: 340px; border: 0; overflow: hidden; background: var(--surface); }

/* Champs et listes : une limite visible commune à tous les écrans. */
body input[type="text"], body input[type="search"], body input[type="password"],
body input[type="number"], body input[type="email"], body input[type="url"],
body input[type="tel"], body input[type="date"], body input[type="datetime-local"],
body textarea, body select:not([multiple]):not([size]), body .combo-field,
body input:hover, body select:hover, body textarea:hover, body .combo-field:hover {
  border-color: var(--control-border);
  background-color: var(--control-bg);
  box-shadow: none;
}
.column-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 12px 14px 14px;
}
.column-bar-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.column-bar-head .side-card-title { margin: 0; }
.column-bar-head input[type="search"] { width: 220px; min-height: 36px; }
.column-bar .chip-list { max-height: none; overflow: visible; }
.sql-gutter { margin: 0; padding: 12px 6px; text-align: right; color: var(--text-3); background: var(--surface-2); font: 13px/1.45 ui-monospace, Consolas, monospace; user-select: none; overflow: hidden; }
.sql-shell .sql-editor { border: 0; min-height: 300px; font: 13.5px/1.6 "Cascadia Mono", Consolas, ui-monospace, monospace; resize: vertical; }
@media (max-width: 768px) {
  .sql-shell { min-height: 260px; }
  .sql-shell .sql-editor { min-height: 220px; }
}

@media (max-width: 768px) {
  .btn, .shell-btn, summary.btn { min-height: 44px; }
  /* La file d'exécution n'est pas redécoupée en cartes : cacheter l'en-tête
     et passer les `<tr>` en blocs retire les nœuds table/row/columnheader de
     l'arbre d'accessibilité et fait disparaître les boutons de tri. Elle
     glisse dans son conteneur, comme toutes les autres grilles. */
}
@media (prefers-reduced-motion: reduce) {
  .kpi, .btn, .deposit-flow li, .quick-action, .dropzone, .activity-list li { transition: none; }
  .kpi:hover, .quick-action:hover { transform: none; }
}

/* =============================================================
   v8 — finition « signature » : élévation, accents et détails
   ============================================================= */

/* ---------- coque : la barre haute se détache, le compte se présente ---------- */
.appbar { box-shadow: var(--shadow-sm); }
.user-badge {
  background: linear-gradient(140deg, var(--accent), var(--accent-bright));
  color: var(--text-on-accent);
}
.user-button:hover { border-color: var(--accent-line); }

/* ---------- menu latéral : l'élément actif porte son trait de signature ---------- */
.nav-item.is-active { position: relative; }
.nav-item.is-active::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 999px;
  background: var(--accent);
}
.nav-item.is-active .nav-icon {
  background: linear-gradient(140deg, var(--accent), var(--accent-bright));
  color: var(--text-on-accent);
}

/* ---------- carte d'appel : même anatomie que les autres ---------- */
/* La carte « Lots à approuver » ne porte plus de fond d'accent : l'appel à
   l'action reste une pastille teintée, lisible sur carte blanche. */
.kpi-cta-go {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid var(--accent-line);
}
/* Sur une carte d'une colonne et demie (≈143 px de contenu), la pastille et la
   flèche faisaient tourner « Vérifier les lots » sur deux lignes : le geste
   reste un lien — sans fond, sans bordure, sans chevron qui déborde. */
@media (max-width: 480px) {
  .kpi-cta-go { padding: 0; border-color: transparent; background: none; }
  .kpi-cta-go .ico { display: none; }
}

/* ---------- panneaux : les listes répondent au doigt ---------- */
.activity-list li {
  margin: 0 -8px; padding: 11px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--motion-fast) var(--ease);
}
.activity-list li:hover { background: var(--row-hover-neutral); }
.quick-action {
  transition: border-color var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease),
    transform var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease);
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---------- menus de ligne : le panneau se détache du cadre ---------- */
.row-menu > summary .ico { margin-left: 2px; }
.row-menu-panel { border-color: var(--line-strong); box-shadow: var(--shadow-menu); }

/* ---------- dépôt : cartes de type avec pastille de choix ---------- */
.deposit-mode .mode-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-soft); border-color: var(--accent-line);
  color: var(--accent-strong);
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease),
    border-color var(--motion-fast) var(--ease);
}
.deposit-mode:hover .mode-icon { background: var(--surface); border-color: var(--accent); }
.deposit-mode.active .mode-icon {
  background: linear-gradient(140deg, var(--accent), var(--accent-bright));
  border-color: var(--accent); color: var(--text-on-accent);
}
.deposit-mode .mode-icon svg { width: 20px; height: 20px; }
.deposit-mode.active { position: relative; }
.deposit-mode.active::after {
  content: "✓";
  position: absolute; top: -7px; right: -7px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--text-on-accent);
  border: 2px solid var(--surface);
  font-size: 12px; font-weight: 800; line-height: 1;
  box-shadow: var(--shadow-sm);
}

/* ---------- dépôt : zone de dépôt et contrôles ---------- */
.dropzone:hover, .dropzone.drag {
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface-2));
}
.check-mark {
  width: 20px; height: 20px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
}
.check.ok .check-mark { background: var(--ok); border-color: var(--ok); color: var(--text-on-accent); }
.check.ko .check-mark { background: var(--danger); border-color: var(--danger); color: var(--text-on-accent); }
