/* =====================================================================
   DIGIT RESTO+ — Design system global
   Chargé par base/base.html sur toutes les pages (client, staff, SaaS).
   - Tokens (clair / sombre)
   - Harmonisation Bootstrap 5 (cartes, formulaires, tableaux, modales)
   - Grilles responsives : 2 cartes par ligne minimum sur téléphone
   - Cartes Leaflet toujours visibles (hauteur explicite)
   - Composants : options de paiement, badges, états vides, skeletons
   ===================================================================== */

:root {
    --primary: #ff4757;
    --primary-dark: #e84118;
    --primary-light: rgba(255, 71, 87, 0.12);
    --primary-rgb: 255, 71, 87;
    --secondary: #2f3542;
    --success: #28a745;
    --success-light: rgba(40, 167, 69, 0.12);
    --warning: #ffc107;
    --warning-light: rgba(255, 193, 7, 0.16);
    --danger: #dc3545;
    --danger-light: rgba(220, 53, 69, 0.12);
    --info: #17a2b8;
    --info-light: rgba(23, 162, 184, 0.12);

    --gray-100: #f8f9fa; --gray-200: #e9ecef; --gray-300: #dee2e6; --gray-400: #ced4da;
    --gray-500: #adb5bd; --gray-600: #6c757d; --gray-700: #495057; --gray-800: #343a40; --gray-900: #212529;

    --body-bg: #f8f9fa;
    --card-bg: #ffffff;
    --surface-2: #f3f4f6;
    --text-color: #1f2330;
    --text-muted: #5c6370;
    --border-color: #e9ecef;
    --input-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.92);

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-sm: 0 2px 8px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.14);
    --shadow-primary: 0 8px 24px rgba(255, 71, 87, 0.28);

    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 24px; --radius-pill: 999px;
    --nav-height: 66px;
    --bottom-nav-height: 68px;
    --map-height: 380px;
    --map-height-sm: 300px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* html[...] : spécificité supérieure aux blocs :root redéfinis dans certaines pages */
html[data-theme="dark"] {
    --body-bg: #15152a;
    --card-bg: #1f1f38;
    --surface-2: #26264a;
    --text-color: #eceaf5;
    --text-muted: #a9a9c8;
    --border-color: #34345a;
    --input-bg: #1a1a33;
    --nav-bg: rgba(31, 31, 56, 0.92);
    --gray-100: #2d2d44; --gray-200: #3a3a5a; --gray-300: #4a4a6a; --gray-400: #6a6a8a;
    --gray-500: #8a8aaa; --gray-600: #aaaaca; --gray-700: #cacaea; --gray-800: #eaeaea; --gray-900: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* ---------------------------------------------------------------------
   Base
   --------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background-color: var(--body-bg); color: var(--text-color); }
img { max-width: 100%; }
img[data-fallback-applied] { object-fit: contain !important; background: var(--surface-2); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: inherit; letter-spacing: -0.01em; }
.text-muted { color: var(--text-muted) !important; }
hr { border-color: var(--border-color); opacity: 1; }
::selection { background: rgba(var(--primary-rgb), 0.25); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Les longues tables ne doivent jamais créer de scroll horizontal de page */
main { overflow-x: clip; }
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ---------------------------------------------------------------------
   Harmonisation Bootstrap (clair + sombre)
   --------------------------------------------------------------------- */
.card, .modal-content, .dropdown-menu, .offcanvas, .list-group-item, .accordion-item, .popover, .toast {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}
.card { border-radius: var(--radius-lg); }
.card-header, .card-footer { background-color: transparent; border-color: var(--border-color); }
.modal-content { border-radius: var(--radius-xl); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border-color); }
.dropdown-item { color: var(--text-color); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--primary-light); color: var(--primary); }

