/* ═══════════════════════════════════════════════════════════════════════
   Sorare Workers Dashboard – Styles
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Theme: Dark (default) ─────────────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg: #0a0e14;
  --bg-card: #131720;
  --bg-hover: #1a1f2e;
  --bg-sidebar: #0f1319;
  --border: #252a35;
  --border-light: #2d3440;
  --text: #e8edf5;
  --text-muted: #9ca3af;
  --accent: #5b9fff;
  --accent-hover: #7ab3ff;
  --accent-glow: rgba(91, 159, 255, .2);
  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, .15);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, .15);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .15);
  --purple: #a78bfa;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Consolas', 'Fira Code', monospace;
}


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

body {
  font-family: var(--font);
  background: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(91, 159, 255, .05) 0%, transparent 50%),
    radial-gradient(at 100% 100%, rgba(167, 139, 250, .05) 0%, transparent 50%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

.sidebar-logo h1 svg { flex-shrink: 0; }
.sidebar-logo h1 .sidebar-favicon { font-size: 16px; line-height: 1; }

.sidebar-logo span {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.sidebar nav { flex: 1; }

.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
  margin: 2px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar a:hover {
  background: var(--bg-hover);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar a.active {
  color: var(--accent);
  background: linear-gradient(90deg, var(--accent-glow) 0%, transparent 100%);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-db-card {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 6px 8px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  overflow: hidden;
}

.sidebar-db-card:hover {
  background: rgba(91, 159, 255, .3);
  border-color: var(--accent-hover);
}

.sidebar-db-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1px;
}

.sidebar-db-label svg { stroke: var(--accent); width: 10px; height: 10px; flex-shrink: 0; }

.sidebar-db-host {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-db-name {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  font-size: 10px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

/* ── Sidebar toggle (mobile) ─────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 101;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-md);
  transition: background .2s, border-color .2s;
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}
.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform .25s, opacity .25s;
}
body.sidebar-open .sidebar-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.sidebar-open .sidebar-toggle span:nth-child(2) {
  opacity: 0;
}
body.sidebar-open .sidebar-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 99;
  opacity: 0;
  transition: opacity .2s;
}
.sidebar-overlay.visible {
  opacity: 1;
}

/* ── Main ───────────────────────────────────────────────────────────── */

.main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  padding: 32px 40px;
  max-width: 1600px;
}

.page { display: none; }
.page.active { display: block; }

/* ── Breadcrumb (fil d'Ariane) ─────────────────────────────────────── */
.breadcrumb {
  display: none; /* masqué par défaut, affiché par JS quand ≥ 2 niveaux */
  align-items: center;
  gap: 0;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 6px 0;
  line-height: 1.4;
  flex-wrap: wrap;
}
.breadcrumb-link {
  color: var(--accent);
  text-decoration: none;
  transition: color .15s;
}
.breadcrumb-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.breadcrumb-sep {
  margin: 0 6px;
  color: var(--text-muted);
  opacity: .5;
  user-select: none;
}
.breadcrumb-current {
  color: var(--text);
  font-weight: 500;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Cards grid ─────────────────────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity .3s;
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

.card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-value {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: -0.5px;
  margin-top: 4px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.card-green { border-left: 3px solid var(--green); }
.card-blue { border-left: 3px solid var(--accent); }
.card-yellow { border-left: 3px solid var(--yellow); }
.card-purple { border-left: 3px solid var(--purple); }
.card-red { border-left: 3px solid var(--red); }

/* ── Worker Detail ────────────────────────────────────────────────── */

/* ── Worker Detail Header ────────────────────────────────────────── */

.wd-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: 400;
}

.wd-header-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Cards compactes dans la page worker detail */
.wd-cards-grid {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.wd-cards-grid .card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.wd-cards-grid .card::before { display: none; }

.wd-cards-grid .card-label {
  font-size: 10px;
  margin-bottom: 2px;
}

.wd-cards-grid .card-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

.wd-card-live {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

@keyframes wd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.wd-history-flex {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.wd-chart-container {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.wd-chart-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: center;
}

.wd-description {
  font-size: 13px;
  color: var(--text-muted);
  margin: -8px 0 12px;
  line-height: 1.4;
}

.wd-context-line {
  background: var(--bg-card);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.wd-context-line .wd-ctx-sep {
  color: var(--text-muted);
  opacity: .4;
}

.wd-context-line .wd-ctx-label {
  color: var(--text-muted);
  font-size: 12px;
}

.wd-mini-bar {
  display: inline-flex;
  vertical-align: middle;
  height: 10px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-hover);
  width: 100%;
  max-width: 100px;
}

.wd-mini-bar span {
  display: block;
  height: 100%;
}

/* ── Erreurs section ─────────────────────────────────────────────── */

.wd-errors-section {
  margin-bottom: 20px;
}

.wd-errors-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.wd-errors-section.wd-errors-prominent {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 16px;
}

.wd-error-row {
  cursor: pointer;
  transition: background .15s;
}

.wd-error-row:hover {
  background: var(--bg-hover);
}

.wd-error-reason {
  max-width: 300px;
  color: var(--red);
  font-size: 13px;
}

.wd-error-reason-text {
  word-break: break-word;
}

.wd-error-expand-btn {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  margin-left: 4px;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.wd-error-expand-btn:hover {
  color: var(--text);
}

.wd-attempts-badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.wd-attempts-warn {
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
}

.wd-attempts-fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

/* ── Job Catalog Grid ─────────────────────────────────────────────── */

.wd-job-catalog {
  margin-bottom: 20px;
}

.wd-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.wd-catalog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s, box-shadow .2s;
}

.wd-catalog-card:hover {
  border-color: var(--accent);
  box-shadow: 0 -2px 0 0 var(--accent) inset, var(--shadow-sm);
}

.wd-catalog-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wd-catalog-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.wd-catalog-dot.dot-ok { background: var(--green); }
.wd-catalog-dot.dot-failed { background: var(--red); }
.wd-catalog-dot.dot-idle { background: var(--text-muted); opacity: .5; }

.wd-catalog-card-name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.wd-catalog-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.wd-catalog-card-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wd-catalog-card-lastrun {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.wd-catalog-card-lastrun .badge { flex-shrink: 0; }
.wd-catalog-lastrun-count {
  flex: 1;
  font-size: 11px;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wd-catalog-lastrun-time {
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
  opacity: .7;
}

.wd-catalog-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-family: var(--mono);
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.wd-catalog-pill-bulk {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: transparent;
}

.wd-catalog-pill-pagination {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: transparent;
}

/* Cartes bulk — visuellement distinctes (lancement uniquement) */
.wd-catalog-card-bulk {
  border-style: dashed;
  border-color: var(--yellow);
  background: var(--yellow-bg);
}
.wd-catalog-card-bulk:hover {
  border-color: var(--yellow);
  box-shadow: 0 -2px 0 0 var(--yellow) inset, var(--shadow-sm);
}
.wd-catalog-card-bulk .wd-catalog-card-name {
  flex: 1;
}
.wd-catalog-bulk-icon {
  width: 18px;
  height: 18px;
  color: var(--yellow);
  flex-shrink: 0;
  opacity: .7;
  transition: opacity .2s;
}
.wd-catalog-card-bulk:hover .wd-catalog-bulk-icon {
  opacity: 1;
}
.wd-catalog-card-bulk-hint {
  font-size: 11px;
  color: var(--yellow);
  opacity: .7;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--yellow) 30%, transparent);
}

/* Carte catalogue en cours d'exécution */
.wd-catalog-card-running {
  position: relative;
  border-color: var(--accent) !important;
  border-style: solid !important;
  box-shadow: 0 0 16px -4px rgba(99, 102, 241, .3);
  overflow: hidden;
}
.wd-catalog-card-running.wd-catalog-card-bulk {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
}
.wd-catalog-card-running .wd-catalog-card-bulk-hint {
  color: var(--accent);
  border-top-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.wd-catalog-running-bar {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: jd-bar-slide 1.4s ease-in-out infinite;
}
.wd-catalog-running-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: jd-dot-pulse 1.5s ease-in-out infinite;
}
.wd-catalog-dot.dot-running {
  background: var(--accent);
  animation: jd-dot-pulse 1.5s ease-in-out infinite;
}
.badge-accent {
  background: rgba(99, 102, 241, .15);
  color: var(--accent);
  border-color: rgba(99, 102, 241, .3);
}

/* ── Job Detail Page ─────────────────────────────────────────────── */

.jd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.jd-header-left {
  flex: 1;
  min-width: 0;
}

.jd-title {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.jd-queue-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-family: var(--mono);
}

.jd-body {
  padding: 0;
}

/* ── Job Detail — Running banner ──────────────────────────────────── */

.jd-running-banner {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 0 16px -4px rgba(99, 102, 241, .25);
}
.jd-running-banner.jd-running-banner-done {
  border-color: var(--green);
  box-shadow: 0 0 16px -4px rgba(34, 197, 94, .2);
}
.jd-running-banner-done .wd-progress-bar {
  background: var(--green) !important;
}

.jd-running-bar {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: jd-bar-slide 1.4s ease-in-out infinite;
}
@keyframes jd-bar-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* Top row: dot + label + elapsed + queue stats */
.jd-running-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.jd-running-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: jd-dot-pulse 1.5s ease-in-out infinite;
}
@keyframes jd-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, .6); }
  50% { box-shadow: 0 0 0 7px rgba(99, 102, 241, 0); }
}

