@media (max-width: 768px) {
    .navbar .container {
        display: flex;
        flex-direction: column;
        height: auto;
        padding: 1rem 1.5rem;
        gap: 1rem;
    }

    
    .nav-menu {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        white-space: nowrap;
        flex: 1 0 auto;
        padding: 0.625rem 1rem;
    }

    .prospect-followup-btn {
        display: none;
    }

.view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-bar {
        flex-direction: column;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal .form-row,
    .modal .form-row > .form-group {
        min-width: 0;
    }

    .modal input[type="date"].form-input {
        display: block;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    .card-actions {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
    }
}


@media (max-width: 480px) {
    /* Meilleure expérience tactile + lisibilité sur téléphone */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .navbar .container {
        padding: 0.75rem 1rem;
    }

    .nav-brand {
        font-size: 1.125rem;
    }

    .nav-icon {
        width: 1.75rem;
        height: 1.75rem;
    }

    /* Évite le zoom automatique iOS sur les champs */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px;
    }

    /* Boutons plus faciles à cliquer */
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .card-actions .btn {
        width: 100%;
    }

    /* Modale plein écran sur téléphone */
    .modal {
        padding: 0;
        top: var(--app-offset-top, 0px);
        height: var(--app-height, 100dvh);
        min-height: 0;
        overflow: hidden;
        align-items: stretch;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: var(--app-height, 100dvh);
        min-height: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .modal-header {
        position: sticky;
        top: 0;
        background: var(--surface);
        z-index: 1;
    }

    .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        padding: 1rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .modal.photo-viewer-open {
        padding: 0;
    }

    .modal.photo-viewer-open .modal-content {
        height: 100dvh;
        max-height: 100dvh;
    }

    .modal.photo-viewer-open .modal-header {
        padding: 0.65rem 0.85rem;
    }

    .modal.photo-viewer-open .modal-header h2 {
        font-size: 1.05rem;
    }

    .modal.photo-viewer-open .modal-body {
        height: calc(100dvh - 58px);
        padding: 0.35rem;
        gap: 0.35rem;
    }

    .photo-viewer {
        position: relative;
        display: block;
        min-height: 0;
        height: 100%;
        background: #0b1220;
        border-radius: 0.5rem;
        margin-bottom: 0;
    }

    .photo-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
        width: 2.35rem;
        height: 2.35rem;
        background: rgba(15, 23, 42, 0.65);
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.25);
    }

    .photo-nav-prev {
        left: 0.35rem;
    }

    .photo-nav-next {
        right: 0.35rem;
    }

    .photo-viewer-main {
        height: 100%;
        max-height: none;
    }

    .photo-viewer-main img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .photo-viewer-counter {
        bottom: 0.5rem;
        right: 0.5rem;
        padding: 0.35rem 0.65rem;
    }

    .photo-viewer-thumbnails {
        padding: 0.25rem;
        gap: 0.35rem;
    }

    .photo-thumbnail {
        width: 64px;
        height: 48px;
    }

    /* Actions de formulaire en bas, toujours visibles */
    .form-actions {
        position: sticky;
        bottom: 0;
        background: var(--surface);
        padding: 0.75rem 0;
        margin-top: 1rem;
        border-top: 1px solid var(--border);
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-actions .btn {
        width: 100%;
    }

    body.pwa-standalone .vehicle-detail-actions {
        --vehicle-actions-bottom-offset: max(env(safe-area-inset-bottom, 0px), 0.75rem);
        --vehicle-actions-toggle-height: 44px;
        align-items: flex-start;
        padding: 0;
        gap: 0.5rem;
        position: fixed;
        right: 0.75rem;
        bottom: calc(var(--vehicle-actions-bottom-offset) + 0.75rem);
        z-index: 12;
        background: transparent;
        border: 0;
        box-shadow: none;
        margin: 0;
    }

    body.pwa-standalone .vehicle-detail-actions-toggle {
        display: inline-flex;
        width: auto;
        min-height: var(--vehicle-actions-toggle-height);
        padding: 0.4rem 0.7rem;
        align-self: flex-start;
        touch-action: manipulation;
        background: rgba(16, 185, 129, 0.2);
        border-color: rgba(16, 185, 129, 0.55);
        color: #047857;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
        backdrop-filter: blur(10px) saturate(1.25);
        -webkit-backdrop-filter: blur(10px) saturate(1.25);
    }

    body.pwa-standalone .vehicle-detail-actions-toggle:hover {
        background: rgba(16, 185, 129, 0.3);
        border-color: rgba(16, 185, 129, 0.75);
        color: #047857;
    }

    body.pwa-standalone .vehicle-detail-actions.is-open .vehicle-detail-actions-toggle {
        background: var(--success);
        border-color: var(--success);
        color: white;
    }

    body.pwa-standalone .vehicle-detail-actions.is-open .vehicle-detail-actions-toggle:hover {
        background: #059669;
        border-color: #059669;
        color: white;
    }

    body.pwa-standalone .vehicle-detail-multiline-item .card-info-value {
        max-width: none;
        justify-self: stretch;
        text-align: left;
    }

    body.pwa-standalone .vehicle-detail-actions-buttons {
        display: none;
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(var(--vehicle-actions-bottom-offset) + var(--vehicle-actions-toggle-height) + 0.5rem);
        max-height: min(45vh, 360px);
        overflow: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4rem;
        padding: 0.5rem;
        border: 1px solid var(--border);
        border-radius: 0.6rem;
        background: var(--surface);
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.2);
    }

    body.pwa-standalone .vehicle-detail-actions.is-open .vehicle-detail-actions-buttons {
        display: grid;
    }

    body.pwa-standalone .vehicle-detail-actions-buttons .btn,
    body.pwa-standalone .vehicle-detail-actions-buttons select {
        width: 100%;
        min-height: 34px;
        padding: 0.38rem 0.45rem;
        font-size: 0.74rem;
        line-height: 1.15;
        justify-content: center;
    }

    body.pwa-standalone .prospect-detail-actions {
        position: sticky;
        right: auto;
        bottom: 0;
        z-index: 5;
        width: auto;
        margin: 1rem 0 0;
        padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom, 0px));
        background: var(--surface);
        border-top: 1px solid var(--border);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
        align-items: center;
    }

    body.pwa-standalone .prospect-detail-actions .vehicle-detail-actions-toggle {
        display: none;
    }

    body.pwa-standalone .prospect-detail-actions .vehicle-detail-actions-buttons {
        display: grid;
        position: static;
        max-height: none;
        overflow: visible;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    /* Images de carte un peu moins hautes */
    .card-image {
        height: 190px;
        object-fit: cover;
    }

    /* Espacement global */
    .view-header {
        gap: 0.75rem;
    }

    .search-bar {
        gap: 0.75rem;
    }
}


