:root {
  --bg-color: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-sidebar: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 48px;
  height: 38px;
  background-image: url('/static/logo_cgexpert_original.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 0;
  flex-shrink: 0;
  display: inline-block;
  transition: transform 0.25s ease;
}

.brand:hover .brand-icon,
.brand-large:hover .brand-icon {
  transform: scale(1.05);
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links a:hover, .nav-links a.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem 4rem;
  overflow-y: auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
}

.btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5);
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(59, 130, 246, 0.6);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Cards Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-Nouveau { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-En.cours { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.status-Réponses.reçues, .status-Terminé, .status-Envoyé, .status-Répondu { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-À.envoyer { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }

/* Table */
.table-container {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1.25rem 1.5rem;
  text-align: left;
}

th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  border-top: 1px solid var(--border-color);
  font-size: 0.95rem;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Back Link */
.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.5rem;
  transition: color 0.3s;
}

.back-link:hover {
  color: var(--text-primary);
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(10px);
  border-left: 4px solid var(--accent-color);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease forwards, fadeOut 0.5s ease 3s forwards;
  opacity: 0;
  transform: translateX(100%);
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.success {
  border-left-color: var(--success);
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

.attachments-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.attachments-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.attachments-list li a {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 0.9rem;
}
.attachments-list li a:hover {
  text-decoration: underline;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}
.drop-zone.dragover {
    border-color: var(--accent-color);
    background: rgba(52, 152, 219, 0.1);
}
.drop-zone-content {
    pointer-events: none;
}


/* ==========================================================================
   Responsive & Mobile Styles
   ========================================================================== */

/* Hamburger menu button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
}



/* ==========================================================================
   Responsive & Mobile Styles
   ========================================================================== */

/* Hamburger menu button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    /* Sidebar becomes a bottom navigation bar or an off-canvas menu */
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-sidebar);
    }

    .brand {
        margin-bottom: 0;
    }
    
    .brand-icon {
        display: none;
    }
    
    .brand span {
        display: none; /* Hide text on very small screens to save space */
    }

    .mobile-menu-btn {
        display: block;
    }

    /* Hide nav links by default on mobile, show via toggle class */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-sidebar);
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }

    .nav-links.show {
        display: flex;
    }

    .main-content {
        padding: 1rem;
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
        width: 100%;
    }

    .header-buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem !important;
    }

    .grid {
        grid-template-columns: 1fr;
        width: 100%;
    }

    /* Make tables scrollable horizontally */
    .table-container {
        overflow-x: auto;
        width: 100%;
    }

    /* Adjust cards for mobile tap targets */
    .btn {
        width: 100%;
        justify-content: center;
        padding: 1rem; /* Larger tap target */
    }
    
    header .btn {
        width: 100%;
    }
    
    .drop-zone {
        padding: 1.5rem;
        width: 100%;
    }
}

/* Light Theme Variables and Overrides */
body.light-theme {
  --bg-color: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-sidebar: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .brand span {
  color: #0f172a;
}

body.light-theme .nav-links a {
  color: #475569;
}

body.light-theme .nav-links a:hover, body.light-theme .nav-links a.active {
  background: rgba(15, 23, 42, 0.05);
  color: #0f172a;
}

body.light-theme .card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
  border-color: rgba(15, 23, 42, 0.15);
}

body.light-theme input, body.light-theme select, body.light-theme textarea, body.light-theme .form-control {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(15, 23, 42, 0.15) !important;
  color: #0f172a !important;
}

body.light-theme th {
  background: rgba(0, 0, 0, 0.03);
  color: #475569;
}

