/* =========================================================
   responsive.css — tablette et mobile
   ========================================================= */
@media (max-width: 1280px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .hide-lg { display: none !important; }
}

@media (max-width: 1100px) {
  .hide-md { display: none !important; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  .main, body.sidebar-collapsed .main { margin-left: 0; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 36, .45); z-index: 55; }
  body.sidebar-collapsed .brand > span:last-child, body.sidebar-collapsed .nav-label { display: revert; }
  body.sidebar-collapsed .nav-link { font-size: 13.5px; justify-content: flex-start; padding: 8px 10px; }
  .agency-sub { display: none; }
}

@media (max-width: 860px) {
  .demo-date { display: none; }
  .user-info { display: none; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid .span-2 { grid-column: auto; }
}

@media (max-width: 680px) {
  .hide-sm { display: none !important; }
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar-right { gap: 4px; }
  .vsep { display: none; }
  .agency strong { font-size: 13px; max-width: 46vw; }
  .content { padding: 12px 14px 20px; }
  .breadcrumb { padding: 10px 14px 0; }
  h1 { font-size: 19px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-ic { width: 32px; height: 32px; }
  .kpi-value { font-size: 20px; }
  .card-head, .card-body, .toolbar { padding-left: 14px; padding-right: 14px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar select, .toolbar input[type=date] { flex: 1 1 140px; min-width: 0; }
  .toolbar .count { margin-left: 0; width: 100%; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }

  /* Popups en pleine largeur */
  .modal { padding: 0; align-items: stretch; }
  .modal-dialog, .modal-sm, .modal-lg { max-width: none; min-height: 100%; border-radius: 0; margin: 0; }
  .modal-body { flex: 1; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-foot .grow:empty { display: none; }
  #confirm-modal .modal-dialog { min-height: 0; margin: auto 0 0; border-radius: 16px 16px 0 0; }

  .dropdown-menu.menu-wide { width: calc(100vw - 16px); }
  .toasts { right: 8px; left: 8px; bottom: 8px; max-width: none; }

  /* Tableaux → cartes empilées */
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 10px 14px; border-bottom: 1px solid var(--border); position: relative; }
  .table.stack td { border: 0; padding: 3px 0; max-width: none; min-width: 0; }
  .table.stack td.actions { position: absolute; top: 8px; right: 10px; width: auto; padding: 0; }
  .table.stack td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 92px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
  .table.stack tr.empty-row { padding: 0; }
  .table.stack tbody tr:hover td { background: none; }
  .table.stack tfoot { display: block; }
  .table.stack tfoot tr { display: flex; justify-content: space-between; padding: 10px 14px; }
  .table.stack tfoot td { display: block; width: auto; border: 0; padding: 0; background: none; }
}

@media (max-width: 400px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .pill-demo { display: none; }
}

@media print {
  .sidebar, .topbar, .breadcrumb, .page-actions, .toolbar, .row-actions, .toasts, .page-foot, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Pages flotte, chauffeurs, vue chauffeur */
@media (max-width: 680px) {
  .fleet-grid, .drv-grid { grid-template-columns: minmax(0, 1fr); padding: 12px 14px 14px; gap: 12px; }
  .wk-legend { width: 100%; margin-left: 0; }
  .wk-legend .wk-d.mini:first-child { margin-left: 0; }
  .seg.ml-auto { margin-left: 0; }
  .phone-shell { box-shadow: none; }
  .ops-table .stepper { max-width: 200px; }
}
@media print {
  body.driver-app { background: #fff; }
  .drv-top, .drv-foot, .dm-actions { display: none !important; }
}
