/* =========================================================================
   prospect-triage — dashboard sombre, esthétique "console d'instrument".
   Tokens OKLCH. Police imposée : IBM Plex Sans / Mono (cohérence CRM).
   ========================================================================= */

:root {
  /* --- Surfaces (charcoal cool, ramp de lightness OKLCH) --- */
  --bg:            oklch(0.165 0.012 245);
  --surface:       oklch(0.205 0.014 245);
  --surface-2:     oklch(0.245 0.016 245);
  --surface-3:     oklch(0.290 0.018 245);
  --border:        oklch(0.330 0.018 245);
  --border-strong: oklch(0.430 0.020 245);

  /* --- Texte --- */
  --text:      oklch(0.960 0.004 245);
  --text-2:    oklch(0.760 0.010 245);
  --text-mute: oklch(0.585 0.014 245);

  /* --- Accent : vert phosphore (terminal + paysage), unique et tranchant --- */
  --accent:     oklch(0.840 0.170 150);
  --accent-2:   oklch(0.700 0.150 150);
  --accent-dim: oklch(0.430 0.090 150);
  --on-accent:  oklch(0.180 0.040 150);

  /* --- Focus : cyan vif, distinct de l'accent --- */
  --focus: oklch(0.840 0.140 215);

  /* --- Faille = échelle de chaleur (forte=chaud=bon prospect → faible=froid) --- */
  --f-aucun:    oklch(0.720 0.200 28);   /* AUCUN_SITE       rouge-orangé */
  --f-hs:       oklch(0.740 0.185 50);   /* SITE_HS          orange       */
  --f-social:   oklch(0.800 0.155 75);   /* RESEAU_SOCIAL    ambre        */
  --f-resp:     oklch(0.840 0.150 100);  /* NON_RESPONSIVE   jaune        */
  --f-perf:     oklch(0.820 0.130 140);  /* PERF_FAIBLE      jaune-vert   */
  --f-vieilli:  oklch(0.760 0.090 215);  /* SITE_VIEILLI     bleu-gris    */
  --f-ras:      oklch(0.560 0.012 245);  /* RAS              gris (écarté)*/

  --danger: oklch(0.700 0.200 28);

  /* --- Géométrie --- */
  --r-sm: 4px;  --r-md: 7px;  --r-lg: 11px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.4), 0 8px 24px oklch(0 0 0 / 0.28);

  --ff-sans: "IBM Plex Sans", system-ui, sans-serif;
  --ff-mono: "IBM Plex Mono", ui-monospace, monospace;

  --h-cmdbar: 64px;
  --h-ticker: 26px;
  --w-rail: 248px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

/* L'attribut [hidden] doit toujours l'emporter sur les display: des composants. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-sans);
  font-size: 14px;
  line-height: 1.45;
  /* Texture discrète : fines lignes verticales façon instrument + vignette */
  background-image:
    radial-gradient(120% 80% at 50% -10%, oklch(0.260 0.030 150 / 0.18), transparent 60%),
    repeating-linear-gradient(90deg, oklch(1 0 0 / 0.012) 0 1px, transparent 1px 3px);
  -webkit-font-smoothing: antialiased;
}

/* --- Accessibilité : skip link + sr-only --- */
.skip-link {
  position: fixed; left: var(--sp-3); top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus { top: var(--sp-3); }

.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;
}

/* --- Focus visible global (jamais retiré) --- */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* =========================== Command bar =========================== */
.cmdbar {
  height: var(--h-cmdbar);
  display: flex; align-items: center; gap: var(--sp-5);
  padding: 0 var(--sp-5);
  background: linear-gradient(var(--surface), var(--surface-2));
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.cmdbar__wordmark {
  font-family: var(--ff-mono); font-size: 16px; font-weight: 600;
  letter-spacing: 0.14em; color: var(--text);
}
.cmdbar__o { color: var(--accent); }

.cmdbar__stats {
  display: flex; gap: var(--sp-5); margin-left: auto;
  padding-right: var(--sp-5); margin-right: var(--sp-5);
  border-right: 1px solid var(--border);
}
.stat { display: flex; flex-direction: column; align-items: flex-end; }
.stat dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-mute); margin: 0; }
.stat dd {
  margin: 0; font-family: var(--ff-mono); font-size: 17px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text);
}

.cmdbar__actions { display: flex; gap: var(--sp-2); }

