/* ======================== DASHBOARD DESIGN SYSTEM ======================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --db-primary: #0B132B;
  --db-primary-mid: #1C2541;
  --db-accent: #10B981;
  --db-accent-hover: #059669;
  --db-accent-light: #D1FAE5;
  --db-white: #ffffff;
  --db-bg: #F8FAFC;
  --db-card: #ffffff;
  --db-border: rgba(15, 23, 42, 0.08);
  --db-text: #0F172A;
  --db-text-sec: #475569;
  --db-text-muted: #64748B;
  --db-warning: #F59E0B;
  --db-error: #EF4444;
  --db-info: #3B82F6;
  --db-success: #10B981;
  --shadow-card: 0 10px 40px rgba(11, 19, 43, 0.06);
  --shadow-hover: 0 20px 60px rgba(11, 19, 43, 0.12);
  --shadow-cta: 0 8px 24px rgba(16, 185, 129, 0.35);
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* ======================== ICÔNES INLINE (Material Symbols) ========================
   Remplacent les emojis dans les titres, badges, boutons, lignes d'info, etc.
   .kp-ico  : icône alignée sur le texte (taille relative au texte)
   .kp-ico-sm : variante plus discrète
   Couleur héritée via currentColor (pose juste color: sur le parent ou en style inline). */
.kp-ico,
.kp-ico-sm {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  line-height: 0;
  flex-shrink: 0;
}
.kp-ico { font-size: 1.15em; vertical-align: -.18em; }
.kp-ico-sm { font-size: 1em; vertical-align: -.15em; }

/* ======================== LAYOUT ======================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background: var(--db-bg);
  font-family: var(--font-body);
  color: var(--db-text);
}

/* Sidebar */
.db-sidebar {
  width: 260px;
  background: var(--db-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}
.db-sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.db-sidebar-header img { height: 36px; }
.db-sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.db-nav-group { margin-bottom: 24px; }
.db-nav-label {
  font-family: var(--font-heading);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  padding: 0 12px; margin-bottom: 8px;
}
.db-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,.65);
  cursor: pointer; transition: all .2s ease;
  text-decoration: none; position: relative;
}
.db-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.db-nav-item.active {
  background: var(--db-accent); color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,201,123,.3);
}
.db-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.db-nav-badge {
  margin-left: auto;
  background: var(--db-error);
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  min-width: 20px; text-align: center;
}
.db-sidebar-profile {
  padding: 20px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 12px;
}
.db-sidebar-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--db-accent); display: flex;
  align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700; font-size: 16px; color: #fff;
}
.db-sidebar-name { font-size: 14px; font-weight: 600; color: #fff; }
.db-sidebar-role { font-size: 12px; color: rgba(255,255,255,.5); }

/* Main Content */
.db-main {
  flex: 1;
  min-width: 0;
  margin-left: 260px;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.db-topbar {
  height: 64px; background: var(--db-white);
  border-bottom: 1px solid var(--db-border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 50;
}
.db-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--db-text-sec);
}
.db-breadcrumb span { color: var(--db-text-muted); }
.db-breadcrumb strong { color: var(--db-text); font-weight: 600; }
.db-topbar-actions {
  display: flex; align-items: center; gap: 16px;
}
.db-notif-btn {
  position: relative; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--db-border);
  background: var(--db-white); display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s;
}
.db-notif-btn:hover { border-color: var(--db-accent); }
.db-notif-btn svg { width: 20px; height: 20px; color: var(--db-text-sec); }
.db-notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--db-error);
  border: 2px solid var(--db-white);
}
.db-topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--db-primary), var(--db-primary-mid));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  font-family: var(--font-heading);
}

/* Content Area */
/* width:100% donne une taille définie au flex-item : sans ça, quand le contenu
   (ex. un tableau large) dépasse, flexbox dimensionne .db-content sur son contenu
   (plafonné à max-width:1600px) au lieu de la largeur du parent .db-main → le bloc
   déborde de son parent et est rogné par overflow-x:hidden (bouton/colonnes coupés).
   Avec width:100%, le tableau scrolle dans son wrapper .db-admin-table-wrapper. */
.db-content { padding: 32px; flex: 1; min-width: 0; width: 100%; }

