/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: #F8F9FA;
    color: #1F2937;
    line-height: 1.6;
    min-height: 100%;
}

/* ========== Alerts (flash/messages) ========== */
.alert {
    margin: 1rem 0 0 0;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    background: #F9FAFB;
    color: #111827;
}

.alert a {
    color: inherit;
    text-decoration: underline;
}

.alert-success {
    border-color: #c3e6cb;
    background: #d4edda;
    color: #155724;
}

.alert-error {
    border-color: #f5c6cb;
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    border-color: #ffeaa7;
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    border-color: #bee5eb;
    background: #d1ecf1;
    color: #0c5460;
}

.alert-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ========== UI primitives (cards/tables/badges/buttons) ========== */
.card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #E5E7EB;
    text-align: left;
    vertical-align: top;
}

.table thead th {
    background: #F9FAFB;
    color: #374151;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

/* ========== UX utilities (replace inline styles) ========== */
.ux-mt-4 { margin-top: 1rem; }
.ux-mt-0 { margin-top: 0; }
.ux-ml-2 { margin-left: 0.5rem; }
.ux-mb-3 { margin-bottom: 0.75rem; }
.ux-mb-1 { margin-bottom: 0.25rem; }

.ux-list { margin-left: 1.25rem; }
.ux-list-scroll { max-height: 420px; overflow: auto; }

.header-logout-link { text-decoration: none; margin-right: 0.5rem; }

.menu-badge--muted { opacity: 0.55; }

/* Pagination helpers */
.page-btn--disabled {
    opacity: 0.5;
    pointer-events: none;
}

.page-ellipsis {
    border: none;
    background: transparent;
    cursor: default;
}

.chart-filter-badge {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    color: #374151;
}

/* Map (Leaflet) popup + markers */
.map-popup {
    text-align: center;
}

.map-popup-btn {
    margin-top: 8px;
}

.map-marker-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    pointer-events: auto;
}
.marker-blue { background-color: #3B82F6; }
.marker-green { background-color: #10B981; }
.marker-orange { background-color: #F59E0B; }
.marker-red { background-color: #EF4444; }

.form-hint {
    display: block;
    margin-top: 0.25rem;
    color: #666;
}

.form-row--actions {
    margin-top: 1rem;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-content--xl {
    max-width: 1100px;
}

.modal-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.modal-viewer {
    /* La hauteur doit s'adapter à la modale (flex), pas être figée. */
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.modal-viewer__frame {
    width: 100%;
    height: 100%;
}

/* Un seul scroll : quand le layout GMAO est utilisé, seul .page-content défile */
body:has(.app-container),
body.app-layout {
    overflow: hidden;
    height: 100%;
    /* Meilleure stabilité du viewport sur mobile */
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
}

/* ========== Layout GMAO (sidebar + main) ========== */
.app-container {
    display: flex;
    /* Sur mobile, 100vh peut dépasser la zone visible (barre d’adresse) */
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    overflow: hidden;
    width: 100%;
}

.app-container .sidebar {
    position: relative;
    width: 260px;
    background: white;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    z-index: 100;
}

.app-container .sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.app-container .sidebar .logo {
    font-size: 24px;
    font-weight: 700;
    color: #16A085;
    margin-bottom: 16px;
    text-decoration: none;
    display: block;
}

.app-container .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #F8F9FA;
    border-radius: 8px;
}

.app-container .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #16A085;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.app-container .avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.app-container .user-details h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.app-container .user-details p {
    font-size: 12px;
    color: #6B7280;
    margin: 0;
}

.app-container .sidebar .menu {
    padding: 12px 12px 16px;
    flex: 0 1 auto;
}

.app-container .menu-section {
    margin-bottom: 8px;
}

.app-container .menu-section:last-child {
    margin-bottom: 0;
}

.app-container .menu-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #9CA3AF;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 6px 12px 2px;
    margin-bottom: 2px;
}

.app-container .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #4B5563;
    text-decoration: none;
}

.app-container .menu-item:hover {
    background: #F3F4F6;
}

.app-container .menu-item.disabled,
.app-container .menu-item[aria-disabled="true"] {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.app-container .menu-item.active {
    background: #E8F5F2;
    color: #16A085;
    font-weight: 600;
}

.app-container .menu-ui-switch-form {
    margin: 0;
}

.app-container button.menu-item.menu-item--switch {
    width: 100%;
    border: none;
    background: transparent;
    font: inherit;
    text-align: left;
    margin: 0;
}

.app-container .menu-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.app-container .menu-item-label {
    flex: 1;
    min-width: 0;
}

.app-container .menu-badge {
    flex-shrink: 0;
    margin-left: auto;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border-radius: 50%;
    background-color: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Plusieurs caractères (10…99, 99+) : pastille arrondie, hauteur = diamètre du cercle */
.app-container .menu-badge.menu-badge--wide {
    width: auto;
    min-width: 24px;
    padding: 0 7px;
    border-radius: 12px;
}

.app-container .menu-item.active .menu-badge {
    background-color: #dc2626;
    color: #ffffff;
}

.app-container .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.app-container .gmao-header {
    background: white;
    border-bottom: 1px solid #E5E7EB;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.app-container .gmao-header .breadcrumb {
    font-size: 14px;
    color: #6B7280;
    flex: 1;
    min-width: 0;
}

.app-container .gmao-header .breadcrumb strong {
    color: #1F2937;
}

.app-container .gmao-header .header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    min-width: 0;
    margin-left: auto;
}

.app-container .gmao-header .header-actions .avatar.avatar-sm {
    flex-shrink: 0;
}

/* Actions d’en-tête : libellé + icône SVG (icône seule en vue compacte) */
.app-container .gmao-header .header-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
}

.app-container .gmao-header .header-action-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex-shrink: 0;
}

.app-container .gmao-header .header-action-btn__svg {
    display: block;
}

.app-container .gmao-header .header-action-btn__label {
    display: inline;
}

.app-container .gmao-header .header-search {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
}

.app-container .gmao-header .header-search__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    background: #fff;
    color: #374151;
    cursor: pointer;
    flex-shrink: 0;
}

.app-container .gmao-header .header-search__toggle:hover {
    background: #F3F4F6;
}