/* =========================== Buttons =========================== */
.btn {
  font-family: var(--ff-sans); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 var(--sp-4);
  border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, transform 0.06s ease;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-mute); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary {
  background: var(--accent); color: var(--on-accent); border-color: transparent;
}
.btn--primary:hover:not(:disabled) { background: var(--accent-2); }
.btn--ghost { background: transparent; }

/* =========================== Ticker =========================== */
.ticker {
  height: var(--h-ticker);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-5);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--text-mute);
  position: sticky; top: var(--h-cmdbar); z-index: 19;
}
.ticker__sep { color: var(--border-strong); }
#ticker-backup.is-ok { color: var(--accent); }
#ticker-backup.is-ko { color: var(--f-hs); }

/* =========================== Layout =========================== */
.layout {
  display: grid; grid-template-columns: var(--w-rail) 1fr;
  height: calc(100vh - var(--h-cmdbar) - var(--h-ticker));
}

/* =========================== Rail / filtres =========================== */
.rail {
  border-right: 1px solid var(--border);
  padding: var(--sp-5) var(--sp-4);
  overflow-y: auto; background: oklch(0.190 0.013 245);
  display: flex; flex-direction: column; gap: var(--sp-5);
}
.field { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label, .field legend {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-mute); font-weight: 600; padding: 0;
}
input[type="search"] {
  font-family: var(--ff-mono); font-size: 13px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 9px var(--sp-3); min-height: 36px;
}
input[type="search"]::placeholder { color: var(--text-mute); }
input[type="search"]:hover { border-color: var(--border-strong); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--ff-mono); font-size: 11px; font-weight: 500;
  padding: 5px 9px; min-height: 28px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chip__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip[aria-pressed="true"] {
  background: var(--surface-3); color: var(--text); border-color: var(--border-strong);
}
.chip:hover { border-color: var(--text-mute); }

.check { display: flex; align-items: center; gap: var(--sp-2); font-size: 13px; color: var(--text-2); cursor: pointer; min-height: 28px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.rail__compteur {
  margin-top: auto; text-align: center;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: var(--sp-3) 0; font-size: 11px; color: var(--text-mute);
}
.rail__compteur #rail-count { font-family: var(--ff-mono); font-weight: 600; color: var(--text); }
.rail__rgpd { margin: 0; font-size: 11px; line-height: 1.5; color: var(--text-mute); }

/* =========================== Content / states =========================== */
.content { overflow: auto; position: relative; }

.state { padding: var(--sp-6); display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center; color: var(--text-2); }
.state h2 { margin: var(--sp-2) 0 0; font-size: 17px; color: var(--text); }
.state p { margin: 0; max-width: 46ch; }
.state__icon { font-size: 34px; color: var(--text-mute); }
.state--error .state__icon { color: var(--danger); }
.state__hint { font-size: 12px; color: var(--text-mute); }
.state code { font-family: var(--ff-mono); background: var(--surface-2); padding: 2px 6px; border-radius: var(--r-sm); color: var(--accent); }

.state--loading { align-items: stretch; }
.skel-bar {
  height: 44px; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* =========================== Table =========================== */
.tablewrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 920px; }

thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  text-align: left; padding: 0; white-space: nowrap;
  font-size: 11px; color: var(--text-2);
}
thead th button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  color: inherit; font-family: var(--ff-sans); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: var(--sp-3) var(--sp-3); display: flex; align-items: center; gap: 6px;
  min-height: 40px;
}
thead th button:hover { color: var(--text); }
thead th .arrow { color: var(--accent); font-size: 9px; }
.th-hint { text-transform: none; letter-spacing: 0; color: var(--text-mute); font-weight: 400; font-size: 10px; padding: var(--sp-3); display: inline-block; }
th[aria-sort] button { color: var(--text); }

.col-score { width: 96px; }
.col-faille { width: 168px; }
.col-rep { width: 116px; }
.col-contact { width: 200px; }

tbody td { padding: var(--sp-3); border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: oklch(0.225 0.015 245); }
tbody tr.is-ecarter { opacity: 0.62; }
tbody tr.is-ecarter:hover { opacity: 0.85; }