body.light-theme .btn.secondary {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #0f172a !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .btn.secondary:hover {
  background: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .status-Nouveau { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
body.light-theme .status-En.cours { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
body.light-theme .status-Réponses.reçues, body.light-theme .status-Terminé, body.light-theme .status-Envoyé, body.light-theme .status-Répondu { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
body.light-theme .status-À.envoyer { background: rgba(0, 0, 0, 0.05) !important; color: #475569 !important; }

body.light-theme .back-link {
  color: #2563eb !important;
}

/* Concessionaires & Users Mobile List & Cards */
.concessionaires-mobile-list, .users-mobile-list {
  display: none;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.concessionaire-card, .user-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.concessionaire-card-header, .user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.concessionaire-name, .user-email {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  word-break: break-all;
}

.badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
body.light-theme .badge.success {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
}

.badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
body.light-theme .badge.warning {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.concessionaire-card-body, .user-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.info-row.status-row {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.info-row .label, .attachments-section .label {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.info-row .value {
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
}

.attachments-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Settings Responsive Grid */
@media (max-width: 768px) {
  .table-container {
    display: none !important;
  }
  
  .concessionaires-mobile-list, .users-mobile-list {
    display: flex !important;
  }
  
  /* Fix settings grid on mobile */
  div[style*="display: grid; grid-template-columns: repeat(auto-fit, minmax(450px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  div[style*="display: grid; grid-template-columns: repeat(auto-fit, minmax(450px, 1fr))"] .card {
    max-width: 100% !important;
    width: 100% !important;
  }
}



/* App Top Navigation */
.app-topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-topnav .brand {
    margin-bottom: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}
.app-topnav .nav-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}
.app-topnav .nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}
.logout-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}
.logout-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}
.app-topnav .nav-links {
    margin-right: auto;
    margin-left: 2rem;
}
.ged-topnav .ged-brand {
    margin-right: 2rem;
}
.nav-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}
a:hover .nav-icon-circle {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}
/* Enterprise Double Bar Header */
.enterprise-header {
    display: block !important;
    margin-bottom: 0 !important;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.top-tier {
    background: #1e293b; /* Dark slate */
    color: #e2e8f0;
    padding: 0.25rem 2.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.top-tier-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-tier-actions a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.top-tier-actions a:hover {
    color: white;
}

.top-icon-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.user-profile-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 1.5rem;
}

.avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-profile-compact span {
    font-size: 0.85rem;
    font-weight: 500;
}

.logout-compact {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-compact:hover {
    background: #ef4444;
    color: white;
}

.bottom-tier {
    background: var(--bg-sidebar);
    padding: 1rem 2.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.brand-large {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.brand-large .brand-icon {
    width: 52px;
    height: 42px;
}

.tier-separator {
    width: 2px;
    height: 30px;
    background: var(--border-color);
}

.module-title-large {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

body.light-theme .enterprise-header {
    border-bottom: 1px solid var(--border-color);
}

body.light-theme .bottom-tier {
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-theme .tier-separator {
    background: rgba(15, 23, 42, 0.12);
}

/* ══════════════════════════════════════════════════════════════════════════
   MODERN CHOICE CELLS & FORM CONTROLS (CELLULES DE CHOIX MODERNES)
   ══════════════════════════════════════════════════════════════════════════ */

/* Global Select Modernization */
select, .form-control select, select.form-control, select.custom-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-card, #1e293b);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  padding-right: 32px !important;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  color: var(--text-primary, #f8fafc);
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

select:hover, .form-control select:hover, select.form-control:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background-color: rgba(30, 41, 59, 0.9);
}

select:focus, .form-control select:focus, select.form-control:focus {
  outline: none;
  border-color: var(--accent-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background-color: var(--bg-sidebar, #1e293b);
}

select option {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 8px 12px;
  font-weight: 500;
}

body.light-theme select, 
body.light-theme .form-control select, 
body.light-theme select.form-control {
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  border-color: #cbd5e1;
  color: #0f172a;
}

body.light-theme select:hover {
  border-color: #93c5fd;
  background-color: #f8fafc;
}

body.light-theme select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

body.light-theme select option {
  background-color: #ffffff;
  color: #0f172a;
}

/* Modern Segmented Choice Pills (.choice-pills / .segmented-control) */
.choice-pills-container {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  width: 100%;
  box-sizing: border-box;
}

.choice-pill-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  white-space: nowrap;
}

.choice-pill-btn:hover {
  color: var(--text-primary, #ffffff);
  background: rgba(255, 255, 255, 0.06);
}

.choice-pill-btn.active {
  color: #ffffff;
  background: var(--accent-color, #2563eb);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.choice-pill-btn.active.demandeur {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

.choice-pill-btn.active.riverain {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

/* Modern Choice Cards (.choice-card / .choice-cards-grid) */
.choice-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  width: 100%;
}

.choice-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-color, rgba(255, 255, 255, 0.1));
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.choice-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.choice-card-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

.choice-card-content {
  flex: 1;
  min-width: 0;
}

.choice-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  line-height: 1.2;
}

.choice-card-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary, #94a3b8);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.choice-card-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.2s;
}

/* Active Choice Cards */
.choice-card.active {
  border-color: var(--accent-color, #3b82f6);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

.choice-card.active .choice-card-check {
  background: var(--accent-color, #3b82f6);
  border-color: var(--accent-color, #3b82f6);
  color: #ffffff;
}

.choice-card.active.demandeur {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.choice-card.active.demandeur .choice-card-check {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.choice-card.active.riverain {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

.choice-card.active.riverain .choice-card-check {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}

/* Light Theme overrides for Choice Components */
body.light-theme .choice-pills-container {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.light-theme .choice-pill-btn {
  color: #64748b;
}

body.light-theme .choice-pill-btn:hover {
  color: #0f172a;
  background: #e2e8f0;
}

body.light-theme .choice-pill-btn.active {
  color: #ffffff;
}

body.light-theme .choice-card {
  border-color: #e2e8f0;
  background: #ffffff;
}

body.light-theme .choice-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

body.light-theme .choice-card-title {
  color: #0f172a;
}

body.light-theme .choice-card-subtitle {
  color: #64748b;
}

body.light-theme .choice-card-check {
  border-color: #cbd5e1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL OVERLAY & MODAL CONTAINER (SHARED)
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-container {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 12px;
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
}

body.light-theme .modal-container {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

body.light-theme .modal-header {
  border-bottom-color: #e2e8f0;
}

body.light-theme .modal-footer {
  border-top-color: #e2e8f0;
  background: #f8fafc;
}

/* ═══════════════════════════════════════════════════════════════════════════
   IK (INDEMNITÉS KILOMÉTRIQUES) & ROUTING COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════ */
.ik-autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.ik-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  max-height: 220px;
  overflow-y: auto;
  z-index: 2500;
  display: none;
}

.ik-autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease;
  font-size: 0.82rem;
  text-align: left;
}

.ik-autocomplete-item:last-child {
  border-bottom: none;
}

.ik-autocomplete-item:hover,
.ik-autocomplete-item.active {
  background: rgba(59, 130, 246, 0.2);
}

.ik-autocomplete-item strong {
  color: var(--text-primary);
  display: block;
}

.ik-autocomplete-item span {
  color: var(--text-secondary);
  font-size: 0.74rem;
  display: block;
  margin-top: 2px;
}

body.light-theme .ik-autocomplete-dropdown {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

body.light-theme .ik-autocomplete-item {
  border-bottom-color: #f1f5f9;
}

body.light-theme .ik-autocomplete-item:hover,
body.light-theme .ik-autocomplete-item.active {
  background: rgba(59, 130, 246, 0.1);
}

/* Steps List */
.ik-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  animation: fadeInStep 0.2s ease;
}

@keyframes fadeInStep {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ik-step-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.ik-step-badge.start-badge {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
}

.ik-step-badge.dest-badge {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.ik-step-remove-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  width: 32px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: all 0.15s;
}

.ik-step-remove-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

/* Leaflet Map in IK Modal */
#ik-leaflet-map {
  width: 100%;
  height: 100%;
  min-height: 440px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #0f172a;
  z-index: 10;
}

.ik-map-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 440px;
}

.ik-map-overlay-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.ik-marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 11px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}