.app-container .gmao-header .header-search__field {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.app-container .gmao-header .header-search__leading {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    color: #9CA3AF;
    pointer-events: none;
}

.app-container .gmao-header .header-search-input,
.app-container .gmao-header .search-bar.header-search .header-search-input {
    width: 260px;
    max-width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.app-container .gmao-header .header-search-input:focus {
    border-color: #16A085;
}

/* Dashboard : cloche « Alertes actives » (entre actions et Déconnexion) */
.app-container .gmao-header .dashboard-header-alerts {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.app-container .gmao-header .dashboard-header-alerts:hover {
    background: #F3F4F6;
}

.app-container .gmao-header .dashboard-header-alerts__bell-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.app-container .gmao-header .dashboard-header-alerts__svg {
    display: block;
}

.app-container .gmao-header .dashboard-header-alerts__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: #EF4444;
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Pastille : [hidden] perd contre display: inline-flex — masquer le compteur à 0 */
.app-container .gmao-header .dashboard-header-alerts__badge[hidden] {
    display: none !important;
}

.app-container .gmao-header .search-bar {
    position: relative;
}

.app-container .gmao-header .search-bar input {
    width: 260px;
    padding: 8px 12px 8px 36px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.app-container .gmao-header .search-bar input:focus {
    border-color: #16A085;
}

.app-container .gmao-header .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
}

.app-container .btn-primary,
.app-container .btn.btn-primary {
    background: #16A085;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.app-container .btn-primary:hover,
.app-container .btn.btn-primary:hover {
    background: #138D75;
}

.app-container .btn-secondary,
.app-container .btn.btn-secondary {
    background: white;
    color: #16A085;
    border: 1px solid #16A085;
}

.app-container .btn-secondary:hover,
.app-container .btn.btn-secondary:hover {
    background: #E8F5F2;
}

.app-container .page-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
}

.app-container .page-title,
.app-container .dashboard-content h1,
.app-container .page-content h2.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 24px;
}

.app-container .gmao-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: #1F2937;
}

.app-container .gmao-footer {
    display: none;
}

.app-container ~ .gmao-footer {
    display: block;
    background: #333;
    color: white;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    .app-container .gmao-header {
        flex-wrap: nowrap;
        align-items: center;
        row-gap: 0;
        padding: 10px 12px;
        gap: 10px;
    }

    .app-container .gmao-header .breadcrumb {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 13px;
        line-height: 1.35;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-container .gmao-header .header-actions {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: flex-end;
        align-items: center;
        flex-shrink: 0;
        min-width: 0;
    }

    .app-container .gmao-header .header-actions .btn {
        white-space: nowrap;
    }

    .app-container .gmao-header .search-bar {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .app-container .gmao-header .search-bar input,
    .app-container .gmao-header .header-search-input {
        width: 100%;
        max-width: min(280px, 100%);
        box-sizing: border-box;
    }

    .app-container .filters-bar {
        padding: 16px;
    }

    .app-container .filters-bar .filters-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .app-container .modal-content {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin: 12px auto;
        padding: 1.25rem;
        max-height: min(92vh, calc(100dvh - 24px));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    .app-container .modal-large {
        max-width: calc(100vw - 24px);
    }

    .app-container .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .app-container .section-header .page-title {
        margin-bottom: 0;
    }

    .app-container .planning-controls .inline-form {
        width: 100%;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem 0.75rem;
    }

    .app-container .planning-controls .inline-form select,
    .app-container .planning-controls .inline-form input[type="search"],
    .app-container .planning-controls .inline-form input[type="date"],
    .app-container .planning-controls .inline-form input[type="month"],
    .app-container .planning-controls .inline-form input[type="number"] {
        max-width: 100%;
        min-width: 0;
    }
}

/* Stats / KPI dans le layout GMAO */
.app-container .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}

.app-container .stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #1F2937;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.app-container .stat-card h3 {
    font-size: 11px;
    text-transform: uppercase;
    color: #9CA3AF;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
    line-height: 1.2;
    min-height: calc(1.2em * 2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.app-container .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #16A085;
    margin: 0;
    line-height: 1.05;
}

/* Carte « Machines actives » (présentation type maquette) */
.app-container .stat-card--machines-actives {
    border: 1px solid #E5E7EB;
    border-top: 4px solid #16A085;
}

.app-container .stat-card--machines-actives .stat-number {
    font-size: 36px;
    margin-bottom: 4px;
}

.app-container .stat-card-machines-sub {
    font-size: 14px;
    color: #4B5563;
    margin: 6px 0 10px 0;
    line-height: 1.35;
    text-align: center;
}

.app-container .stat-card-machines-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    /* Charte capture : pastille vert menthe très pâle + texte teal = KPI principal */
    background: #ecfdf5;
    color: #16a085;
    border: 1px solid #a7f3d0;
    box-shadow: 0 1px 0 rgba(16, 160, 133, 0.06);
}

/* Carte « Interventions mois » (charte type capture : bandeau teal, texte centré) */
.app-container .stat-card--interventions-mois {
    text-align: center;
    border: 1px solid #E5E7EB;
    border-top: 4px solid #10B981;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.app-container .stat-card--interventions-mois h3 {
    margin-bottom: 10px;
}

.app-container .stat-card--interventions-mois .stat-number {
    font-size: 40px;
    font-weight: 700;
    color: #10B981;
    line-height: 1.1;
    margin: 0 0 8px 0;
}

.app-container .stat-card-interventions-mois-sub {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #4B5563;
    line-height: 1.35;
    text-align: center;
}

/* Carte « Alertes actives » (bandeau ambre, métrique verte, badge rose) */
.app-container .stat-card--alertes-actives {
    text-align: center;
    border: 1px solid #E5E7EB;
    border-top: 4px solid #F59E0B;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.app-container .stat-card--alertes-actives h3 {
    color: #64748B;
    margin-bottom: 8px;
}

.app-container .stat-card--alertes-actives .stat-card-alertes-value {
    font-size: 36px;
    font-weight: 700;
    color: #16a34a;
    line-height: 1.1;
    margin: 0 0 6px 0;
}

.app-container .stat-card-alertes-sub {
    margin: 6px 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #4B5563;
    line-height: 1.35;
    text-align: center;
}

.app-container .stat-card-alertes-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.25;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    box-shadow: 0 1px 0 rgba(185, 28, 28, 0.06);
}

.app-container .stat-card-alertes-badge--calm {
    background: #f9fafb;
    color: #6b7280;
    border-color: #e5e7eb;
    box-shadow: none;
}

.app-container .stat-card-alertes-badge-icon {
    display: flex;
    flex-shrink: 0;
    line-height: 0;
}

.app-container .stat-card-alertes-badge-icon svg {
    display: block;
}

/* Carte « Temps moyen résolution » (bandeau bleu, valeur verte, pastille tendance) */
.app-container .stat-card--temps-resolution {
    text-align: left;
    border: 1px solid #E5E7EB;
    border-top: 3px solid #2563EB;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    align-items: flex-start;
}

.app-container .stat-card--temps-resolution h3 {
    color: #64748B;
    margin-bottom: 8px;
}

.app-container .stat-card-temps-resolution-value {
    font-size: 36px;
    font-weight: 700;
    color: #059669;
    line-height: 1.1;
    margin: 0 0 6px 0;
}

.app-container .stat-card-temps-resolution-vs {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 400;
    color: #6B7280;
    line-height: 1.4;
}

.app-container .stat-card-temps-resolution-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.app-container .stat-card-temps-resolution-badge--good {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    box-shadow: 0 1px 0 rgba(5, 150, 105, 0.06);
}

.app-container .stat-card-temps-resolution-badge--bad {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    box-shadow: 0 1px 0 rgba(185, 28, 28, 0.06);
}

.app-container .stat-card-temps-resolution-badge-arrow {
    font-size: 11px;
    line-height: 1;
}

/* Dashboard KPI : pas de scroll horizontal sur petit écran, grille qui passe à la ligne */
@media (max-width: 900px) {
    .app-container .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 12px;
        margin-bottom: 16px;
        overflow-x: visible;
        padding-bottom: 0;
        scroll-snap-type: none;
    }

    .app-container .stat-card {
        scroll-snap-align: unset;
        padding: 12px 10px;
        min-width: 0;
    }

    .app-container .stat-card h3 {
        min-height: 0;
        white-space: normal;
        font-size: 10px;
        line-height: 1.25;
        margin-bottom: 6px;
    }

    .app-container .stat-number {
        font-size: 1.5rem;
    }

    .app-container .stat-card--machines-actives .stat-number {
        font-size: 1.65rem;
        margin-bottom: 2px;
    }

    .app-container .stat-card--interventions-mois .stat-number {
        font-size: 1.75rem;
    }

    .app-container .stat-card--interventions-mois h3 {
        margin-bottom: 6px;
    }

    .app-container .stat-card--alertes-actives .stat-card-alertes-value {
        font-size: 1.65rem;
    }

    .app-container .stat-card-machines-sub,
    .app-container .stat-card-interventions-mois-sub,
    .app-container .stat-card-alertes-sub {
        font-size: 12px;
        white-space: normal;
    }

    .app-container .stat-card-machines-badge {
        font-size: 11px;
        padding: 4px 8px;
        white-space: normal;
        text-align: center;
        max-width: 100%;
    }

    .app-container .stat-card-alertes-badge {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 4px;
        padding: 5px 10px;
        font-size: 11px;
        max-width: 100%;
    }

    .app-container .stat-card-alertes-badge-text {
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }

    .app-container .stat-card-temps-resolution-value {
        font-size: 1.65rem;
    }

    .app-container .stat-card-temps-resolution-vs {
        font-size: 11px;
        white-space: normal;
    }

    .app-container .stat-card-temps-resolution-badge {
        flex-wrap: wrap;
        justify-content: center;
        max-width: 100%;
        font-size: 11px;
    }

    .app-container .stat-card--temps-resolution {
        text-align: center;
        align-items: center;
    }

    .app-container .stat-card--temps-resolution h3 {
        margin-bottom: 6px;
    }
}