/* Row reveal stagger on load */
tbody tr.reveal { animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Score meter */
.score { display: flex; align-items: center; gap: var(--sp-2); }
.score__num { font-family: var(--ff-mono); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 26px; }
.score__meter { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.score__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }

/* Company cell */
.co-name { font-weight: 600; color: var(--text); }
.co-meta { font-size: 11px; color: var(--text-mute); font-family: var(--ff-mono); margin-top: 2px; }

/* Faille badge */
.badge {
  font-family: var(--ff-mono); font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; gap: 6px;
  color: oklch(0.18 0.02 245); /* texte foncé sur badge clair = contraste AA */
  white-space: nowrap;
}
.badge .badge__rank { opacity: 0.65; font-weight: 500; }
.badge[data-f="AUCUN_SITE"]         { background: var(--f-aucun); }
.badge[data-f="SITE_HS"]            { background: var(--f-hs); }
.badge[data-f="RESEAU_SOCIAL_ONLY"] { background: var(--f-social); }
.badge[data-f="NON_RESPONSIVE"]     { background: var(--f-resp); }
.badge[data-f="PERF_FAIBLE"]        { background: var(--f-perf); }
.badge[data-f="SITE_VIEILLI"]       { background: var(--f-vieilli); }
.badge[data-f="RAS"]                { background: var(--f-ras); color: oklch(0.92 0.004 245); }

/* Reputation */
.rep { font-family: var(--ff-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.rep__stars { color: var(--accent); }
.rep__avis { color: var(--text-mute); font-size: 11px; }
.rep--none { color: var(--text-mute); font-style: italic; font-family: var(--ff-sans); font-size: 12px; }

/* Contact */
.contact a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.contact a:hover { color: var(--accent); border-color: var(--accent); }
.contact__phone { font-family: var(--ff-mono); font-size: 13px; }
.contact__phone--mobile { color: var(--accent); font-weight: 600; }
.contact__phone--fixe { color: var(--text-mute); }
.phone-tag { font-size: 11px; }
.contact__site { font-size: 11px; color: var(--text-mute); display: block; margin-top: 2px; max-width: 184px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact__email { font-size: 11px; color: var(--text-2); display: block; margin-top: 2px; max-width: 184px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.contact__email:hover { color: var(--accent); border-color: var(--accent); }
.contact--empty { color: var(--text-mute); font-style: italic; font-size: 12px; }
.contact--injoignable { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--danger); }
tbody tr.is-injoignable { opacity: 0.5; }
tbody tr.is-injoignable:hover { opacity: 0.8; }

/* Accroche (editable) */
.accroche {
  font-size: 12.5px; line-height: 1.5; color: var(--text-2);
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 6px 8px; cursor: text; min-height: 32px;
  transition: border-color 0.12s, background 0.12s;
}
.accroche:hover { border-color: var(--border); background: var(--bg); }
.accroche[contenteditable="true"] { border-color: var(--accent); background: var(--bg); color: var(--text); outline: none; }
.accroche.is-dirty { border-left: 2px solid var(--accent); }

/* =========================== Toast =========================== */
.toast {
  position: fixed; bottom: var(--sp-5); left: 50%; transform: translateX(-50%);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  padding: var(--sp-3) var(--sp-5); border-radius: var(--r-md); box-shadow: var(--shadow);
  font-size: 13px; z-index: 50; animation: rise 0.2s ease;
}

/* =========================== Responsive =========================== */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .rail { border-right: 0; border-bottom: 1px solid var(--border); }
  .cmdbar { flex-wrap: wrap; height: auto; padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); }
  .cmdbar__stats { margin: 0; width: 100%; justify-content: space-between; }
  /* Le tableau scrolle horizontalement (cf. .tablewrap) plutôt que de masquer des colonnes,
     ce qui désaligne header/corps. */
}
/* =========================== Slide-over =========================== */
.slideover { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; }
.slideover__backdrop { position: absolute; inset: 0; background: oklch(0 0 0 / 0.55); }
.slideover__panel {
  position: relative; width: min(520px, 100%); height: 100%; background: var(--surface);
  border-left: 1px solid var(--border-strong); display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: slidein 0.18s ease;
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.slideover__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.slideover__head h2 { margin: 0; font-size: 15px; font-family: var(--ff-mono); letter-spacing: 0.04em; }
.slideover__body { flex: 1; overflow-y: auto; padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-5); }
.slideover__foot { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); }

.so-naf-list, .so-dep-list { max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-top: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-2); }
.so-opt { text-align: left; background: none; border: 0; color: var(--text-2); font-family: var(--ff-sans); font-size: 13px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.so-opt:hover { background: var(--surface-3); color: var(--text); }
.so-opt[aria-pressed="true"] { background: oklch(0.30 0.05 150 / 0.4); color: var(--accent); }
.so-opt small { color: var(--text-mute); }
.so-naf-free { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }
.so-naf-free input { flex: 1; }
.so-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-2); }
.so-chip { font-family: var(--ff-mono); font-size: 11px; padding: 4px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text); display: inline-flex; gap: 6px; align-items: center; }
.so-chip button { background: none; border: 0; color: var(--text-mute); cursor: pointer; font-size: 13px; }
.so-inline { flex-direction: row; align-items: center; justify-content: space-between; }
.so-inline input[type="number"] { width: 72px; margin-left: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 6px; }