.form-control, .form-select, .input-group-text {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: var(--border-color);
    border-radius: var(--radius-md);
}
.form-control, .form-select { min-height: 46px; font-size: 16px; } /* 16px = pas de zoom iOS */
textarea.form-control { min-height: 80px; }
.form-control::placeholder { color: var(--text-muted); opacity: 0.8; }
.form-control:focus, .form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15); border-color: var(--primary); }
.form-label { font-weight: 600; font-size: 0.9rem; color: var(--text-color); }
.form-text { color: var(--text-muted); }
[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cfcfe6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.table { color: var(--text-color); --bs-table-bg: transparent; --bs-table-color: var(--text-color); border-color: var(--border-color); }
.table > :not(caption) > * > * { border-bottom-color: var(--border-color); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--primary-light); color: var(--text-color); }
[data-theme="dark"] .table-light, [data-theme="dark"] thead.table-light th { --bs-table-bg: var(--surface-2); color: var(--text-color); }
[data-theme="dark"] .bg-light, [data-theme="dark"] .bg-white { background-color: var(--surface-2) !important; color: var(--text-color); }
[data-theme="dark"] .text-dark { color: var(--text-color) !important; }
[data-theme="dark"] .btn-light { background: var(--surface-2); border-color: var(--border-color); color: var(--text-color); }
[data-theme="dark"] .btn-outline-dark { color: var(--text-color); border-color: var(--border-color); }
[data-theme="dark"] .btn-outline-dark:hover { background: var(--surface-2); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-theme="dark"] .alert-info { background: var(--info-light); color: #9fe6f1; border-color: transparent; }
[data-theme="dark"] .alert-warning { background: var(--warning-light); color: #ffe08a; border-color: transparent; }
[data-theme="dark"] .alert-success { background: var(--success-light); color: #9be3ad; border-color: transparent; }
[data-theme="dark"] .alert-danger { background: var(--danger-light); color: #ffb3bb; border-color: transparent; }
[data-theme="dark"] .border, [data-theme="dark"] .border-top, [data-theme="dark"] .border-bottom { border-color: var(--border-color) !important; }
[data-theme="dark"] .nav-tabs { border-color: var(--border-color); }
[data-theme="dark"] .nav-tabs .nav-link.active { background: var(--card-bg); color: var(--text-color); border-color: var(--border-color) var(--border-color) var(--card-bg); }
[data-theme="dark"] .page-link { background: var(--card-bg); border-color: var(--border-color); color: var(--text-color); }
[data-theme="dark"] .list-group-item-action:hover { background: var(--surface-2); color: var(--text-color); }

/* Boutons Bootstrap aux couleurs de la marque */
.btn { border-radius: var(--radius-md); font-weight: 600; }
.btn-lg { border-radius: var(--radius-pill); }
.btn-primary, .btn-danger:not(.btn-sm) {
    --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark);
}
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.badge { font-weight: 600; letter-spacing: 0.01em; }
.rounded-pill-btn, .btn-pill { border-radius: var(--radius-pill) !important; }
.pagination { --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-color: var(--primary); }

/* ---------------------------------------------------------------------
   Grilles responsives : 2 cartes par ligne minimum sur téléphone
   --------------------------------------------------------------------- */
.dr-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px)  { .dr-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1100px) { .dr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; } }
.dr-grid.dr-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1024px) { .dr-grid.dr-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dr-grid { gap: 12px; } }
@media (max-width: 340px) { .dr-grid { gap: 8px; } }
.dr-grid > * { min-width: 0; }

/* Colonnes Bootstrap de cartes / KPI hors formulaires : 2 par ligne sur mobile */
@media (max-width: 767.98px) {
    .row > .col-md-3:not(form .col-md-3):not(.col-6):not(.col-12),
    .row > .col-md-4:not(form .col-md-4):not(.col-6):not(.col-12),
    .row > .col-lg-3:not([class*="col-md-"]):not(form .col-lg-3):not(.col-6):not(.col-12),
    .row > .col-xl-3:not([class*="col-md-"]):not([class*="col-lg-"]):not(form .col-xl-3),
    .row.cards-row > [class*="col-"]:not(.col-12),
    .row.row-cards > [class*="col-"]:not(.col-12) {
        flex: 0 0 auto;
        width: 50%;
    }
}

/* Cartes compactes sur petit écran (texte lisible, pas de débordement) */
@media (max-width: 640px) {
    .dr-grid .card-body, .row.cards-row .card-body { padding: 0.75rem; }
    .dr-grid h5, .dr-grid .h5 { font-size: 0.95rem; }
    .dr-grid h6, .dr-grid .h6 { font-size: 0.88rem; }
}

/* ---------------------------------------------------------------------
   Carte générique
   --------------------------------------------------------------------- */