.jd-running-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.jd-running-elapsed {
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text-muted);
  font-weight: 600;
}

.jd-running-queue-stats {
  display: flex;
  gap: 12px;
  margin-left: auto;
}
.jd-rq {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.jd-rq-val {
  font-family: var(--mono);
  font-weight: 700;
  margin-right: 2px;
}
.jd-rq-accent { color: var(--accent); }
.jd-rq-yellow { color: var(--yellow); }
.jd-rq-red { color: var(--red); }

/* Bottom row: big counters */
.jd-running-counters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Worker-detail : compteurs en ligne compacte */
.wd-running-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.wd-running-counters .jd-counter {
  flex: 1 1 0;
  min-width: 70px;
  padding: 6px 8px;
}
.wd-running-counters .jd-counter-val {
  font-size: 18px;
}
.wd-running-counters .jd-counter-label {
  font-size: 10px;
  margin-top: 2px;
}

/* Pills des jobs actifs */
.wd-job-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.wd-pill {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent);
  background: rgba(99, 102, 241, .10);
  border: 1px solid rgba(99, 102, 241, .25);
  border-radius: 12px;
  white-space: nowrap;
}

/* Bouton annuler dans la bannière */
.wd-cancel-btn {
  margin-left: 8px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .wd-running-counters .jd-counter {
    min-width: 55px;
  }
  .wd-running-counters .jd-counter-val {
    font-size: 15px;
  }
}

/* Barre de progression exécution worker-detail */
.wd-progress-bar-container {
  position: relative;
  height: 22px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-top: 10px;
  overflow: hidden;
}
.wd-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: var(--radius-sm);
  transition: width .4s ease;
  min-width: 0;
}
.wd-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

.jd-counter {
  text-align: center;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}
.jd-counter-val {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-muted);
  transition: transform .3s, color .3s;
}
.jd-counter-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.jd-counter-green .jd-counter-val { color: var(--green); }
.jd-counter-blue .jd-counter-val { color: var(--accent); }
.jd-counter-yellow .jd-counter-val { color: var(--yellow); }
.jd-counter-purple .jd-counter-val { color: var(--purple); }
.jd-counter-accent .jd-counter-val { color: var(--accent); }
.jd-counter-red .jd-counter-val { color: var(--red); }