/* ======================== HERO WELCOME ======================== */
.db-hero {
  background: linear-gradient(135deg, #0A1F44 0%, #0D2E6B 100%);
  border-radius: 16px; padding: 40px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 32px;
  margin-bottom: 32px; position: relative; overflow: hidden;
}
.db-hero::before {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,201,123,.15) 0%, transparent 70%);
  border-radius: 50%;
}
.db-hero-text { position: relative; z-index: 1; }
.db-hero-text h1 {
  font-family: var(--font-heading);
  font-size: 28px; font-weight: 700; color: #fff;
  margin-bottom: 8px;
}
.db-hero-text h1 span { color: var(--db-accent); }
.db-hero-text p {
  font-size: 15px; color: rgba(255,255,255,.7);
  margin-bottom: 20px;
}
.db-btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--db-accent); color: #fff;
  border: none; border-radius: 12px;
  padding: 14px 28px; font-family: var(--font-heading);
  font-weight: 600; font-size: 15px;
  cursor: pointer; transition: all .2s ease;
  box-shadow: var(--shadow-cta);
  text-decoration: none;
}
.db-btn-primary:hover {
  background: var(--db-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,201,123,.4);
}
.db-btn-primary svg { width: 18px; height: 18px; }
.db-btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--db-accent);
  border: 1.5px solid var(--db-accent); border-radius: 12px;
  padding: 12px 24px; font-family: var(--font-heading);
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all .2s ease;
  text-decoration: none;
}
.db-btn-secondary:hover {
  background: var(--db-accent-light);
  transform: translateY(-1px);
}