.so-preview { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); }
.so-preview-table { max-height: 220px; overflow-y: auto; font-family: var(--ff-mono); font-size: 11px; color: var(--text-2); }
.so-preview-table div { padding: 2px 0; border-bottom: 1px solid var(--border); }

.so-progress__bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.so-progress__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width 0.3s ease; }
.so-progress p { font-family: var(--ff-mono); font-size: 12px; color: var(--text-2); margin: var(--sp-2) 0 0; }

/* =========================== Statut =========================== */
.col-statut { width: 132px; }
.statut-select {
  font-family: var(--ff-sans); font-size: 12px; width: 100%;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 5px 6px; cursor: pointer;
}
.statut-select:hover { border-color: var(--border-strong); }
.cell-statut.is-traite .statut-select { color: var(--accent); border-color: var(--accent-dim); }

/* =========================== Qui m'appelle ? =========================== */
.whois {
  position: fixed; top: calc(var(--h-cmdbar) + var(--sp-4)); right: var(--sp-5); z-index: 70;
  width: min(420px, 92vw); max-height: 70vh; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--sp-5);
  animation: rise 0.18s ease;
}
.whois__close { position: absolute; top: 8px; right: 8px; background: none; border: 0; color: var(--text-mute); cursor: pointer; font-size: 15px; }
.whois__close:hover { color: var(--text); }
.whois__none { color: var(--text-2); margin: var(--sp-2) 0 0; }
.whois__card { padding: var(--sp-2) 0; }
.whois__card + .whois__card { border-top: 1px solid var(--border); margin-top: var(--sp-3); padding-top: var(--sp-3); }
.whois__name { font-weight: 700; font-size: 16px; color: var(--text); }
.whois__meta { font-family: var(--ff-mono); font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.whois__line { font-size: 12px; color: var(--text-2); margin-top: var(--sp-3); }
.whois__tel { font-family: var(--ff-mono); font-size: 13px; color: var(--text); margin-top: var(--sp-2); }
.whois__accroche { font-size: 13px; line-height: 1.5; color: var(--text); background: var(--bg); border-left: 2px solid var(--accent); border-radius: var(--r-sm); padding: var(--sp-3); margin-top: var(--sp-3); }

/* =========================== Suppression / exclusion =========================== */
.row-del {
  background: none; border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-mute); cursor: pointer; font-size: 12px; line-height: 1;
  width: 26px; height: 26px; margin-top: 4px;
}
.row-del:hover { color: var(--danger); border-color: var(--danger); }
.btn--del { color: var(--text-mute); font-size: 12px; min-height: 30px; justify-content: flex-start; }
.btn--del:hover { color: var(--danger); border-color: var(--danger); }

/* =========================== Pourcentage de progression =========================== */
.so-progress__pct {
  font-family: var(--ff-mono); font-size: 28px; font-weight: 600; color: var(--accent);
  font-variant-numeric: tabular-nums; text-align: center; margin-bottom: var(--sp-2);
  text-shadow: 0 0 14px var(--accent-dim);
}

.whois__statut-edit { display: flex; align-items: center; gap: var(--sp-2); font-size: 12px; color: var(--text-2); margin-top: var(--sp-3); }
.whois__statut-edit .statut-select { flex: 1; max-width: 200px; }

/* ---- Suggestions téléphone incrémentales ---- */
.phone-suggest { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.phone-suggest__item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: inherit; cursor: pointer; text-align: left; font: inherit;
}
.phone-suggest__item:hover, .phone-suggest__item:focus-visible { background: rgba(255, 255, 255, 0.06); }
.phone-suggest__name { font-weight: 600; }
.phone-suggest__meta { font-size: 0.85em; opacity: 0.75; }