/* Carte mappés — fond coloré selon le ratio */
.jd-counter-matched-green { background: #16a34a; border-color: #16a34a; }
.jd-counter-matched-green .jd-counter-val,
.jd-counter-matched-green .jd-counter-label { color: #fff; }
.jd-counter-matched-orange { background: #d97706; border-color: #d97706; }
.jd-counter-matched-orange .jd-counter-val,
.jd-counter-matched-orange .jd-counter-label { color: #fff; }
.jd-counter-matched-red { background: #dc2626; border-color: #dc2626; }
.jd-counter-matched-red .jd-counter-val,
.jd-counter-matched-red .jd-counter-label { color: #fff; }

/* Animation flash quand la valeur change */
@keyframes jd-counter-bump {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.jd-counter-val.jd-bumped {
  animation: jd-counter-bump .4s ease-out;
}


/* ── Job Doc Modal ────────────────────────────────────────────────── */

.modal-jobdoc {
  max-width: 720px;
  width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-jobdoc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.modal-jobdoc-body {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

.modal-jobdoc-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Job Doc Cards ───────────────────────────────────────────────── */

.jobdoc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.jobdoc-card-summary { padding: 12px 14px; }

.jobdoc-card-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: .6px;
  margin-bottom: 10px;
  font-weight: 700;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

.jobdoc-detail-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.jobdoc-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.jobdoc-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--mono);
  font-weight: 600;
}

.jobdoc-pill-concurrency {
  background: rgba(167, 139, 250, .15);
  color: var(--purple);
  border: 1px solid var(--purple);
}

.jobdoc-pill-pagination {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* Flow — numbered steps */
.jobdoc-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.jobdoc-flow-step {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.jobdoc-flow-step:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.jobdoc-flow-num {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  background: var(--accent-glow);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.jobdoc-flow-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
}

/* Rules lists (matching + protections) */
.jobdoc-rules-list {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
}
.jobdoc-rules-list li::marker { color: var(--text-muted); }
.jobdoc-rules-shield { list-style: none; padding-left: 0; }
.jobdoc-rules-shield li { padding-left: 20px; position: relative; }
.jobdoc-rules-shield li::before { content: '\1F6E1'; position: absolute; left: 0; top: 0; font-size: 11px; }

/* Layout 2 colonnes : Flux (gauche) + Règles/Meta (droite) */
.jobdoc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.jobdoc-layout-left, .jobdoc-layout-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.jobdoc-layout .jobdoc-card { margin-bottom: 0; }
@media (max-width: 900px) { .jobdoc-layout { grid-template-columns: 1fr; } }

/* Metadata stack inside a card */
.jobdoc-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.jobdoc-meta-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.jobdoc-meta-item:first-child { padding-top: 0; }
.jobdoc-meta-item:last-child { border-bottom: none; padding-bottom: 0; }

/* Params table */
.jobdoc-params-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.jobdoc-params-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: .3px;
}

.jobdoc-params-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.jobdoc-params-table tr:last-child td { border-bottom: none; }
.jobdoc-params-table .mono { font-family: var(--mono); }

.jobdoc-badge-required {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--red-bg);
  color: var(--red);
  font-weight: 600;
}

.jobdoc-badge-optional {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-muted);
}


.jobdoc-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.jobdoc-tables-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.jobdoc-tables-row:last-child { margin-bottom: 0; }

.jobdoc-table-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--mono);
}

.jobdoc-table-badge-read {
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.jobdoc-table-badge-write {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid transparent;
}

.jobdoc-gql-func {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 2px;
}

.jobdoc-gql-query {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.jobdoc-return-code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 3px;
  display: inline-block;
  word-break: break-all;
}

/* ── Queue filter bar ──────────────────────────────────────────────── */

.queue-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.queue-filter-search {
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  width: 200px;
  transition: border-color .15s;
}
.queue-filter-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.queue-filter-btns {
  display: flex;
  gap: 4px;
}

.queue-filter-btn {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font);
}
.queue-filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.queue-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.queue-filter-btn span {
  font-family: var(--mono);
  font-size: 11px;
  margin-left: 4px;
  opacity: .8;
}

.queue-filter-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.queue-hidden { display: none !important; }

/* ── Queue row ──────────────────────────────────────────────────────── */

.queue-table {
  width: 100%;
  border-collapse: collapse;
}

.queue-table {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.queue-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: var(--bg-hover);
}

.queue-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background .2s;
}

.queue-table tr:last-child td {
  border-bottom: none;
}

.queue-table tr:hover td {
  background: var(--bg-hover);
}

.queue-name {
  font-weight: 600;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}

/* ── Queue row active (jobs en cours) ────────────────────────────── */

.queue-row-active {
  background: rgba(91, 159, 255, 0.06) !important;
  border-left: 3px solid var(--accent);
  animation: queue-row-pulse 2.5s ease-in-out infinite;
}

.queue-row-active td:first-child {
  padding-left: 17px;
}

@keyframes queue-row-pulse {
  0%, 100% { background: rgba(91, 159, 255, 0.06); }
  50% { background: rgba(91, 159, 255, 0.12); }
}

.queue-active-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(91, 159, 255, 0.6);
  animation: queue-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes queue-dot-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(91, 159, 255, 0.6); }
  50% { opacity: 0.4; box-shadow: 0 0 2px rgba(91, 159, 255, 0.3); }
}

/* ── Badges ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.3px;
  border: 1px solid transparent;
  transition: all .2s;
}

.badge-green  { 
  background: var(--green-bg);  
  color: var(--green);
  border-color: rgba(74, 222, 128, .2);
}
.badge-yellow { 
  background: var(--yellow-bg); 
  color: var(--yellow);
  border-color: rgba(251, 191, 36, .2);
}
.badge-red    { 
  background: var(--red-bg);    
  color: var(--red);
  border-color: rgba(248, 113, 113, .2);
}
.badge-blue   { 
  background: #1e3a5f; 
  color: #fff;
  border-color: rgba(91, 159, 255, .4);
}
.badge-blue .spinner-inline {
  border-color: rgba(255, 255, 255, .3);
  border-top-color: #fff;
}
.badge-muted  { 
  background: rgba(156, 163, 175, .1); 
  color: var(--text-muted);
  border-color: rgba(156, 163, 175, .1);
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(91, 159, 255, .3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 16px rgba(91, 159, 255, .4);
  transform: translateY(-2px);
}

.btn-danger {
  color: var(--red);
  border-color: rgba(248, 81, 73, .3);
}

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

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-icon {
  padding: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.btn-group { display: flex; gap: 8px; }

/* ── Modal ──────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.modal h3 {
  font-size: 18px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.form-group textarea {
  font-family: var(--mono);
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
}

.params-help {
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.params-help .param-line {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.params-help .param-line:last-child { border-bottom: none; }
.params-help .text-muted { color: var(--text-muted); margin-top: 4px; }

/* Add job modal: description */
.aj-job-description {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Add job modal: param fields */
.aj-params-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.aj-param-row {
  margin-bottom: 0;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
}
.aj-param-row label.param-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
  padding-top: 9px;
}
.aj-param-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aj-param-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 0;
}
.aj-param-row input[type="checkbox"] {
  width: auto;
}
.aj-json-details {
  margin-top: 12px;
}
.aj-json-details summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.aj-json-details .text-small { font-size: 12px; margin-top: 6px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ── Pipeline tree ──────────────────────────────────────────────────── */

.pipeline-graph { padding: 8px 0; max-width: 700px; }

.pipeline-tree { display: flex; flex-direction: column; gap: 0; }

.pipe-node {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2px;
}

.pipe-node:hover { 
  border-color: var(--border-light); 
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.pipe-node.running { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-md);
  background: linear-gradient(90deg, var(--accent-glow) 0%, var(--bg-card) 100%);
}
.pipe-node.done { 
  border-color: var(--green); 
  box-shadow: 0 0 0 2px var(--green-bg);
}
.pipe-node.error { 
  border-color: var(--red); 
  box-shadow: 0 0 0 2px var(--red-bg);
}

.pipe-dot {
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 9px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  transition: border-color .4s, background .4s, color .4s;
  margin-top: 1px;
}

.pipe-dot.running {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}
.pipe-dot.done { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.pipe-dot.error { border-color: var(--red); background: var(--red-bg); color: var(--red); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, .3); }
  50% { box-shadow: 0 0 0 8px rgba(88, 166, 255, 0); }
}

.pipe-content { flex: 1; min-width: 0; }

.pipe-content-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pipe-label { font-weight: 600; font-size: 12px; line-height: 1.1; }

.pipe-topright {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-family: var(--mono);
  white-space: nowrap;
}
.pipe-trigger {
  font-size: 9px;
  background: rgba(88,166,255,.1);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  font-family: var(--mono);
}

.pipe-meta {
  display: flex;
  gap: 10px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.pipe-meta code { font-size: 11px; color: var(--purple); }

.pipe-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.2;
}

.pipe-queue-badge {
  display: inline-flex;
  font-size: 9px;
  font-family: var(--mono);
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 0 5px;
  border-radius: 6px;
  margin-top: 1px;
  margin-right: 3px;
}

/* ── Producer info box (modal pipeline step) ─────────────────────── */
.producer-info {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
}
.producer-info.hidden { display: none; }
.producer-info-desc {
  color: var(--text-muted);
  margin-bottom: 6px;
}
.producer-info-queues {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.producer-info-queues .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 2px;
}
.producer-info-jobs {
  font-size: 11px;
  color: var(--yellow);
}

.pipe-node.root-node {
  border-left: 3px solid var(--accent);
}

/* ── Groupe parallèle ──────────────────────────────────────────────── */

.pipe-parallel-group {
  border-left: 2px dashed var(--purple);
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.04) 0%, transparent 300px);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 4px 0 2px;
  position: relative;
}

.pipe-parallel-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--purple);
  padding: 1px 8px 1px 8px;
  background: rgba(167, 139, 250, 0.1);
  border-radius: 0 8px 8px 0;
  margin-bottom: 3px;
  margin-left: -2px;
}

.pipe-parallel-header svg {
  flex-shrink: 0;
}

.pipe-connector-parallel {
  background: var(--purple) !important;
  opacity: 0.3;
  height: 4px !important;
}

.pipe-queue-info {
  font-size: 12px;
  color: var(--yellow);
  margin-top: 3px;
}

.pipe-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 3px;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Pipeline status indicators ────────────────────────────────────── */

.pipe-status {
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.2;
}

.status-running { color: var(--accent); }
.status-processing { color: var(--yellow); }
.status-done { color: var(--green); }
.status-error { color: var(--red); }
.status-idle { color: var(--text-muted); }

/* ── Pipeline Metrics Badges ──────────────────────────────────────── */

.pipe-metrics-row {
  display: flex;
  gap: 4px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.pm {
  font-size: 9px;
  font-family: var(--mono);
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
  line-height: 1.5;
}
.pm-duration { background: rgba(88, 166, 255, .12); color: var(--accent); }
.pm-created  { background: var(--green-bg); color: var(--green); }
.pm-updated  { background: var(--yellow-bg); color: var(--yellow); }
.pm-jobs     { background: var(--bg-hover); color: var(--text-muted); }

/* ── Spinner on dot ───────────────────────────────────────────────── */

.pipe-dot.running::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.pipe-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity .15s;
  margin-top: -1px;
}
.pipe-node:hover > .pipe-actions { opacity: 1; }