/* ======================== STAT CARDS ======================== */
.db-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; margin-bottom: 32px; }
.db-stat-card {
  background: var(--db-card); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow-card);
  transition: box-shadow .2s, transform .2s;
  min-width: 0; overflow: hidden;
}
.db-stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.db-stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.db-stat-icon svg { width: 24px; height: 24px; }
.db-stat-icon.blue { background: #EFF6FF; color: var(--db-info); }
.db-stat-icon.green { background: var(--db-accent-light); color: var(--db-accent); }
.db-stat-icon.orange { background: #FFF7ED; color: var(--db-warning); }
.db-stat-icon.teal { background: #F0FDFA; color: #14B8A6; }
.db-stat-value {
  font-family: var(--font-heading);
  font-size: 2rem; font-weight: 700;
  color: var(--db-text); line-height: 1;
  margin-bottom: 4px;
}
.db-stat-label { font-size: 13px; color: var(--db-text-sec); }

/* ======================== SECTIONS ======================== */
.db-section-title {
  font-family: var(--font-heading);
  font-size: 18px; font-weight: 700;
  color: var(--db-text); margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.db-section-title svg { width: 20px; height: 20px; color: var(--db-accent); }

/* ======================== RECENT ORDER ======================== */
.db-recent-order {
  background: var(--db-card); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow-card);
  margin-bottom: 32px;
}
.db-order-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.db-order-id {
  font-family: var(--font-heading);
  font-size: 14px; font-weight: 600; color: var(--db-text);
}
.db-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.db-badge.green { background: #F0FDF4; color: #15803D; }
.db-badge.blue { background: #EFF6FF; color: #2563EB; }
.db-badge.orange { background: #FFF7ED; color: #D97706; }
.db-badge.red { background: #FEF2F2; color: #DC2626; }
.db-badge.purple { background: #F5F3FF; color: #7C3AED; }
.db-badge.gray { background: #F9FAFB; color: #6B7280; }
.db-order-details {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 16px; margin-bottom: 16px;
}
.db-order-detail { font-size: 13px; }
.db-order-detail span { color: var(--db-text-muted); display: block; margin-bottom: 2px; }
.db-order-detail strong { color: var(--db-text); font-weight: 600; }

/* ======================== SERVICES GRID ======================== */
.db-services-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 16px; margin-bottom: 32px;
}
.db-service-tile {
  background: var(--db-card); border-radius: 16px;
  padding: 24px; text-align: center;
  border: 1.5px solid var(--db-border);
  cursor: pointer; transition: all .2s ease;
  text-decoration: none; color: var(--db-text);
  min-width: 0; overflow: hidden;
}
.db-service-tile:hover {
  border-color: var(--db-accent);
  background: var(--db-accent-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.db-service-tile-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--db-primary), var(--db-primary-mid));
  color: #fff;
}
.db-service-tile-icon svg { width: 24px; height: 24px; }
.db-service-tile h4 {
  font-family: var(--font-heading);
  font-size: 14px; font-weight: 600;
}

/* ======================== DRIVER SPECIFIC ======================== */
.db-availability-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .3s ease;
}
.db-availability-toggle.online {
  background: rgba(0,201,123,.12); color: var(--db-accent);
  border: 1.5px solid var(--db-accent);
}
.db-availability-toggle.offline {
  background: rgba(148,163,184,.12); color: var(--db-text-muted);
  border: 1.5px solid var(--db-border);
}
.db-toggle-dot {
  width: 10px; height: 10px; border-radius: 50%;
  transition: background .3s;
}
.online .db-toggle-dot { background: var(--db-accent); box-shadow: 0 0 8px var(--db-accent); }
.offline .db-toggle-dot { background: var(--db-text-muted); }

/* Mission Cards */
.db-mission-card {
  background: var(--db-card); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow-card);
  border-left: 4px solid var(--db-accent);
  margin-bottom: 16px; transition: all .2s;
}
.db-mission-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.db-mission-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.db-mission-type {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-heading);
  font-size: 15px; font-weight: 600;
}
.db-mission-type svg { width: 20px; height: 20px; color: var(--db-accent); }
.db-mission-info { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.db-mission-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--db-text-sec);
}
.db-mission-row svg { width: 16px; height: 16px; color: var(--db-text-muted); flex-shrink: 0; }
.db-mission-actions {
  display: flex; gap: 12px; padding-top: 16px;
  border-top: 1px solid var(--db-border);
}
.db-btn-accept {
  flex: 1; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  background: var(--db-accent); color: #fff;
  border: none; border-radius: 12px;
  padding: 14px 32px; font-family: var(--font-heading);
  font-weight: 600; font-size: 15px;
  cursor: pointer; transition: all .2s;
  box-shadow: var(--shadow-cta);
}
.db-btn-accept:hover {
  background: var(--db-accent-hover);
  transform: translateY(-1px);
}
.db-btn-refuse {
  display: flex; align-items: center;
  justify-content: center; gap: 6px;
  background: transparent; color: var(--db-error);
  border: 1.5px solid var(--db-error); border-radius: 12px;
  padding: 12px 20px; font-family: var(--font-heading);
  font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.db-btn-refuse:hover { background: #FEF2F2; }

/* ======================== CHAT BUTTON ======================== */
.db-chat-fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--db-accent); color: #fff;
  border: none; display: flex;
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-cta);
  cursor: pointer; z-index: 200;
  transition: all .3s ease;
  animation: fabBounce 2s ease-in-out;
}
.db-chat-fab:hover { transform: scale(1.1); }
.db-chat-fab svg { width: 24px; height: 24px; }
@keyframes fabBounce {
  0%,20%,50%,80%,100% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  60% { transform: translateY(-6px); }
}

/* ======================== MOBILE BOTTOM NAV ======================== */
.db-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--db-white);
  border-top: 1px solid var(--db-border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}
.db-bottom-nav-inner {
  display: flex; justify-content: space-around; align-items: center;
}
.db-bottom-nav-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  font-size: 11px; color: var(--db-text-muted);
  text-decoration: none; transition: color .2s;
  padding: 4px 8px;
}
.db-bottom-nav-item.active { color: var(--db-accent); }
.db-bottom-nav-item svg { width: 22px; height: 22px; }

/* Hamburger */
.db-menu-toggle {
  display: none; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--db-border);
  background: var(--db-white); align-items: center;
  justify-content: center; cursor: pointer;
}
.db-menu-toggle svg { width: 20px; height: 20px; color: var(--db-text); }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 1024px) {
  .db-sidebar { transform: translateX(-100%); }
  .db-sidebar.open { transform: translateX(0); }
  .db-main { margin-left: 0; }
  .db-menu-toggle { display: flex; }
  .db-bottom-nav { display: block; }
  .db-stats { grid-template-columns: repeat(2,1fr); }
  .db-services-grid { grid-template-columns: repeat(2,1fr); }
  .db-content { padding-bottom: 80px; }
  .db-chat-fab { bottom: calc(80px + env(safe-area-inset-bottom)); right: 16px; }
}
@media (max-width: 640px) {
  .db-content { padding: 16px; padding-bottom: 80px; }
  .db-hero { flex-direction: column; padding: 24px; }
  .db-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .db-services-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .db-order-details { grid-template-columns: 1fr; }
  .db-topbar { padding: 0 16px; }
  .db-hero-text h1 { font-size: 22px; }
}