@media (max-width: 420px) {
    .app-container .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.app-container section {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-bottom: 0;
}

.app-container .section-header h2 {
    color: #1F2937;
    font-size: 1.25rem;
}

.app-container .data-table thead {
    background: #F9FAFB;
    color: #1F2937;
}

.app-container .data-table th {
    color: #6B7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-container .data-table th a {
    color: #6B7280;
}

.app-container .data-table th a:hover {
    color: #16A085;
}

.app-container .section-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-top: 1rem;
}

/* Dashboard : graphiques (maquette) */
.app-container .chart-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.app-container .chart-card {
    background: white;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.app-container .chart-header {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.app-container .chart-select {
    padding: 6px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 13px;
    color: #6B7280;
    background: white;
    outline: none;
}

.app-container .chart-select:focus {
    border-color: #16A085;
}

.app-container .chart-canvas-wrap {
    position: relative;
    height: 200px;
    width: 100%;
}

.app-container .chart-canvas-wrap canvas {
    max-height: 200px;
}

@media (max-width: 992px) {
    .app-container .chart-row {
        grid-template-columns: 1fr;
    }
}

.app-container .filters,
.app-container .filter-form {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.app-container .badge-success { background: #D1FAE5; color: #059669; }
.app-container .badge-danger { background: #FEE2E2; color: #DC2626; }
.app-container .badge-warning { background: #FEF3C7; color: #D97706; }
.app-container .badge-info { background: #DBEAFE; color: #2563EB; }
.app-container .badge-primary { background: #E8F5F2; color: #16A085; }
.app-container .badge-secondary { background: #F3F4F6; color: #6B7280; }

/* ========== Page Machines (maquette) ========== */
.app-container .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.app-container .page-header .page-title {
    margin-bottom: 0;
}

.app-container .stats-row-machines {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.app-container .stat-card-machines {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #16A085;
}

.app-container .stat-card-machines.success { border-left-color: #10B981; }
.app-container .stat-card-machines.warning { border-left-color: #F59E0B; }
.app-container .stat-card-machines.danger { border-left-color: #EF4444; }
.app-container .stat-card-machines.info { border-left-color: #3B82F6; }

.app-container .stat-card-machines .stat-label {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 4px;
}

.app-container .stat-card-machines .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
}

.app-container .filters-bar {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 100%;
    box-sizing: border-box;
}

.app-container .filters-title {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 12px;
}

.app-container .filters-bar .filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
    min-width: 0;
}

.app-container .filters-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.app-container .filters-bar .filter-label {
    font-size: 12px;
    color: #6B7280;
    font-weight: 600;
}

.app-container .filters-bar .filter-input,
.app-container .filters-bar .filter-select {
    padding: 8px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.app-container .filters-bar .filter-input:focus,
.app-container .filters-bar .filter-select:focus {
    border-color: #16A085;
}

.app-container .filters-bar .filter-group-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.app-container .machines-table {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 24px;
}

.app-container .machines-table .table-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-container .machines-table .table-title {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

.app-container .machines-table .table-actions {
    display: flex;
    gap: 12px;
}

.app-container .machines-table table {
    width: 100%;
    border-collapse: collapse;
}

.app-container .machines-table th.col-select,
.app-container .machines-table td.col-select {
    width: 2.75rem;
    text-align: center;
    vertical-align: middle;
    padding-left: 12px;
    padding-right: 12px;
}

.app-container .machines-table th.col-select input,
.app-container .machines-table td.col-select input {
    margin: 0;
    cursor: pointer;
}

.app-container .machines-table .table-actions .action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.app-container .machines-table thead {
    background: #F9FAFB;
}

.app-container .machines-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-container .machines-table th a {
    color: #6B7280;
    text-decoration: none;
}

.app-container .machines-table th a:hover {
    color: #16A085;
}

.app-container .machines-table tbody tr {
    border-bottom: 1px solid #F3F4F6;
    transition: background 0.2s;
}

.app-container .machines-table tbody tr:hover {
    background: #F9FAFB;
}

.app-container .machines-table td {
    padding: 16px 20px;
    font-size: 14px;
    color: #1F2937;
}

.app-container .machine-id {
    font-weight: 600;
    color: #16A085;
}

.app-container .machine-site-name {
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 2px;
}

.app-container .machine-site {
    color: #6B7280;
    font-size: 13px;
}

.app-container .machines-table .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.app-container .machines-table .status-badge.active {
    background: #D1FAE5;
    color: #059669;
}

.app-container .machines-table .status-badge.maintenance {
    background: #FEF3C7;
    color: #D97706;
}

.app-container .machines-table .status-badge.broken {
    background: #FEE2E2;
    color: #DC2626;
}

.app-container .machines-table .status-badge.inactive {
    background: #FEE2E2;
    color: #DC2626;
}

.app-container .priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.app-container .priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.app-container .priority-dot.high { background: #EF4444; }
.app-container .priority-dot.medium { background: #F59E0B; }
.app-container .priority-dot.low { background: #10B981; }

.app-container .machines-table .action-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    color: #4B5563;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    margin-right: 6px;
}

.app-container .machines-table .action-btn:hover {
    background: #F9FAFB;
    border-color: #16A085;
    color: #16A085;
}

.app-container .machines-table .action-btn-danger:hover {
    border-color: #DC2626;
    color: #DC2626;
}

.app-container .machines-table .pagination {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-container .pagination-info {
    font-size: 14px;
    color: #6B7280;
}

.app-container .pagination-controls {
    display: flex;
    gap: 8px;
}

.app-container .pagination-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.app-container .gmao-per-page {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6B7280;
}

.app-container .gmao-per-page__select {
    width: auto;
    min-width: 4.5rem;
    padding: 6px 10px;
}

.app-container .page-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #4B5563;
}

.app-container .page-btn.active {
    background: #16A085;
    color: white;
    border-color: #16A085;
}

.app-container .machines-map-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 24px;
    isolation: isolate;
}

.app-container .machines-map-card .table-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.app-container .machines-map-card .table-title {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

/* Bandeau « Carte des machines » + légende (charte type capture) */
.app-container .machines-map-card .map-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.app-container .machines-map-card .map-card-head__title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-container .machines-map-card .map-card-head__icon {
    display: flex;
    flex-shrink: 0;
    line-height: 0;
}

.app-container .machines-map-card .map-card-head__map-svg {
    display: block;
}

.app-container .machines-map-card .map-card-head__label {
    font-size: 16px;
    font-weight: 600;
    color: #003366;
    letter-spacing: 0.01em;
}

.app-container .machines-map-card .map-card-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-container .machines-map-card .map-card-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #003366;
    white-space: nowrap;
}

.app-container .machines-map-card .map-card-legend__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid #0f172a;
    box-sizing: border-box;
}

.app-container .machines-map-card .map-card-legend__dot--ok {
    background: #22c55e;
}

.app-container .machines-map-card .map-card-legend__dot--maintenance {
    background: #f97316;
}

.app-container .machines-map-card .map-card-legend__dot--alerte {
    background: #ef4444;
}

.app-container .map-search-bar {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.app-container .map-search-bar label {
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
}

.app-container .map-search-bar input {
    padding: 8px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

.app-container .map-search-results {
    padding: 0 20px 8px;
    font-size: 13px;
    color: #6B7280;
}

.app-container .machines-map-card #map {
    height: 400px;
    margin: 0 20px 20px;
    border-radius: 8px;
}

/* ========== Dashboard : paire cartes interventions (charte identique capture) ========== */
.app-container .dashboard-interventions-pair {
    --dash-teal-link: #20b2aa;
    --dash-teal-link-hover: #009e7e;
    --dash-head-title: #1a202c;
    --dash-title: #1a202c;
    --dash-muted: #6b7280;
    --dash-line: #e5e7eb;
    --dash-red-dot: #e53e3e;

    /* Points de ligne (capture : rouge vif, ambre, bleu, émeraude) */
    --dash-dot-urgent: #ff0000;
    --dash-dot-attente: #f59e0b;
    --dash-dot-blue: #3b82f6;
    --dash-dot-emerald: #10b981;

    /* Pastilles statut (fonds pastel + texte saturé) */
    --dash-pill-urgent-fg: #dc2626;
    --dash-pill-urgent-bg: #fecaca;
    --dash-pill-attente-fg: #ca8a04;
    --dash-pill-attente-bg: #fef9c3;
    --dash-pill-termine-fg: #065f46;
    --dash-pill-termine-bg: #d1fae5;
    --dash-pill-encours-fg: #c2410c;
    --dash-pill-encours-bg: #ffedd5;
    --dash-pill-prevu-fg: #d97706;
    --dash-pill-prevu-bg: #fffbeb;

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 1.5rem;
    padding: 20px 20px 24px;
    background: #f7f8fa;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Arial, sans-serif;
}

@media (max-width: 900px) {
    .app-container .dashboard-interventions-pair {
        grid-template-columns: 1fr;
    }
}

.app-container .dash-inter-card {
    background: #fff;
    border: 1px solid var(--dash-line);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.app-container .dash-inter-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 20px;
    flex-wrap: nowrap;
    background: #fff;
    border-bottom: 1px solid var(--dash-line);
}

.app-container .dash-inter-card__head-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.app-container .dash-inter-card__head-icon--urgent {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--dash-red-dot);
    border: 1px solid #000;
    box-sizing: border-box;
    flex-shrink: 0;
}

.app-container .dash-inter-card__head-icon--calendar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.app-container .dash-inter-card__head-icon--calendar svg {
    display: block;
    width: 22px;
    height: 22px;
}

.app-container .dash-inter-card__head .dash-inter-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--dash-head-title);
    letter-spacing: -0.01em;
    line-height: 1.25;
    min-width: 0;
}

.app-container .dash-inter-card__head .dash-inter-card__link {
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--dash-teal-link);
    text-decoration: none;
    white-space: nowrap;
}

.app-container .dash-inter-card__head .dash-inter-card__link:hover {
    color: var(--dash-teal-link-hover);
    text-decoration: underline;
}

.app-container .dash-inter-card__link span[aria-hidden="true"] {
    margin-left: 0.15em;
}

.app-container .dash-inter-card__list {
    padding: 0;
}

.app-container .dash-inter-card__empty {
    margin: 0;
    padding: 1.15rem 1.25rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--dash-muted);
    line-height: 1.5;
}

.app-container .dash-inter-row {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.95rem 1.25rem;
    text-decoration: none;
    color: inherit;
    border-top: 1px solid var(--dash-line);
    transition: background-color 0.12s ease;
}

.app-container .dash-inter-card__list .dash-inter-row:first-of-type {
    border-top: none;
}

.app-container .dash-inter-row:hover {
    background: #fafafa;
}

.app-container .dash-inter-row__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-top: 0.42rem;
    flex-shrink: 0;
}

.app-container .dash-inter-row__dot--urgent {
    background: var(--dash-dot-urgent);
}

.app-container .dash-inter-row__dot--attente {
    background: var(--dash-dot-attente);
}

.app-container .dash-inter-row__dot--today-blue {
    background: var(--dash-dot-blue);
}

.app-container .dash-inter-row__dot--today-green {
    background: var(--dash-dot-emerald);
}

.app-container .dash-inter-row__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.app-container .dash-inter-row__primary {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--dash-title);
    line-height: 1.4;
}

.app-container .dash-inter-row__secondary {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--dash-muted);
    line-height: 1.45;
}

.app-container .dash-badge {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    margin-top: 0.05rem;
    line-height: 1.2;
}

.app-container .dash-badge--urgent {
    color: var(--dash-pill-urgent-fg);
    background-color: var(--dash-pill-urgent-bg);
}

.app-container .dash-badge--amber-pill {
    color: var(--dash-pill-attente-fg);
    background-color: var(--dash-pill-attente-bg);
}

.app-container .dash-badge--encours {
    color: var(--dash-pill-encours-fg);
    background-color: var(--dash-pill-encours-bg);
}

.app-container .dash-badge--prevu {
    color: var(--dash-pill-prevu-fg);
    background-color: var(--dash-pill-prevu-bg);
}

.app-container .dash-badge--termine {
    color: var(--dash-pill-termine-fg);
    background-color: var(--dash-pill-termine-bg);
}

/* ========== Dashboard : bandeau KPI (sous cartes interventions) ========== */
.app-container .dashboard-kpi-slab {
    --dash-kpi-label: #5e6d82;
    --dash-kpi-value: #149178;
    margin-top: 1.25rem;
    padding: 20px;
    background: #f7f8fa;
    border-radius: 12px;
}

.app-container .dashboard-kpi-row--quad {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 16px;
}

.app-container .dashboard-kpi-row--quad .dash-kpi-card {
    flex: 1 1 0;
    min-width: 0;
}

@media (max-width: 1024px) {
    .app-container .dashboard-kpi-row--quad {
        gap: 12px;
    }

    .app-container .dashboard-kpi-row--quad .dash-kpi-card {
        padding: 16px 14px;
    }

    .app-container .dashboard-kpi-row--quad .dash-kpi-card__value {
        font-size: clamp(1.25rem, 2.8vw, 1.875rem);
    }

    .app-container .dashboard-kpi-row--quad .dash-kpi-card__label {
        font-size: 0.8125rem;
    }

    .app-container .dash-kpi-card__label {
        min-height: calc(1.35em * 2);
    }
}

@media (max-width: 640px) {
    .app-container .dashboard-kpi-slab {
        padding: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-container .dashboard-kpi-row--quad {
        flex-wrap: nowrap;
        gap: 12px;
        min-width: min-content;
    }

    .app-container .dashboard-kpi-row--quad .dash-kpi-card {
        flex: 0 0 auto;
        width: min(42vw, 160px);
        min-width: 130px;
    }
}

.app-container .dash-kpi-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 22px 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.app-container .dash-kpi-card__label {
    margin: 0 0 0.35rem;
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--dash-kpi-label);
    line-height: 1.35;
    min-height: calc(1.35em * 2);
}

.app-container .dash-kpi-card__value {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--dash-kpi-value);
}

.app-container .dash-kpi-card--satisfaction .dash-kpi-card__rating-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-top: 0.05rem;
}

.app-container .dash-kpi-card__star {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.app-container .dash-kpi-card__star svg {
    display: block;
}

/* ========== Page Interventions (maquette) ========== */
.app-container .tabs-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.app-container .tabs-container .tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #E5E7EB;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.app-container .tabs-container .tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

.app-container .tabs-container .tab:hover {
    color: #16A085;
}

.app-container .tabs-container .tab.active {
    color: #16A085;
    border-bottom-color: #16A085;
}

.app-container .tabs-container .tab-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: #F3F4F6;
    color: #6B7280;
}

.app-container .tabs-container .tab.active .tab-badge {
    background: #E8F5F2;
    color: #16A085;
}

.app-container .tabs-container .stats-row-interventions {
    margin-bottom: 0;
}

.app-container .stats-row-interventions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.app-container .stat-card-interventions {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #16A085;
}

.app-container .stat-card-interventions.urgent { border-left-color: #EF4444; }
.app-container .stat-card-interventions.progress { border-left-color: #3B82F6; }
.app-container .stat-card-interventions.pending { border-left-color: #F59E0B; }
.app-container .stat-card-interventions.done { border-left-color: #10B981; }

.app-container .stat-card-interventions .stat-label {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.app-container .stat-card-interventions .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 4px;
}

.app-container .stat-card-interventions .stat-subtitle {
    font-size: 13px;
    color: #6B7280;
    margin-top: 4px;
}

/* Liste interventions (cartes, maquette HTML) */
.app-container .interventions-list-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    overflow: visible;
}

.app-container .interventions-list-panel__head {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-container .interventions-list-panel__title {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

.app-container .interventions-list-panel__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.app-container .interventions-list-msg {
    margin: 0 20px 16px;
    padding: 0.75rem;
    border-radius: 8px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    font-size: 0.9rem;
}

.app-container .interventions-sort-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 0 20px 16px;
    border-bottom: 1px solid #E5E7EB;
    margin-bottom: 0;
}

.app-container .interventions-sort-bar__label {
    font-size: 11px;
    font-weight: 600;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-container .interventions-sort-bar__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.app-container .interventions-sort-bar__links a {
    font-size: 13px;
    color: #6B7280;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.app-container .interventions-sort-bar__links a:hover {
    color: #16A085;
    background: #F3F4F6;
}

.app-container .interventions-sort-bar__links a.is-active {
    color: #16A085;
    font-weight: 600;
    background: #E8F5F2;
}

.app-container .interventions-grid--list {
    display: grid;
    gap: 16px;
    padding: 16px 20px 8px;
}

.app-container .interventions-list-empty {
    padding: 2rem 20px;
    margin: 0;
    text-align: center;
    color: #6B7280;
    font-size: 14px;
}

.app-container .intervention-list-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #16A085;
    transition: box-shadow 0.2s, transform 0.2s;
}

.app-container .intervention-list-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* Bordure gauche = couleur d’accent du badge (status-badge--*) */
.app-container .intervention-list-card--default {
    border-left-color: #16A085;
}

.app-container .intervention-list-card--urgent {
    border-left-color: #DC2626;
}

.app-container .intervention-list-card--progress {
    border-left-color: #2563EB;
}

.app-container .intervention-list-card--pending {
    border-left-color: #D97706;
}

.app-container .intervention-list-card--done {
    border-left-color: #059669;
}

.app-container .intervention-list-card--scheduled {
    border-left-color: #4F46E5;
}

.app-container .intervention-list-card--secondary {
    border-left-color: #6B7280;
}

.app-container .intervention-list-card--annulee {
    opacity: 0.95;
}

.app-container .intervention-list-card--locked {
    background: #FAFBFC;
}

.app-container .intervention-list-card--abs-warning {
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.45);
}

.app-container .intervention-list-card--abs-danger {
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.4);
}

.app-container .intervention-list-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.app-container .intervention-list-card__title-block {
    flex: 1;
    min-width: 0;
}

.app-container .intervention-list-card__meta {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 4px;
}

.app-container .intervention-list-card__machine {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 4px;
    word-break: break-word;
}

.app-container .intervention-list-card__site {
    font-size: 14px;
    color: #6B7280;
    word-break: break-word;
}

.app-container .intervention-list-card__status {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
}

.app-container .intervention-list-card__status.status-badge--urgent {
    background: #FEE2E2;
    color: #DC2626;
}

.app-container .intervention-list-card__status.status-badge--progress {
    background: #DBEAFE;
    color: #2563EB;
}

.app-container .intervention-list-card__status.status-badge--pending {
    background: #FEF3C7;
    color: #D97706;
}

.app-container .intervention-list-card__status.status-badge--done {
    background: #D1FAE5;
    color: #059669;
}

.app-container .intervention-list-card__status.status-badge--scheduled {
    background: #E0E7FF;
    color: #4F46E5;
}

.app-container .intervention-list-card__status.status-badge--secondary {
    background: #F3F4F6;
    color: #6B7280;
}

.app-container .gmao-card-actions--wrap {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.app-container .facture-inline-form {
    display: inline-flex;
    margin: 0;
}

.app-container .machines-list-sort-bar,
.app-container .techniciens-list-sort-bar {
    margin-bottom: 12px;
}

.app-container .intervention-list-card__details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
}

.app-container .intervention-list-card__detail {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}

.app-container .intervention-list-card__detail-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1.2;
}

.app-container .intervention-list-card__detail-label {
    color: #6B7280;
}

.app-container .intervention-list-card__detail-value {
    font-weight: 600;
    color: #1F2937;
}

.app-container .intervention-list-card__description {
    font-size: 14px;
    color: #4B5563;
    line-height: 1.5;
    margin-bottom: 16px;
}

.app-container .intervention-list-card__footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid #F3F4F6;
}

.app-container .intervention-list-card__tech {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.app-container .intervention-list-card__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.app-container .intervention-list-card__tech-name {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    line-height: 1.3;
}

.app-container .intervention-list-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.app-container .intervention-list-card__actions .action-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    color: #4B5563;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.app-container .intervention-list-card__actions .action-btn:hover {
    background: #F9FAFB;
    border-color: #16A085;
    color: #16A085;
}

.app-container .intervention-list-card__actions .action-btn--primary {
    background: #16A085;
    color: #fff;
    border-color: #16A085;
}

.app-container .intervention-list-card__actions .action-btn--primary:hover {
    background: #138D75;
    color: #fff;
    border-color: #138D75;
}

.app-container .intervention-list-card__actions .action-btn--danger:hover {
    border-color: #DC2626;
    color: #DC2626;
}

.app-container .interventions-list-panel__pagination {
    border-top: 1px solid #E5E7EB;
}

.app-container .interventions-list-panel .pagination {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.app-container .interventions-list-panel .pagination-info {
    font-size: 14px;
    color: #6B7280;
}

.app-container .interventions-list-panel .pagination-controls {
    display: flex;
    gap: 8px;
}

.app-container .interventions-list-panel .page-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #4B5563;
}

.app-container .interventions-list-panel .page-btn.active {
    background: #16A085;
    color: white;
    border-color: #16A085;
}

.app-container .interventions-list-panel__actions .action-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    color: #4B5563;
    transition: all 0.2s;
}

.app-container .interventions-list-panel__actions .action-btn:hover {
    background: #F9FAFB;
    border-color: #16A085;
    color: #16A085;
}

.app-container .interventions-list-panel__actions .action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 640px) {
    .app-container .intervention-list-card__details {
        grid-template-columns: 1fr;
    }
    .app-container .intervention-list-card__footer {
        flex-direction: column;
        align-items: stretch;
    }
    .app-container .intervention-list-card__actions {
        justify-content: flex-start;
    }
}

/* Table interventions : réutilise le style machines-table */
.app-container .interventions-table {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

/* (Suppression du ruleset vide) */
.app-container .interventions-table .table-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-container .interventions-table .table-title { font-size: 16px; font-weight: 600; color: #1F2937; margin: 0; }
.app-container .interventions-table .table-actions { display: flex; gap: 12px; }
.app-container .interventions-table table { width: 100%; border-collapse: collapse; }
.app-container .interventions-table thead { background: #F9FAFB; }
.app-container .interventions-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.app-container .interventions-table th a { color: #6B7280; text-decoration: none; }
.app-container .interventions-table th a:hover { color: #16A085; }
.app-container .interventions-table tbody tr { border-bottom: 1px solid #F3F4F6; transition: background 0.2s; }
.app-container .interventions-table tbody tr:hover { background: #F9FAFB; }
.app-container .interventions-table td { padding: 16px 20px; font-size: 14px; color: #1F2937; }
.app-container .interventions-table .intervention-id { font-weight: 600; color: #16A085; }
.app-container .interventions-table .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.app-container .interventions-table .status-badge-done { background: #D1FAE5; color: #059669; }
.app-container .interventions-table .status-badge-progress { background: #DBEAFE; color: #2563EB; }
.app-container .interventions-table .status-badge-pending { background: #FEF3C7; color: #D97706; }
.app-container .interventions-table .status-badge-danger { background: #FEE2E2; color: #DC2626; }
.app-container .interventions-table .status-badge-info { background: #DBEAFE; color: #2563EB; }
.app-container .interventions-table .status-badge-secondary { background: #F3F4F6; color: #6B7280; }
.app-container .interventions-table .action-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    color: #4B5563;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    margin-right: 6px;
}
.app-container .interventions-table .action-btn:hover { background: #F9FAFB; border-color: #16A085; color: #16A085; }
.app-container .interventions-table .action-btn-danger:hover { border-color: #DC2626; color: #DC2626; }
.app-container .interventions-table .pagination {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-container .interventions-table .pagination-info { font-size: 14px; color: #6B7280; }
.app-container .interventions-table .pagination-controls { display: flex; gap: 8px; }
.app-container .interventions-table .page-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #4B5563;
}
.app-container .interventions-table .page-btn.active { background: #16A085; color: white; border-color: #16A085; }

@media (max-width: 992px) {
    .app-container .stats-row-machines {
        grid-template-columns: repeat(3, 1fr);
    }
    .app-container .stats-row-interventions {
        grid-template-columns: repeat(2, 1fr);
    }
    .app-container .filters-bar .filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .app-container .page-content {
        padding: 16px 12px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .app-container .stats-row-machines {
        grid-template-columns: repeat(2, 1fr);
    }
    .app-container .filters-bar .filters-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .app-container .machines-table .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .app-container .machines-table .pagination {
        flex-direction: column;
        gap: 12px;
    }
}

/* Responsive sidebar */
@media (max-width: 768px) {
    .app-container .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-x: hidden;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    /* Défilement sur la zone nav uniquement : évite les blocages iOS quand tout le aside défile */
    .app-container .sidebar .menu {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .app-container .sidebar.open {
        transform: translateX(0);
    }
    .app-container .gmao-menu-toggle {
        display: block;
    }

    .app-container .gmao-header .breadcrumb {
        display: none;
    }

    /* En-tête compact : icônes seules, recherche en overlay */
    .app-container .gmao-header .header-action-btn__label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .app-container .gmao-header .header-actions .btn.header-action-btn {
        padding: 0;
        width: 40px;
        height: 40px;
        min-width: 40px;
        gap: 0;
        justify-content: center;
    }

    .app-container .gmao-header .header-actions .btn.header-action-btn.btn-sm {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .app-container .gmao-header .header-search__toggle {
        display: inline-flex;
    }

    .app-container .gmao-header .header-search__field {
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        z-index: 200;
        padding: 10px 12px;
        padding-top: calc(52px + env(safe-area-inset-top, 0px));
        background: #fff;
        border-bottom: 1px solid #E5E7EB;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
        transform: translateY(-110%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
    }

    .app-container .gmao-header .header-search--open .header-search__field {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .app-container .gmao-header .header-search-input {
        width: 100%;
        max-width: none;
    }

    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }
}

/* ========== Page Comptes utilisateurs (comptes_utilisateurs.php) ========== */
.app-container .admin-users-page {
    max-width: 1200px;
    margin: 0 auto;
}

.app-container .admin-users-lead {
    color: #6B7280;
    margin: 0 0 1.5rem;
    line-height: 1.5;
    font-size: 0.9375rem;
}

.app-container .admin-users-message {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 500;
}

.app-container .admin-users-message--success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.app-container .admin-users-message--error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.app-container .admin-users-form-section {
    background: white;
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.app-container .admin-users-section-title {
    color: #16A085;
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.app-container .admin-users-hint {
    color: #555;
    margin: 0 0 1rem;
    line-height: 1.5;
    font-size: 0.9375rem;
}

.app-container .admin-users-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

.app-container .admin-users-table-wrap {
    background: white;
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-container .admin-users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.app-container .admin-users-table th,
.app-container .admin-users-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
}

.app-container .admin-users-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.app-container .admin-users-table tbody tr:hover {
    background-color: #f8f9fa;
}

.app-container .admin-users-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.app-container .admin-users-inline-form {
    display: inline-flex;
    margin: 0;
}

.app-container .admin-users-edit-form {
    margin-top: 0.5rem;
    padding: 1rem 1.25rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

@media (max-width: 640px) {
    .app-container .admin-users-form-section,
    .app-container .admin-users-table-wrap {
        padding: 1rem;
    }

    .app-container .admin-users-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .app-container .admin-users-inline-form {
        width: 100%;
    }

    .app-container .admin-users-inline-form .btn {
        width: 100%;
    }
}

/* Header (ancien layout) */
header {
    background: #003366;
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.header-logo img {
    height: 40px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

header h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 500;
}

header .header-title-only {
    display: none;
}

/* Bouton hamburger pour mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 1rem;
    transition: transform 0.3s;
}

.menu-toggle:hover {
    transform: scale(1.1);
}

.menu-toggle.active {
    transform: rotate(90deg);
}

nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

nav a.active {
    background-color: rgba(255,255,255,0.3);
    font-weight: bold;
}

/* Menu mobile */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #003366;
    z-index: 9999;
    padding: 2rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-menu-logo {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

.mobile-menu-logo img {
    height: 50px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    margin-bottom: 2rem;
}

.mobile-menu-header h2 {
    color: white;
    font-size: 1.5rem;
    margin: 0;
    display: none;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.mobile-menu nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-menu nav a {
    display: block;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 8px;
    text-align: left;
    background-color: rgba(255,255,255,0.1);
}

.mobile-menu nav a:hover,
.mobile-menu nav a.active {
    background-color: rgba(255,255,255,0.3);
}

/* Main content */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    color: #667eea;
    font-size: 1.5rem;
}

.section-content {
    margin-top: 1.5rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table thead {
    background-color: #667eea;
    color: white;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.data-table th.col-select,
.data-table td.col-select {
    width: 2.75rem;
    text-align: center;
    vertical-align: middle;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.data-table thead th.col-select {
    background-color: inherit;
}

.data-table th.col-select input,
.data-table td.col-select input {
    margin: 0;
    cursor: pointer;
}

.section-header .btn.btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.data-table th a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

.data-table th a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.data-table th a span {
    font-size: 0.9em;
    font-weight: bold;
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #333;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

.badge-primary {
    background-color: #007bff;
    color: white;
}

.badge-secondary {
    background-color: #6c757d;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* iOS/PWA: évite que le contenu soit sous la barre système */
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
             env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.modal-content {
    background-color: white;
    margin: 20px auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
    /* Utiliser toute la hauteur disponible, sans dépasser le viewport */
    /* dvh = viewport réel (mobile), vh = fallback */
    height: calc(100vh - 40px);
    height: calc(100dvh - 40px);
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-large {
    max-width: 900px;
}

/* Contenu scrollable interne (évite le double scroll modal + contenu) */
.modal-content > .modal-body,
.modal-content > form,
.modal-content > .modal-viewer {
    flex: 1 1 auto;
    min-height: 0;
}

.modal-content > .modal-body,
.modal-content > form {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: #000;
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Filters */
.filters {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-form select,
.filter-form input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-form label {
    margin: 0;
    font-weight: 500;
}

.planning-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Planning */
.planning-grid {
    display: grid;
    grid-template-columns: 200px repeat(7, 1fr);
    gap: 1px;
    background-color: #ddd;
    border: 1px solid #ddd;
    margin-top: 1rem;
    overflow-x: auto;
}

/* Vue mois / mois dans l’année : jours contigus, style type Outlook */
.planning-grid--month {
    gap: 0;
    background-color: #c8c6c4;
    border: 1px solid #c8c6c4;
    border-radius: 2px;
}

.planning-grid--month .planning-col-header {
    padding: 0.35rem 0.2rem;
    background-color: #f3f2f1;
    color: #323130;
    font-weight: 600;
    border-right: 1px solid #edebe9;
    border-bottom: 1px solid #edebe9;
}

.planning-grid--month .planning-col-header:last-child {
    border-right: none;
}

.planning-grid--month .planning-col-header.today {
    background-color: #e8deef;
    color: #201f1e;
}

.planning-grid--month .planning-col-header.outside-month {
    background-color: #e9e7e6;
    color: #8a8886;
}

.planning-grid--month .planning-col-header.outside-month .planning-hd-dow,
.planning-grid--month .planning-col-header.outside-month .planning-hd-dom {
    color: #8a8886;
}

.planning-grid--month .planning-col-header.weekend {
    background-color: #edebe9;
}

.planning-grid--month .planning-col-header-corner {
    background-color: #f3f2f1;
    color: #323130;
    text-align: left;
    padding-left: 0.75rem;
    border-right: 1px solid #edebe9;
    border-bottom: 1px solid #edebe9;
}

/* Semaines suivantes : pas de ligne d’en-tête */
.planning-grid--month.planning-grid--month-no-header {
    margin-top: 0;
}

/* Mois / année : une seule ligne de cellules (tous techniciens fusionnés) */
.planning-grid--month.planning-grid--merged .planning-row--merged {
    display: contents;
}

.intervention-tech {
    font-size: 0.72rem;
    font-weight: 600;
    color: #605e5c;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.planning-grid--merged .planning-cell-stack .intervention-card:last-child {
    margin-bottom: 0;
}

.planning-col-header-month {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-height: 3rem;
}

.planning-hd-dow {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #605e5c;
    line-height: 1.1;
}

.planning-hd-dom {
    font-size: 1.15rem;
    font-weight: 600;
    color: #323130;
    line-height: 1.1;
}

.planning-grid--month .planning-col-name {
    background-color: #faf9f8;
    border-right: 1px solid #edebe9;
    border-bottom: 1px solid #edebe9;
}

.planning-col-month {
    padding: 0.35rem 0.3rem 0.5rem;
    min-height: 100px;
    border-right: 1px solid #edebe9;
    border-bottom: 1px solid #edebe9;
    background-color: #ffffff;
}

.planning-col-month.weekend {
    background-color: #faf9f8;
}

.planning-col-month.today {
    background-color: #fff9e6;
}

.planning-col-month.planning-col-outside {
    background-color: #f3f2f1;
    pointer-events: none;
}

.planning-col-month.planning-col-outside .planning-cell-dom {
    color: #a19f9d;
}

.planning-cell-dom {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #605e5c;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.planning-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 0;
}

.planning-grid--month .intervention-card {
    font-size: 0.72rem;
    padding: 0.35rem 0.4rem;
    margin-bottom: 0;
}

.planning-year-month-block {
    margin-top: 1.75rem;
}

.planning-year-month-block:first-child {
    margin-top: 0;
}

.planning-year-month-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.planning-year-month-block .planning-grid--month {
    margin-top: 0.5rem;
}

/* Une ligne de grille par semaine (lun–dim) */
.planning-month-week-wrap {
    margin-top: 0;
}

.planning-month-week-wrap .planning-grid--month {
    margin-top: 0;
}

.planning-year-month-title + .planning-month-week-wrap {
    margin-top: 0;
}

.planning-header {
    display: contents;
}

.planning-col-header {
    background-color: #667eea;
    color: white;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    position: sticky;
    left: 0;
    z-index: 10;
}

.planning-col-header.today {
    background-color: #764ba2;
}

.day-name {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.day-date {
    font-size: 1.1rem;
}

.planning-row {
    display: contents;
}

.planning-col-name {
    background-color: #f8f9fa;
    padding: 1rem;
    font-weight: 500;
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 2px solid #ddd;
}

.planning-col-name strong {
    display: block;
    margin-bottom: 0.3rem;
}

.planning-col-name small {
    color: #666;
    font-size: 0.85rem;
}

.planning-col {
    background-color: white;
    padding: 0.5rem;
    min-height: 100px;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
}

.planning-col.today {
    background-color: #fff9e6;
}

.planning-col.drag-over {
    background-color: #e8f5e9;
    border: 2px dashed #4caf50;
    border-radius: 4px;
}

.intervention-card {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    cursor: move;
    transition: transform 0.2s, opacity 0.2s;
    font-size: 0.85rem;
    user-select: none;
}

.intervention-card:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.intervention-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing;
}

/* Alerte préventif (liste machines) : molette rouge clignotante */
@keyframes gmaoBlinkRed {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 0 rgba(220,38,38,0)); transform: translateZ(0); }
    50% { opacity: 0.25; filter: drop-shadow(0 0 6px rgba(220,38,38,0.65)); transform: translateZ(0); }
}
.gmao-preventive-alert {
    background: #DC2626;
    color: #ffffff;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    line-height: 1;
    animation: gmaoBlinkRed 1.1s infinite;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.22);
}

.gmao-preventive-alert__icon {
    display: block;
}

.gmao-preventive-alert__delay {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(220, 38, 38, 0.12);
    color: #DC2626;
    font-weight: 800;
    font-size: 12px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.intervention-card.intervention-curative {
    background-color: #ffebee;
    border-left-color: #f44336;
}

.intervention-card.intervention-preventive {
    background-color: #e3f2fd;
    border-left-color: #2196f3;
}

.intervention-card.intervention-terminee {
    opacity: 0.7;
    background-color: #e8f5e9;
    border-left-color: #4caf50;
}

.intervention-card.intervention-en_cours {
    background-color: #fff3e0;
    border-left-color: #ff9800;
}

.intervention-time {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.2rem;
}

.intervention-num {
    font-size: 0.72rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.intervention-machine {
    font-weight: 500;
    color: #555;
    margin-bottom: 0.2rem;
}

.intervention-type {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.2rem;
}

.intervention-status {
    font-size: 0.7rem;
    color: #888;
    font-style: italic;
}

/* Footer */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

/* Styles pour les cartes Leaflet */
.custom-marker {
    background: transparent;
    border: none;
    cursor: pointer;
}

.leaflet-container {
    font-family: inherit;
}

/* Styles pour le bouton d'installation PWA */
.pwa-install-button {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .header-logo img {
        height: 35px;
        max-width: 120px;
    }
    
    .header-title-only {
        display: block !important;
    }
    
    /* Afficher le bouton hamburger sur mobile */
    .menu-toggle {
        display: block;
    }
    
    /* Masquer le menu desktop sur mobile */
    header nav {
        display: none;
    }
    
    /* Afficher le menu mobile */
    .mobile-menu {
        display: block;
    }
    
    main {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header h2 {
        font-size: 1.2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .data-table {
        font-size: 0.75rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table thead,
    .data-table tbody,
    .data-table tr {
        display: block;
    }
    
    .data-table thead {
        display: none;
    }
    
    .data-table tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 5px;
        padding: 0.5rem;
        background: white;
    }
    
    .data-table td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem;
        border: none;
        border-bottom: 1px solid #eee;
    }
    
    .data-table td:last-child {
        border-bottom: none;
    }
    
    .data-table td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 1rem;
        flex: 0 0 40%;
    }
    
    .data-table td.actions-cell {
        flex-direction: column;
        align-items: stretch;
    }
    
    .data-table td.actions-cell:before {
        margin-bottom: 0.5rem;
    }
    
    .actions-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .actions-buttons .btn {
        width: 100%;
        margin: 0;
    }
    
    .planning-grid {
        grid-template-columns: 120px repeat(7, 100px);
        font-size: 0.7rem;
        overflow-x: auto;
    }
    
    .planning-col-name {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .planning-col-header {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .planning-col {
        min-height: 80px;
        padding: 0.25rem;
    }
    
    .intervention-card {
        font-size: 0.7rem;
        padding: 0.4rem;
    }
    
    .modal {
        /* Sur mobile: on centre avec padding fixe (le scroll est dans le contenu) */
        display: none;
        align-items: center;
        justify-content: center;
        padding: calc(12px + env(safe-area-inset-top, 0px))
                 calc(12px + env(safe-area-inset-right, 0px))
                 calc(12px + env(safe-area-inset-bottom, 0px))
                 calc(12px + env(safe-area-inset-left, 0px));
    }

    .modal[style*="display: block"] {
        display: flex !important;
    }

    .modal-content {
        width: 100%;
        margin: 0;
        padding: 1rem;
        /* vh est instable sur mobile (barre d’adresse). dvh = viewport réel. */
        max-height: calc(100dvh - 24px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    /* Zone scrollable générique dans une modale (si page ajoute un bloc long) */
    .modal-content > .modal-body,
    .modal-content > form,
    .modal-content > .modal-viewer {
        min-height: 0;
    }

    .modal-content > .modal-body {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    /* Le viewer PDF doit prendre la hauteur restante, sans forcer 75vh */
    .modal-viewer {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        overflow: hidden;
    }
    
    .modal-large {
        width: 95%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 600;
        font-size: 0.9rem;
    }
    
    .form-group select,
    .form-group input,
    .form-group textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
        box-sizing: border-box;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }
    
    .form-actions .btn {
        width: 100%;
        margin: 0;
        padding: 0.85rem;
    }
    
    .btn {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .filters {
        padding: 1rem;
        background: #f8f9fa;
        border-radius: 5px;
        margin-bottom: 1rem;
    }
    
    .filter-form {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filter-form select,
    .filter-form input {
        width: 100%;
        margin-bottom: 0;
        padding: 0.75rem;
        font-size: 0.9rem;
        box-sizing: border-box;
    }
    
    .filter-form .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .section-header .btn {
        width: 100%;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-form select,
    .filter-form input {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    #map {
        height: 300px;
    }
    
    #miniMap {
        height: 250px;
    }
    
    .address-search-container {
        flex-direction: column;
    }
    
    .address-search-container button {
        width: 100%;
    }
    
    .pwa-install-button {
        bottom: 10px;
        right: 10px;
        padding: 10px 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.1rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .planning-grid {
        grid-template-columns: 100px repeat(7, 80px);
    }
    
    .modal-content {
        padding: 0.75rem;
        width: 98%;
        margin: 1% auto;
    }
    
    .data-table {
        font-size: 0.7rem;
    }
    
    .data-table td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    .data-table td:before {
        flex: 0 0 35%;
        font-size: 0.75rem;
    }
    
    .actions-buttons .btn {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    .filter-form select {
        font-size: 0.85rem;
        padding: 0.65rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* ========== Page de connexion ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #16A085 0%, #1ABC9C 100%);
    padding: 1rem;
}
.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
}
.login-box h1 {
    color: #16A085;
    font-size: 28px;
    text-align: center;
    margin-bottom: 0.5rem;
}
.login-subtitle {
    text-align: center;
    color: #6B7280;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.login-form .form-group {
    margin-bottom: 1.25rem;
}
.login-form .form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: #374151;
}
.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 1rem;
}
.login-form input:focus {
    outline: none;
    border-color: #16A085;
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.15);
}
.btn-block {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    font-size: 1rem;
}
.login-error {
    background: #FEE2E2;
    color: #DC2626;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.login-success {
    background: #D1FAE5;
    color: #065F46;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.login-hint {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6B7280;
}
.login-hint strong {
    color: #374151;
}
.login-hint a {
    color: #16A085;
    text-decoration: none;
}
.login-hint a:hover {
    text-decoration: underline;
}

/* Panneau latéral : fiche machine depuis la carte dashboard (iframe machines.php) */
.dashboard-machine-edit-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(480px, 46vw);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 2500;
    background: #fff;
    box-shadow: -6px 0 28px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    border-left: 1px solid #e5e7eb;
}
.dashboard-machine-edit-panel.is-open {
    transform: translateX(0);
}
.dashboard-machine-edit-panel__header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}
.dashboard-machine-edit-panel__title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-machine-edit-panel__close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.dashboard-machine-edit-panel__close:hover {
    color: #111827;
    background: #e5e7eb;
}
.dashboard-machine-edit-panel__frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
    background: #fff;
}

@media (max-width: 768px) {
    .dashboard-machine-edit-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        height: 100%;
        min-height: 100dvh;
        border-left: none;
        box-sizing: border-box;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
        box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
    }

    .dashboard-machine-edit-panel__title {
        white-space: normal;
        line-height: 1.35;
        word-break: break-word;
    }

    .dashboard-machine-edit-panel__frame {
        width: 100%;
        max-width: 100%;
    }
}

