/* ============================================
   GestCan - Feuille de style globale
   Système de gestion avec navigation cohérente
   ============================================ */

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #F9F4EC;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* ============================================
   VARIABLES CSS (Couleurs personnalisées)
   ============================================ */
:root {
    --bg-color: #F9F4EC;
    --primary-color: #193F74;
    --secondary-color: #D08128;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #333;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
    --transition-base: all 0.3s ease;
    --border-radius: 8px;
    --border-radius-lg: 15px;
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    --spacing-xl: 40px;
}

/* ============================================
   HEADER / NAVIGATION PRINCIPALE
   ============================================ */
.main-header {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.site-logo {
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-logo:hover {
    color: var(--secondary-color);
}

/* Navigation Menu */
.main-nav {
    display: flex;
    gap: 5px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: var(--border-radius);
    transition: var(--transition-base);
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
    background: var(--secondary-color);
}

/* User Section */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.btn-logout {
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 800px;
}

.container-lg {
    max-width: 1400px;
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header h1 {
    color: var(--primary-color);
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

.page-title {
    color: var(--primary-color);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.page-subtitle {
    color: #666;
    font-size: 16px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.card h2,
.card h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--light-color);
}

.card p {
    color: #666;
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.welcome-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.welcome-card p {
    color: #666;
    line-height: 1.6;
}

.admin-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--primary-color);
    margin-top: var(--spacing-md);
}

.permissions-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s;
    border-left: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card.primary {
    border-left-color: var(--primary-color);
}

.stat-card.secondary {
    border-left-color: var(--secondary-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-icon.primary {
    background: var(--primary-color);
    color: white;
}

.stat-icon.secondary {
    background: var(--secondary-color);
    color: white;
}

.stat-icon.success {
    background: var(--success-color);
    color: white;
}

.stat-icon.warning {
    background: var(--warning-color);
    color: white;
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    border: none;
    padding: 0;
}

.stat-card .value {
    color: var(--dark-color);
    font-size: 28px;
    font-weight: bold;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-color);
    font-weight: 500;
    font-size: 14px;
}

.form-group label .required {
    color: var(--danger-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    transition: var(--transition-base);
    font-family: inherit;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 63, 116, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 13px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkboxes personnalisées */
.checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition-base);
    cursor: pointer;
    margin-bottom: 10px;
}

.checkbox-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(25, 63, 116, 0.2);
}

.checkbox-item input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    margin: 0 !important;
    flex: 1;
}

.remember-me {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.remember-me input {
    margin-right: 8px;
    cursor: pointer;
}

.remember-me label {
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

/* Containers spéciaux pour formulaires */
.droits-container {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    background: var(--light-color);
}

.droits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: var(--spacing-md);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0f2d52;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #b8711f;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-light {
    background: white;
    color: var(--dark-color);
    border: 2px solid var(--border-color);
}

.btn-light:hover:not(:disabled) {
    background: var(--light-color);
    border-color: var(--primary-color);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-outline-secondary:hover:not(:disabled) {
    background: var(--secondary-color);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 17px;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.btn-group-justified .btn {
    flex: 1;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--spacing-md);
}

thead {
    background: var(--primary-color);
    color: white;
}

th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    font-size: 14px;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tbody tr {
    background: white;
    transition: var(--transition-base);
}

tbody tr:hover {
    background: #faf8f5;
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-striped tbody tr:nth-child(even) {
    background: #faf8f5;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-primary {
    background: rgba(25, 63, 116, 0.2);
    color: var(--primary-color);
}

.badge-secondary {
    background: rgba(208, 129, 40, 0.2);
    color: var(--secondary-color);
}

.badge-error {
    background: var(--warning-color);
    color: #333;
}

.badge-admin {
    background: var(--danger-color);
    color: white;
}

.badge-resp {
    background: var(--info-color);
    color: white;
}

.badge-user {
    background: var(--success-color);
    color: white;
}

.badge-famille {
    background: var(--secondary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
}

.permission-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    margin: 5px;
    font-size: 13px;
    font-weight: 500;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border-left: 4px solid #c33;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border-left: 4px solid #3c3;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #856404;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #0c5460;
}

/* ============================================
   LOGIN CONTAINER (Page de connexion)
   ============================================ */
body.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-md);
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    opacity: 0.9;
    font-size: 14px;
}

.login-body {
    padding: 40px 30px;
}

.login-footer {
    text-align: center;
    padding: 20px 30px 30px;
    color: #666;
    font-size: 13px;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

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

.text-muted {
    color: #999;
}

.text-primary {
    color: var(--primary-color);
}

.text-secondary {
    color: var(--secondary-color);
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

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

.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }

.no-data,
.no-permissions,
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: #999;
    font-style: italic;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: #ccc;
    margin-bottom: 20px;
}

/* ============================================
   PASSWORD STRENGTH INDICATOR
   ============================================ */
.password-strength {
    height: 5px;
    border-radius: 3px;
    margin-top: 8px;
    background: var(--border-color);
    transition: var(--transition-base);
}

.password-strength.weak {
    background: var(--danger-color);
    width: 33%;
}

.password-strength.medium {
    background: var(--warning-color);
    width: 66%;
}

.password-strength.strong {
    background: var(--success-color);
    width: 100%;
}

/* ============================================
   DEBUG PANEL
   ============================================ */
.debug-panel {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.debug-panel h3 {
    margin-top: 0;
    color: #495057;
}

.debug-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.debug-panel li {
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.debug-panel li:last-child {
    border-bottom: none;
}

/* ============================================
   VEHICULES SPECIFIC STYLES
   ============================================ */
.vehicles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.vehicle-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    border-left: 4px solid var(--primary-color);
}

.vehicle-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.vehicle-card.in-use {
    border-left-color: var(--secondary-color);
}

.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.vehicle-immat {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color);
}

.vehicle-info {
    margin-bottom: 15px;
}

.vehicle-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.vehicle-info-item:last-child {
    border-bottom: none;
}

.vehicle-info-label {
    color: #666;
    font-size: 14px;
}

.vehicle-info-value {
    font-weight: 500;
    color: var(--dark-color);
}

.vehicle-status {
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    margin-top: 15px;
}

.status-active {
    background: rgba(208, 129, 40, 0.1);
    border: 1px solid var(--secondary-color);
}

.vehicle-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* ============================================
   LIVRAISONS SPECIFIC STYLES
   ============================================ */
.date-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.date-selector input[type="date"] {
    flex: 1;
}

.documents-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.documents-list {
    border-right: 2px solid var(--border-color);
    overflow-y: auto;
    max-height: 600px;
}

.document-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    color: inherit;
    display: block;
}

.document-item:hover {
    background: #faf8f5;
}

.document-item.active {
    background: var(--primary-color);
    color: white;
}

.document-detail {
    padding: 30px;
    overflow-y: auto;
    max-height: 600px;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.info-item {
    background: #faf8f5;
    padding: 12px;
    border-radius: var(--border-radius);
}

.info-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.info-item .value {
    color: var(--dark-color);
    font-weight: 500;
}

.total-section {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
}

.total-section .label {
    font-size: 18px;
    font-weight: 500;
}

.total-section .amount {
    font-size: 28px;
    font-weight: bold;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        padding: 10px;
        box-shadow: var(--shadow-sm);
    }

    .main-nav.active {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .header-container {
        flex-wrap: wrap;
    }

    .header-left {
        flex: 1;
        justify-content: space-between;
    }

    .documents-container {
        grid-template-columns: 1fr;
    }

    .documents-list {
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .page-container {
        padding: 20px 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 24px;
    }

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

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

    .user-section {
        flex-direction: column;
        gap: 10px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

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

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

    table {
        font-size: 13px;
    }

    th, td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .login-header h1 {
        font-size: 24px;
    }

    .login-body {
        padding: 30px 20px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .site-logo {
        font-size: 20px;
    }

    .vehicle-immat {
        font-size: 18px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .main-header,
    .btn,
    .mobile-menu-toggle,
    .btn-logout,
    .vehicle-actions {
        display: none;
    }

    body {
        background: white;
    }

    .card,
    .vehicle-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .page-container {
        padding: 0;
    }
}

/* ============================================
   MODULES PV / ÉTAT VÉHICULES / TABLEAU DE BORD FLOTTE
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 var(--spacing-md);
}
.form-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-sm);
}
.stat-card.danger { border-left-color: var(--danger-color); }
.stat-card small { color: #777; font-size: 13px; }
.alert-danger { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger-color); }
.immat { font-family: 'Courier New', monospace; letter-spacing: .5px; }

.card-alerte { border-left: 5px solid var(--danger-color); }

/* Filtres */
.filtres {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm) var(--spacing-md);
    align-items: flex-end;
}
.filtres .form-group { margin-bottom: 0; min-width: 150px; flex: 1 1 150px; }
.filtres .filtres-actions { display: flex; gap: var(--spacing-sm); flex: 0 0 auto; }

/* Choix du type de PV */
.choix-type {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}
.choix-type-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-base);
}
.choix-type-item.actif { border-color: var(--primary-color); background: rgba(25, 63, 116, .06); }
.bloc-conditionnel { display: none; padding: var(--spacing-md); background: #faf8f5; border-radius: var(--border-radius); }
.exces-info { font-weight: 600; padding: 8px 12px; border-radius: var(--border-radius); }
.exces-info:empty { display: none; }
.exces-nul   { background: #d1ecf1; color: #0c5460; }
.exces-leger { background: #fff3cd; color: #856404; }
.exces-moyen { background: #ffe0b2; color: #8a4b00; }
.exces-fort  { background: #f8d7da; color: #721c24; }
.exces-grave { background: #721c24; color: #fff; }

.suggestion-box {
    margin-top: 8px;
    padding: 10px;
    border-radius: var(--border-radius);
    background: #e8f0fb;
    font-size: 14px;
}
.suggestion-box.vide { background: #f5f5f5; color: #777; }
.suggestion-ligne { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }

/* État véhicule */
.etat-grid {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}
@media (max-width: 900px) { .etat-grid { grid-template-columns: 1fr; } }
.etat-grid > .card { margin-bottom: 0; }
.schema-vehicule { width: 100%; max-width: 260px; display: block; margin: 0 auto; }
.schema-vehicule text { font-size: 13px; fill: #193F74; font-weight: 600; }
.legende { font-size: 13px; text-align: center; margin-top: 10px; }
.legende span { display: inline-block; width: 14px; height: 14px; border: 1px solid #193F74; border-radius: 3px; vertical-align: middle; margin: 0 4px 0 10px; }

.dommages-liste { display: grid; gap: var(--spacing-md); }
.dommage-card {
    border: 2px solid var(--border-color);
    border-left-width: 6px;
    border-radius: var(--border-radius);
    padding: 15px;
    background: #fff;
}
.dommage-card.gravite-mineur    { border-left-color: var(--info-color); }
.dommage-card.gravite-moyen     { border-left-color: var(--warning-color); }
.dommage-card.gravite-important { border-left-color: var(--danger-color); }
.dommage-entete { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.dommage-corps { display: flex; gap: 15px; align-items: flex-start; }
.dommage-photo img { width: 140px; height: 105px; object-fit: cover; border-radius: var(--border-radius); border: 1px solid var(--border-color); }
@media (max-width: 600px) { .dommage-corps { flex-direction: column; } .dommage-photo img { width: 100%; height: auto; } }
.dommage-suivi { margin-top: 12px; }
.dommage-suivi summary { cursor: pointer; color: var(--primary-color); font-weight: 600; }
.dommage-suivi form { margin-top: 12px; }

/* Tableau de bord */
.ligne-active td { background: rgba(208, 129, 40, .12) !important; }
.mini-pv { white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--spacing-md); }
.detail-grid h3 { color: var(--primary-color); margin-bottom: 8px; font-size: 16px; }
.liste-detail { list-style: none; padding: 0; }
.liste-detail li { padding: 6px 0; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.table-triable th[data-tri]:hover { background: rgba(255, 255, 255, .12); }
.sous-titre { color: var(--primary-color); font-size: 17px; margin: var(--spacing-md) 0 var(--spacing-sm); }

/* ============================================
   SIGNALEMENTS
   ============================================ */
.sig-ligne {
    display: grid;
    grid-template-columns: 240px 1fr auto;
    gap: var(--spacing-sm);
    align-items: start;
    margin-bottom: var(--spacing-sm);
}
.sig-ligne textarea { min-height: 44px; }
@media (max-width: 768px) {
    .sig-ligne { grid-template-columns: 1fr auto; }
    .sig-ligne textarea { grid-column: 1 / -1; grid-row: 2; }
}
.sig-aide-dommage {
    display: none;
    margin-top: var(--spacing-sm);
    background: #fdf1e3;
    border-left: 4px solid var(--secondary-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}
.sig-summary { cursor: pointer; color: var(--primary-color); font-weight: 600; font-size: 16px; }

.sig-liste { display: flex; flex-direction: column; gap: var(--spacing-sm); }
.sig-carte {
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--danger-color);
    border-radius: var(--border-radius);
    padding: 12px 15px;
    background: #fff;
    scroll-margin-top: 90px;
}
.sig-carte:target { box-shadow: 0 0 0 3px rgba(208, 129, 40, .45); }
.sig-carte.sig-corrige    { border-left-color: var(--success-color); background: #fbfdfb; }
.sig-carte.sig-sans_suite { border-left-color: #6c757d; background: #fafafa; }
.sig-entete { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sig-entete .immat { font-weight: 700; margin-right: 4px; }
.sig-date { margin-left: auto; color: #777; font-size: 13px; }
.sig-commentaire { margin: 8px 0 4px; }
.sig-meta { margin: 0; color: #666; font-size: 13px; }
.sig-correction {
    margin-top: 8px;
    padding: 6px 10px;
    background: #eef7ee;
    border-radius: 6px;
    font-size: 13px;
}
.sig-sans_suite .sig-correction { background: #f0f0f0; }
.sig-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-start; margin-top: 10px; }
.sig-actions details summary { cursor: pointer; color: var(--primary-color); font-weight: 600; font-size: 14px; }
.sig-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 280px; max-width: 520px; }
.sig-form .form-group { margin-bottom: 0; }

/* ============================================
   POINTS CHAUFFEURS
   ============================================ */
.points-resume { display: flex; flex-wrap: wrap; gap: var(--spacing-lg); align-items: center; }
.points-total {
    width: 120px; height: 120px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: 800; color: #fff;
    flex-shrink: 0;
}
.points-total small { font-size: 15px; font-weight: 600; opacity: .85; margin-left: 2px; }
.points-bon    { background: var(--success-color); }
.points-moyen  { background: var(--secondary-color); }
.points-faible { background: var(--danger-color); }
.points-bon-txt    { color: var(--success-color); }
.points-moyen-txt  { color: var(--secondary-color); }
.points-faible-txt { color: var(--danger-color); }
.points-detail { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 260px; }
.points-detail > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; border-bottom: 1px dashed var(--border-color); padding-bottom: 6px; }
.points-detail span { flex: 1 1 220px; color: #555; }
.points-detail strong { font-size: 18px; min-width: 50px; text-align: right; }
.points-detail em { flex-basis: 100%; font-size: 12px; color: #888; }
.points-pastille {
    display: inline-block; min-width: 44px; padding: 4px 10px;
    border-radius: 20px; color: #fff; font-weight: 700; text-align: center;
}
.table-points td { vertical-align: top; }

.criteres-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--spacing-sm); margin: var(--spacing-sm) 0; }
.critere {
    display: flex; gap: 10px; align-items: flex-start;
    border: 1px solid var(--border-color); border-radius: var(--border-radius);
    padding: 10px 12px; cursor: pointer; background: #fff;
}
.critere input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--primary-color); }
.critere small { display: block; color: #777; font-size: 12px; margin-top: 2px; }
.critere-alerte { border-color: #f1b0b7; background: #fff7f8; }
.decisions { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); margin: var(--spacing-md) 0 6px; }
.decision {
    display: flex; gap: 8px; align-items: center;
    border: 2px solid var(--border-color); border-radius: var(--border-radius);
    padding: 8px 14px; cursor: pointer; font-weight: 600;
}
.decision:has(input:checked) { border-color: var(--primary-color); background: #eef2f8; }
.decision:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.ligne-alerte { background: #fff3f3; }

/* Infobulles du tableau des points */
.tip { cursor: help; border-bottom: 1px dotted #999; display: inline-block; padding-bottom: 1px; }
.tip:focus { outline: 2px solid var(--secondary-color); outline-offset: 2px; }
#tipFlottant {
    display: none;
    position: fixed;
    z-index: 2000;
    max-width: min(520px, calc(100vw - 20px));
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.45;
}
#tipFlottant .tip-section + .tip-section { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border-color); }
#tipFlottant .tip-titre { display: block; color: var(--primary-color); margin-bottom: 4px; }
#tipFlottant ul { margin: 0; padding-left: 18px; }
#tipFlottant li { margin-bottom: 4px; }
#tipFlottant .tip-vide { margin: 0; color: #888; }
#tipFlottant .badge { font-size: 11px; }

/* ============================================
   ACCUEIL : ACTIONS RAPIDES
   ============================================ */
.carte-actions { display: flex; flex-direction: column; gap: var(--spacing-md); }
.en-cours-bandeau {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
    background: #fff8e1; border-left: 5px solid var(--secondary-color);
    border-radius: var(--border-radius); padding: 12px 15px;
}
.en-cours-titre { font-weight: 700; color: var(--secondary-color); }
.en-cours-bandeau .immat { font-size: 20px; color: var(--primary-color); }
.action-principale {
    display: flex; align-items: center; justify-content: center;
    min-height: 64px; padding: 14px 20px;
    background: var(--primary-color); color: #fff; text-decoration: none;
    font-size: 20px; font-weight: 700; border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}
.action-principale:active { transform: scale(.98); }
.action-restituer { background: var(--secondary-color); }
.actions-tuiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--spacing-sm); }
.tuile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 84px; padding: 10px 6px;
    background: var(--bg-color); border: 1px solid var(--border-color); border-radius: var(--border-radius);
    color: var(--primary-color); text-decoration: none; font-weight: 600; font-size: 14px; text-align: center;
}
.tuile span { font-size: 28px; line-height: 1; }
.tuile:active { background: #efe6d6; }
.actions-alertes { display: flex; flex-direction: column; gap: 6px; }
.actions-alertes a {
    display: block; padding: 10px 12px; border-radius: var(--border-radius);
    background: #fff3f3; color: var(--danger-color); text-decoration: none; font-weight: 600; font-size: 14px;
}

/* ============================================
   BARRE DE NAVIGATION BASSE (SMARTPHONE)
   ============================================ */
.barre-bas { display: none; }
.nav-mobile-seul { display: none !important; }

@media (max-width: 992px) {
    .barre-bas {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
        background: var(--primary-color);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, .2);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .barre-bas a, .barre-bas button {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px; min-height: 60px; padding: 6px 1px;
        color: rgba(255, 255, 255, .85); text-decoration: none; font-size: 10px; font-weight: 600;
        background: none; border: none; font-family: inherit; cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .barre-bas a > span:last-child, .barre-bas button > span:last-child {
        max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .barre-bas-ico { font-size: 22px; line-height: 1; }
    .barre-bas a:active, .barre-bas button:active { background: rgba(255, 255, 255, .18); }
    .barre-bas a.active { color: #fff; background: rgba(255, 255, 255, .12); border-top: 3px solid var(--secondary-color); }
    body.avec-barre-bas { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

    /* En-tête compact */
    .header-container { min-height: 56px; padding: 0 12px; flex-wrap: nowrap; }
    .site-logo { font-size: 20px; }
    .header-right { gap: 8px; }
    .user-section { padding: 4px; background: none; flex-direction: row; }
    .user-name, .btn-logout { display: none; }
    .user-avatar { width: 34px; height: 34px; font-size: 13px; }

    /* Menu complet en panneau plein écran */
    .main-nav {
        position: fixed; top: 56px; bottom: 0; left: 0; right: 0;
        overflow-y: auto; z-index: 1050; gap: 4px; padding: 12px;
    }
    body.avec-barre-bas .main-nav { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
    .main-nav .nav-link { padding: 14px 16px; font-size: 17px; }
    .nav-mobile-seul { display: flex !important; margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, .2); }
    body.menu-ouvert { overflow: hidden; }
    /* Le hamburger du haut est doublé par le bouton "Menu" de la barre basse */
    body.avec-barre-bas .mobile-menu-toggle { display: none; }
}

/* ============================================
   AJUSTEMENTS SMARTPHONE
   ============================================ */
@media (max-width: 768px) {
    /* 16px minimum : évite le zoom automatique d'iOS sur les champs */
    input, select, textarea { font-size: 16px !important; }
    input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
    .btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; }
    .btn-sm { min-height: 40px; }
    .card { padding: 16px; border-radius: var(--border-radius); margin-bottom: 16px; }
    .page-container { padding: 14px 10px; }
    .page-title, .page-header h1 { font-size: 22px; }
    .page-header { gap: 10px; margin-bottom: 14px; }
    .filtres .form-group { flex: 1 1 100%; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-card .value { font-size: 24px; }

    .actions-tuiles { grid-template-columns: repeat(2, 1fr); }

    .points-resume { gap: var(--spacing-md); }
    .points-total { width: 90px; height: 90px; font-size: 30px; }
    .criteres-grid { grid-template-columns: 1fr; }
    .decisions { flex-direction: column; }
    .decision { padding: 12px 14px; }

    .sig-date { margin-left: 0; width: 100%; }
    .sig-form { min-width: 0; max-width: none; }
    .sig-actions { flex-direction: column; align-items: stretch; }
    .sig-actions details summary { padding: 10px 0; }

    /* Infobulles en "tiroir" au-dessus de la barre basse */
    #tipFlottant {
        left: 8px !important; right: 8px !important; top: auto !important;
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        max-width: none; max-height: 55vh;
    }

    /* Tableaux transformés en cartes */
    .table-cartes thead { display: none; }
    .table-cartes, .table-cartes tbody, .table-cartes tr, .table-cartes td { display: block; width: 100%; }
    .table-cartes tr {
        background: #fff; border: 1px solid var(--border-color); border-radius: var(--border-radius);
        margin-bottom: 10px; padding: 6px 10px;
    }
    .table-cartes td {
        display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
        border: none !important; padding: 7px 0 !important; text-align: right;
    }
    .table-cartes td + td { border-top: 1px dashed var(--border-color) !important; }
    .table-cartes td::before {
        content: attr(data-label); flex-shrink: 0;
        font-weight: 600; color: var(--primary-color); text-align: left;
    }
    .table-cartes td.td-titre { font-size: 16px; font-weight: 700; text-align: left; justify-content: flex-start; flex-wrap: wrap; }
    .table-cartes td.td-titre::before, .table-cartes td.td-action::before { content: none; }
    .table-cartes td.td-action { justify-content: stretch; }
    .table-cartes td.td-action .btn { width: 100%; }
    .table-cartes td.td-libre { flex-direction: column; text-align: left; }
    .table-cartes td.td-libre:empty { display: none; }
    .table-cartes .tip { text-align: right; }
    .table-container:has(.table-cartes) { overflow: visible; }
}

/* ============================================
   LIVRAISONS
   ============================================ */
.action-livraisons {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    min-height: 56px; padding: 12px 18px;
    background: #eef2f8; border: 2px solid var(--primary-color); border-radius: var(--border-radius-lg);
    color: var(--primary-color); text-decoration: none; font-size: 18px; font-weight: 700;
}
.action-livraisons span { font-size: 14px; font-weight: 600; color: var(--secondary-color); }

.liv-nav-date { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.liv-nav-date .btn { width: auto; flex: 1; }
.liv-resume { padding: 14px 16px; }
.liv-barre { height: 10px; background: #e9e4da; border-radius: 6px; overflow: hidden; }
.liv-barre span { display: block; height: 100%; background: var(--success-color); transition: width .3s; }
.liv-compteurs { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 14px; }
.liv-compteurs strong { font-size: 18px; }
.liv-journal {
    display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
    margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border-color); font-size: 14px;
}
.liv-filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; position: sticky; top: 72px; z-index: 5; }
.liv-filtres input[type="search"] { flex: 1 1 220px; min-height: 46px; }
.liv-tournee select { min-height: 46px; }

.liv-liste { display: flex; flex-direction: column; gap: 10px; }
.liv-carte {
    background: #fff; border: 1px solid var(--border-color); border-left: 6px solid var(--secondary-color);
    border-radius: var(--border-radius); padding: 12px 14px; scroll-margin-top: 130px;
}
.liv-carte.liv-livre     { border-left-color: var(--success-color); background: #f6fbf6; }
.liv-carte.liv-non_livre { border-left-color: var(--danger-color);  background: #fff7f7; }
.liv-entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.liv-client { font-size: 17px; color: var(--primary-color); margin-right: 6px; }
.liv-ordre {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; margin-right: 6px; border-radius: 50%;
    background: var(--primary-color); color: #fff; font-size: 13px; font-weight: 700;
}
.liv-adresse { margin-top: 6px; font-size: 14px; }
.liv-gps { margin-left: 6px; white-space: nowrap; font-weight: 600; }
.liv-infos { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 13px; color: #555; }
.liv-note { margin-top: 6px; font-size: 13px; background: #fff8e1; padding: 4px 8px; border-radius: 4px; }
.liv-contenu { margin-top: 6px; font-size: 13px; }
.liv-contenu summary { cursor: pointer; color: var(--primary-color); font-weight: 600; padding: 4px 0; }
.liv-contenu ul { margin: 4px 0 0; padding-left: 18px; }
.liv-fait { margin-top: 8px; font-size: 13px; }
.liv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-top: 10px; }
.liv-actions form { margin: 0; }
.liv-btn-livre { min-height: 50px; min-width: 160px; font-size: 17px; font-weight: 700; }
.liv-non summary {
    cursor: pointer; color: var(--danger-color); font-weight: 600;
    padding: 12px 10px; min-height: 46px; display: flex; align-items: center;
}
.liv-non form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; min-width: 260px; }

@media (max-width: 992px) {
    .liv-filtres { top: 56px; background: var(--bg-color); padding: 6px 0; }
}
@media (max-width: 768px) {
    .liv-actions { flex-direction: column; align-items: stretch; }
    .liv-btn-livre { width: 100%; }
    .liv-non form { min-width: 0; }
    .liv-nav-date .btn { font-size: 13px; }
}

/* ============================================
   ÉTATS DES LIEUX
   ============================================ */
[hidden] { display: none !important; }
.sr-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.el-etapes { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; position: sticky; top: 72px; z-index: 6; }
.el-etape {
    flex: 1 1 auto; text-align: center; padding: 8px 10px; border-radius: 20px;
    background: #f1ece3; color: var(--primary-color); text-decoration: none; font-weight: 600; font-size: 13px;
}
.el-etape.ok { background: #e3f4e6; color: var(--success-color); }
.el-etape.ok::before { content: '✓ '; }

.el-infos { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }

/* Photos */
.el-photos-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.el-photo-case {
    border: 1px solid var(--border-color); border-radius: var(--border-radius);
    padding: 8px; background: #fff; display: flex; flex-direction: column; gap: 6px;
}
.el-photo-case.manquante { border: 2px dashed var(--secondary-color); background: #fffaf2; }
.el-vignettes { display: flex; flex-wrap: wrap; gap: 6px; }
.el-vignette { position: relative; }
.el-vignette img { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-color); display: block; }
.el-vignette form { position: absolute; top: -6px; right: -6px; margin: 0; }
.el-vignette button {
    width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--danger-color); color: #fff; font-size: 12px; line-height: 24px; padding: 0;
}
.el-btn-photo {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px; padding: 8px 12px; border-radius: var(--border-radius);
    background: var(--primary-color); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; position: relative;
}
.el-btn-photo-large { width: 100%; min-height: 54px; font-size: 16px; }
.el-btn-photo.en-cours { opacity: .6; pointer-events: none; }
.el-btn-photo.en-cours::after { content: ' ⏳'; }

/* Schéma */
.schema-el { max-width: 900px; margin: 0 auto; }
.schema-onglets { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 8px; }
.schema-onglet {
    flex: 1 0 auto; padding: 10px 12px; min-height: 44px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius); background: #fff; color: var(--primary-color);
    font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit;
}
.schema-onglet.actif { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.schema-nb { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger-color); color: #fff; font-size: 12px; }
.schema-vue svg { width: 100%; height: auto; display: block; background: #fbfcfe; border: 1px solid var(--border-color); border-radius: var(--border-radius); touch-action: manipulation; }
.schema-interactif svg { cursor: crosshair; }
/* (repères : voir « Schéma v2 » plus bas) */
.legende-marqueurs { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 12px; margin: 8px 0 12px; }
.lm { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: -8px; }
.lm.m-nouveau { background: #dc3545; } .lm.m-a-verifier { background: #0d6efd; }
.lm.m-confirme { background: #fd7e14; } .lm.m-absent { background: #28a745; }
.el-aide { background: #eef2f8; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.el-aide.mode-placer { background: #f3e8ff; border: 2px solid #6f42c1; }

.el-form-dommage { margin: 12px 0; padding: 14px; border: 2px solid var(--primary-color); border-radius: var(--border-radius); background: #fff; scroll-margin-top: 90px; }
.el-form-dommage h3 { margin: 0 0 10px; color: var(--primary-color); font-size: 17px; }

/* Liste des dommages */
.el-dommages { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.el-dommage {
    border: 1px solid var(--border-color); border-left: 5px solid #fd7e14; border-radius: var(--border-radius);
    padding: 10px 12px; background: #fff; scroll-margin-top: 110px; transition: box-shadow .3s;
}
.el-dommage.nouveau { border-left-color: #dc3545; }
.el-dommage.a-verifier { border-left-color: #0d6efd; background: #f5f9ff; }
.el-dommage.surbrillance, .dommage-card.surbrillance { box-shadow: 0 0 0 3px #6f42c1; }
.el-dommage-entete { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.el-num {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
    border-radius: 50%; background: var(--primary-color); color: #fff; font-size: 12px; font-weight: 700; margin-right: 4px;
}
.el-dommage-desc { margin: 6px 0 4px; font-size: 14px; }
.el-dommage .el-vignettes { margin-top: 8px; }
.el-dommage-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.el-constat { display: flex; flex-direction: column; gap: 8px; }
.el-constat-choix { display: flex; flex-wrap: wrap; gap: 6px; }
.el-constat-choix label {
    display: flex; align-items: center; gap: 6px; padding: 8px 10px; min-height: 44px;
    border: 1px solid var(--border-color); border-radius: var(--border-radius); cursor: pointer; font-size: 14px;
}
.el-constat-choix label:has(input:checked) { border-color: var(--primary-color); background: #eef2f8; font-weight: 600; }
.el-constat-boutons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Contrôles */
.el-controles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.el-controle { border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 10px 12px; background: #fff; }
.el-controle.res-anomalie { border-left: 5px solid var(--danger-color); }
.el-controle.res-ok { border-left: 5px solid var(--success-color); }
.el-controle-lib { font-weight: 600; margin-bottom: 6px; }
.el-controle-choix { display: flex; gap: 6px; }
.el-choix { flex: 1; position: relative; }
.el-choix input { position: absolute; opacity: 0; }
.el-choix span {
    display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px;
    border: 1px solid var(--border-color); border-radius: var(--border-radius); cursor: pointer; font-size: 14px;
}
.el-choix-ok input:checked + span       { background: #e3f4e6; border-color: var(--success-color); font-weight: 700; }
.el-choix-anomalie input:checked + span { background: #fde8ea; border-color: var(--danger-color); font-weight: 700; }
.el-choix-na input:checked + span       { background: #eee; border-color: #999; font-weight: 700; }
.el-controle-com { margin-top: 6px; display: none; }
.el-controle:has(.el-choix-anomalie input:checked) .el-controle-com,
.el-controle-com:not(:placeholder-shown) { display: block; }

.el-bloquants { margin: 10px 0; padding-left: 18px; color: var(--danger-color); }
.el-btn-valider { min-height: 54px; font-size: 17px; width: 100%; max-width: 420px; }
.el-btn-valider:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 992px) { .el-etapes { top: 56px; } }
@media (max-width: 768px) {
    .el-photos-grille { grid-template-columns: 1fr 1fr; }
    .schema-onglet { font-size: 13px; padding: 8px; }
    .el-etape { font-size: 12px; padding: 6px 8px; }
}

/* Impression : toutes les vues, sans formulaires */
@media print {
    .main-header, .barre-bas, .btn-group, .el-etapes, form:not(.el-garder), .el-aide, .el-garder .form-actions, #btnSansPosition, .schema-onglets { display: none !important; }
    body { padding: 0 !important; background: #fff; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .schema-vue { display: block !important; margin-bottom: 8px; break-inside: avoid; }
    .schema-vue svg { max-height: 190px; width: auto; }
    .el-vignette img { width: 110px; height: 110px; }
}

/* ============================================
   SCHÉMA v2 : vue éclatée, zones (cercles / ellipses)
   ============================================ */
.schema-outils { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.schema-outils button {
    min-height: 42px; padding: 8px 12px; border-radius: var(--border-radius); cursor: pointer;
    border: 1px solid var(--border-color); background: #fff; color: var(--primary-color); font-weight: 600; font-family: inherit; font-size: 14px;
}
.schema-outils .schema-mode.actif { background: #eef2f8; border-color: var(--primary-color); }
.schema-outils .schema-dessiner { margin-left: auto; background: var(--secondary-color); border-color: var(--secondary-color); color: #fff; }
.schema-el.dessin .schema-dessiner { background: #6f42c1; border-color: #6f42c1; }

.schema-el.mode-eclate .schema-onglets { display: none; }
.schema-grille {
    display: grid; gap: 8px; align-items: center;
    grid-template-columns: 22fr 40fr 22fr;
    grid-template-areas: ". gauche ." "avant dessus arriere" ". droite .";
}
.schema-vue[data-vue="gauche"]  { grid-area: gauche; }
.schema-vue[data-vue="droite"]  { grid-area: droite; }
.schema-vue[data-vue="avant"]   { grid-area: avant; }
.schema-vue[data-vue="arriere"] { grid-area: arriere; }
.schema-vue[data-vue="dessus"]  { grid-area: dessus; }
.schema-el.mode-eclate .schema-vue { display: block; }
.schema-el.mode-face .schema-grille { display: block; }
.schema-el.mode-face .schema-vue { display: none; }
.schema-el.mode-face .schema-vue.actif { display: block; }
.schema-el.mode-face .schema-zoom { display: none; }
.schema-vue-titre { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--primary-color); margin-bottom: 2px; }
.schema-zoom { border: none; background: none; cursor: pointer; font-size: 14px; padding: 2px 4px; }
.schema-vue svg { touch-action: manipulation; }
.schema-el.dessin svg { touch-action: none; cursor: crosshair; outline: 3px dashed #6f42c1; outline-offset: -3px; }

.schema-el .marqueur { cursor: pointer; color: #fd7e14; }
.schema-el .marqueur .zone { fill: currentColor; fill-opacity: .22; stroke: currentColor; }
.schema-el .marqueur .pastille { fill: currentColor; stroke: #fff; }
.schema-el .marqueur text { fill: #fff; font-weight: 700; pointer-events: none; }
.schema-el .marqueur:focus .zone, .schema-el .marqueur:hover .zone { fill-opacity: .4; }
.schema-el .marqueur.m-nouveau    { color: #dc3545; }
.schema-el .marqueur.m-a-verifier { color: #0d6efd; }
.schema-el .marqueur.m-confirme,
.schema-el .marqueur.m-existant   { color: #fd7e14; }
.schema-el .marqueur.m-absent     { color: #28a745; }
.schema-el .marqueur.m-temp       { color: #6f42c1; }
.schema-el .marqueur.m-temp .zone { stroke-dasharray: 6 4; fill-opacity: .3; animation: pulse-m 1.2s infinite; }
@keyframes pulse-m { 50% { fill-opacity: .12; } }

input[type="range"] { width: 100%; accent-color: var(--primary-color); }
.img-schema-apercu { width: 100%; max-height: 110px; object-fit: contain; background: #fff; border: 1px solid var(--border-color); border-radius: 6px; }

@media (max-width: 700px) {
    .schema-grille { gap: 4px; }
    .schema-vue-titre { font-size: 10px; }
    .schema-outils .schema-dessiner { margin-left: 0; flex: 1 1 100%; }
}
@media print {
    .schema-outils, .schema-zoom { display: none !important; }
    .schema-el .schema-grille { display: grid !important; }
    .schema-el .schema-vue { display: block !important; }
    .schema-vue svg { max-height: none; width: 100%; }
}

/* Fiche véhicule : le schéma (vue éclatée) prend toute la largeur, le formulaire passe dessous */
.etat-grid { grid-template-columns: 1fr !important; }

/* ============================================
   COMPTES EXTERNES PARTAGÉS
   ============================================ */
.bandeau-externe {
    background: #fff3cd; color: #664d03; border-bottom: 2px solid #ffc107;
    padding: 8px 16px; font-size: 14px; text-align: center;
}
.bandeau-externe a { font-weight: 600; margin-left: 4px; }
.page-identification { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg-color); }
.identification-boite {
    width: 100%; max-width: 440px; background: #fff; border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md); padding: 24px 20px;
}
.identification-boite h1 { color: var(--primary-color); font-size: 24px; margin: 0 0 10px; }
.identification-boite p { font-size: 14px; color: #555; }
.identification-atteste { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 14px 0; cursor: pointer; }
.identification-atteste input { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }

/* ============================================
   RÉCLAMATIONS CLIENTS
   ============================================ */
.sig-carte.rec-en_cours { border-left-color: var(--warning-color); }
.sig-carte.rec-resolue  { border-left-color: var(--success-color); background: #fbfdfb; }
.sig-carte.rec-rejetee  { border-left-color: #6c757d; background: #fafafa; }
.rec-bloc-imputation {
    margin-top: 8px; padding: 6px 10px; border-radius: 6px; font-size: 13px; background: #f4f6fa;
}
.rec-bloc-imputation.imput-livreur { background: #fdecee; }
.rec-bloc-imputation.imput-a_determiner { background: #fff8e1; }
.rec-imputation-bloc { border: 1px dashed var(--border-color); border-radius: var(--border-radius); padding: 10px 12px; margin: 10px 0; }
.rec-imputation-bloc legend { font-weight: 600; color: var(--primary-color); padding: 0 6px; font-size: 14px; }
.liv-lien-reclamation {
    display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600;
    color: var(--danger-color); text-decoration: none; padding: 6px 0;
}
.liv-lieu { font-size: 14px; font-weight: 600; color: var(--secondary-color); margin-top: 2px; }
.liv-ref  { font-size: 13px; color: #555; }
.liv-rang {
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 26px; padding: 0 6px;
    margin-right: 6px; border-radius: 13px; background: var(--success-color); color: #fff; font-size: 13px; font-weight: 700;
}
.liv-non_livre .liv-rang { background: var(--danger-color); }
.liv-deplacer { display: flex; gap: 6px; }
.liv-deplacer .btn { min-width: 48px; }
@media (max-width: 768px) { .liv-deplacer { order: -1; } .liv-deplacer form { flex: 1; } .liv-deplacer .btn { width: 100%; } }

/* ============================================
   LIVRAISONS : journal du livreur + « Ajouter une livraison »
   ============================================ */
.liv-btn-ajouter {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    width: 100%; min-height: 72px; margin: 0 0 16px; padding: 12px;
    border: none; border-radius: var(--border-radius-lg); cursor: pointer; font-family: inherit;
    background: var(--primary-color); color: #fff; font-size: 20px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.liv-btn-ajouter small { font-size: 13px; font-weight: 500; opacity: .85; }
.liv-btn-ajouter:disabled { background: #9aa7b8; cursor: default; }
.liv-btn-ajouter:not(:disabled):active { transform: scale(.98); }
@media (max-width: 992px) {
    /* Toujours à portée de pouce, juste au-dessus de la barre de navigation */
    .liv-page .liv-btn-ajouter {
        position: sticky; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 20;
        box-shadow: 0 -4px 14px rgba(0, 0, 0, .12), var(--shadow-sm);
    }
}

.liv-choix {
    position: fixed; inset: 0; z-index: 1200; background: var(--bg-color);
    display: flex; flex-direction: column; overflow-y: auto;
}
body.liv-choix-ouvert { overflow: hidden; }
.liv-choix-entete {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; background: var(--primary-color); color: #fff; font-size: 17px;
}
.liv-choix-fermer {
    width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255, 255, 255, .15); color: #fff; font-size: 18px; flex-shrink: 0;
}
.liv-choix-etape { padding: 12px 14px 24px; max-width: 760px; width: 100%; margin: 0 auto; }
.liv-choix-filtres {
    display: flex; gap: 8px; flex-wrap: wrap; position: sticky; top: 64px; z-index: 1;
    background: var(--bg-color); padding: 4px 0 10px;
}
.liv-choix-filtres input { flex: 1 1 220px; min-height: 48px; font-size: 16px; }
.liv-choix-filtres select { min-height: 48px; }
.liv-choix-liste { display: flex; flex-direction: column; gap: 8px; }
.liv-choix-item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
    padding: 12px 14px; min-height: 64px; cursor: pointer; font-family: inherit;
    background: #fff; border: 1px solid var(--border-color); border-left: 6px solid var(--secondary-color);
    border-radius: var(--border-radius);
}
.liv-choix-item:active { background: #eef2f8; }
.liv-choix-item[hidden] { display: none; }
.lci-client { font-size: 17px; font-weight: 700; color: var(--primary-color); }
.lci-lieu { font-size: 14px; font-weight: 600; color: var(--secondary-color); }
.lci-adresse { font-size: 14px; color: #444; }
.lci-meta { font-size: 12px; color: #777; }
.liv-choix-resume { margin-bottom: 14px; }
.liv-choix-resume .liv-choix-item { cursor: default; }
.liv-btn-confirmer { width: 100%; min-height: 64px; font-size: 20px; font-weight: 700; margin-bottom: 12px; }
#choixConfirmer .liv-non { margin-bottom: 16px; }
#choixConfirmer .liv-non form { display: flex; flex-direction: column; gap: 8px; }
#choixRetour { width: 100%; }
/* Journal : actions compactes sur une ligne (⬆️ ⬇️ ↩️) */
.liv-livre .liv-actions, .liv-non_livre .liv-actions { flex-direction: row !important; flex-wrap: wrap; align-items: center; gap: 6px; }
.liv-livre .liv-deplacer, .liv-non_livre .liv-deplacer { order: 0 !important; flex: 0 0 auto; }
.liv-livre .liv-deplacer form, .liv-non_livre .liv-deplacer form { flex: 0 0 auto; }
.liv-livre .liv-deplacer .btn, .liv-non_livre .liv-deplacer .btn { width: 52px !important; min-height: 40px; }
.liv-livre .liv-actions > form:last-child, .liv-non_livre .liv-actions > form:last-child { flex: 1 1 auto; }
.liv-livre .liv-actions > form:last-child .btn, .liv-non_livre .liv-actions > form:last-child .btn { width: 100%; min-height: 40px; }
.liv-non_livre .liv-actions > form:first-child { flex: 1 1 100%; order: 2; }
.liv-non_livre .liv-actions > form:first-child .liv-btn-livre { width: 100%; }

/* ============================================
   LIVRAISONS : passages hors liste (hors système, enlèvements, récupérations)
   ============================================ */
.liv-hl-titre { margin: 4px 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b7a90; }
.liv-hl-tuiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.liv-hl-tuile {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding: 12px 6px; min-height: 92px;
    background: #fff; border: 1px solid var(--border-color); border-top: 5px solid var(--secondary-color); border-radius: var(--border-radius);
    font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; color: var(--primary-color); cursor: pointer;
}
.liv-hl-tuile:active { background: #fdf3e6; }
.liv-hl-ico { font-size: 28px; line-height: 1; }
.liv-hl-aide { margin: 0 0 14px; padding: 10px 12px; background: #eef4fb; border-radius: var(--border-radius); font-size: 14px; color: #34495e; }
.liv-hl-form .form-group { margin-bottom: 14px; }
.liv-hl-form input[type="text"], .liv-hl-form textarea, .liv-hl-form select { width: 100%; min-height: 48px; font-size: 16px; }
.liv-hl-choix { display: flex; gap: 10px; }
.liv-hl-choix label {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px;
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-weight: 600; cursor: pointer;
}
.liv-hl-choix input:checked + span, .liv-hl-choix label:has(input:checked) { background: #e8f1fb; border-color: var(--primary-color); }
#hlTiersBloc[hidden] { display: none; }
#choixHorsListe .liv-non { margin-bottom: 16px; }
#choixHorsListe .liv-non select { margin: 8px 0; }
#choixHorsListe .liv-non button { width: 100%; }
#hlRetour { width: 100%; }
.liv-carte.liv-hs { border-right: 4px solid var(--secondary-color); }
.liv-hs-info { display: block; color: var(--secondary-color); font-weight: 700; }
.liv-hs-info.sans-doc { color: #b45309; }
.liv-objet { margin-top: 6px; padding: 6px 10px; background: #f3f6fb; border-radius: 6px; font-size: 14px; }
.liv-rattacher { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.liv-rattacher input { flex: 1 1 200px; min-height: 48px; font-size: 16px; text-transform: uppercase; }
.liv-rattacher .btn { min-height: 48px; }
@media (max-width: 420px) { .liv-hl-tuile { font-size: 12px; padding: 10px 4px; } .liv-hl-ico { font-size: 24px; } }
