/*
 * AutoParc - design system (feuille de style originale).
 * Construit sur Bootstrap 5 (licence MIT) et Bootstrap Icons (licence MIT).
 * Aucune police externe : pile de polices système (pas d'appel à un tiers, conforme RGPD).
 */

/* ============================================================
   1. Variables
   ============================================================ */
:root {
  --ap-primary: #0066c8;
  --ap-primary-hover: #0057ab;
  --ap-primary-soft: #e6f0fb;
  --ap-accent: #054075;

  --ap-success: #16a34a;
  --ap-warning: #d97706;
  --ap-danger: #dc2626;
  --ap-info: #0891b2;

  --ap-bg: #f4f6fb;
  --ap-surface: #ffffff;
  --ap-text: #10213d;
  --ap-muted: #64748b;
  --ap-border: #e2e8f0;

  --ap-sidebar-bg: #031b3c;
  --ap-sidebar-text: #cbd5e1;
  --ap-sidebar-muted: #64748b;

  --ap-radius: 14px;
  --ap-radius-sm: 10px;
  --ap-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  --ap-shadow-lg: 0 12px 32px rgba(15, 23, 42, .18);

  --ap-header-h: 64px;
  --ap-sidebar-w: 272px;

  --ap-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --bs-primary: #0066c8;
  --bs-primary-rgb: 0, 102, 200;
  --bs-success: #16a34a;
  --bs-success-rgb: 22, 163, 74;
  --bs-warning: #d97706;
  --bs-warning-rgb: 217, 119, 6;
  --bs-danger: #dc2626;
  --bs-danger-rgb: 220, 38, 38;
  --bs-info: #0891b2;
  --bs-info-rgb: 8, 145, 178;
  --bs-body-font-family: var(--ap-font);
  --bs-body-color: var(--ap-text);
  --bs-body-bg: var(--ap-bg);
  --bs-border-color: var(--ap-border);
  --bs-link-color: var(--ap-primary);
  --bs-link-hover-color: var(--ap-primary-hover);
  --bs-border-radius: var(--ap-radius-sm);
}

/* ============================================================
   2. Base
   ============================================================ */
html { scroll-behavior: smooth; }

body {
  font-family: var(--ap-font);
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--ap-text);
  background: var(--ap-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ap-primary); text-decoration: none; }
a:hover { color: var(--ap-primary-hover); }