.pipe-action-icon {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: all .15s;
}

.pipe-action-icon:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border);
}

.pipe-action-icon.pipe-action-delete:hover {
  color: var(--red);
  background: var(--red-bg);
  border-color: rgba(248, 113, 113, .3);
}

/* ── Pipeline Drag & Drop ──────────────────────────────────────────── */

.pipe-drag-handle {
  cursor: grab;
  opacity: .35;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  transition: opacity .2s, color .2s;
  color: var(--text-muted);
  padding: 1px 2px;
  border-radius: 3px;
  margin-top: 2px;
}

.pipe-drag-handle:hover {
  opacity: 1;
  color: var(--accent);
}

.pipe-drag-handle:active {
  cursor: grabbing;
}

.pipe-drag-handle.disabled {
  opacity: .15;
  cursor: not-allowed;
  pointer-events: none;
}

.pipe-node.dragging {
  opacity: .4;
  border-style: dashed;
  border-color: var(--accent);
}

.pipe-drop-indicator {
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 0 6px var(--accent-glow);
  margin: -2px 0;
  transition: margin-left .15s;
}

.pipe-node.drop-target-child {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md) !important;
}

.pipeline-tree.dragging-active .pipe-node:hover {
  transform: none;
}

/* ── Pipeline progress bar ─────────────────────────────────────────── */

.pipe-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.pipe-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.pipe-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green), #34d399);
  transition: width .6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.pipe-progress-text {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
  min-width: 36px;
  text-align: right;
}

.pipe-connector {
  width: 2px;
  height: 6px;
  background: var(--border-light);
  margin-left: 21px;
}

/* ── Pipeline Cron Bar ─────────────────────────────────────────────── */

.pipe-cron-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  max-width: 700px;
  flex-wrap: wrap;
}

.pipe-cron-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.pipe-cron-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pipe-cron-value {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}

.pipe-cron-hint {
  color: var(--text-muted);
  font-size: 13px;
}

.pipe-cron-tz {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--mono);
  opacity: .7;
}

.pipe-cron-edit-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font);
  transition: all .2s;
  flex-shrink: 0;
}

.pipe-cron-edit-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}

.pipe-cron-editor {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.pipe-cron-editor input[type="text"] {
  width: 140px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}

.pipe-cron-editor input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pipe-cron-editor select {
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
}

.pipe-cron-editor .pipe-cron-hint-live {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--mono);
}

.pipe-cron-editor .btn {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Jobs table ─────────────────────────────────────────────────────── */

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.jobs-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  background: var(--bg-hover);
}

.jobs-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background .2s;
}

.jobs-table tr:last-child td {
  border-bottom: none;
}

.jobs-table tr:hover td { 
  background: var(--bg-hover); 
}

.jobs-table .mono { font-family: var(--mono); font-size: 12px; }

/* History status pills */
.history-status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.hsp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.hsp-pill:hover { border-color: var(--accent); color: var(--text); }
.hsp-pill.hsp-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.hsp-pill.pill-blue.hsp-active { background: var(--accent); border-color: var(--accent); }
.hsp-pill.pill-red.hsp-active { background: var(--red); border-color: var(--red); }
.hsp-pill.pill-green.hsp-active { background: var(--green); border-color: var(--green); }
.hsp-pill.pill-yellow.hsp-active { background: var(--yellow); border-color: var(--yellow); color: #1a1a2e; }
.hsp-count {
  font-weight: 600;
  font-size: 12px;
  background: rgba(255,255,255,.15);
  padding: 1px 7px;
  border-radius: 10px;
}
.hsp-pill:not(.hsp-active) .hsp-count { background: var(--border); }

/* History master jobs (groupes) */
.jobs-table tr.history-master {
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.jobs-table tr.history-master:hover {
  background: rgba(91, 159, 255, .15) !important;
  transform: translateX(2px);
  box-shadow: 2px 0 8px rgba(91, 159, 255, .2);
}

/* History children jobs */
.jobs-table tr.history-child {
  background: rgba(91, 159, 255, .02);
  border-left: 2px solid var(--accent);
  opacity: 0.85;
}

.jobs-table tr.history-child:hover {
  background: rgba(91, 159, 255, .06);
  opacity: 1;
}

.jobs-table tr.history-child td {
  padding-left: 32px;
}

.inline-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.inline-checkbox:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.inline-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Schedule table ─────────────────────────────────────────────────── */

.schedule-table { 
  width: 100%; 
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.schedule-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: var(--bg-hover);
}

.schedule-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background .2s;
}

.schedule-table tr:last-child td {
  border-bottom: none;
}

.schedule-table tr:hover td { 
  background: var(--bg-hover); 
}

/* ── Toggle switch ──────────────────────────────────────────────────── */

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toggle input { display: none; }

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 2px;
  left: 2px;
  transition: transform .3s cubic-bezier(.4, .0, .2, 1), background .3s ease, box-shadow .3s ease;
}

.toggle:hover .slider {
  border-color: var(--text-muted);
}

.toggle:active .slider::before {
  width: 22px;
}

.toggle input:checked + .slider {
  background: var(--green-bg);
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(74, 222, 128, .25);
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
  background: var(--green);
  box-shadow: 0 1px 4px rgba(74, 222, 128, .4);
}

.toggle:active input:checked + .slider::before {
  transform: translateX(16px);
}

/* ── Schedule row active (running) ─────────────────────────────────── */
.sched-row-active {
  background: rgba(91, 159, 255, 0.06) !important;
  border-left: 3px solid var(--accent);
  animation: sched-row-pulse 2.5s ease-in-out infinite;
}

.sched-row-active td:first-child {
  padding-left: 13px;
}

@keyframes sched-row-pulse {
  0%, 100% { background: rgba(91, 159, 255, 0.06); }
  50% { background: rgba(91, 159, 255, 0.12); }
}

.sched-running-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 4px;
  vertical-align: middle;
  animation: sched-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes sched-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91, 159, 255, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(91, 159, 255, 0); }
}

.sched-badge-running {
  animation: sched-badge-glow 2s ease-in-out infinite;
}

@keyframes sched-badge-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91, 159, 255, 0.3); }
  50% { box-shadow: 0 0 8px 2px rgba(91, 159, 255, 0.2); }
}

.sched-live-label {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(91, 159, 255, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  animation: sched-live-blink 2s ease-in-out infinite;
}

@keyframes sched-live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Filter tabs ────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-bar button {
  padding: 8px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
  margin-bottom: -1px;
}

.tab-bar button:hover { color: var(--text); }

.tab-bar button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  animation: slideIn .3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 380px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  opacity: .5;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 18px;
  transition: opacity .2s;
}
.toast-close:hover { opacity: 1; }

.toast-timer {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
  animation: toastTimer 4s linear forwards;
}

@keyframes toastTimer {
  from { width: 100%; }
  to { width: 0%; }
}

.toast-success { border-color: var(--green); color: var(--green); }
.toast-success .toast-timer { background: var(--green); }

.toast-error { border-color: var(--red); color: var(--red); }
.toast-error .toast-timer { background: var(--red); }

.toast-info { border-color: var(--accent); color: var(--accent); }
.toast-info .toast-timer { background: var(--accent); }

.toast-warning { border-color: var(--yellow); color: var(--yellow); }
.toast-warning .toast-timer { background: var(--yellow); }

