/* Traducteur IA Agent - Base styles */
:root {
  /* Light theme (default) */
  --bg: #f7f8fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --success: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --border: #e5e7eb;
  --shadow: 0 10px 25px rgba(0,0,0,.08);
  --button-height: 30px;

  /* ============================================
     DYNAMIC HEIGHT SYSTEM
     Ces valeurs sont calculées par dynamic-height.js
     Valeurs par défaut (fallback avant JS)
     ============================================ */
  --header-height: 70px;
  --breadcrumb-height: 45px;
  --content-offset: 115px;
  --available-height: calc(100vh - 115px);
  --dvh: 1vh; /* Fallback, sera recalculé en px par JS */
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #22d3ee;
  --primary-600: #0ea5e9;
  --primary-50: #0b1220;
  --success: #22c55e;
  --warn: #fbbf24;
  --danger: #ef4444;
  --border: #1f2937;
  --shadow: 0 10px 25px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--text); background: var(--bg); transition: background-color 0.3s ease, color 0.3s ease; }

/* Utilities */
.bg-light { background: var(--bg); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.w-full { width: 100%; }
.flex-between { display:flex; align-items:center; justify-content:space-between; }
.grid-2 { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.grid-3 { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }

/* ============================================
   HEIGHT UTILITIES
   Utilise les CSS variables de dynamic-height.js
   ============================================ */

/* Hauteur complète disponible */
.h-available { height: var(--available-height); }
.min-h-available { min-height: var(--available-height); }
.max-h-available { max-height: var(--available-height); }

/* Hauteurs fractionnelles de l'espace disponible */
.h-available-75 { height: calc(var(--available-height) * 0.75); }
.h-available-50 { height: calc(var(--available-height) * 0.50); }
.h-available-25 { height: calc(var(--available-height) * 0.25); }

/* Hauteurs avec offset personnalisé (ex: pour un footer local) */
.h-available-minus-50 { height: calc(var(--available-height) - 50px); }
.h-available-minus-100 { height: calc(var(--available-height) - 100px); }
.h-available-minus-150 { height: calc(var(--available-height) - 150px); }
.h-available-minus-200 { height: calc(var(--available-height) - 200px); }

/* Conteneur flex qui remplit l'espace restant */
.flex-fill {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* Important pour le scroll interne */
}

/* Enfant qui prend tout l'espace restant dans un flex parent */
.flex-grow { flex: 1; min-height: 0; }

/* Support dvh natif pour navigateurs modernes */
@supports (height: 100dvh) {
  .h-dvh { height: 100dvh; }
  .min-h-dvh { min-height: 100dvh; }
  .max-h-dvh { max-height: 100dvh; }
}

/* Buttons */
button, .btn { cursor: pointer; transition: all 0.2s ease; }
.btn {
  height: var(--button-height);
  appearance: none;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  padding: 0 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn:hover, button:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.btn:active, button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25), 0 1px 3px rgba(37, 99, 235, 0.15);
}
.btn-primary:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35), 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--bg);
  border-color: var(--primary);
}

.btn-secondary {
  background: #111827;
  color: #fff;
  border-color: #111827;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.25), 0 1px 3px rgba(17, 24, 39, 0.15);
}
.btn-secondary:hover {
  background: #1f2937;
  border-color: #1f2937;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.35), 0 2px 6px rgba(17, 24, 39, 0.25);
}

.btn-small {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.btn.warn {
  background: var(--warn);
  color: #111;
  border-color: var(--warn);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25), 0 1px 3px rgba(245, 158, 11, 0.15);
}

/* Cards */
.card { background: var(--card); border:1px solid var(--border); border-radius:12px; box-shadow: var(--shadow); padding: 16px 10px; }