:focus-visible {
  outline: 3px solid rgba(0, 102, 200, .45);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 3000;
  background: var(--ap-primary); color: #fff; padding: .6rem 1rem; border-radius: 8px;
}
.skip-link:focus { top: 1rem; color: #fff; }

.form-error { color: var(--ap-danger); font-size: .8rem; }
.form-error ul { list-style: none; margin: .25rem 0 0; padding: 0; }

/* ============================================================
   3. En-tête
   ============================================================ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1030;
  height: var(--ap-header-h);
  padding: 0 1rem;
  display: flex; align-items: center; gap: 1rem;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--ap-border);
}

.header .logo { display: flex; align-items: center; gap: .6rem; color: var(--ap-text); font-weight: 700; font-size: 1.15rem; }
.header .logo img { max-height: 36px; width: auto; }

.toggle-sidebar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ap-text); font-size: 1.5rem; cursor: pointer;
}
.toggle-sidebar-btn:hover { background: var(--ap-primary-soft); color: var(--ap-primary); }

.header-nav { margin-left: auto; }
.header-nav > ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .25rem; }

.header-nav .nav-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; color: var(--ap-muted); font-size: 1.2rem;
}
.header-nav .nav-icon:hover { background: var(--ap-primary-soft); color: var(--ap-primary); }
.header-nav .badge-number {
  position: absolute; top: 4px; right: 2px; min-width: 18px; font-size: .65rem; padding: .2em .45em;
}

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ap-primary);
  color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: .02em; text-transform: uppercase;
}

.header-nav .nav-profile { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem; border-radius: 12px; color: var(--ap-text); }
.header-nav .nav-profile:hover { background: var(--ap-primary-soft); }
.header-nav .nav-profile .who { line-height: 1.15; text-align: left; }
.header-nav .nav-profile .who strong { display: block; font-size: .85rem; }
.header-nav .nav-profile .who small { color: var(--ap-muted); font-size: .72rem; }

.dropdown-menu {
  border: 1px solid var(--ap-border); border-radius: 14px; box-shadow: var(--ap-shadow-lg); padding: .5rem;
}
.dropdown-item { border-radius: 8px; padding: .55rem .75rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item:active { background: var(--ap-primary); }
.dropdown-header { font-weight: 600; color: var(--ap-text); }

.notifications { min-width: 360px; max-width: 400px; }
.notifications .notification-item {
  display: flex; gap: .75rem; align-items: flex-start; padding: .6rem .5rem; border-radius: 10px; color: var(--ap-text);
}
.notifications .notification-item:hover { background: #f8fafc; color: var(--ap-text); }
.notifications .notification-item > i { font-size: 1.15rem; margin-top: .1rem; }
.notifications .notification-item strong { display: block; font-size: .85rem; }
.notifications .notification-item p { margin: .1rem 0; font-size: .8rem; color: var(--ap-muted); }
.notifications .notification-item small { font-size: .72rem; color: #94a3b8; }
.notification-item.is-unread { background: var(--ap-primary-soft); }
.notification-item.is-unread strong::after,
.liste-notifications li.is-unread strong::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: .4rem; border-radius: 50%; background: var(--ap-primary); vertical-align: middle;
}

/* Page des notifications */
.liste-notifications { list-style: none; margin: 0; padding: 0; }
.liste-notifications li { display: flex; gap: 1rem; align-items: flex-start; padding: .9rem .5rem; border-bottom: 1px solid var(--ap-border); }
.liste-notifications li.is-unread { background: #f8fbff; }
.liste-notifications__icone { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.liste-notifications__corps { flex: 1 1 auto; min-width: 0; color: var(--ap-text); display: flex; flex-direction: column; gap: .15rem; }
.liste-notifications__corps:hover { color: var(--ap-text); }
.liste-notifications__corps span { color: #475569; font-size: .9rem; }
.liste-notifications__corps small { color: var(--ap-muted); font-size: .75rem; }
.liste-notifications__actions { display: flex; gap: .35rem; }
.notifications .empty { text-align: center; color: var(--ap-muted); padding: 1.25rem 1rem; }
.notifications .empty i { display: block; font-size: 1.8rem; margin-bottom: .25rem; }

/* ============================================================
   4. Menu latéral
   ============================================================ */
.sidebar {
  position: fixed; top: var(--ap-header-h); left: 0; bottom: 0; z-index: 1020;
  width: var(--ap-sidebar-w);
  padding: 1rem .75rem 2rem;
  overflow-y: auto;
  background: var(--ap-sidebar-bg);
  transition: transform .25s ease;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.sidebar-nav .nav-heading {
  padding: .9rem .9rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ap-sidebar-muted);
}

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .9rem; border-radius: var(--ap-radius-sm);
  color: var(--ap-sidebar-text); font-weight: 500; background: transparent;
  transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i { font-size: 1.1rem; opacity: .9; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.sidebar-nav .nav-link[data-bs-toggle="collapse"]:not(.collapsed) { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .nav-link:not([data-bs-toggle]):not(.collapsed) {
  background: var(--ap-primary); color: #fff; box-shadow: 0 6px 16px rgba(0, 102, 200, .35);
}
.sidebar-nav .nav-link .bi-chevron-down { font-size: .8rem; transition: transform .2s; }
.sidebar-nav .nav-link:not(.collapsed) .bi-chevron-down { transform: rotate(180deg); }

.sidebar-nav .nav-content { list-style: none; margin: .15rem 0 .35rem; padding: 0 0 0 1.25rem; border-left: 1px solid #1e293b; margin-left: 1.35rem; }
.sidebar-nav .nav-content a {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; border-radius: 8px;
  color: #94a3b8; font-size: .875rem; transition: background .15s, color .15s;
}
.sidebar-nav .nav-content a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.sidebar-nav .nav-content a.active { color: #fff; background: rgba(0, 102, 200, .3); font-weight: 600; }
.sidebar-nav .nav-content a.is-soon { opacity: .55; cursor: not-allowed; }
.sidebar-nav .badge-soon {
  margin-left: auto; font-size: .62rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px;
  background: #1e293b; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em;
}

.sidebar-backdrop { display: none; }

/* ============================================================
   5. Contenu principal
   ============================================================ */
.main {
  margin-top: var(--ap-header-h);
  margin-left: var(--ap-sidebar-w);
  padding: 1.75rem 1.75rem 1rem;
  min-height: calc(100vh - var(--ap-header-h) - 64px);
  transition: margin-left .25s ease;
}

.pagetitle { margin-bottom: 1.25rem; }
.pagetitle h1 { font-size: 1.45rem; font-weight: 700; margin: 0 0 .15rem; display: flex; align-items: center; gap: .5rem; }
.breadcrumb { margin: 0; font-size: .8rem; }
.breadcrumb-item a { color: var(--ap-muted); }
.breadcrumb-item.active { color: var(--ap-text); }

.section { padding-bottom: 1rem; }

.footer {
  margin-left: var(--ap-sidebar-w);
  padding: 1.1rem 1.75rem;
  border-top: 1px solid var(--ap-border);
  background: var(--ap-surface);
  font-size: .8rem; color: var(--ap-muted);
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; justify-content: space-between;
  transition: margin-left .25s ease;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.footer a { color: var(--ap-muted); }
.footer a:hover { color: var(--ap-primary); }

.back-to-top {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1010;
  width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: var(--ap-primary); color: #fff; font-size: 1.5rem;
  box-shadow: var(--ap-shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.back-to-top.active { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { background: var(--ap-primary-hover); color: #fff; }

/* Menu replié (ordinateur) et menu mobile */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main,
body.sidebar-collapsed .footer { margin-left: 0; }

@media (max-width: 1199.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--ap-shadow-lg); }
  .main, .footer { margin-left: 0; padding-left: 1rem; padding-right: 1rem; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: var(--ap-header-h) 0 0 0; z-index: 1010; background: rgba(15, 23, 42, .45);
  }
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
}

/* ============================================================
   6. Cartes, tableaux, formulaires
   ============================================================ */
.card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
  margin-bottom: 1.25rem;
}
.card-body { padding: 1.25rem 1.4rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--ap-text); padding: .25rem 0 .9rem; margin: 0; }

.info-card .card-icon {
  width: 52px; height: 52px; font-size: 1.5rem;
  background: var(--ap-primary-soft); color: var(--ap-primary);
}
.info-card h6 { font-size: 1.7rem; font-weight: 700; margin: 0; color: var(--ap-text); }
.info-card.revenue-card .card-icon { background: #ecfdf5; color: #059669; }
.info-card.sales-card .card-icon { background: #e6f0fb; color: #0066c8; }
.info-card.customers-card .card-icon { background: #fff7ed; color: #ea580c; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead > tr > th {
  background: #f8fafc; color: var(--ap-muted);
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--ap-border); white-space: nowrap; padding: .75rem .85rem;
}
.table > tbody > tr > td { vertical-align: middle; padding: .8rem .85rem; border-color: var(--ap-border); }
.table > tbody > tr:hover > * { background: #f8fafc; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: transparent; }
.table-responsive { border-radius: var(--ap-radius-sm); }

.btn { border-radius: var(--ap-radius-sm); font-weight: 600; padding: .5rem 1rem; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 8px; }
.btn-primary {
  --bs-btn-bg: var(--ap-primary); --bs-btn-border-color: var(--ap-primary);
  --bs-btn-hover-bg: var(--ap-primary-hover); --bs-btn-hover-border-color: var(--ap-primary-hover);
  --bs-btn-active-bg: #1e40af; --bs-btn-active-border-color: #1e40af;
  --bs-btn-disabled-bg: var(--ap-primary); --bs-btn-disabled-border-color: var(--ap-primary);
  box-shadow: 0 2px 8px rgba(0, 102, 200, .25);
}
.btn-outline-primary {
  --bs-btn-color: var(--ap-primary); --bs-btn-border-color: var(--ap-primary);
  --bs-btn-hover-bg: var(--ap-primary); --bs-btn-hover-border-color: var(--ap-primary);
  --bs-btn-active-bg: var(--ap-primary); --bs-btn-active-border-color: var(--ap-primary);
}

.form-label { font-weight: 600; font-size: .8rem; color: #475569; margin-bottom: .3rem; }
.form-control, .form-select {
  border: 1px solid #cbd5e1; border-radius: var(--ap-radius-sm); padding: .55rem .8rem; background-color: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ap-primary); box-shadow: 0 0 0 .22rem rgba(0, 102, 200, .18);
}
.form-control:disabled, .form-control[readonly] { background: #f1f5f9; }
.input-group-text { background: #f8fafc; border-color: #cbd5e1; color: var(--ap-muted); }

.badge { font-weight: 600; padding: .4em .75em; border-radius: 999px; }

.alert { border: 1px solid; border-radius: var(--ap-radius-sm); box-shadow: var(--ap-shadow); }
.alert-warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.alert-danger { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.alert-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.alert-info { border-color: #a5f3fc; background: #ecfeff; color: #155e75; }

.modal-content { border: 0; border-radius: var(--ap-radius); box-shadow: var(--ap-shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--ap-border); }
.modal-footer { border-top: 1px solid var(--ap-border); }

.pagination { gap: .25rem; }
.page-link { border-radius: 8px !important; border: 1px solid var(--ap-border); color: var(--ap-text); }
.page-item.active .page-link { background: var(--ap-primary); border-color: var(--ap-primary); }

/* Onglets */
.nav-tabs-bordered { border-bottom: 1px solid var(--ap-border); gap: .25rem; }
.nav-tabs-bordered .nav-link {
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  color: var(--ap-muted); font-weight: 600; padding: .7rem 1rem;
}
.nav-tabs-bordered .nav-link:hover { color: var(--ap-primary); }
.nav-tabs-bordered .nav-link.active { color: var(--ap-primary); border-bottom-color: var(--ap-primary); background: none; }

.profile .profile-overview .label { font-weight: 600; color: var(--ap-muted); }

/* Formulaires de création / édition : étiquette au-dessus du champ, deux colonnes */
form:has(> .row > label.form-label) {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; align-items: start;
}
form:has(> .row > label.form-label) > .row { --bs-gutter-x: 0; margin: 0 0 1rem; }
form:has(> .row > label.form-label) > .row > label.form-label { padding: 0; margin-bottom: .3rem; }
form:has(> .row > label.form-label) > .row > .col-12 { padding: 0; }
form:has(> .row > label.form-label) > :not(.row),
form:has(> .row > label.form-label) > .row:has(textarea),
form:has(> .row > label.form-label) > .row:has(select[multiple]) { grid-column: 1 / -1; }
form:has(> .row > label.form-label) > .text-center { padding-top: .5rem; margin-top: .25rem; border-top: 1px solid var(--ap-border); }
form .form-error { display: block; margin-top: .25rem; }
@media (max-width: 767.98px) {
  form:has(> .row > label.form-label) { grid-template-columns: minmax(0, 1fr); }
}
.modal-body form:has(> .row > label.form-label), .modal-content form:has(> .row > label.form-label) { grid-template-columns: minmax(0, 1fr); }

/* Select2 */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  min-height: 42px; border: 1px solid #cbd5e1; border-radius: var(--ap-radius-sm);
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px; padding-left: .8rem; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; }
.select2-container--default.select2-container--focus .select2-selection--single { border-color: var(--ap-primary); }

/* Panneau de recherche */
.search-panel {
  background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem;
}
.search-panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.search-panel__head h5 { margin: 0; font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.search-panel__head h5 i { color: var(--ap-primary); }
.search-panel__input { position: relative; }
.search-panel__input > i {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--ap-muted); font-size: 1.1rem; pointer-events: none;
}
.search-panel__input .form-control { padding: .85rem 1rem .85rem 2.75rem; font-size: 1rem; background: #f8fafc; border-color: var(--ap-border); }
.search-panel__input .form-control:focus { background: #fff; }
.search-panel__filters { margin-top: .25rem; }
.search-panel__filters .form-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ap-muted); }
.search-panel__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--ap-border); }
/* Panneau replié par défaut : un bandeau compact, les champs s'ouvrent au besoin */
.search-panel--repliable { padding: .7rem 1.1rem; }
.search-panel--repliable .search-panel__head { margin-bottom: 0; flex-wrap: wrap; gap: .5rem; }
.search-panel__toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--ap-border); background: var(--ap-surface); color: var(--ap-text, #1f2937); font-weight: 600;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.search-panel__toggle > .bi-sliders2 { color: var(--ap-primary); }
.search-panel__toggle:hover { border-color: var(--ap-primary); color: var(--ap-primary); background: var(--bs-primary-bg-subtle, #e8f1fb); }
.search-panel__toggle:focus-visible { outline: 0; box-shadow: 0 0 0 .2rem rgba(0, 102, 200, .25); }
/* Ouvert : bouton plein, comme un onglet actif */
.search-panel__toggle:not(.collapsed) { background: var(--ap-primary); border-color: var(--ap-primary); color: #fff; }
.search-panel__toggle:not(.collapsed) > .bi-sliders2, .search-panel__toggle:not(.collapsed) .search-panel__chevron { color: #fff; }
.search-panel__compteur {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--ap-primary); color: #fff; font-size: .72rem; font-weight: 700;
}
.search-panel__toggle:not(.collapsed) .search-panel__compteur { background: #fff; color: var(--ap-primary); }
.search-panel__chevron { font-size: .8rem; color: var(--ap-muted); transition: transform .2s ease; }
.search-panel__toggle:not(.collapsed) .search-panel__chevron { transform: rotate(180deg); }
.search-panel__raccourcis { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.search-panel__body { padding: 1rem 0 .4rem; }

/* Petit avatar (tableaux) */
.avatar--sm { width: 36px; height: 36px; font-size: .75rem; flex: 0 0 auto; }

/* Vignette de véhicule (tableaux) */
.vignette-vehicule { flex: 0 0 auto; width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.vignette-vehicule--defaut { object-fit: cover; }
button.vignette-bouton { padding: 0; border: 0; background: none; line-height: 0; border-radius: 6px; cursor: zoom-in; }
.vignette-bouton:hover .vignette-vehicule { box-shadow: 0 0 0 2px var(--ap-primary); }
.photo-agrandie .modal-body { padding: 0; background: #0f172a; text-align: center; }
.photo-agrandie img { max-width: 100%; max-height: 75vh; object-fit: contain; }

/* Cartes de véhicules */
.vehicle-card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; color: var(--ap-text);
  background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: var(--ap-radius); box-shadow: var(--ap-shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.vehicle-card:hover { color: var(--ap-text); transform: translateY(-3px); border-color: #bfdbfe; box-shadow: var(--ap-shadow-lg); }
.vehicle-card__img { width: 100%; height: 170px; object-fit: cover; background: #f1f5f9; }
.vehicle-card__body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem; }
.vehicle-card__plate { display: block; font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; }
.vehicle-card__model { display: block; color: var(--ap-muted); font-size: .85rem; }
.vehicle-card__info { list-style: none; margin: 0; padding: .75rem 0 0; border-top: 1px solid var(--ap-border); display: flex; gap: 1rem; color: #475569; font-size: .83rem; }
.vehicle-card__info i { color: var(--ap-muted); margin-right: .3rem; }

/* Cartes de membres */
.member-card {
  display: flex; flex-direction: column; gap: 1rem; height: 100%;
  padding: 1.25rem; color: var(--ap-text);
  background: var(--ap-surface); border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius); box-shadow: var(--ap-shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.member-card:hover { color: var(--ap-text); transform: translateY(-3px); border-color: #bfdbfe; box-shadow: var(--ap-shadow-lg); }
.member-card__top { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.member-card__avatar, .member-card__photo {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
}
.member-card__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ap-primary);
  color: #fff; font-weight: 700; font-size: 1.1rem; text-transform: uppercase;
}
.member-card__id { min-width: 0; display: flex; flex-direction: column; }
.member-card__id strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-card__id span { color: var(--ap-muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-card__info { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; color: #475569; font-size: .86rem; }
.member-card__info i { color: var(--ap-muted); margin-right: .4rem; }
.member-card__foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding-top: .85rem; border-top: 1px solid var(--ap-border); }

/* En-tête de profil et tuiles d'information */
.profile-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.profile-hero__avatar, .profile-hero__photo { flex: 0 0 auto; width: 84px; height: 84px; border-radius: 50%; object-fit: cover; }
.profile-hero__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ap-primary);
  color: #fff; font-weight: 700; font-size: 1.8rem; text-transform: uppercase;
}
/* Photo de véhicule dans l'en-tête : vignette arrondie, cliquable pour l'agrandir */
.profile-hero__photo--vehicule { width: 112px; border-radius: 14px; overflow: hidden; background: var(--bs-tertiary-bg, #f1f5f9); }
.profile-hero__photo--vehicule img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.profile-hero__photo--vehicule { cursor: zoom-in; }
.profile-hero__id h2 { font-size: 1.35rem; font-weight: 800; margin: 0 0 .15rem; }
.profile-hero__id p { color: var(--ap-muted); margin: 0 0 .5rem; }
.info-tile { padding: .9rem 1.1rem; background: #f8fafc; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm); }
.info-tile small { display: block; color: var(--ap-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .15rem; }
.info-tile strong { font-weight: 600; word-break: break-word; }

/* Tableau de bord */
.kpi {
  display: flex; align-items: center; gap: 1rem; height: 100%; padding: 1.15rem 1.25rem;
  background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: var(--ap-radius); box-shadow: var(--ap-shadow);
}
.kpi__icon { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.kpi__icon--blue { background: #e6f0fb; color: #0066c8; }
.kpi__icon--green { background: #ecfdf5; color: #059669; }
.kpi__icon--amber { background: #fffbeb; color: #d97706; }
.kpi__icon--red { background: #fef2f2; color: #dc2626; }
.kpi small { display: block; color: var(--ap-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi strong { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.15; }
.kpi strong em { font-style: normal; font-size: .85rem; font-weight: 600; color: var(--ap-muted); }
.kpi span { color: var(--ap-muted); font-size: .8rem; }

.chart-box { position: relative; height: 300px; }
.chart-box--sm { height: 240px; }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.quick-actions a {
  display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .8rem .4rem;
  background: #f8fafc; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm);
  color: var(--ap-text); font-size: .8rem; font-weight: 600; text-align: center;
  transition: background .15s, border-color .15s, color .15s;
}
.quick-actions a i { font-size: 1.3rem; color: var(--ap-primary); }
.quick-actions a:hover { background: var(--ap-primary-soft); border-color: #bfdbfe; color: var(--ap-primary); }

.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.todo-list li { display: flex; gap: .7rem; align-items: flex-start; }
.todo-list li > i { font-size: 1.1rem; margin-top: .1rem; }
.todo-list strong { display: block; font-size: .88rem; }
.todo-list span { display: block; color: var(--ap-muted); font-size: .8rem; }

/* État vide */
.empty-state { text-align: center; padding: 3rem 1rem; background: var(--ap-surface); border: 1px dashed #cbd5e1; border-radius: var(--ap-radius); }
.empty-state > i { font-size: 2.5rem; color: #94a3b8; }
.empty-state h6 { margin: .5rem 0 .25rem; font-weight: 700; }
.empty-state p { color: var(--ap-muted); margin-bottom: 1rem; }

/* Plans d'abonnement */
.plan-card--current { border-color: var(--ap-primary); box-shadow: 0 0 0 3px rgba(0, 102, 200, .15), var(--ap-shadow); }
.plan-header small { display: block; opacity: .85; margin-top: .25rem; font-size: .78rem; }
.plan-card { overflow: hidden; border-radius: 18px; transition: transform .2s, box-shadow .2s; }
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--ap-shadow-lg); }
.plan-header { padding: 1.25rem; text-align: center; color: #fff; background: var(--ap-primary); }
.plan-header h2 { margin: 0; font-size: 1.2rem; font-weight: 700; color: #fff; }
.plan-feature i { color: var(--ap-success); margin-right: .35rem; }
.plan-button { background: var(--ap-primary); color: #fff; border: 0; }
.plan-button:hover { background: var(--ap-primary-hover); color: #fff; }
.plan-button:disabled { opacity: .5; }

/* ============================================================
   7. Chargement
   ============================================================ */
.loader-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .7); backdrop-filter: blur(4px);
  opacity: 1; transition: opacity .3s ease;
}
.loader-overlay.hidden { opacity: 0; pointer-events: none; }

/* ============================================================
   8. Notifications (toasts) - disparition automatique
   ============================================================ */
.ap-toasts {
  position: fixed; top: calc(var(--ap-header-h) + .75rem); right: 1rem; z-index: 2000;
  display: flex; flex-direction: column; gap: .6rem;
  width: min(390px, calc(100vw - 2rem));
  pointer-events: none;
}
body.no-header .ap-toasts { top: 1rem; }

.ap-toast {
  --ap-toast-color: var(--ap-success);
  position: relative; overflow: hidden; pointer-events: auto;
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 2.5rem .95rem .95rem;
  background: var(--ap-surface); color: var(--ap-text);
  border: 1px solid var(--ap-border);
  border-radius: 12px; box-shadow: var(--ap-shadow-lg);
  animation: ap-toast-in .28s ease-out both;
  transition: opacity .3s ease, transform .3s ease;
}
.ap-toast--success { --ap-toast-color: var(--ap-success); }
.ap-toast--info { --ap-toast-color: var(--ap-info); }
.ap-toast--warning { --ap-toast-color: var(--ap-warning); }
.ap-toast--error { --ap-toast-color: var(--ap-danger); }

.ap-toast__icon { flex: 0 0 auto; font-size: 1.25rem; line-height: 1.3; color: var(--ap-toast-color); }
.ap-toast__text { flex: 1 1 auto; font-size: .9rem; line-height: 1.4; word-break: break-word; }

.ap-toast__close {
  position: absolute; top: .45rem; right: .45rem; width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ap-muted); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.ap-toast__close:hover { background: #f1f5f9; color: var(--ap-text); }

.ap-toast__bar {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--ap-toast-color); opacity: .55;
  transform-origin: left center;
  animation: ap-toast-bar var(--ap-toast-duration, 5000ms) linear forwards;
}
.ap-toast.is-paused .ap-toast__bar { animation-play-state: paused; }
.ap-toast.is-leaving { opacity: 0; transform: translateX(24px); }

@keyframes ap-toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes ap-toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ============================================================
   9. Pages publiques (connexion, inscription, pages légales, erreurs)
   ============================================================ */
body.no-header { background: var(--ap-bg); }
body.no-header .footer { margin-left: 0; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .auth-shell { grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); } }

.auth-brand {
  display: none; position: relative; color: #fff; padding: 3rem;
  background: var(--ap-sidebar-bg);
  overflow: hidden;
}
@media (min-width: 992px) { .auth-brand { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-brand::after {
  content: ""; position: absolute; width: 420px; height: 420px; right: -140px; bottom: -140px; border-radius: 50%;
  background: rgba(0, 102, 200, .22);  /* aplat, sans dégradé */
}
.auth-brand h2 { font-size: 2rem; font-weight: 800; line-height: 1.2; max-width: 22ch; }
.auth-brand p { color: #cbd5e1; max-width: 42ch; }
.auth-brand ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; position: relative; z-index: 1; }
.auth-brand li { display: flex; gap: .6rem; align-items: center; color: #e2e8f0; }
.auth-brand li i { color: #93c5fd; }
.auth-brand .brand-logo { position: relative; z-index: 1; display: inline-flex; align-self: flex-start; text-decoration: none; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.3rem; color: #fff; }
.auth-brand .brand-logo img { max-height: 40px; background: #fff; border-radius: 10px; padding: 4px; }

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .brand-mobile { text-align: center; margin-bottom: 1.5rem; }
.auth-card .brand-mobile img { max-height: 48px; }
.auth-card h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: .25rem; }
.auth-card .lead-sm { color: var(--ap-muted); margin-bottom: 1.5rem; }
.auth-card .card { padding: .5rem; }
.auth-links { margin-top: 1.25rem; font-size: .85rem; text-align: center; color: var(--ap-muted); }
.auth-legal { margin-top: 1.5rem; font-size: .75rem; color: var(--ap-muted); text-align: center; }
.auth-legal a { color: var(--ap-muted); text-decoration: underline; }

.otp-input { font-size: 2rem; letter-spacing: .6rem; font-weight: 700; height: 64px; text-align: center; }

.public-header { background: var(--ap-surface); border-bottom: 1px solid var(--ap-border); }
.public-header .container { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.public-header .logo { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--ap-text); }
.public-header .logo img { max-height: 34px; }

.legal { max-width: 860px; margin: 2rem auto; }
.legal .card-body { padding: 2rem 2.25rem; }
.legal h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: .25rem; }
.legal h2 { font-size: 1.15rem; font-weight: 700; margin: 1.75rem 0 .5rem; }
.legal p, .legal li { color: #334155; }
.legal .updated { color: var(--ap-muted); font-size: .85rem; margin-bottom: 1.5rem; }
.legal .todo { background: #fef3c7; border-radius: 4px; padding: 0 .3em; font-weight: 600; color: #92400e; }

.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; }
.error-page .code {
  font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; line-height: 1;
  background: var(--ap-primary); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-page h2 { font-size: 1.4rem; margin: .5rem 0 1.5rem; color: var(--ap-muted); font-weight: 600; }

/* ============================================================
   10. Accessibilité : réduction des animations
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* ---------- Rapports ---------- */
.rapport-nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.rapport-carte { transition: transform .15s ease, box-shadow .15s ease; }
.rapport-carte:hover, .rapport-carte:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }

/* ---------- Impression (rapports, fiches) : seul le contenu est imprimé ---------- */
@media print {
  #header, #sidebar, .sidebar, .header, .back-to-top, #footer, .footer, .pagetitle, .no-print,
  .alert, .ap-toasts, .sidebar-backdrop { display: none !important; }
  #main, .main { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .kpi { border: 1px solid #ddd; box-shadow: none !important; break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
  .chart-box { height: 220px !important; }
  .table-responsive { overflow: visible !important; }
}


/* ---------- Géolocalisation ---------- */
.geo-carte { height: 68vh; min-height: 380px; border-radius: 12px; overflow: hidden; z-index: 0; }
.geo-carte--fiche { height: 460px; }
.geo-liste { overflow-y: auto; max-height: calc(68vh - 90px); }
.geo-liste__item {
  width: 100%; display: flex; align-items: center; gap: .6rem; padding: .55rem .5rem; border: 0; border-radius: 10px;
  background: transparent; color: inherit; text-align: left;
}
.geo-liste__item:hover:not(:disabled), .geo-liste__item:focus-visible { background: var(--bs-tertiary-bg, #f1f5f9); }
.geo-liste__item:disabled { opacity: .6; cursor: default; }
.geo-pastille { flex: 0 0 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.geo-pastille--en_mouvement { background: #16a34a; }
.geo-pastille--a_l_arret { background: #0066c8; }
.geo-pastille--hors_ligne { background: #64748b; }
.geo-pastille--jamais { background: transparent; border: 2px solid #cbd5e1; }
.geo-compteur .bi-circle-fill, .geo-compteur .bi-circle { font-size: .55rem; vertical-align: middle; }
.geo-marqueur {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  color: #fff; font-size: 1rem; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(15, 23, 42, .35); background: #64748b;
}
.geo-marqueur--en_mouvement { background: #16a34a; }
.geo-marqueur--a_l_arret { background: #0066c8; }
.geo-marqueur--hors_ligne { background: #64748b; }
.geo-marqueur__cap { position: absolute; inset: -9px; pointer-events: none; }
.geo-marqueur__cap::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #16a34a;
}
@media print { .geo-carte { height: 420px; } }
.geo-offre { max-width: 560px; }
.geo-offre__icone {
  display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px;
  background: var(--bs-primary-bg-subtle, #dbeafe); color: var(--bs-primary, #0066c8); font-size: 2rem;
}

/* ============================================================
   Téléphones : aucun contenu ne doit dépasser de l'écran
   ============================================================ */
@media (max-width: 767.98px) {
  /* Tableau non enveloppé dans .table-responsive : il défile dans sa carte au lieu d'élargir la page */
  .card-body table.table:not(.table-responsive > table) { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
  /* Textes longs (noms, e-mails, références) : retour à la ligne plutôt que débordement */
  .card-title, .card-body h1, .card-body h2, .card-body h3, .card-body h4, .card-body h5, .card-body h6,
  .card-body p, .card-body dd, .card-body dt, .card-body li, .card-body label, .card-body small,
  .pagetitle h1, .breadcrumb, .alert, .list-group-item, .empty-state { overflow-wrap: anywhere; }
  .card-body .d-flex > *, .list-group-item.d-flex > * { min-width: 0; }
  /* Titres de page et barres d'actions : passage à la ligne des boutons */
  .pagetitle { flex-wrap: wrap; gap: .5rem; }
  .card-body .btn-group { flex-wrap: wrap; }
  /* Grandes valeurs des cartes indicateurs */
  .info-card h6, .card-body .fs-1, .card-body .display-6 { overflow-wrap: anywhere; }
  /* Fenêtres modales pleine largeur utile */
  .modal-dialog { margin: .5rem; }
  img, video, canvas { max-width: 100%; }
  /* Cartes indicateurs des rapports (deux par ligne) : icône au-dessus, valeur réduite */
  .kpi { flex-direction: column; align-items: flex-start; gap: .5rem; padding: 14px; }
  .kpi > div { min-width: 0; width: 100%; }
  .kpi__icon { width: 40px; height: 40px; font-size: 1.15rem; border-radius: 11px; }
  .kpi strong { font-size: 1.3rem; overflow-wrap: anywhere; }
  .kpi small, .kpi span { overflow-wrap: anywhere; }
}

/* ---------- Galerie photo d'un véhicule ---------- */
.galerie-vehicule { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--ap-border, #dee2e6); background: #f1f5f9; aspect-ratio: 4 / 3; }
.galerie-vehicule__image { display: block; width: 100%; height: 100%; background: none; cursor: zoom-in; }
.galerie-vehicule__image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.galerie-vehicule__image:hover img, .galerie-vehicule__image:focus-visible img { transform: scale(1.04); }
.galerie-vehicule__supprimer { position: absolute; top: 6px; right: 6px; margin: 0; }
.galerie-vehicule__supprimer .btn { box-shadow: 0 2px 6px rgba(15, 23, 42, .2); }

/* Déconnexion par formulaire (POST) : le bouton garde l'aspect du lien ou de l'élément de menu qu'il remplace */
.form-deconnexion { margin: 0; display: contents; }
.form-deconnexion > button { border: 0; font-family: inherit; cursor: pointer; }
.form-deconnexion > button.nav-link, .form-deconnexion > button.dropdown-item { width: 100%; text-align: left; background: transparent; }
.form-deconnexion > .btn-link { font-size: inherit; text-decoration: none; vertical-align: baseline; }