.toast-exit {
  animation: slideOut .3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ── Select queue for history ───────────────────────────────────────── */

.inline-select {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: var(--font);
}

.inline-select:focus { border-color: var(--accent); }

/* ── Scrollbar ──────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { 
  background: var(--border); 
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { 
  background: var(--border-light); 
}

/* ── Responsive ─────────────────────────────────────────────────────── */

/* Wrapper pour tables : scroll horizontal sur petits écrans */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}
.table-wrapper .queue-table,
.table-wrapper .schedule-table,
.table-wrapper .jobs-table {
  min-width: 600px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg { margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

.wd-no-exec-banner {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--yellow);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Workers Grid (Vue d'ensemble) ────────────────────────────────── */

.workers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.worker-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}

.worker-card:hover {
  border-color: var(--accent);
  box-shadow: 0 -2px 0 0 var(--accent) inset, var(--shadow-sm);
}

.worker-card-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.worker-card-active .worker-card-dot {
  animation: workerPulse 1.8s ease-in-out infinite;
}

@keyframes workerPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent); }
  50% { opacity: .7; box-shadow: 0 0 0 4px var(--accent-glow); }
}

.worker-card-paused {
  opacity: 0.6;
}

.worker-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.worker-card-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}
.worker-card-logo-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.worker-card-logo-wrap[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 4px 10px;
  background: var(--bg-hover);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  z-index: 10;
  pointer-events: none;
}
.worker-card-logo-wrap[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + 3px);
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-bottom-color: var(--border-light);
  z-index: 10;
  pointer-events: none;
}

.worker-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  top: 12px;
  right: 12px;
}

.worker-card-dot.dot-ok {
  background: var(--green);
}

.worker-card-dot.dot-idle {
  background: var(--text-muted);
  opacity: 0.5;
}

.worker-card-dot.dot-failed {
  background: var(--red);
}

.worker-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.worker-card-paused-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.worker-card-jobs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.worker-card-job-badge {
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(167, 139, 250, .1);
  border: 1px solid rgba(167, 139, 250, .2);
  color: var(--purple);
  white-space: nowrap;
}

.worker-card-lastrun {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.worker-card-lastrun .badge {
  flex-shrink: 0;
}

.worker-card-lastrun-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
}

.worker-card-lastrun-time {
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

.worker-card-purge {
  padding-top: 8px;
  text-align: right;
}

/* Breakpoint : tablette */
@media (max-width: 1024px) {
  .main {
    padding: 24px 20px;
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 24px;
  }
  .page-header h2 { font-size: 22px; }
  .btn-group { flex-wrap: wrap; }
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
  }
  .card-value { font-size: 26px; }
  .pipeline-graph { max-width: 100%; }
  .pipe-node { flex-wrap: wrap; gap: 8px; }
  .pipe-actions { width: 100%; justify-content: flex-start; margin-top: 4px; margin-left: 36px; }
  .modal { width: 90%; max-width: 560px; padding: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .workers-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* Breakpoint : mobile (sidebar en drawer) */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.visible {
    display: block;
  }
  .sidebar-toggle {
    display: flex;
  }
  .main {
    margin-left: 0;
    padding: 16px 12px;
    padding-top: 64px; /* place pour le bouton hamburger */
  }
  .page-header h2 { font-size: 20px; }
  .workers-grid { grid-template-columns: 1fr 1fr; }
  .cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }
  .card { padding: 16px; }
  .card-value { font-size: 22px; }
  .card-label { font-size: 10px; }
  .queue-table th,
  .queue-table td,
  .schedule-table th,
  .schedule-table td,
  .jobs-table th,
  .jobs-table td {
    padding: 10px 12px;
    font-size: 12px;
  }
  .queue-table .btn-group,
  .schedule-table .btn-group {
    flex-wrap: wrap;
    gap: 4px;
  }
  .queue-table .btn-group .btn,
  .schedule-table .btn-group .btn {
    padding: 4px 8px;
    font-size: 11px;
  }
  .pipe-node {
    padding: 5px 8px;
    margin-left: 0 !important;
  }
  .pipe-dot { min-width: 18px; height: 18px; font-size: 8px; }
  .pipe-label { font-size: 11px; }
  .pipe-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .pipe-actions .btn { padding: 4px 8px; font-size: 11px; }
  .modal {
    width: calc(100% - 24px);
    max-width: none;
    margin: 12px;
    max-height: calc(100vh - 24px);
    padding: 20px;
  }
  .modal h3 { font-size: 16px; margin-bottom: 16px; }
  .modal-actions { margin-top: 16px; flex-wrap: wrap; }
  .logs-live-container {
    height: calc(100vh - 180px);
    min-height: 300px;
  }
  #page-logs .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  #page-logs .page-header .btn-group {
    flex-wrap: wrap;
  }
  #page-logs .inline-input { width: 100%; min-width: 0; }
  .pagination { gap: 4px; margin-top: 12px; }
  .pagination .btn-sm { min-width: 32px; padding: 4px 8px; font-size: 11px; }
  .pagination-info { font-size: 12px; margin-right: 4px; }
}

/* Breakpoint : petit mobile */
@media (max-width: 480px) {
  .main { padding: 12px 10px; padding-top: 56px; }
  .sidebar-toggle { top: 12px; left: 12px; width: 40px; height: 40px; }
  .page-header h2 { font-size: 18px; }
  .workers-grid { grid-template-columns: 1fr; }
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .card-value { font-size: 24px; }
  .queue-table .btn-group { flex-direction: column; }
  .queue-table .btn-group .btn { width: 100%; justify-content: center; }
  .schedule-table .btn-group { flex-direction: column; }
  .schedule-table .btn-group .btn { width: 100%; justify-content: center; }
  .pipe-node { flex-direction: column; align-items: flex-start; }
  .pipe-actions { width: 100%; }
  .modal { width: calc(100% - 20px); margin: 10px; padding: 16px; }
  .toast { max-width: 100%; }
  .logs-modal { max-width: 100%; padding: 16px; }
}

.cron-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--mono);
}

/* ── Indicateur de refresh ─────────────────────────────────────────── */
.page-header h2 .refresh-indicator,
.refresh-indicator {
  font-size: 13px;
  color: #9ca3af !important;
  font-weight: normal;
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  -webkit-text-fill-color: #9ca3af !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
}

.page-header h2 .refresh-indicator *,
.refresh-indicator * {
  color: #9ca3af !important;
  -webkit-text-fill-color: #9ca3af !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
}

.refresh-indicator .spinner-inline {
  width: 12px;
  height: 12px;
  border-width: 2px;
  border-color: rgba(156, 163, 175, 0.3) !important;
  border-top-color: #9ca3af !important;
}

/* ── Badge actif avec animation ────────────────────────────────────── */
.badge-blue.job-active {
  animation: pulse-blue 2s ease-in-out infinite;
  position: relative;
}

@keyframes pulse-blue {
  0%, 100% {
    background-color: #1e3a5f;
    box-shadow: 0 0 0 0 rgba(91, 159, 255, 0.4);
  }
  50% {
    background-color: #2a4a7a;
    box-shadow: 0 0 0 4px rgba(91, 159, 255, 0);
  }
}

/* ── Spinner inline (dans badges) ──────────────────────────────────── */

.spinner-inline {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(88,166,255,.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 2px;
}

/* ── Logs Modal ───────────────────────────────────────────────────── */

.logs-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.logs-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}

.logs-modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.logs-modal-top h3 {
  margin: 0;
  font-size: 16px;
}

.logs-header {
  margin-bottom: 12px;
}

.logs-header code {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.logs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.logs-section {
  margin-bottom: 14px;
}

.logs-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.logs-pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
}

.logs-output {
  color: var(--text);
}

/* ── Logs modal détaillés ──────────────────────────────────────────── */