.dr-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
    overflow: hidden;
    color: var(--text-color);
}
.dr-card:hover { box-shadow: var(--shadow-md); }
.dr-card-body { padding: 18px; }
@media (max-width: 640px) { .dr-card-body { padding: 14px; } }
.dr-section-title { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dr-section-title .ic {
    width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-light); color: var(--primary); font-size: 0.95rem; flex-shrink: 0;
}

/* Boutons */
.dr-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; border-radius: var(--radius-pill); padding: 13px 22px; font-weight: 700; font-size: 0.95rem;
    cursor: pointer; transition: var(--transition); text-decoration: none; line-height: 1.2;
}
.dr-btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: var(--shadow-primary); }
.dr-btn-primary:hover { color: #fff; transform: translateY(-2px); }
.dr-btn-primary:disabled { opacity: 0.6; transform: none; cursor: not-allowed; }
.dr-btn-ghost { background: var(--surface-2); color: var(--text-color); }
.dr-btn-ghost:hover { background: var(--primary-light); color: var(--primary); }
.dr-btn-block { width: 100%; }

/* États vides */
.dr-empty { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.dr-empty .ic {
    width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
    background: var(--primary-light); color: var(--primary); font-size: 1.8rem;
}
.dr-empty h3, .dr-empty h4 { color: var(--text-color); font-weight: 800; font-size: 1.15rem; }

/* Badges de statut */
.dr-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; }
.dr-badge-success { background: var(--success-light); color: var(--success); }
.dr-badge-warning { background: var(--warning-light); color: #b78300; }
.dr-badge-danger { background: var(--danger-light); color: var(--danger); }
.dr-badge-info { background: var(--info-light); color: var(--info); }
.dr-badge-primary { background: var(--primary-light); color: var(--primary); }
[data-theme="dark"] .dr-badge-warning { color: var(--warning); }

/* Skeleton */
.dr-skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border-color) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: dr-shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes dr-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------------------------------------------
   Cartes Leaflet — toujours visibles
   --------------------------------------------------------------------- */
.leaflet-container {
    min-height: 220px;
    width: 100%;
    z-index: 1;
    font-family: var(--font);
    background: #e8eef3;
    border-radius: inherit;
}
[data-map], .dr-map, #map, #mapContainer, #map-container, .map-container > div[id], #exploreMap, #deliveryMap, #trackingMap, #locationMap, #ambulantsMap {
    min-height: var(--map-height-sm);
}
.dr-map { height: var(--map-height); width: 100%; border-radius: var(--radius-lg); overflow: hidden; position: relative; }
@media (max-width: 640px) { .dr-map { height: var(--map-height-sm); } }
.leaflet-pane, .leaflet-top, .leaflet-bottom { z-index: 400; }
.leaflet-top, .leaflet-bottom { z-index: 500; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card-bg); color: var(--text-color); box-shadow: var(--shadow-md); }
.leaflet-popup-content-wrapper { border-radius: var(--radius-md); }
.leaflet-popup-content { margin: 12px 14px; font-size: 0.85rem; line-height: 1.45; }
.leaflet-bar a { background: var(--card-bg); color: var(--text-color); border-color: var(--border-color); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, 0.8) !important; }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(31, 31, 56, 0.8) !important; color: var(--text-muted); }
[data-theme="dark"] .leaflet-control-attribution a { color: var(--text-muted); }
[data-theme="dark"] .leaflet-tile-pane { filter: brightness(0.82) contrast(1.08) saturate(0.85); }
.dr-map-pin {
    width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28); display: flex; align-items: center; justify-content: center;
}
.dr-map-pin i { transform: rotate(45deg); color: #fff; font-size: 13px; }
.dr-map-pin.is-user { background: #2f80ed; }
.dr-map-pin.is-closed { background: #8a8aa0; }
.dr-map-user-dot {
    width: 18px; height: 18px; border-radius: 50%; background: #2f80ed; border: 3px solid #fff;
    box-shadow: 0 0 0 6px rgba(47, 128, 237, 0.25);
}
.dr-map-fallback {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; color: var(--text-muted); background: var(--surface-2); text-align: center; padding: 16px; font-size: 0.9rem;
}

/* ---------------------------------------------------------------------
   Paiement — sélecteur de moyen
   --------------------------------------------------------------------- */
.pay-options { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .pay-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pay-option { position: relative; margin: 0; cursor: pointer; }
.pay-option input { position: absolute; opacity: 0; pointer-events: none; }
.pay-option .pay-box {
    height: 100%; border: 2px solid var(--border-color); border-radius: var(--radius-lg); padding: 14px 12px;
    background: var(--card-bg); display: flex; flex-direction: column; gap: 6px; transition: var(--transition);
}
.pay-option:hover .pay-box { border-color: rgba(var(--primary-rgb), 0.45); }
.pay-option input:checked + .pay-box { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.08); }
.pay-option input:disabled + .pay-box { opacity: 0.5; cursor: not-allowed; }
.pay-option .pay-ic {
    width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--primary); font-size: 1.05rem;
}
.pay-option input:checked + .pay-box .pay-ic { background: var(--primary); color: #fff; }
.pay-option .pay-title { font-weight: 700; font-size: 0.9rem; line-height: 1.25; }
.pay-option .pay-sub { font-size: 0.75rem; color: var(--text-muted); line-height: 1.35; }
.pay-option .pay-check {
    position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--border-color); background: var(--card-bg); transition: var(--transition);
}
.pay-option input:checked + .pay-box .pay-check { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--card-bg); }
.pay-operators { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.pay-operators span {
    font-size: 0.66rem; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-pill);
    background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border-color);
}
.pay-secure { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-muted); }
.pay-secure i { color: var(--success); }