/* Login */
.login-container { min-height: 100vh; display:flex; align-items:center; justify-content:center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; padding: 28px; }
.login-header { text-align:center; margin-bottom: 16px; }
.login-icon { width:48px; height:48px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center; font-size:28px; margin-bottom:8px; background: var(--primary-50); margin: 0 auto 8px; }
.logo { width:48px; height:48px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center; font-size:28px; margin-bottom:8px; background: var(--primary-50); }
.form { display:block; }
.form-group { margin-bottom: 12px; }
.form .form-group { margin-bottom: 12px; }
.form label { display:block; margin-bottom:6px; font-weight:600; font-size:14px; color:#374151; }
.form-group label { display:block; margin-bottom:6px; font-weight:600; font-size:14px; color:#374151; }
.form input[type="text"],
.form input[type="password"],
.form input[type="file"],
.form textarea,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="file"],
.form-group textarea { width:100%; padding:12px 12px; border:1px solid var(--border); border-radius:8px; font-size:14px; outline:none; background:#fff; color:var(--text); }
select {
  width: 100%;
  min-height: var(--button-height);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  background: #fff;
  color: var(--text);
}
.form textarea { resize: vertical; }
.btn-login { width: 100%; height: 40px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-login:hover { background: var(--primary-600); }
.error { color: var(--danger); }
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Chat */
.chat-body { background: var(--bg); }
.chat-header { position: sticky; top:0; z-index: 5; background:#fff; border-bottom:1px solid var(--border); padding: 12px 16px; display:flex; align-items:center; justify-content:space-between; }
.chat-header .left { display:flex; gap:12px; align-items:center; }
.chat-header .right { display:flex; gap:10px; align-items:center; }

.chat-main { display:grid; grid-template-columns: 300px minmax(0,1fr); gap: 16px; padding: 16px; }
.chat-sidebar { background:#fff; border:1px solid var(--border); border-radius:12px; padding: 12px; height: calc(100vh - 110px); overflow:auto; }
.sidebar-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.sidebar-list { display:flex; flex-direction:column; gap:6px; }
.sidebar-item { border:1px solid var(--border); border-radius:8px; padding:10px; cursor:pointer; background:#fff; }
.sidebar-item .title { font-weight:600; font-size:14px; }
.sidebar-item.active { border-color: var(--primary); background: var(--primary-50); }

.chat-section { display:flex; flex-direction:column; gap:12px; }
.chat-window { background:#fff; border:1px solid var(--border); border-radius:12px; padding: 12px; height: calc(100vh - 210px); overflow:auto; }

.message { display:flex; margin: 8px 0; }
.message.user { justify-content:flex-end; }
.message.ai { justify-content:flex-start; }
.bubble { max-width: 80%; padding: 10px 12px; border-radius: 14px; border:1px solid var(--border); }
.bubble.user { background: var(--primary); color:#fff; border-color: transparent; }
.bubble.ai { background:#f9fafb; }

.chat-input { display:flex; gap:10px; align-items:flex-end; background:#fff; border:1px solid var(--border); border-radius:12px; padding: 10px; }
.chat-input textarea { width:100%; min-height:40px; max-height:200px; padding:10px 12px; border:1px solid var(--border); border-radius:10px; font-size:14px; }
.chat-actions { display:flex; gap:10px; align-items:center; justify-content:space-between; }

/* Admin */
.admin-body { background: var(--bg); }
.admin-main { padding: 16px; }
.admin-grid { display:grid; grid-template-columns: 1fr; gap: 16px; }
.card h3 { margin: 0; line-height: var(--button-height); }
.filters { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.table-responsive { background:#fff; border:1px solid var(--border); border-radius:12px; overflow:auto; }
.table { width:100%; border-collapse: collapse; font-size:14px; }
.table th, .table td { padding:10px 12px; border-bottom:1px solid var(--border); text-align:left; }
.table thead th { background:#f3f4f6; font-weight:600; }
.actions { display:flex; gap:6px; justify-content:flex-end; align-items:center; }

/* Modal */
.modal { position: fixed; inset:0; background: rgba(0,0,0,.35); display:flex; align-items:center; justify-content:center; padding:20px; }
.modal-content { width: 100%; max-width: 900px; background:#fff; border-radius:12px; border:1px solid var(--border); box-shadow: var(--shadow); padding: 16px; }
.pdf-preview iframe { border-radius: 8px; }

/* Pagination */
.pagination { display:flex; align-items:center; justify-content:center; gap:12px; padding:12px 0; }

/* ============================================
   SVDE Shell - Conteneur global unifié
   ============================================ */

/* Conteneur principal de l'application */
.svde-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* Header fixe en haut */
.svde-shell__header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

/* Contenu du header */
.svde-header {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  gap: 16px;
}

.svde-header__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.svde-header__logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.svde-header__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.svde-header__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.svde-header__title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.svde-header__title p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.svde-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.impersonate-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.impersonate-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.impersonate-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  min-width: 160px;
  background: #fff;
  height: 32px;
}

.impersonation-banner {
  max-width: 1400px;
  margin: 6px auto 0 auto;
  padding: 8px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.impersonation-indicator {
  background: #fff4e6;
  color: #b54708;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid #f8e0c2;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-stop-impersonate {
  background: #b54708;
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid #92400e;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-stop-impersonate:hover {
  background: #92400e;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.impersonation-message {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.impersonation-message.success {
  background: #ecfdf3;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.impersonation-message.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Fil d'Ariane */
.svde-shell__breadcrumbs {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  flex-shrink: 0;
}

.breadcrumb {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  font-size: 14px;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  color: var(--muted);
}

.breadcrumb-item:not(:last-child)::after {
  content: "→";
  margin-left: 8px;
  color: var(--muted);
  opacity: 0.5;
}

.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.breadcrumb-item a:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

.breadcrumb-item:last-child {
  color: var(--text);
  font-weight: 500;
}

/* Zone de contenu scrollable */
.svde-shell__content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
}

/* Scrollbar personnalisée */
.svde-shell__content::-webkit-scrollbar {
  width: 10px;
}

.svde-shell__content::-webkit-scrollbar-track {
  background: var(--bg);
}

.svde-shell__content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

.svde-shell__content::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Container & Layout */
.container { max-width: 1400px; margin: 0 auto; padding: 20px; background: var(--bg); }

/* Header */
header { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 24px; box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.header-left { flex: 1; }
.header-left h1 { margin: 0 0 8px 0; font-size: 24px; color: var(--text); }
.header-left p { margin: 0; color: var(--muted); font-size: 14px; }
.header-right { display: flex; align-items: center; gap: 12px; }

/* Navigation Tabs */
.nav-tabs { display: flex; gap: 8px; margin-top: 12px; }
.nav-tabs a { padding: 8px 16px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 14px; font-weight: 500; transition: all 0.2s; border: 1px solid transparent; }
.nav-tabs a:hover { background: var(--bg); }
.nav-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* User Info */
.user-info { text-align: right; }
.user-name { font-weight: 600; color: var(--text); font-size: 14px; }
.user-login { font-size: 12px; color: var(--muted); }
.admin-badge { background: var(--primary); color: white; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; margin-left: 6px; }

/* Debug Toggle (Admin uniquement) */
.debug-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.debug-toggle-wrapper:hover {
  background: var(--bg);
  box-shadow: var(--shadow);
}

.debug-toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  user-select: none;
}

.debug-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.debug-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.debug-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 22px;
}

.debug-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.debug-toggle input:checked + .debug-toggle-slider {
  background-color: #f59e0b;
}

.debug-toggle input:focus + .debug-toggle-slider {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.debug-toggle input:checked + .debug-toggle-slider:before {
  transform: translateX(20px);
}

.debug-toggle input:checked ~ .debug-toggle-label {
  color: #f59e0b;
  font-weight: 600;
}

.cloudflare-indicator {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 12px;
  border: 1px solid transparent;
}
.cloudflare-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}
.cloudflare-ko {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.35);
}

/* Buttons Extensions */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25), 0 1px 3px rgba(22, 163, 74, 0.15);
}
.btn-success:hover {
  background: #15803d !important;
  border-color: #15803d !important;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35), 0 2px 6px rgba(22, 163, 74, 0.25) !important;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25), 0 1px 3px rgba(220, 38, 38, 0.15);
}
.btn-danger:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35), 0 2px 6px rgba(220, 38, 38, 0.25) !important;
}

.btn-warning {
  background: var(--warn);
  color: #111;
  border-color: var(--warn);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25), 0 1px 3px rgba(245, 158, 11, 0.15);
}
.btn-warning:hover {
  background: #d97706 !important;
  border-color: #d97706 !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35), 0 2px 6px rgba(245, 158, 11, 0.25) !important;
}

.btn-logout {
  background: #fff;
  border: 2px solid var(--border);
  color: var(--text);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-logout:hover {
  background: #f9fafb !important;
  border-color: var(--danger) !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15), 0 2px 4px rgba(0, 0, 0, 0.08) !important;
  color: var(--danger) !important;
}

/* Toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: #fff; padding: 16px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.toolbar h2 { margin: 0; font-size: 18px; }

/* Tables */
table { width: 100%; background: #fff; border-radius: 12px; border: 1px solid var(--border); border-collapse: collapse; box-shadow: var(--shadow); overflow: hidden; }
table thead { background: #f8f9fa; }
table th { padding: 12px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); font-size: 14px; }
table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: #f9fafb; }

/* Forms */
.form-container { background: #fff; padding: 24px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.form-container h2 { margin: 0 0 20px 0; font-size: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* Notification Messages */
.notification-message { background: #dbeafe; color: #1e40af; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #93c5fd; font-size: 14px; }
.error-message { background: #fee; color: var(--danger); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid #fca5a5; }

/* Stats */
.stats { color: var(--muted); font-size: 14px; }

/* Highlight */
.highlight { background: #fef08a; padding: 2px 4px; border-radius: 2px; font-weight: 600; }

/* Theme Toggle Button */
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; transition: all 0.3s ease; }
.theme-toggle:hover { transform: rotate(20deg); box-shadow: var(--shadow); }

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.success-toast, .error-toast, .warning-toast {
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.success-toast { background: #28a745; color: white; }
.error-toast { background: #dc3545; color: white; }
.warning-toast { background: #ffc107; color: #000; }
.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    line-height: 1;
}
.toast-close:hover { opacity: 1; }
@keyframes toastSlideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

/* ============================================
   SPINNER & LOADING MODAL
   Composants réutilisables pour les chargements
   ============================================ */

/* Spinner de chargement (animation rotation) */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border, #e0e0e0);
    border-top-color: var(--primary, #003366);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}
.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal overlay (fond semi-transparent + centrage) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.modal-overlay.active,
.modal-overlay[style*="display: flex"] {
    display: flex;
}

/* Contenu du modal loading */
.modal-loading {
    background: var(--card, white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 30px;
    text-align: center;
    max-width: 350px;
}
.modal-loading .spinner {
    margin: 0 auto 15px;
}
.modal-loading p {
    margin: 0;
    font-size: 16px;
    color: var(--text, #333);
}

/* ============================================
   TODO MANAGER - TAG SELECTOR STYLES
   ============================================ */

.tag-selector__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 600px !important;
    min-width: 600px;
    max-width: 90vw;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 8px;
}

.tag-selector__dropdown-wrapper {
    position: relative;
}

.tag-selector__search {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.tag-selector__search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

.tag-selector__options {
    max-height: 350px;
    overflow-y: auto;
    padding: 12px;
}

.tag-selector__group {
    margin-bottom: 16px;
}

.tag-selector__group-label {
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
}

.tag-selector__group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tag-selector__option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 6px;
    border: 2px solid transparent;
    background: transparent;
}

.tag-selector__option:hover {
    border-color: #cbd5e1;
}

.tag-selector__option--selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.tag-selector__option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
}

.tag-selector__count {
    font-size: 11px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.tag-selector__no-results {
    padding: 24px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

/* ============================================
   CHANTIERS / BAUSTELLEN MODULE
   ============================================ */

/* --- Home page --- */
.chantiers-home { padding: 20px; max-width: 900px; margin: 0 auto; }
.chantiers-home-cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; }
.chantiers-home-card {
    display: flex; align-items: center; gap: 16px;
    padding: 20px 24px; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; text-decoration: none; color: var(--text);
    transition: all 0.15s; cursor: pointer;
}
.chantiers-home-card:hover { border-color: #3b82f6; box-shadow: 0 2px 8px rgba(59,130,246,0.1); }
.chantiers-home-card--primary { border-color: #3b82f6; background: linear-gradient(135deg, #eff6ff, #ffffff); }
.chantiers-home-card__icon { color: #3b82f6; flex-shrink: 0; }
.chantiers-home-card__content { flex: 1; }
.chantiers-home-card__content h3 { margin: 0 0 4px 0; font-size: 16px; font-weight: 600; }
.chantiers-home-card__content p { margin: 0; font-size: 13px; color: #64748b; }
.chantiers-home-card__arrow { color: #94a3b8; }

.chantiers-home-stats { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.chantiers-home-stats h3 { margin: 0 0 16px 0; font-size: 15px; font-weight: 600; }
.chantiers-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.chantiers-stat-card {
    background: #f8fafc; border-radius: 8px; padding: 16px; text-align: center;
    border: 1px solid #e2e8f0;
}
.chantiers-stat-card--active { border-color: #22c55e; background: #f0fdf4; }
.chantiers-stat-card--upcoming { border-color: #3b82f6; background: #eff6ff; }
.chantiers-stat-card__value { font-size: 28px; font-weight: 700; color: var(--text); }
.chantiers-stat-card__label { font-size: 12px; color: #64748b; margin-top: 4px; }

.chantiers-regions-overview h4 { margin: 0 0 8px 0; font-size: 13px; color: #64748b; }
.chantiers-regions-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chantiers-region-item {
    display: flex; align-items: center; gap: 6px;
    background: #f1f5f9; padding: 4px 10px; border-radius: 6px; font-size: 12px;
}
.chantiers-region-item__count { background: #e2e8f0; padding: 1px 6px; border-radius: 10px; font-weight: 600; }

/* --- Consultation page layout --- */
.chantiers-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    height: var(--available-height);
    overflow: hidden;
}
.chantiers-sidebar {
    display: flex; flex-direction: column;
    height: var(--available-height);
    overflow: hidden;
    border-right: 1px solid var(--border);
    background: var(--card);
}
.chantiers-map-container { height: var(--available-height); position: relative; }
.chantiers-map { height: 100%; width: 100%; }

/* --- Filters --- */
.chantiers-filters {
    flex: 1 1 50%; padding: 12px;
    overflow-y: auto; min-height: 0;
}
.chantiers-sidebar__resizer {
    height: 5px; cursor: ns-resize; background: var(--border, #dee2e6);
    transition: background .15s; flex-shrink: 0;
}
.chantiers-sidebar__resizer:hover, .chantiers-sidebar__resizer.active { background: var(--primary, #2563eb); }
.chantiers-filters__header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.chantiers-filters__header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.chantiers-filter-group { margin-bottom: 6px; }
.chantiers-filter-group label { font-size: 11px; color: #64748b; margin-bottom: 2px; display: block; }
.chantiers-filter-section { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 6px; }
.chantiers-filter-section summary {
    font-size: 12px; font-weight: 600; padding: 6px 10px; cursor: pointer;
    background: #f8fafc; border-radius: 6px; user-select: none;
}
.chantiers-filter-section[open] summary { border-radius: 6px 6px 0 0; border-bottom: 1px solid var(--border); }
.chantiers-filter-section__body { padding: 6px 10px; overflow-y: auto; }
.fahrweg-checkbox {
    display: flex; align-items: center; gap: 6px; padding: 3px 0;
    font-size: 12px; cursor: pointer; color: #334155;
}
.fahrweg-checkbox input { margin: 0; cursor: pointer; }
.fahrweg-tolerance { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.fahrweg-tolerance label { font-size: 11px; color: #64748b; display: block; margin-bottom: 2px; }
.fahrweg-tolerance input[type=range] { width: 100%; height: 4px; cursor: pointer; }
.chantiers-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
/* Zug filter tree */
.zug-tree-node { margin: 0; }
.zug-tree-node > summary { list-style: none; cursor: pointer; }
.zug-tree-node > summary::-webkit-details-marker { display: none; }
.zug-tree-zugtyp { display:flex; align-items:center; gap:6px; padding:4px 0; font-size:13px; }
.zug-tree-offre { display:flex; align-items:center; gap:6px; padding:3px 0 3px 16px; font-size:12px; color:#334155; }
.zug-tree-offre-node { margin-left:4px; }
.zug-tree-badge { background:#e0e7ff; color:#3730a3; padding:0 5px; border-radius:3px; font-size:10px; font-weight:500; }
.zug-tree-zug { display:flex; align-items:center; gap:5px; padding:2px 0 2px 36px; font-size:11px; cursor:pointer; color:#475569; }
.zug-tree-zug:hover { background:#f8fafc; }
.zug-tree-zug input { margin:0; cursor:pointer; }
.zug-tree-zug__nr { font-weight:600; min-width:40px; }
.zug-tree-zug__zeit { color:#2563eb; font-size:10px; }
.zug-tree-zug__vt { color:#64748b; font-size:10px; }
.chantiers-filter-actions {
    display: flex; gap: 8px; margin-top: 8px; padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* --- Data list --- */
.chantiers-data {
    flex: 1 1 50%; overflow-y: auto;
    display: flex; flex-direction: column;
    min-height: 0;
}
.chantiers-data__header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; font-size: 12px; color: #64748b;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.chantiers-list { flex: 1; overflow-y: auto; padding: 4px; }
.chantiers-list__loading, .chantiers-list__empty {
    padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 14px;
}

/* --- Chantier card --- */
.chantier-card {
    padding: 10px 12px; margin-bottom: 4px;
    border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: all 0.1s;
    background: var(--card); font-size: 12px;
}
.chantier-card:hover { border-color: #94a3b8; }
.chantier-card--selected { border-color: #3b82f6; background: #eff6ff; }
.chantier-card--active { border-left: 3px solid #22c55e; }
.chantier-card--unwichtig { opacity: 0.45; border-color: #e2e8f0; background: #f8fafc; order: 999; }
.chantier-card--unwichtig .betroffenheit-select { opacity: 0.6; }
.chantier-card--unwichtig:hover { opacity: 0.75; }
.betroffenheit-select {
    width: 100%; padding: 6px 10px; border: 1px solid; border-radius: 5px;
    font-size: 12px; font-weight: 600; cursor: pointer; margin-bottom: 6px;
    outline: none; appearance: auto; -webkit-appearance: auto;
}
.betroffenheit-select:focus { box-shadow: 0 0 0 2px rgba(59,130,246,0.3); }
.chantier-card__header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 4px;
}
.chantier-card__bke { font-weight: 600; font-size: 13px; color: var(--text); }
.chantier-card__kat { font-size: 11px; color: #64748b; background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.chantier-card__dates { color: #475569; margin-bottom: 3px; }
.chantier-card__tage { margin-left: 8px; color: #3b82f6; font-weight: 500; }
.chantier-card__location {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 3px; color: #64748b;
}
.chantier-card__strecke { font-weight: 600; color: #dc2626; }
.chantier-card__stations { color: #475569; margin-bottom: 3px; }
.chantier-card__desc { color: #64748b; font-size: 11px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chantier-card__impacts { display: flex; gap: 4px; margin-bottom: 4px; }
.chantier-card__actions {
    display: flex; justify-content: space-between; align-items: center;
}
.chantier-card__betrieb { font-size: 11px; color: #64748b; }

/* Impact badges */
.impact-badge {
    font-size: 10px; padding: 1px 5px; border-radius: 3px;
    background: #f1f5f9; color: #94a3b8; font-weight: 500;
}
.impact-badge--warn { background: #fef2f2; color: #dc2626; }

/* Pagination */
.btn-pagination {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    padding: 2px 8px; cursor: pointer; font-size: 14px; color: var(--text);
}
.btn-pagination:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-link { background: none; border: none; color: #3b82f6; cursor: pointer; font-size: 12px; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* --- Tooltips carte --- */
.chantiers-tooltip { font-size: 12px; }
.chantiers-popup h4 { margin: 0 0 4px 0; font-size: 14px; }
.chantiers-popup ul { margin: 4px 0 0 0; padding-left: 16px; font-size: 12px; }
.chantiers-popup li { margin-bottom: 6px; }

/* --- Detail modal --- */
.chantiers-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.chantiers-modal__content {
    background: var(--card); border-radius: 12px; width: 90%; max-width: 600px;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.chantiers-modal__header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.chantiers-modal__header h3 { margin: 0; font-size: 16px; }
.chantiers-modal__close {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: #64748b; padding: 0; line-height: 1;
}
.chantiers-modal__body { padding: 20px; }
.chantiers-detail-table { width: 100%; font-size: 13px; }
.chantiers-detail-table th {
    text-align: left; padding: 6px 12px 6px 0; color: #64748b;
    font-weight: 500; white-space: nowrap; width: 130px; vertical-align: top;
}
.chantiers-detail-table td { padding: 6px 0; color: var(--text); }

.chantier-ve-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.chantier-ve-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chantier-ve-card__body { font-size: 12px; }
.chantier-ve-row { display: flex; justify-content: space-between; padding: 2px 0; }
.chantier-ve-row span { color: #334155; }

/* --- Import page --- */
/* Unsere Baustellen */
.unsere-baustellen-page { padding: 20px; max-width: 1400px; margin: 0 auto; }
.unsere-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.unsere-filter-chip { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; cursor: pointer; border: 2px solid var(--chip-color); background: var(--chip-bg); transition: opacity .15s; user-select: none; }
.unsere-filter-chip:has(input:not(:checked)) { opacity: 0.35; }
.unsere-filter-chip input { accent-color: var(--chip-color); }
.unsere-filter-chip__label { font-size: 13px; font-weight: 600; color: var(--chip-color); }
.unsere-filter-chip__count { font-size: 11px; color: var(--chip-color); opacity: 0.7; }
.unsere-table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
.unsere-table { font-size: 13px; margin: 0; }
.unsere-table th { cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; background: var(--card); z-index: 1; }
.unsere-table th:hover { color: #3b82f6; }
.unsere-table th .sort-arrow { font-size: 10px; margin-left: 3px; opacity: 0.4; }
.unsere-table th.sorted .sort-arrow { opacity: 1; color: #3b82f6; }
.unsere-table td { white-space: nowrap; }
.unsere-bke { font-weight: 600; }
.unsere-status { margin-top: 8px; font-size: 13px; color: #64748b; }
.betroffenheit-select--compact { padding: 3px 6px; font-size: 11px; min-width: 140px; }

/* Chantier Groups */
.chantier-group-card { border: 1px solid #3b82f6; border-radius: 8px; margin-bottom: 4px; }
.chantier-group-card > summary { list-style: none; cursor: pointer; }
.chantier-group-card > summary::-webkit-details-marker { display: none; }
.chantier-group-card[open] { border-color: #2563eb; box-shadow: 0 2px 8px rgba(59,130,246,0.15); }
.group-badge { background: #3b82f6; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle; }
.group-badge-sm { background: #3b82f6; color: #fff; font-size: 10px; font-weight: 600; padding: 0 5px; border-radius: 8px; margin-left: 4px; vertical-align: middle; }
.chantier-group-members { padding: 4px 8px 8px; border-top: 1px solid var(--border, #e2e8f0); }
.chantier-group-members .chantier-card { border-left: 3px solid #3b82f6; margin-left: 12px; margin-bottom: 4px; }
.chantier-group-member { position: relative; }
.btn-ungroup { position: absolute; top: 4px; right: 4px; background: none; border: 1px solid #dc2626; color: #dc2626; border-radius: 4px; width: 20px; height: 20px; cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.btn-ungroup:hover { background: #fef2f2; }
.chantier-card__group-bkes { font-size: 11px; color: #64748b; margin-top: 2px; }
.group-select-label { position: absolute; top: 6px; right: 6px; z-index: 1; cursor: pointer; }
.group-select-cb { cursor: pointer; }
.group-action-bar { position: sticky; bottom: 0; background: var(--card, #fff); border-top: 2px solid #3b82f6; padding: 8px 12px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; z-index: 2; }
.group-parent-row { background: var(--bg-secondary, #f8fafc); font-weight: 500; }
.group-parent-row td { border-bottom: none !important; }
.group-child-row { background: var(--bg-tertiary, #f1f5f9); }
.group-child-row td:nth-child(2) { padding-left: 24px; }
.btn-group-toggle { background: none; border: 1px solid #94a3b8; border-radius: 4px; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; margin-right: 4px; vertical-align: middle; }
.btn-group-toggle:hover { background: #e2e8f0; }

/* Zugprofile */
.zugprofile-page { padding: 20px; max-width: 900px; margin: 0 auto; }
.zugprofile-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.zugprofile-header h3 { margin: 0; font-size: 16px; }
.zugprofile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.zugprofil-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.zugprofil-card:hover { border-color: #3b82f6; box-shadow: 0 2px 8px rgba(59,130,246,0.1); }
.zugprofil-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.zugprofil-card__header strong { font-size: 15px; }
.zugprofil-card__va { font-size: 11px; color: #64748b; background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.zugprofil-card__desc { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.zugprofil-card__specs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: #475569; }
.zugprofil-card__specs span { background: #f8fafc; padding: 1px 6px; border-radius: 3px; border: 1px solid #e2e8f0; }

.zp-form-row { display: flex; gap: 8px; margin-bottom: 8px; }
.zp-form-group { flex: 1; margin-bottom: 8px; }
.zp-form-group label { font-size: 11px; color: #64748b; margin-bottom: 2px; display: block; font-weight: 500; }
.zp-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e2e8f0; }

.chantiers-import-page { padding: 20px; max-width: 1200px; margin: 0 auto; }
.chantiers-import-upload { margin-bottom: 24px; }
.chantiers-import-upload h3 { margin: 0 0 12px 0; font-size: 15px; }

.chantiers-drop-zone {
    border: 2px dashed #cbd5e1; border-radius: 12px;
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: all 0.15s; color: #64748b;
}
.chantiers-drop-zone:hover, .chantiers-drop-zone--active {
    border-color: #3b82f6; background: #eff6ff;
}
.chantiers-drop-zone svg { color: #94a3b8; margin-bottom: 12px; }
.chantiers-drop-zone p { margin: 4px 0; }
.chantiers-drop-zone__hint { font-size: 12px; color: #94a3b8; }
.chantiers-drop-zone__loading { padding: 20px; color: #3b82f6; }

.chantiers-import-meta { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.chantiers-import-meta__row { display: flex; gap: 16px; align-items: end; }
.chantiers-import-meta__field { flex: 1; }
.chantiers-import-meta__field label { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
.chantiers-import-preview { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 24px; }
.chantiers-import-preview__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.chantiers-import-preview__header h3 { margin: 0; font-size: 15px; }
.chantiers-import-preview__table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; margin-bottom: 16px; }
.chantiers-import-actions { display: flex; justify-content: flex-end; gap: 8px; }

.chantiers-column-mapping { margin-bottom: 12px; }
.chantiers-column-mapping h4 { font-size: 13px; color: #64748b; margin: 0 0 6px 0; }
.chantiers-mapping-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.chantiers-mapping-badge { font-size: 11px; background: #f0fdf4; color: #166534; padding: 2px 8px; border-radius: 4px; border: 1px solid #bbf7d0; }

.chantiers-import-result { padding: 20px; border-radius: 12px; margin-bottom: 24px; }
.chantiers-import-result--success { background: #f0fdf4; border: 1px solid #bbf7d0; }
.chantiers-import-result--error { background: #fef2f2; border: 1px solid #fecaca; }
.chantiers-import-result h3 { margin: 0 0 12px 0; font-size: 15px; }
.chantiers-import-result__stats { display: flex; gap: 24px; font-size: 14px; }
.chantiers-import-result--progress { background: #eff6ff; border: 1px solid #bfdbfe; }

.chantiers-progress { margin-top: 4px; }
.chantiers-progress__bar-wrap { height: 20px; background: #e2e8f0; border-radius: 10px; overflow: hidden; }
.chantiers-progress__bar { height: 100%; background: linear-gradient(90deg, #3b82f6, #2563eb); border-radius: 10px; transition: width .3s ease; min-width: 0; }
.chantiers-progress__info { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: #475569; }
.chantiers-progress__percent { font-weight: 600; color: #2563eb; }

.chantiers-import-history { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.chantiers-import-history .table { width: 100%; }
.chantiers-import-history h3 { margin: 0 0 12px 0; font-size: 15px; }
.chantiers-import-history th { text-align: center; white-space: nowrap; }
.chantiers-import-history td { text-align: center; vertical-align: middle; }
.chantiers-import-history td:nth-child(2) { text-align: left; }
.btn-delete-import { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; opacity: 0.6; transition: opacity .15s; }
.btn-delete-import:hover { opacity: 1; background: #fef2f2; }

.text-success { color: #16a34a; }
.text-warning { color: #d97706; }
.text-danger { color: #dc2626; }

/* --- BS Selector (modal-based station picker) --- */
.bs-selector {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    cursor: pointer; font-size: 13px; display: flex; align-items: center;
    justify-content: space-between; transition: all 0.1s; background: var(--card);
    min-height: 36px;
}
.bs-selector:hover { border-color: #94a3b8; }
.bs-selector--filled { border-color: #3b82f6; background: #eff6ff; }
.bs-selector--small { padding: 6px 8px; font-size: 12px; min-height: 30px; }
.bs-selector__placeholder { color: #94a3b8; }
.bs-selector__value { flex: 1; }
.bs-selector__value strong { color: #3b82f6; margin-right: 4px; }
.bs-selector__clear { background: none; border: none; cursor: pointer; color: #dc2626; font-size: 16px; padding: 0 0 0 8px; }

/* BS Modal results */
.bs-modal-results { margin-top: 8px; max-height: 350px; overflow-y: auto; }
.bs-modal-hint { padding: 20px; text-align: center; color: #94a3b8; font-size: 13px; }
.bs-modal-item { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.1s; }
.bs-modal-item:hover { background: #eff6ff; }
.bs-modal-item__main { font-size: 14px; }
.bs-modal-item__code { font-weight: 700; color: #3b82f6; margin-right: 8px; }
.bs-modal-item__name { color: var(--text); }
.bs-modal-item__meta { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.bs-modal-item__flag { margin-right: 4px; }
.bs-modal-item__loc { font-size: 11px; color: #94a3b8; margin-left: 6px; font-weight: 400; }
.bs-selector__loc { font-size: 10px; color: #94a3b8; font-weight: 400; }

/* Waypoint items */
.trajets-waypoint-item {
    display: flex; align-items: center; gap: 6px; padding: 6px 8px;
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px;
    margin-bottom: 4px; font-size: 12px;
}
.trajets-waypoint-item__num {
    background: #22c55e; color: #fff; width: 20px; height: 20px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.trajets-waypoint-item__value { flex: 1; }
.trajets-waypoint-item__value strong { color: #3b82f6; }
.trajets-waypoint-item__remove { background: none; border: none; cursor: pointer; color: #dc2626; font-size: 16px; padding: 0; }
.trajets-waypoint-add { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.trajets-waypoint-add .trajets-waypoint-item__num { background: #94a3b8; }

/* Strecke label on map */
.strecke-label {
    background: none !important; border: none !important;
}
.strecke-tooltip { font-size: 11px !important; font-weight: 600; }
.strecke-label span {
    background: #2563eb; color: #fff; font-size: 10px; font-weight: 700;
    padding: 1px 5px; border-radius: 3px; white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* --- Trajets / Routing page --- */
.trajets-layout {
    display: grid; grid-template-columns: 400px 1fr;
    height: var(--available-height); overflow: hidden;
}
.trajets-sidebar {
    display: flex; flex-direction: column; height: var(--available-height);
    overflow: hidden; border-right: 1px solid var(--border); background: var(--card);
}
.trajets-map-container { height: var(--available-height); position: relative; }
.trajets-map { height: 100%; width: 100%; }

.trajets-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.trajets-tab {
    flex: 1; padding: 10px; text-align: center; cursor: pointer;
    background: none; border: none; font-size: 13px; font-weight: 500;
    color: #64748b; border-bottom: 2px solid transparent;
}
.trajets-tab--active { color: #3b82f6; border-bottom-color: #3b82f6; }

.trajets-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.trajets-panel__content { flex: 1; overflow-y: auto; min-height: 0; }
.trajets-form { padding: 12px; }
.trajets-form-group { margin-bottom: 8px; position: relative; }
.trajets-form-group label { font-size: 11px; color: #64748b; margin-bottom: 2px; display: block; font-weight: 500; }

/* Timeline */
.trajets-timeline { padding: 8px 12px; }
.tl-node { display: flex; gap: 10px; position: relative; padding-bottom: 4px; }
.tl-node:not(:last-child)::after {
    content: ''; position: absolute; left: 14px; top: 30px; bottom: 0;
    width: 2px; background: #cbd5e1;
}
.tl-node--endpoint::after { background: #3b82f6; }
.tl-node__marker {
    width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; z-index: 1;
}
.tl-node__marker--start { background: #22c55e; color: #fff; }
.tl-node__marker--end { background: #dc2626; color: #fff; }
.tl-node__marker--choice { background: #f59e0b; color: #fff; animation: pulse 1.5s infinite; }
.tl-node__marker--step { background: #3b82f6; color: #fff; font-size: 10px; width: 24px; height: 24px; margin: 3px; }
.tl-node__marker--auto { background: #e2e8f0; color: #64748b; font-size: 8px; width: 18px; height: 18px; margin: 6px; }
.tl-node__content { flex: 1; min-width: 0; padding-top: 4px; }
.tl-node__content label { font-size: 11px; color: #64748b; margin-bottom: 2px; display: block; }

/* Timeline step (étape validée) */
.tl-step { display: flex; gap: 10px; align-items: center; position: relative; padding: 3px 0; }
.tl-step:not(:last-child)::after {
    content: ''; position: absolute; left: 14px; top: 24px; bottom: -3px;
    width: 2px; background: #3b82f6;
}
.tl-step__info { flex: 1; display: flex; justify-content: space-between; align-items: center; font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 4px; }
.tl-step__info:hover { background: #eff6ff; }
.tl-step__name { font-weight: 500; }
.tl-step__meta { font-size: 10px; color: #94a3b8; display: flex; gap: 6px; align-items: center; }
.tl-step__remove { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 14px; padding: 0 2px; opacity: 0; transition: opacity 0.15s; }
.tl-step:hover .tl-step__remove { opacity: 1; }

/* Strecke separator in timeline */
.tl-strecke-badge {
    font-size: 9px; background: #3b82f6; color: #fff; padding: 1px 6px;
    border-radius: 3px; font-weight: 600; margin-left: 34px; margin-bottom: 2px; display: inline-block;
}

/* Choice area */
.tl-choice-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tl-choice-header strong { font-size: 13px; }
.tl-choice-direction { font-size: 11px; color: #64748b; margin-bottom: 6px; padding: 4px 8px; background: #f8fafc; border-radius: 4px; }
.tl-choice-list { display: flex; flex-direction: column; gap: 3px; }

@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); } 50% { box-shadow: 0 0 0 8px rgba(245,158,11,0); } }

/* Autocomplete suggestions */
.trajets-suggest {
    display: none; position: absolute; z-index: 100; left: 0; right: 0; top: 100%;
    background: var(--card); border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-height: 200px; overflow-y: auto;
}
.trajets-suggest__item { padding: 8px 10px; cursor: pointer; font-size: 12px; border-bottom: 1px solid #f1f5f9; }
.trajets-suggest__item:hover { background: #eff6ff; }
.trajets-suggest__item strong { color: #3b82f6; }
.trajets-suggest__art { float: right; font-size: 10px; color: #94a3b8; }
.trajets-suggest__empty { padding: 12px; color: #94a3b8; font-size: 12px; text-align: center; }

/* Waypoints */
.trajets-waypoints { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.trajets-waypoint-tag {
    display: flex; align-items: center; gap: 4px; background: #f0fdf4;
    border: 1px solid #bbf7d0; padding: 2px 8px; border-radius: 4px; font-size: 11px;
}
.trajets-waypoint-tag button { background: none; border: none; cursor: pointer; color: #dc2626; font-size: 14px; padding: 0; }
.trajets-waypoint-add { position: relative; }

/* Strecken badges */
.trajets-strecken { display: flex; flex-wrap: wrap; gap: 4px; }
.trajets-strecke-badge { display: inline-flex; align-items: center; gap: 4px; background: #eff6ff; border: 1px solid #bfdbfe; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; color: #2563eb; }
.trajets-strecke-badge button { background: none; border: none; cursor: pointer; color: #dc2626; font-size: 14px; padding: 0; line-height: 1; }

/* Route result */
.trajets-route-result { font-size: 13px; }
.trajets-route-summary { font-size: 14px; margin-bottom: 8px; padding: 8px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; }
.trajets-variants { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.trajets-variant { font-size: 11px; padding: 3px 8px; border: 1px solid #e2e8f0; border-radius: 4px; background: #fff; cursor: pointer; }
.trajets-variant:hover { border-color: #3b82f6; }
.trajets-variant--selected { background: #eff6ff; border-color: #3b82f6; color: #2563eb; font-weight: 600; }
.trajets-route-stops { max-height: 300px; overflow-y: auto; font-size: 12px; }
.trajets-stop { padding: 2px 8px; border-left: 2px solid #e2e8f0; color: #64748b; }
.trajets-stop--waypoint { border-left-color: #2563eb; color: var(--text); font-weight: 600; }
.trajets-stop__km { float: right; font-size: 11px; color: #94a3b8; }

/* Routing progress */
.trajets-progress { padding: 12px; }
.trajets-progress__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.trajets-progress__header h4 { margin: 0; font-size: 14px; font-weight: 600; }
.trajets-progress__km { font-size: 13px; font-weight: 600; color: #3b82f6; }

.trajets-path { max-height: 250px; overflow-y: auto; margin-bottom: 8px; }
.trajets-path-list { font-size: 12px; }
.trajets-path-strecke { margin-bottom: 4px; }
.trajets-path-strecke__nr { font-size: 10px; color: #3b82f6; font-weight: 600; background: #eff6ff; padding: 1px 6px; border-radius: 3px; }
.trajets-path-stop { padding: 3px 8px; display: flex; justify-content: space-between; border-left: 2px solid #e2e8f0; margin-left: 8px; }
.trajets-path-stop--waypoint { border-left-color: #f59e0b; background: #fffbeb; }
.trajets-path-stop--choice { border-left-color: #8b5cf6; }
.trajets-path-stop__name { color: var(--text); }
.trajets-path-stop__km { color: #94a3b8; font-size: 11px; }

/* Choices (bifurcation) */
.trajets-choices { margin-bottom: 8px; }
.trajets-choices__header { font-size: 12px; color: #64748b; margin-bottom: 6px; padding: 6px 8px; background: #f8fafc; border-radius: 6px; }
.trajets-choices__section { margin-bottom: 6px; }
.trajets-choices__label { font-size: 10px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }

.trajets-choice {
    display: flex; flex-direction: column; gap: 1px; width: 100%;
    padding: 6px 10px; margin-bottom: 3px; background: var(--card);
    border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
    text-align: left; font-size: 12px; transition: all 0.1s; overflow: hidden;
}
.trajets-choice:hover { border-color: #3b82f6; background: #eff6ff; }
.trajets-choice--same-strecke { border-color: #93c5fd; background: #eff6ff; border-width: 2px; }
.trajets-choice--same-strecke:hover { border-color: #2563eb; background: #dbeafe; }
.trajets-choice--recommended { border-color: #bbf7d0; background: #f0fdf4; }
.trajets-choice--recommended:hover { border-color: #22c55e; background: #dcfce7; }
.trajets-choice__same { font-size: 9px; background: #2563eb; color: #fff; padding: 1px 4px; border-radius: 3px; font-weight: 600; }
.trajets-choice__top { display: flex; align-items: center; gap: 6px; }
.trajets-choice__dir { font-weight: 700; color: #3b82f6; min-width: 22px; text-align: center; flex-shrink: 0; }
.trajets-choice__name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trajets-choice__info { font-size: 10px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 28px; }
.trajets-choice__info em { font-style: normal; color: #64748b; }

.trajets-actions { padding-top: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }

/* AI Chat */
.trajets-ai-chat { border-top: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.trajets-ai-chat__resizer { height: 5px; cursor: ns-resize; background: var(--border, #dee2e6); transition: background .15s; flex-shrink: 0; }
.trajets-ai-chat__resizer:hover, .trajets-ai-chat__resizer.active { background: var(--primary, #2563eb); }
.trajets-ai-chat__header { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: var(--bg-muted, #f8f9fa); font-size: 12px; font-weight: 600; color: #555; border-bottom: 1px solid var(--border); }
.btn-ai-toggle { background: none; border: none; cursor: pointer; font-size: 12px; color: #888; padding: 2px 4px; }
.trajets-ai-chat__messages { overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.ai-msg { padding: 6px 10px; border-radius: 8px; max-width: 95%; line-height: 1.4; word-break: break-word; }
.ai-msg--assistant { background: #e8f4fd; color: #1a3a4f; align-self: flex-start; }
.ai-msg--user { background: #dbeafe; color: #1e40af; align-self: flex-end; }
.ai-msg--system { background: #f0fdf4; color: #166534; align-self: center; font-style: italic; text-align: center; font-size: 11px; }
.ai-msg--error { background: #fef2f2; color: #991b1b; align-self: center; font-size: 11px; }
.ai-msg--loading { background: #f3f4f6; color: #6b7280; align-self: flex-start; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.ai-msg__waypoints { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.ai-wp { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; background: rgba(255,255,255,.6); border-radius: 4px; font-size: 11px; }
.ai-wp--valid { border-left: 3px solid #22c55e; }
.ai-wp--invalid { border-left: 3px solid #ef4444; }
.ai-wp__code { font-weight: 700; font-family: monospace; }
.ai-wp__btn { margin-left: auto; font-size: 10px; padding: 1px 6px; cursor: pointer; }
.trajets-ai-chat__input { display: flex; gap: 4px; padding: 6px 12px; border-top: 1px solid var(--border); }
.trajets-ai-chat__input input { flex: 1; font-size: 12px; }

/* Saved trajets list */
.trajets-saved-search { padding: 12px 12px 0; }
.trajets-saved-list { padding: 8px; overflow-y: auto; }

.trajet-card {
    padding: 10px 12px; margin-bottom: 4px; border: 2px solid var(--border);
    border-radius: 8px; cursor: pointer; transition: all 0.15s; background: var(--card);
}
.trajet-card:hover { border-color: #93c5fd; }
.trajet-card--selected { border-color: #3b82f6; background: #eff6ff; cursor: default; }
.trajet-card--selected:hover { border-color: #3b82f6; }
.trajet-card__name { font-weight: 600; font-size: 13px; margin-bottom: 2px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.trajet-card__zp-tag { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 4px; white-space: nowrap; letter-spacing: 0.3px; }
.trajet-card__detail-btn {
    display: none; cursor: pointer; font-size: 16px; padding: 2px 6px;
    border-radius: 4px; transition: background 0.1s; line-height: 1;
}
.trajet-card__detail-btn:hover { background: #dbeafe; }
.trajet-card--selected .trajet-card__detail-btn { display: inline-block; }
.trajet-card__route { font-size: 12px; color: #475569; margin-bottom: 4px; }
.trajet-card__info { display: flex; gap: 8px; font-size: 11px; color: #64748b; margin-bottom: 2px; }
.trajet-card__meta { font-size: 10px; color: #94a3b8; display: flex; align-items: center; gap: 4px; }
.trajet-card__meta > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trajet-card__tags { display: flex; gap: 3px; flex-shrink: 0; }

/* Trajet detail modal */
.trajet-detail-header { padding: 12px; background: #f8fafc; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.trajet-detail-fahrweg { margin-bottom: 16px; border: 1px solid var(--border); border-radius: 8px; }
.trajet-detail-fahrweg summary {
    padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 14px;
    list-style: none; display: flex; align-items: center; gap: 8px;
}
.trajet-detail-fahrweg summary::before { content: '▶'; font-size: 10px; color: #94a3b8; transition: transform 0.2s; }
.trajet-detail-fahrweg[open] summary::before { transform: rotate(90deg); }
.trajet-detail-fahrweg summary:hover { background: #f8fafc; }
.trajet-detail-stops { max-height: 300px; overflow-y: auto; padding: 0 8px 8px; }
.trajet-detail-stop {
    display: flex; gap: 8px; align-items: center; padding: 4px 8px;
    border-left: 2px solid #e2e8f0; margin-left: 8px; font-size: 12px;
}
.trajet-detail-stop.stop--waypoint { border-left-color: #f59e0b; background: #fffbeb; }
.trajet-detail-stop.stop--bifurcation { border-left-color: #8b5cf6; }
.stop__kuerzel { font-weight: 600; color: #3b82f6; min-width: 50px; }
.stop__name { flex: 1; }
.stop__km { font-size: 11px; color: #94a3b8; }
.stop__strecke { font-size: 10px; color: #64748b; background: #f1f5f9; padding: 1px 5px; border-radius: 3px; }

.trajet-detail-chantiers { max-height: 200px; overflow-y: auto; }
.trajet-chantier {
    padding: 8px; margin-bottom: 4px; background: #fef2f2;
    border: 1px solid #fecaca; border-radius: 6px; font-size: 12px;
}

/* Responsive */
/* BS markers popup (clic carte → ajouter waypoint) */
.bs-popup-container .leaflet-popup-content-wrapper { border-radius: 8px; padding: 0; }
.bs-popup-container .leaflet-popup-content { margin: 0; min-width: 200px; }
.bs-popup__header { font-size: 13px; padding: 8px 12px 4px; }
.bs-popup__meta { font-size: 11px; color: #64748b; padding: 0 12px 8px; }
.bs-popup__btn {
  display: block; width: 100%; padding: 8px 12px;
  background: #4f46e5; color: #fff; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  border-radius: 0 0 8px 8px; transition: background 0.15s;
}
.bs-popup__btn:hover { background: #4338ca; }
.bs-map-tooltip { font-size: 12px; }

@media (max-width: 1024px) {
  .chat-main { grid-template-columns: 1fr; }
  .chat-sidebar { height:auto; order:2; }
  .chat-window { height: 50vh; }
  header { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .chantiers-layout { grid-template-columns: 1fr; height: auto; }
  .chantiers-sidebar { height: auto; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
  .chantiers-map-container { height: 50vh; }
  .chantiers-stats-grid { grid-template-columns: 1fr; }
  .chantiers-home-card { flex-direction: column; text-align: center; }
  .trajets-layout { grid-template-columns: 1fr; height: auto; }
  .trajets-sidebar { height: auto; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
  .trajets-map-container { height: 50vh; }
}