.settings-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
}
.settings-tab-btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.15);
  color: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.settings-tab-btn.active {
  border-color: rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.28);
}

.vehicle-priority-panel {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin: .25rem 0 1rem;
  padding: .7rem .85rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface);
}
.vehicle-priority-item { padding: .25rem .55rem; border-radius: 999px; font-size: .88rem; font-weight: 600; }
.vehicle-priority-item.is-warning { color: #92400e; background: #fef3c7; }
.vehicle-priority-item.is-danger { color: #b91c1c; background: #fee2e2; }
.vehicle-list-tabs {
  box-sizing: border-box;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  margin-right: 0;
}

#vehicle-search {
  min-width: 0;
  flex: 1 1 20rem;
}

#vehicle-status-filter {
  flex: 0 1 13rem;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
}

.vehicle-subview-tabs {
  flex-basis: 100%;
  margin-left: 0;
}
.vehicle-list-tabs .settings-tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}
.vehicle-list-tabs .settings-tab-btn.active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-dark);
}
.tab-panel { display:none; }
.tab-panel.active { display:block; }
.btn-sm { padding: 6px 10px; font-size: 0.9rem; }

@media (max-width: 768px) {
  .vehicle-list-tabs {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: .35rem;
  }

  #vehicle-search,
  #vehicle-status-filter {
    display: block;
    visibility: visible;
    opacity: 1;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }

  #vehicle-search {
    flex: 0 0 auto;
  }

  #vehicle-status-filter {
    flex: 0 0 auto;
    min-height: 48px;
  }

  body.theme-test #view-vehicles .search-bar > #vehicle-status-filter {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    min-height: 48px !important;
  }
}

body.pwa-standalone .modal {
    padding: 0;
    top: var(--app-offset-top, 0px);
    height: var(--app-height, 100dvh);
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
}

body.pwa-standalone .modal-content {
    width: 100%;
    height: 100%;
    max-height: var(--app-height, 100dvh);
    min-height: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.trucklist-ios-native.pwa-standalone .modal-header {
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    min-height: calc(4.25rem + env(safe-area-inset-top, 0px));
    align-items: flex-end;
}

body.trucklist-ios-native.pwa-standalone .modal-header h2 {
    line-height: 1.15;
}

body.pwa-standalone .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}