/* Récapitulatif collant (checkout / panier) */
.dr-summary { position: sticky; top: calc(var(--nav-height) + 16px); }
.dr-summary-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.92rem; gap: 12px; }
.dr-summary-row.total { border-top: 1px dashed var(--border-color); margin-top: 8px; padding-top: 14px; font-size: 1.15rem; font-weight: 800; }
.dr-summary-row .neg { color: var(--success); }

/* Barre d'action mobile collée au-dessus de la bottom-nav */
.dr-mobile-cta {
    position: fixed; left: 0; right: 0; bottom: var(--bottom-nav-height); z-index: 1020;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--nav-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-color); display: flex; align-items: center; gap: 12px;
}
.dr-mobile-cta .amount { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.dr-mobile-cta .amount small { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }
.dr-mobile-cta .dr-btn { flex: 1; }
@media (min-width: 992px) { .dr-mobile-cta { display: none; } }
body.has-mobile-cta { padding-bottom: calc(var(--bottom-nav-height) + 76px); }
@media (min-width: 992px) { body.has-mobile-cta { padding-bottom: 0; } }

/* Page container utilitaire */
.dr-page { padding: 24px 0 40px; }
@media (max-width: 640px) { .dr-page { padding: 16px 0 28px; } .container, .container-fluid { padding-left: 16px; padding-right: 16px; } }
.dr-page-head { margin-bottom: 20px; }
.dr-page-head h1 { font-size: clamp(1.35rem, 4vw, 1.9rem); font-weight: 800; margin: 0 0 4px; }
.dr-page-head p { color: var(--text-muted); margin: 0; }

/* Steps / progression */
.dr-steps { display: flex; gap: 6px; align-items: center; margin-bottom: 18px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.dr-steps .s { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.dr-steps .s .n { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); font-size: 0.72rem; }
.dr-steps .s.done .n, .dr-steps .s.active .n { background: var(--primary); color: #fff; }
.dr-steps .s.active { color: var(--text-color); }
.dr-steps .sep { width: 18px; height: 2px; background: var(--border-color); border-radius: 2px; }

/* Choix segmenté (type de commande) */
.dr-segment { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.dr-segment label { margin: 0; cursor: pointer; }
.dr-segment input { position: absolute; opacity: 0; pointer-events: none; }
.dr-segment .seg {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; text-align: center;
    border: 2px solid var(--border-color); border-radius: var(--radius-md); font-weight: 700; font-size: 0.82rem; transition: var(--transition);
    background: var(--card-bg);
}
.dr-segment .seg i { font-size: 1.1rem; color: var(--text-muted); }
.dr-segment input:checked + .seg { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.dr-segment input:checked + .seg i { color: var(--primary); }

/* Réduit les animations si demandé */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Impression (factures) */
@media print {
    nav, .bottom-nav, .site-footer, .toast-container, .loading-overlay, .dr-mobile-cta, .no-print { display: none !important; }
    body { padding: 0 !important; background: #fff !important; color: #000 !important; }
}

/* ===============================================================
   Réseau / hors ligne
   =============================================================== */
.dr-netbar { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; visibility: hidden; z-index: 2000; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 999px; background: #1f2330; color: #fff; font-size: .82rem; font-weight: 600; box-shadow: var(--shadow-lg); transition: transform .3s ease, opacity .3s ease, visibility .3s; pointer-events: none; }
.dr-netbar.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.dr-netbar.is-off { background: var(--danger); }
.dr-netbar .n:not(:empty) { background: rgba(255,255,255,.22); border-radius: 999px; padding: 0 8px; }
@media (min-width: 1024px) { .dr-netbar { bottom: 24px; } }

/* ===============================================================
   Cloche de notifications
   =============================================================== */
.dr-bell { position: relative; }
.dr-bell-count { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .65rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--card-bg); }
.dr-notif-menu { width: min(360px, calc(100vw - 24px)); padding: 6px; border-radius: 16px; border: 1px solid var(--border-color); background: var(--card-bg); box-shadow: var(--shadow-lg); }
.dr-notif-menu .hd { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-weight: 800; font-size: .9rem; }
.dr-notif-menu .hd a { font-size: .75rem; color: var(--primary); text-decoration: none; font-weight: 700; }
.dr-notif-list { max-height: 60vh; overflow-y: auto; }
.dr-notif { display: grid; gap: 2px; padding: 10px; border-radius: 12px; color: var(--text-color); text-decoration: none; font-size: .8rem; }
.dr-notif:hover { background: var(--surface-2); color: var(--text-color); }
.dr-notif.unread { background: var(--primary-light); }
.dr-notif span { color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dr-notif small { color: var(--text-muted); font-size: .68rem; }
.dr-notif-empty { padding: 18px 10px; text-align: center; color: var(--text-muted); font-size: .82rem; }

/* ===============================================================
   Pleine largeur : grands écrans, moniteurs et téléviseurs
   =============================================================== */
@media (min-width: 1400px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl { max-width: 1360px; }
}
@media (min-width: 1700px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl { max-width: 1600px; }
    .dr-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .dr-grid.dr-grid-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 2200px) {
    html { font-size: 18px; }
    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl { max-width: 2000px; }
    .dr-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
[hidden] { display: none !important; }

/* ==================== Installer l'application (mode d'emploi) ==================== */
.dr-install-help { background: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color); border-radius: var(--radius-lg, 16px); }
.dr-install-help .btn-close { filter: none; }
[data-theme="dark"] .dr-install-help .btn-close { filter: invert(1) grayscale(1); }
.dr-install-logo { border-radius: 9px; background: var(--primary-light, rgba(255,71,87,.12)); padding: 4px; object-fit: contain; }
.dr-install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dr-install-steps li { display: flex; align-items: center; gap: 12px; font-size: .9rem; line-height: 1.4; }
.dr-install-ic { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-light, rgba(255,71,87,.12)); color: var(--primary); }

/* ==================== Réseaux sociaux d'un établissement ==================== */
.dr-reseaux { display: flex; gap: 8px; flex-wrap: wrap; }
.dr-reseaux a {
    width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-color);
    text-decoration: none; transition: var(--transition); font-size: 1rem;
}
.dr-reseaux.sm a { width: 32px; height: 32px; border-radius: 10px; font-size: .88rem; }
.dr-reseaux a:hover { transform: translateY(-2px); color: #fff; border-color: transparent; }
.dr-reseaux a.ig:hover { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.dr-reseaux a.tt:hover { background: #111; }
.dr-reseaux a.fb:hover { background: #1877f2; }
.dr-reseaux a.web:hover { background: var(--primary); }

/* ==================== Mode sombre : classes Bootstrap à couleur fixe ==================== */
/* Plusieurs pages utilisent bg-white / bg-light / text-dark : en sombre elles donnaient
   du texte noir sur fond sombre. On les ramène sur les variables du thème. */
[data-theme="dark"] .bg-white, [data-theme="dark"] .bg-light { background-color: var(--card-bg) !important; color: var(--text-color); }
[data-theme="dark"] .text-dark, [data-theme="dark"] .text-black { color: var(--text-color) !important; }
[data-theme="dark"] .table-light, [data-theme="dark"] .table-light > th, [data-theme="dark"] .table-light > td { --bs-table-bg: var(--gray-100); --bs-table-color: var(--text-color); color: var(--text-color); }
[data-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: var(--text-color); color: var(--text-color); border-color: var(--border-color); }
[data-theme="dark"] .bg-warning.text-dark, [data-theme="dark"] .bg-info.text-dark { color: #1f2330 !important; }
[data-theme="dark"] .card { background-color: var(--card-bg); color: var(--text-color); border-color: var(--border-color); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background-color: var(--card-bg); color: var(--text-color); border-color: var(--border-color); }
[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }
[data-theme="dark"] .modal-content, [data-theme="dark"] .dropdown-menu, [data-theme="dark"] .list-group-item { background-color: var(--card-bg); color: var(--text-color); border-color: var(--border-color); }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }

/* ===== Paiement direct au restaurant (T-Money / Flooz) ===== */
.pd-box { display: flex; flex-direction: column; gap: 12px; }
.pd-provisoire { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: rgba(255,193,7,.14); border: 1px solid rgba(255,193,7,.45); font-size: .82rem; line-height: 1.45; color: var(--text-color); }
.pd-provisoire i { color: #b7791f; margin-top: 3px; }
.pd-etapes { margin: 0; padding-left: 20px; font-size: .84rem; color: var(--text-muted, var(--gray-600)); line-height: 1.55; }
.pd-montant { font-size: .95rem; }
.pd-montant b { color: var(--primary); font-size: 1.15rem; }
.pd-moyens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pd-moyen { position: relative; cursor: pointer; margin: 0; }
.pd-moyen input { position: absolute; opacity: 0; pointer-events: none; }
.pd-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border: 2px solid var(--border-color); border-radius: 16px; background: var(--card-bg); text-align: center; transition: var(--transition); height: 100%; }
.pd-moyen input:checked + .pd-card { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.pd-op { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .8rem; padding: 4px 12px; border-radius: 999px; }
.pd-tmoney .pd-op { background: rgba(255,193,7,.2); color: #8a6100; }
.pd-flooz .pd-op { background: rgba(13,110,253,.12); color: #0b5ed7; }
[data-theme="dark"] .pd-tmoney .pd-op { color: #ffd166; }
[data-theme="dark"] .pd-flooz .pd-op { color: #7fb2ff; }
.pd-code { font-size: 1.25rem; font-weight: 900; letter-spacing: .04em; color: var(--text-color); cursor: copy; }
.pd-code i { font-size: .8rem; color: var(--gray-500); margin-left: 4px; }
.pd-nom { font-size: .76rem; color: var(--gray-600); }
.pd-qr { width: 100%; max-width: 150px; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #fff; padding: 6px; border: 1px solid var(--border-color); }

/* ===== Lien vers le guide (tableaux de bord) ===== */
.dr-guide-bandeau { display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin: 0 0 16px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--card-bg); color: var(--text-color); text-decoration: none; transition: var(--transition); max-width: 420px; }
.dr-guide-bandeau:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); color: var(--text-color); }
.dr-guide-bandeau .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dr-guide-bandeau .txt { flex: 1; min-width: 0; line-height: 1.25; }
.dr-guide-bandeau .txt b { display: block; font-size: .9rem; }
.dr-guide-bandeau .txt small { color: var(--gray-600); font-size: .75rem; }
.dr-guide-bandeau > .fa-arrow-right { color: var(--primary); }

/* ===== Alertes push ===== */
.dr-push { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0 0 16px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--card-bg); max-width: 560px; }
.dr-push .ic { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,193,7,.18); color: #b7791f; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dr-push.on .ic { background: rgba(40,167,69,.14); color: var(--success); }
.dr-push .txt { flex: 1; min-width: 0; line-height: 1.3; }
.dr-push .txt b { display: block; font-size: .9rem; }
.dr-push .txt small { color: var(--gray-600); font-size: .76rem; }
.dr-push .dr-btn { flex-shrink: 0; padding: 8px 16px; }
.dr-guide-ligne { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.dr-guide-ligne > * { flex: 1 1 300px; }

/* ===== État d'exploitation (super admin) ===== */
.dr-exploit { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
@media (min-width: 1024px) { .dr-exploit { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.dr-exploit > * { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-color); text-decoration: none; }
.dr-exploit i { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dr-exploit .ok i { background: rgba(40,167,69,.12); color: var(--success); }
.dr-exploit .ko i { background: rgba(220,53,69,.12); color: var(--danger); }
.dr-exploit small { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-600); }
.dr-exploit b { font-size: .9rem; }