.logs-detail-header {
  margin-bottom: 14px;
}
.logs-detail-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.logs-detail-title .mono {
  font-size: 15px;
  font-weight: 700;
}
.logs-detail-queue {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Timeline horizontale */
.logs-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.logs-tl-step {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 12px;
}
.logs-tl-step:not(:last-child)::after {
  content: '→';
  margin: 0 10px;
  color: var(--text-muted);
  opacity: .4;
}
.logs-tl-icon {
  font-size: 13px;
  opacity: .7;
}
.logs-tl-label {
  font-weight: 600;
  color: var(--text);
}
.logs-tl-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Métriques en grille */
.logs-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.logs-metric {
  text-align: center;
  padding: 10px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.logs-metric-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}
.logs-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-top: 4px;
}

/* Progress bar */
.logs-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.logs-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .3s ease;
}

/* Compteur de logs */
.logs-count {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* Logs colorisés */
.logs-colored {
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
}
.log-line {
  display: block;
  padding: 5px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.log-line:last-child { border-bottom: none; }
.log-ts {
  color: var(--text-muted);
  opacity: .6;
  font-size: 11px;
}
.log-icon {
  display: inline-block;
  width: 18px;
  text-align: center;
  margin-right: 4px;
  flex-shrink: 0;
}
.log-start { color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.log-done { color: var(--green); background: color-mix(in srgb, var(--green) 6%, transparent); }
.log-error { color: var(--red); background: color-mix(in srgb, var(--red) 6%, transparent); }
.log-warn { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 6%, transparent); }
.log-api { color: #a78bfa; }
.log-db { color: #22d3ee; }
.log-page { color: var(--text-muted); opacity: .8; }

/* Résultat OK / Erreur */
.logs-result-ok {
  border-color: color-mix(in srgb, var(--green) 30%, var(--border));
  background: color-mix(in srgb, var(--green) 5%, var(--bg));
  color: var(--green);
}
.logs-result-err {
  border-color: color-mix(in srgb, var(--red) 30%, var(--border));
  background: color-mix(in srgb, var(--red) 5%, var(--bg));
  color: var(--red);
}
.logs-stacktrace {
  font-size: 11px;
  color: var(--red);
  opacity: .8;
  max-height: 200px;
}
.logs-section-success .logs-section-title,
.logs-section-error .logs-section-title {
  font-size: 13px;
}

/* Réponse API collapsible */
.logs-collapse-toggle { cursor: pointer; user-select: none; }
.logs-collapse-toggle:hover { color: var(--accent); }
.logs-collapse-icon { font-size: 11px; margin-left: 4px; transition: transform .2s; }
.logs-collapsed .logs-collapse-icon { transform: rotate(-90deg); }
.logs-collapsed .logs-pre { display: none; }
.logs-api-response {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
  max-height: 400px;
}

@media (max-width: 600px) {
  .logs-metrics { grid-template-columns: repeat(2, 1fr); }
  .logs-timeline { flex-wrap: wrap; gap: 4px; }
}

/* ─── Logs en direct ───────────────────────────────────────────────── */

.logs-live-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 200px);
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.logs-live-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  background: #000;
  color: #0f0;
}

.log-line {
  margin: 2px 0;
  padding: 2px 0;
  word-break: break-all;
  white-space: pre-wrap;
}

.log-line:hover {
  background: rgba(255, 255, 255, 0.05);
}

.log-time {
  color: var(--text-muted);
  margin-right: 8px;
}

.log-queue {
  color: var(--accent);
  font-weight: 600;
  margin-right: 6px;
}

.log-job-id {
  color: var(--purple);
  margin-right: 6px;
}

.log-job-name {
  color: var(--yellow);
  margin-right: 6px;
}

.log-message {
  color: var(--text);
}

.log-error {
  color: var(--red);
}

.log-error .log-message {
  color: var(--red);
}

.log-system {
  color: var(--green);
}

.log-system .log-message {
  color: var(--green);
}

.inline-input {
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
}

.inline-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Pagination ──────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination .btn-sm {
  min-width: 34px;
  text-align: center;
}

.pagination .btn-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination .btn-sm:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 8px;
}

/* ─── Dead Letter Queue ──────────────────────────────────────────────── */

.badge-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(248, 113, 113, .2);
}

.badge-sm {
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 8px;
}

.dlq-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dlq-stat-item {
  font-size: 13px;
  color: var(--text-muted);
}

.dlq-stat-item strong {
  color: var(--text);
}

.dlq-error {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--red);
  font-size: 12px;
}

.dlq-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.dlq-detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dlq-detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

.dlq-detail-value {
  font-size: 14px;
  color: var(--text);
}

.dlq-detail-error,
.dlq-detail-data {
  margin: 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.dlq-detail-error {
  color: var(--red);
}

.text-center {
  text-align: center;
}

/* ─── Health Status Bar ──────────────────────────────────────────────── */

.health-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.health-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background .3s;
}

.health-item.ok .health-dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(74, 222, 128, .5);
}

.health-item.warning .health-dot {
  background: var(--yellow);
  box-shadow: 0 0 8px rgba(251, 191, 36, .5);
  animation: pulse 1.5s infinite;
}

.health-item.error .health-dot {
  background: var(--red);
  box-shadow: 0 0 8px rgba(248, 113, 113, .5);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.health-label {
  color: var(--text-muted);
}

.health-item.ok .health-label {
  color: var(--text);
}

.health-item.error .health-label {
  color: var(--red);
}

.health-item.warning .health-label {
  color: var(--yellow);
}

.health-action {
  margin-left: 4px;
  padding: 2px 6px;
  font-size: 10px;
}

/* ─── Sidebar Footer ─────────────────────────────────────────────────── */

.sidebar-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.sidebar-footer-actions {
  display: flex;
  gap: 4px;
}

.sidebar-footer-actions .btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Settings Page ──────────────────────────────────────────────────── */

/* Settings layout */
.set-row-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.set-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.set-card {
  padding: 20px !important;
}

.set-card::before { display: none; }

.set-card--mini {
  padding: 16px !important;
}

.set-card--mini .set-card-header {
  margin-bottom: 10px;
}

.set-card--mini .btn-group {
  gap: 6px;
}

.set-card--mini .btn {
  font-size: 12px;
  padding: 5px 10px;
}

.set-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--accent);
}

.set-card-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.settings-row span {
  color: var(--text-muted);
  font-size: 13px;
}

.settings-row select {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}

.settings-resilience-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settings-resilience-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.settings-resilience-item .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.settings-resilience-item .indicator.warning {
  background: var(--yellow);
}

.settings-resilience-item .indicator.error {
  background: var(--red);
}

.settings-stats {
  font-size: 12px;
  color: var(--text-muted);
}

.settings-db-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-db-form .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.settings-db-form input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}

.settings-db-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.settings-db-result {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.settings-db-testing {
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
}

.settings-db-success {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green);
}

.settings-db-error {
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red);
}

/* ─── Stats Modal ────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.stats-card h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.stats-chart {
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stats-bar {
  flex: 1;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  min-height: 4px;
  transition: height .3s ease;
  position: relative;
}

.stats-bar:hover {
  background: var(--accent-hover);
}

.stats-bar::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
}

.stats-bar:hover::after {
  opacity: 1;
}

/* ── Stats: Horizontal bars ──────────────────────────────────────────── */

.stats-hbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.stats-hbar-label {
  width: 80px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.stats-hbar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.stats-hbar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s ease;
}

.stats-hbar-value {
  width: 52px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Stats: SVG Donut ───────────────────────────────────────────────── */

.stats-donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stats-donut-wrap svg {
  display: block;
}

.stats-donut-detail {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Stats: Resilience section ───────────────────────────────────────── */

.stats-resilience {
  margin-top: 4px;
}

.stats-resilience h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

.stats-resilience-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stats-resilience-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.stats-res-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

.stats-res-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--mono);
}