/* Sidebar overlay */
.db-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
}
.db-overlay.open { display: block; }

/* Animations */
.db-fade-in { animation: dbFadeIn .5s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes dbFadeIn {
  from { opacity: 0; transform: translateY(20px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.db-fade-in:nth-child(1) { animation-delay: .05s; }
.db-fade-in:nth-child(2) { animation-delay: .1s; }
.db-fade-in:nth-child(3) { animation-delay: .15s; }
.db-fade-in:nth-child(4) { animation-delay: .2s; }

/* Micro-animations pour les interactions */
button, .db-service-tile, .cp-support-card, .cp-stat-card {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
button:active, .db-service-tile:active {
  transform: scale(0.97) translateY(0);
}
input, select, textarea {
  transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
}
input:focus, select:focus, textarea:focus {
  background: var(--db-white);
  box-shadow: 0 0 0 4px rgba(0,201,123,0.15);
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE ENHANCEMENTS — Desktop XL → Mobile 320px
   ════════════════════════════════════════════════════════════ */

/* Desktop large 1440px+ */
@media (min-width: 1440px) {
  .db-content { padding: 36px 48px; max-width: 1600px; margin: 0 auto; }
  .db-hero { padding: 48px; }
  .db-hero-text h1 { font-size: 32px; }
}

/* Laptops 1024-1280px */
@media (max-width: 1280px) and (min-width: 1025px) {
  .db-stats { gap: 16px; }
  .db-content { padding: 28px 32px; }
  .db-hero { padding: 32px; }
  .db-hero-text h1 { font-size: 24px; }
}

/* Tablette landscape ≤ 1024px : sidebar off-canvas */
@media (max-width: 1024px) {
  .db-sidebar {
    transform: translateX(-100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    width: 280px;
  }
  .db-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .db-main { margin-left: 0; }
  .db-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99; }
  .db-overlay.open { display: block; }
  .db-content { padding: 24px 24px 96px; }
  .db-stats { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .db-hero { padding: 28px; }
  .db-hero::before { width: 280px; height: 280px; }
}

/* Tablette portrait ≤ 768px */
@media (max-width: 768px) {
  .db-sidebar { width: 78%; max-width: 320px; }
  .db-topbar { padding: 0 16px; height: 60px; }
  .db-breadcrumb { font-size: 13px; gap: 6px; }
  .db-topbar-actions { gap: 8px; }
  .db-hero { padding: 24px 20px; border-radius: 14px; }
  .db-hero-text h1 { font-size: 22px; line-height: 1.25; }
  .db-hero-text p { font-size: 13px; }
  .db-hero svg { display: none; }
  .db-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
  .db-stat-card { padding: 18px 16px; border-radius: 14px; }
  .db-stat-icon { width: 40px; height: 40px; margin-bottom: 10px; border-radius: 10px; }
  .db-stat-icon svg { width: 20px; height: 20px; }
  .db-stat-value { font-size: 20px; }
  .db-stat-label { font-size: 11px; }
  .db-section-title { font-size: 14px; margin-bottom: 14px; }
  .db-btn-primary, .db-btn-secondary {
    min-height: 44px;
    padding: 11px 22px;
    font-size: 14px;
  }
  .db-btn-primary svg, .db-btn-secondary svg { width: 16px; height: 16px; }
}

/* Phones ≤ 640px */
@media (max-width: 640px) {
  .db-content { padding: 16px 14px 92px; }
  .db-topbar { padding: 0 12px; height: 56px; }
  .db-breadcrumb span:first-child,
  .db-breadcrumb span:nth-child(2) { display: none; }
  .db-hero { padding: 20px 16px; }
  .db-hero-text h1 { font-size: 20px; }
  .db-stats { gap: 10px; }
  .db-stat-card { padding: 16px 14px; }
  .db-stat-value { font-size: 18px; }
  .db-services-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .db-service-tile { padding: 16px 12px; }
  .db-service-tile h4 { font-size: 13px; }
  .db-service-tile-icon { width: 44px !important; height: 44px !important; }
  .db-recent-order { padding: 18px 14px; }
  .db-order-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .db-order-id { font-size: 14px; }
}

/* Petits phones ≤ 480px */
@media (max-width: 480px) {
  .db-sidebar { width: 88%; }
  .db-stat-card { padding: 14px 12px; border-radius: 12px; }
  .db-stat-value { font-size: 17px; }
  .db-stat-label { font-size: 10px; line-height: 1.3; }
  .db-services-grid { gap: 8px; }
  .db-service-tile h4 { font-size: 12px; line-height: 1.25; }
  .db-recent-order { padding: 16px 12px; border-radius: 12px; }
  .db-order-details { gap: 8px; font-size: 12px; }
  .db-bottom-nav-item { font-size: 10px; padding: 4px 6px; }
  .db-bottom-nav-item svg { width: 20px; height: 20px; }
}

/* Phones étroits ≤ 380px */
@media (max-width: 380px) {
  .db-content { padding: 14px 10px 88px; }
  .db-stats { gap: 8px; }
  .db-stat-value { font-size: 16px; }
  .db-services-grid { grid-template-columns: 1fr 1fr !important; }
  .db-service-tile { padding: 14px 10px; }
  .db-hero-text h1 { font-size: 18px; }
}

/* Très petits ≤ 340px : stats en 1 colonne avec layout horizontal */
@media (max-width: 340px) {
  .db-stats { grid-template-columns: 1fr; }
  .db-stat-card { display: flex; flex-direction: row; align-items: center; padding: 12px; }
  .db-stat-icon { margin-bottom: 0; margin-right: 12px; flex-shrink: 0; }
  .db-stat-value { font-size: 18px; }
}

/* Accessibilité : reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .db-fade-in { animation: none !important; opacity: 1 !important; transform: none !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Print */
@media print {
  .db-sidebar, .db-topbar, .db-bottom-nav, .db-chat-fab,
  .db-btn-primary, .db-btn-secondary, .db-menu-toggle { display: none !important; }
  .db-main { margin-left: 0 !important; }
  .db-content { padding: 0; }
  .db-stat-card, .db-recent-order { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  body { background: #fff; color: #000; }
}

/* Évite zoom iOS au focus des inputs */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
    min-height: 44px;
  }
  textarea { min-height: 80px; }
}

/* ============================================================
   CARTE UNIVERSELLE — Leaflet wrapper (.kp-map)
   Utilisé par : couverture partenaire, suivi partenaire/client/livreur,
   carte admin partenaires, suivi admin, tracking universel.
   ============================================================ */
.kp-map {
  position: relative;
  height: 600px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(0,201,123,.04) 0%, rgba(10,31,68,.06) 100%),
    repeating-linear-gradient(45deg, #eef2f7 0 10px, #f4f7fb 10px 20px);
  box-shadow:
    0 1px 2px rgba(10, 31, 68, 0.04),
    0 12px 32px rgba(10, 31, 68, 0.12),
    0 32px 72px rgba(10, 31, 68, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.9);
  transition: box-shadow .35s ease, transform .35s ease;
  animation: kp-map-in .6s cubic-bezier(.4,0,.2,1);
}
@keyframes kp-map-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.kp-map:hover {
  box-shadow:
    0 1px 2px rgba(10, 31, 68, 0.05),
    0 18px 40px rgba(10, 31, 68, 0.16),
    0 40px 80px rgba(10, 31, 68, 0.12),
    0 0 0 4px rgba(0, 201, 123, 0.06);
}

/* Halo intérieur subtil pour cadrer la carte */
.kp-map::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  z-index: 401;
}

/* Coin "LIVE" en haut à droite quand la carte affiche du temps réel */
.kp-map[data-live="true"]::after {
  content: '\25CF  LIVE';
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(239, 68, 68, .95);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 5px 10px;
  border-radius: 999px;
  z-index: 500;
  box-shadow: 0 4px 12px rgba(239, 68, 68, .35);
  animation: kp-live-pulse 2s ease-in-out infinite;
}
@keyframes kp-live-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* ── Marqueur livreur « live » : halo pulsé (suivi temps réel) ── */
.kp-live-marker { position: relative; }
.kp-live-marker::after {
  content: '';
  position: absolute; inset: -7px;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.55);
  animation: kp-marker-pulse 1.8s cubic-bezier(.4, 0, .2, 1) infinite;
  pointer-events: none;
}
@keyframes kp-marker-pulse {
  0%   { transform: scale(.6); opacity: .9; }
  100% { transform: scale(2.4); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kp-live-marker::after { animation: none; }
}

/* Variantes de taille */
.kp-map-sm { height: 380px; border-radius: 16px; }
.kp-map-lg { height: 720px; }
.kp-map-xl { height: 820px; border-radius: 24px; }

/* État chargement / erreur (placeholder texte centré) */
.kp-map-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: 24px;
  text-align: center; font-size: 14px; color: var(--db-text-muted);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.05), rgba(10, 31, 68, 0.03));
}

/* Bloc info sous la carte (mise à jour, statut livreur, etc.) */
.kp-map-info {
  margin-top: 14px;
  padding: 14px 20px 14px 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(10,31,68,.04),
    0 4px 14px rgba(10,31,68,.06);
  font-size: 13.5px;
  color: var(--db-text-sec);
  text-align: center;
  border: 1px solid var(--db-border);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}
.kp-map-info::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--db-accent, #00C97B), var(--db-accent-hover, #00A862));
}
.kp-map-info strong { color: var(--db-text); font-weight: 700; }

/* Customisation Leaflet — boutons zoom plus modernes */
.kp-map .leaflet-control-zoom a {
  background: var(--db-card, #fff) !important;
  color: var(--db-text, #1A2B4A) !important;
  border: 1px solid var(--db-border, #E2E8F0) !important;
  box-shadow: 0 2px 8px rgba(10, 31, 68, 0.08);
  width: 36px !important; height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  transition: all .2s ease;
}
.kp-map .leaflet-control-zoom a:hover {
  background: var(--db-accent, #00C97B) !important;
  color: #fff !important;
  border-color: var(--db-accent, #00C97B) !important;
  transform: scale(1.05);
}
.kp-map .leaflet-control-zoom-in { border-radius: 10px 10px 6px 6px !important; }
.kp-map .leaflet-control-zoom-out { border-radius: 6px 6px 10px 10px !important; }

/* Attribution discrète */
.kp-map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(6px);
  font-size: 10px !important;
  padding: 3px 8px !important;
  border-radius: 6px 0 0 0 !important;
}

/* Popups Leaflet stylés */
.kp-map .leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 8px 28px rgba(10, 31, 68, 0.18) !important;
  padding: 4px 6px !important;
}
.kp-map .leaflet-popup-content {
  font-family: var(--font-body, 'DM Sans', sans-serif) !important;
  font-size: 13px !important;
  color: var(--db-text, #1A2B4A) !important;
  margin: 10px 14px !important;
  line-height: 1.5 !important;
}
.kp-map .leaflet-popup-content strong {
  color: var(--db-primary, #0A1F44);
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 14px;
}
.kp-map .leaflet-popup-tip { box-shadow: 0 4px 12px rgba(10, 31, 68, 0.1) !important; }

/* Tuiles plus nettes */
.kp-map .leaflet-tile { filter: contrast(1.02) saturate(1.05); }

/* Responsive */
@media (max-width: 1024px) {
  .kp-map { height: 500px; }
  .kp-map-lg { height: 580px; }
  .kp-map-xl { height: 640px; }
}
@media (max-width: 768px) {
  .kp-map { height: 440px; border-radius: 16px; }
  .kp-map-sm { height: 320px; }
  .kp-map-lg { height: 480px; }
  .kp-map-xl { height: 520px; }
  .kp-map .leaflet-control-zoom a { width: 32px !important; height: 32px !important; line-height: 32px !important; }
}
@media (max-width: 480px) {
  .kp-map { height: 380px; border-radius: 14px; }
  .kp-map-sm { height: 280px; }
}

/* ════════════════════════════════════════════════════════════
   PROFIL — En-tête média partagé (photo de profil / logo entreprise)
   Utilisé par : espace livreur (photo), partenaire & client pro (logo).
   Couleurs paramétrables par dashboard via --kp-hero-from/-to et --kp-accent.
   ════════════════════════════════════════════════════════════ */

/* ---- En-tête profil avec bannière (livreur) ---- */
.kp-profile-hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 28px;
  background: var(--db-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--db-border);
}
.kp-profile-cover {
  height: 104px;
  background:
    radial-gradient(120% 140% at 12% -10%, rgba(255,255,255,.22), transparent 55%),
    linear-gradient(135deg, var(--kp-hero-from, var(--db-accent)), var(--kp-hero-to, var(--db-accent-hover)));
}
.kp-profile-body {
  padding: 0 24px 26px;
  text-align: center;
  margin-top: -56px;
}
.kp-profile-media {
  position: relative;
  width: 112px; height: 112px;
  margin: 0 auto 14px;
}
.kp-profile-media .king-avatar {
  box-shadow: 0 0 0 5px var(--db-card), var(--shadow-card);
}
.kp-avatar-fallback {
  width: 112px; height: 112px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 800;
  font-family: var(--font-heading); font-size: 38px;
  background: var(--db-accent);
  box-shadow: 0 0 0 5px var(--db-card), var(--shadow-card);
}
.kp-photo-btn {
  position: absolute; right: 0; bottom: 0;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--db-info); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 3px solid var(--db-card);
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
  transition: transform .2s ease, background .2s ease;
  z-index: 4;
}
.kp-photo-btn:hover { transform: scale(1.08); background: #2563EB; }
.kp-photo-btn .material-symbols-outlined { font-size: 19px; }

.kp-profile-name {
  font-family: var(--font-heading); font-size: 21px; font-weight: 700;
  color: var(--db-text); margin: 0;
}
.kp-profile-sub { color: var(--db-text-sec); font-size: 14px; margin: 4px 0 0; }
.kp-profile-hint { font-size: 11.5px; color: var(--db-text-muted); margin: 7px 0 0; }

.kp-profile-stats {
  display: flex; justify-content: center; gap: 14px;
  margin-top: 18px; flex-wrap: wrap;
}
.kp-profile-stat {
  background: var(--db-bg); border: 1px solid var(--db-border);
  border-radius: 14px; padding: 12px 18px; min-width: 92px;
}
.kp-profile-stat strong {
  display: block; font-family: var(--font-heading); font-size: 19px; font-weight: 700;
  color: var(--db-text); line-height: 1.1;
}
.kp-profile-stat span { font-size: 11.5px; color: var(--db-text-muted); }
.kp-profile-stat.is-rating strong  { color: var(--db-warning); }
.kp-profile-stat.is-info strong     { color: var(--db-info); }
.kp-profile-stat.is-success strong  { color: var(--db-success); }

/* ---- Carte upload logo entreprise (partenaire + client pro) ---- */
.kp-logo-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 20px; border: 1px solid var(--db-border); border-radius: 16px;
  background: var(--db-card); box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}
.kp-logo-preview {
  flex-shrink: 0;
  width: 100px; height: 100px; border-radius: 16px;
  background: var(--db-bg);
  border: 1px dashed var(--db-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.kp-logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.kp-logo-empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--db-text-muted); font-size: 11px; text-align: center; padding: 6px; line-height: 1.2;
}
.kp-logo-empty .material-symbols-outlined { font-size: 30px; }
.kp-logo-info { flex: 1; min-width: 200px; }
.kp-logo-info h4 {
  font-family: var(--font-heading); font-size: 16px; margin: 0 0 4px; color: var(--db-text);
}
.kp-logo-info p { font-size: 13px; color: var(--db-text-sec); margin: 0 0 12px; }
.kp-logo-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.kp-logo-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; cursor: pointer;
  font-family: var(--font-heading); font-size: 13px; font-weight: 600;
  border: 1.5px solid transparent; transition: all .2s ease;
}
.kp-logo-btn-primary { background: var(--kp-accent, var(--db-accent)); color: #fff; box-shadow: 0 4px 14px rgba(11,19,43,.18); }
.kp-logo-btn-primary:hover { filter: brightness(.95); }
.kp-logo-btn-ghost { background: transparent; color: var(--db-error); border-color: var(--db-error); }
.kp-logo-btn-ghost:hover { background: rgba(239,68,68,.06); }
.kp-logo-hint { font-size: 11.5px; color: var(--db-text-muted); margin: 10px 0 0; }

@media (max-width: 480px) {
  .kp-logo-card { flex-direction: column; text-align: center; }
  .kp-logo-info { min-width: 0; }
  .kp-logo-actions { justify-content: center; }
  .kp-profile-stats { gap: 10px; }
  .kp-profile-stat { padding: 10px 14px; min-width: 80px; }
}