/* ---- Onglets pipeline ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px 0; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px 8px 0 0;
  background: transparent; color: inherit; cursor: pointer; font: inherit;
  border-bottom: none; opacity: 0.85;
}
.tab:hover, .tab:focus-visible { background: rgba(255, 255, 255, 0.05); opacity: 1; }
.tab[aria-selected="true"] {
  background: var(--accent); color: var(--on-accent); font-weight: 600; opacity: 1;
}
.tab__count {
  font-size: 0.82em; padding: 1px 7px; border-radius: 999px;
  background: rgba(127, 127, 127, 0.22);
}
.tab[aria-selected="true"] .tab__count { background: rgba(0, 0, 0, 0.18); }
.tab--vide { opacity: 0.45; }

/* =========================== Connexion =========================== */
.login {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login__box {
  display: flex; flex-direction: column; gap: var(--sp-3);
  width: min(320px, 86vw); padding: var(--sp-6);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.login__brand { font-family: var(--ff-mono); font-size: 18px; font-weight: 600; letter-spacing: 0.14em; text-align: center; margin-bottom: var(--sp-2); }
.login__brand span { color: var(--accent); }
.login__box label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-mute); }
.login__box input { font-family: var(--ff-mono); font-size: 14px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px var(--sp-3); }
.login__error { margin: 0; font-size: 12px; color: var(--danger); }

/* =========================== Mode mobile (≤ 700 px) =========================== */
.mobile-only { display: none; }

@media (max-width: 700px) {
  /* Header compact : wordmark + filtres ; stats/ticker/export/nouvelle liste cachés */
  .cmdbar { gap: var(--sp-3); padding: 0 var(--sp-3); }
  .cmdbar__stats, .ticker, #btn-export, #btn-new-list { display: none !important; }
  .mobile-only { display: inline-flex; }

  /* Le rail devient un panneau repliable plein écran (ouvert via ⚙) */
  .layout { grid-template-columns: 1fr; height: calc(100vh - var(--h-cmdbar)); }
  .rail { display: none; }
  .rail.rail--open {
    display: flex; position: fixed; inset: var(--h-cmdbar) 0 0 0; z-index: 40;
    background: var(--bg); border-right: none;
  }

  /* Onglets : chips scrollables sur une ligne */
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 8px 10px 0; }
  .tab { white-space: nowrap; flex: none; }

  /* Table desktop cachée, vue carte affichée (app.js gère [hidden]) */
  .tablewrap { display: none !important; }
}

.mobile { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3); flex: 1; }
.mobile__card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-4); touch-action: pan-y; user-select: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.mobile__card.is-drag { transition: none; }
.mobile__card.is-exit-left { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.mobile__card.is-exit-right { transform: translateX(120%) rotate(8deg); opacity: 0; }
.mobile__entete { display: flex; justify-content: space-between; align-items: flex-start; }
.mobile__score { font-family: var(--ff-mono); font-size: 28px; font-weight: 600; color: var(--accent); }
.mobile__nom { font-size: 19px; font-weight: 600; margin-top: var(--sp-2); line-height: 1.25; }
.mobile__meta { font-size: 12px; color: var(--text-mute); margin-top: 3px; }
.mobile__rep { font-size: 12px; color: var(--text-2); margin-top: var(--sp-2); }
.mobile__accroche {
  margin-top: var(--sp-3); padding: var(--sp-3); background: var(--bg);
  border-radius: var(--r-md); font-size: 12.5px; line-height: 1.5; color: var(--text-2);
}
.mobile__appeler {
  display: block; margin-top: var(--sp-3); padding: 14px 0; text-align: center;
  background: var(--accent); color: var(--on-accent); border-radius: var(--r-md);
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.mobile__hint { display: flex; justify-content: space-between; margin-top: var(--sp-2); font-size: 10px; color: var(--text-mute); }
.mobile__position { text-align: center; font-family: var(--ff-mono); font-size: 11px; color: var(--text-mute); }
.mobile__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.mobile__statut { justify-content: center; min-height: 46px; font-size: 13.5px; }
.mobile__statut--ok { color: var(--accent); }
.mobile__statut--ko { color: var(--f-aucun); }
.mobile__passer { grid-column: 1 / -1; min-height: 42px; justify-content: center; }
.mobile__fin { text-align: center; padding: var(--sp-6) var(--sp-4); color: var(--text-mute); }
.mobile__exclure { margin-top: var(--sp-2); background: none; border: none; color: var(--text-mute); font-size: 11px; cursor: pointer; text-decoration: underline; }
.toast__action {
  margin-left: var(--sp-3); background: none; border: none; color: var(--accent);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline;
}