.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }

/* ── Pipeline Gantt ─────────────────────────────────────────────────── */

.gantt-title {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text);
}

.gantt-wrap {
  max-width: 700px;
  overflow-x: auto;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.gantt-wrap:empty {
  display: none;
}

.gantt-wrap svg {
  display: block;
}

/* ── Sparklines ─────────────────────────────────────────────────────── */

.sparkline-svg {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

/* ─── Webhooks Page ──────────────────────────────────────────────────── */

/* Config row: endpoint + token */
.wh-config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.wh-config-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px !important;
}

.wh-config-card::before { display: none; }

.wh-config-icon {
  color: var(--accent);
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.wh-config-body {
  flex: 1;
  min-width: 0;
}

.wh-config-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  margin-top: 2px;
  display: block;
}

.wh-token-input {
  width: 100%;
  margin-top: 4px;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

/* Exemples cURL — card avec tabs */
.wh-examples-card {
  padding: 0 !important;
  margin-bottom: 28px;
  overflow: hidden;
}

.wh-examples-card::before { display: none; }

.wh-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.wh-tab {
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.wh-tab:hover {
  color: var(--text);
}

.wh-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.wh-code-block {
  margin: 0;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

/* Jobs section */
.wh-jobs-section {
  margin-top: 4px;
}

.wh-jobs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.wh-jobs-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.wh-queue-group {
  margin-bottom: 20px;
}

.wh-queue-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.wh-jobs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.wh-job-card {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, box-shadow .2s, transform .2s;
  box-shadow: var(--shadow-sm);
}

.wh-job-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.wh-job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wh-job-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.wh-copy-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s;
}

.wh-job-card:hover .wh-copy-icon {
  opacity: 1;
}

.wh-job-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
}

.wh-job-params {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.wh-param {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: help;
}

.wh-param-req {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.wh-param-none {
  font-size: 10px;
  color: var(--text-muted);
  opacity: .5;
  font-style: italic;
}

.wh-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.wh-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.wh-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.wh-legend-req {
  background: var(--accent);
}

.wh-legend-opt {
  background: var(--border);
}

.wh-legend-sep {
  color: var(--border);
  font-size: 11px;
}

.webhook-url-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.webhook-url-box code {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.code-block {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── Responsive improvements ────────────────────────────────────────── */

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-resilience-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .set-row-top {
    grid-template-columns: 1fr;
  }

  .set-grid {
    grid-template-columns: 1fr;
  }

  .settings-resilience-grid {
    grid-template-columns: 1fr;
  }

  .settings-db-form {
    grid-template-columns: 1fr;
  }

  .settings-db-form .form-group[style*="grid-column"] {
    grid-column: auto !important;
  }

  .wh-config-row {
    grid-template-columns: 1fr;
  }

  .wh-jobs-list {
    grid-template-columns: 1fr;
  }

  .wd-history-flex {
    flex-direction: column;
  }

  .wd-chart-container {
    width: 100%;
  }

  .wd-catalog-grid {
    grid-template-columns: 1fr;
  }

  .modal-jobdoc {
    max-height: 95vh;
  }
}

/* ─── Transferts ─────────────────────────────────────────────────── */

/* ── Transferts page ───────────────────────────────────────────────── */

/* Hero import zone */
/* ── Toolbar (date + actions) ─────────────────────────── */
.tf-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  position: relative;
  transition: border-color .25s, box-shadow .25s;
}
.tf-topbar.dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md);
}
.tf-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.tf-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
  justify-content: flex-end;
}
.tf-toolbar-date {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tf-nav-center {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tf-nav-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.tf-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.tf-nav-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.tf-nav-today {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.tf-nav-today:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.tf-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Date input */
.tf-date-input {
  width: 150px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
  text-align: center;
}
.tf-date-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.tf-date-input:hover:not(:focus) {
  border-color: var(--border-light);
}
.tf-date-input::-webkit-calendar-picker-indicator {
  filter: invert(.7);
  cursor: pointer;
  opacity: .6;
  transition: opacity .15s;
}
.tf-date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
.tf-hero-drop {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  background: var(--accent-glow);
  animation: tf-pulse .8s ease-in-out infinite alternate;
}
.tf-hero.dragover .tf-hero-drop { display: flex; }
@keyframes tf-pulse {
  from { opacity: .7; }
  to   { opacity: 1; }
}

/* Progress */
.tf-hero-status {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.tf-progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.tf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 2px;
  transition: width .4s ease;
  width: 0%;
}
.tf-hero-status-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Stats row */
.tf-stats-row { margin-bottom: 8px; }
.tf-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tf-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color .2s;
}
.tf-stat:hover { border-color: var(--border-light); }
.tf-stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tf-stat-icon svg { width: 15px; height: 15px; }
.tf-stat-icon--total    { background: rgba(91, 159, 255, .1);  color: var(--accent); }
.tf-stat-icon--inserted { background: var(--green-bg);  color: var(--green); }
.tf-stat-icon--errors   { background: var(--red-bg);    color: var(--red); }
.tf-stat-text { display: flex; flex-direction: column; min-width: 0; }
.tf-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.1;
  font-family: var(--mono);
}
.tf-stat-label {
  font-size: .6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 1px;
}

/* Empty state */
.tf-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  color: var(--text-muted);
  text-align: center;
}
.tf-empty svg { opacity: .25; margin-bottom: 12px; }
.tf-empty p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.tf-empty span { font-size: 12px; }

/* Job info banner */
/* tf-job-info styles maintenant dans .tf-topbar-right */
.tf-job-info-link {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  margin-left: 4px;
  opacity: .7;
  transition: opacity .15s;
  vertical-align: middle;
}
.tf-job-info-link:hover { opacity: 1; }
.tf-job-info-pages {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
}
.tf-job-info-pages .tf-job-info-link { margin-left: 2px; }
.tf-job-info-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.tf-btn-logs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  flex-shrink: 0;
}
.tf-btn-logs:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Tabs */
.tf-tabs-wrap {}
.tf-tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tf-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  font-family: var(--font);
}
.tf-tab:hover { color: var(--text); }
.tf-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tf-tab-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--mono);
  background: var(--bg-hover);
  color: var(--text-muted);
}
.tf-tab-count:empty { display: none; }
.tf-tab.active .tf-tab-count {
  background: rgba(91, 159, 255, .12);
  color: var(--accent);
}
.tf-tab-count--ok:not(:empty)     { background: var(--green-bg); color: var(--green); }
.tf-tab-count--warn:not(:empty)   { background: var(--yellow-bg); color: var(--yellow); }
.tf-tab-count--danger:not(:empty) { background: var(--red-bg); color: var(--red); }

/* Raison erreur dans le tableau Erreurs */
.tf-table td:has(.tf-reason) { white-space: normal; overflow: visible; }
.tf-reason {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: normal;
}
.tf-reason-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 3px;
}
.tf-reason-badge--skip { background: var(--yellow-bg); color: var(--yellow); }
.tf-reason-badge--miss { background: var(--red-bg); color: var(--red); }

/* Tab panels */
.tf-panel { display: none; }
.tf-panel.active { display: block; }
.tf-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.tf-table-scroll { max-height: 520px; overflow-y: auto; }

/* ── Transfer table ──────────────────────────────────────────── */
.tf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.tf-table thead { position: sticky; top: 0; z-index: 1; }
.tf-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  background: var(--bg-hover);
  overflow: hidden;
}
.tf-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background .15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tf-table tbody tr:last-child td { border-bottom: none; }
.tf-table tbody tr:hover td { background: var(--bg-hover); }

/* Sortable headers */
.tf-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px !important;
  transition: color .15s;
}
.tf-sortable:hover { color: var(--text); }
.tf-sortable::after {
  content: '⇅';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: .3;
  transition: opacity .15s;
}
.tf-sortable:hover::after { opacity: .6; }
.tf-sortable.tf-sort-asc::after  { content: '↑'; opacity: 1; color: var(--accent); }
.tf-sortable.tf-sort-desc::after { content: '↓'; opacity: 1; color: var(--accent); }
.tf-sortable.tf-sort-asc,
.tf-sortable.tf-sort-desc { color: var(--accent); }

/*
 * Column sizing — fixed layout, pourcentages par tableau
 * OK      :  # 5%  | Joueur 25% | Transfert 50% | Type 20%
 * Erreurs :  # 5%  | Joueur 22% | Transfert 38% | Raison 35%
 * Cartes  :  Joueur 25% | Transfert 40% | Type 20% | Cartes 15%
 * History :  Date 35% | Statut 35% | Transferts 30%
 */

/* OK — 4 colonnes */
#tf-panel-ok .tf-table col:nth-child(1) { width: 5%; }
#tf-panel-ok .tf-table col:nth-child(2) { width: 22%; }
#tf-panel-ok .tf-table col:nth-child(3) { width: 40%; }
#tf-panel-ok .tf-table col:nth-child(4) { width: 15%; }
#tf-panel-ok .tf-table col:nth-child(5) { width: 18%; }

/* Erreurs — 5 colonnes */
#tf-panel-errors .tf-table col:nth-child(1) { width: 5%; }
#tf-panel-errors .tf-table col:nth-child(2) { width: 20%; }
#tf-panel-errors .tf-table col:nth-child(3) { width: 30%; }
#tf-panel-errors .tf-table col:nth-child(4) { width: 13%; }
#tf-panel-errors .tf-table col:nth-child(5) { width: 32%; }

/* Cartes — 4 colonnes */
#tf-panel-cards .tf-table col:nth-child(1) { width: 25%; }
#tf-panel-cards .tf-table col:nth-child(2) { width: 40%; }
#tf-panel-cards .tf-table col:nth-child(3) { width: 20%; }
#tf-panel-cards .tf-table col:nth-child(4) { width: 15%; }

/* History — 3 colonnes */
#tf-panel-history .tf-table col:nth-child(1) { width: 35%; }
#tf-panel-history .tf-table col:nth-child(2) { width: 35%; }
#tf-panel-history .tf-table col:nth-child(3) { width: 30%; }

/* Alignement spécial */
.tf-col-idx   { text-align: center; }
.tf-col-count { text-align: center; }

/* Player name in table */
.tf-player {
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

/* Transfer direction cell: Club A → Club B */
.tf-table td:has(.tf-transfer-cell) { overflow: visible; white-space: normal; }
.tf-transfer-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  min-width: 0;
}
.tf-club {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.tf-club--from { color: var(--text-muted); }
.tf-club--to   { color: var(--text); font-weight: 500; }
.tf-arrow {
  color: var(--accent);
  flex-shrink: 0;
  opacity: .55;
}

/* Copy button */
.tf-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
  vertical-align: middle;
  flex-shrink: 0;
}
.tf-table tr:hover .tf-copy { opacity: .6; }
.tf-copy:hover { opacity: 1 !important; background: var(--bg-hover); color: var(--accent); }
.tf-copy--ok { opacity: 1 !important; color: var(--green) !important; }

/* Warning suggestion code */
.tf-table td code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

/* Empty row — override white-space for centering */
.tf-table .tf-empty-row td {
  text-align: center;
  padding: 32px 14px;
  color: var(--text-muted);
  font-size: 13px;
  white-space: normal;
}

/* Responsive */
@media (max-width: 768px) {
  .tf-topbar { flex-wrap: wrap; gap: 8px; }
  .tf-topbar-left { width: 100%; justify-content: center; flex-wrap: wrap; }
  .tf-topbar-right { width: 100%; justify-content: center; }
  .tf-toolbar-date { width: 100%; justify-content: center; }
  .tf-toolbar-actions { width: 100%; justify-content: center; }
  .tf-nav-today { display: none; }
  .tf-stats { grid-template-columns: repeat(2, 1fr); }
  .tf-table th, .tf-table td { padding: 8px 8px; font-size: 12px; }
}


/* ═══════════════════════════════════════════════════════════════════════
   Login Screen
   ═══════════════════════════════════════════════════════════════════════ */

@keyframes login-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes login-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -40px) scale(1.1); }
  66%      { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes login-fade-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

@keyframes login-glow-pulse {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(91, 159, 255, .4)); }
  50%      { filter: drop-shadow(0 0 20px rgba(91, 159, 255, .8)); }
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0e14 0%, #12102a 40%, #1a1040 70%, #0e1425 100%);
  background-size: 300% 300%;
  animation: login-gradient 12s ease infinite;
  transition: opacity .5s ease, visibility .5s ease;
}

.login-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Orbes flottants (fond décoratif) ──────────────────────────────── */

.login-orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
  animation: login-orb-float 8s ease-in-out infinite;
}

.login-orb-1 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(91, 159, 255, .6), transparent 70%);
  top: -80px; left: -60px;
  animation-delay: 0s;
}

.login-orb-2 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(167, 139, 250, .5), transparent 70%);
  bottom: -60px; right: -40px;
  animation-delay: -3s;
}

.login-orb-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(91, 159, 255, .3), transparent 70%);
  top: 50%; left: 60%;
  animation-delay: -6s;
}

/* ── Carte de login (glassmorphism) ────────────────────────────────── */

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 40px 36px 36px;
  background: rgba(19, 23, 32, .55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(91, 159, 255, .12);
  border-radius: 20px;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 255, 255, .04);
  animation: login-fade-in .6s ease both;
}

/* ── Logo ──────────────────────────────────────────────────────────── */

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  display: inline-block;
  font-size: 42px;
  line-height: 1;
  margin-bottom: 8px;
  animation: login-glow-pulse 3s ease-in-out infinite;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Champs de saisie ──────────────────────────────────────────────── */

.login-field {
  position: relative;
  margin-bottom: 16px;
}

.login-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color .2s;
}

.login-field input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.login-field input::placeholder {
  color: var(--text-muted);
  opacity: .7;
}

.login-field input:focus {
  border-color: var(--accent);
  background: rgba(91, 159, 255, .05);
  box-shadow: 0 0 0 3px rgba(91, 159, 255, .15);
}

.login-field:has(input:focus) .login-field-icon {
  color: var(--accent);
}

/* ── Bouton de connexion ───────────────────────────────────────────── */

.login-btn {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s, box-shadow .2s, opacity .2s;
}

.login-btn:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 6px 24px rgba(91, 159, 255, .35);
}

.login-btn:active {
  transform: scale(0.98);
}

.login-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

/* ── Message d'erreur ──────────────────────────────────────────────── */

.login-error {
  color: var(--red);
  font-size: 13px;
  text-align: center;
  min-height: 0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .3s, opacity .3s, margin .3s;
}

.login-error.visible {
  max-height: 40px;
  opacity: 1;
  margin-bottom: 8px;
}

.login-error.shake {
  animation: login-shake .4s ease;
}

/* ── Responsive mobile ─────────────────────────────────────────────── */

@media (max-width: 480px) {
  .login-card {
    margin: 16px;
    padding: 32px 24px 28px;
    border-radius: 16px;
  }
  .login-logo-icon { font-size: 36px; }
  .login-logo h1 { font-size: 20px; }
}
