/* AJOUTS ET AMÉLIORATIONS CSS POUR LES NOUVELLES PAGES */

/* Page Header avec bouton retour */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.btn-back {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--secondary);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--primary);
    color: white;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Scanner QR Code */
.qr-scanner-container {
    padding: 2rem 1.5rem;
}

.scanner-info {
    text-align: center;
    margin-bottom: 2rem;
}

.scanner-info svg {
    margin: 0 auto 1rem;
}

.scanner-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.scanner-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 2rem;
    border-radius: 16px;
    overflow: hidden;
    display: none;
}

#qr-video {
    width: 100%;
    height: auto;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-area {
    width: 200px;
    height: 200px;
    border: 3px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        border-color: var(--primary);
    }
    50% {
        border-color: var(--primary-light);
    }
}

.scanner-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.btn-secondary {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--primary);
    background: white;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--secondary);
}

/* Résultat du scan */
.scan-result {
    padding: 0 1.5rem;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.result-icon.success {
    background: var(--success);
}

.result-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.patient-details {
    text-align: left;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.patient-details p {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.patient-details strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Détails patient - Card large */
.patient-card-large {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.patient-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto 1.5rem;
}

.patient-info-large h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
}

.patient-info-large p {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.patient-info-large strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.code-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--secondary);
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 2px;
    border-radius: 8px;
    margin-left: 0.5rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.status-pending {
    background: #FEF3C7;
    color: #92400E;
}

.status-confirmed {
    background: #D1FAE5;
    color: #065F46;
}

.status-cancelled {
    background: #FEE2E2;
    color: #991B1B;
}

.status-completed {
    background: #DBEAFE;
    color: #1E40AF;
}

/* Antécédents styling amélioré */
.antecedent-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.antecedent-card.medical {
    border-left-color: #0891B2;
}

.antecedent-card.chirurgical {
    border-left-color: #F59E0B;
}

.antecedent-card.familial {
    border-left-color: #8B5CF6;
}

.antecedent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.antecedent-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--secondary);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: capitalize;
}

.antecedent-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.antecedent-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.antecedent-traitement {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Btn icon dans header */
.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--secondary);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
}

/* Header de l'app */
.app-header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.logo-small {
    display: flex;
    align-items: center;
}

.header-title {
    display: flex;
    flex-direction: column;
    margin-left: 0.75rem;
}

.header-title span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.header-title small {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Navigation du bas */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
    background: var(--secondary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

/* Responsive */
@media (max-width: 640px) {
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .patient-card-large {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .patient-avatar-large {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

/* Loading & Error states */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--error);
}

/* Amélioration des modales */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--secondary);
    color: var(--primary);
    font-size: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: var(--primary);
    color: white;
}

/* Section subtitle */
.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Form help text */
.form-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Amélioration des textarea */
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* Amélioration des select */
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Harmonisation responsive globale */
* {
    max-width: 100%;
}

.main-content,
.section-card,
.profil-card,
.patient-card-large,
.result-card {
    width: 100%;
}

.info-row {
    flex-wrap: wrap;
}

.info-label {
    min-width: 105px;
}

@media (max-width: 680px) {
    .page-header {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.1rem;
    }

    .result-card,
    .patient-card-large,
    .profil-card,
    .section-card {
        padding: 1rem;
        margin: .75rem 0;
    }

    .code-badge {
        display: inline-flex;
        margin: .5rem 0 0;
        font-size: 1rem;
        letter-spacing: 1.5px;
    }
}
/* ─────────────────────────────────────────────────────────────
   FIX: bottom-nav cache la zone de saisie (messagerie)
   ───────────────────────────────────────────────────────────── */

:root{
  --bottom-nav-height: 72px; /* approx : 0.75rem padding + icone+texte */
}

/* Laisse de la place au menu fixe en bas */
.app-container{
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

/* La messagerie ne doit pas aller sous le menu */
.messages-layout{
  height: calc(100vh - 132px - var(--bottom-nav-height) - env(safe-area-inset-bottom));
}

/* La barre d'envoi doit rester visible */
.chat-input-bar{
  position: sticky;
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  z-index: 50;
  background: var(--surface);
}
/* AJOUTS ET AMÉLIORATIONS CSS POUR LES NOUVELLES PAGES */

/* Page Header avec bouton retour */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.btn-back {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--secondary);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--primary);
    color: white;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Scanner QR Code */
.qr-scanner-container {
    padding: 2rem 1.5rem;
}

.scanner-info {
    text-align: center;
    margin-bottom: 2rem;
}

.scanner-info svg {
    margin: 0 auto 1rem;
}

.scanner-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.scanner-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 2rem;
    border-radius: 16px;
    overflow: hidden;
    display: none;
}

#qr-video {
    width: 100%;
    height: auto;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-area {
    width: 200px;
    height: 200px;
    border: 3px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        border-color: var(--primary);
    }
    50% {
        border-color: var(--primary-light);
    }
}

.scanner-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.btn-secondary {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--primary);
    background: white;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--secondary);
}

/* Résultat du scan */
.scan-result {
    padding: 0 1.5rem;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.result-icon.success {
    background: var(--success);
}

.result-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.patient-details {
    text-align: left;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.patient-details p {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.patient-details strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Détails patient - Card large */
.patient-card-large {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.patient-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto 1.5rem;
}

.patient-info-large h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
}

.patient-info-large p {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.patient-info-large strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.code-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--secondary);
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 2px;
    border-radius: 8px;
    margin-left: 0.5rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.status-pending {
    background: #FEF3C7;
    color: #92400E;
}

.status-confirmed {
    background: #D1FAE5;
    color: #065F46;
}

.status-cancelled {
    background: #FEE2E2;
    color: #991B1B;
}

.status-completed {
    background: #DBEAFE;
    color: #1E40AF;
}

/* Antécédents styling amélioré */
.antecedent-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.antecedent-card.medical {
    border-left-color: #0891B2;
}

.antecedent-card.chirurgical {
    border-left-color: #F59E0B;
}

.antecedent-card.familial {
    border-left-color: #8B5CF6;
}

.antecedent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.antecedent-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--secondary);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: capitalize;
}

.antecedent-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.antecedent-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.antecedent-traitement {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Btn icon dans header */
.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--secondary);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
}

/* Header de l'app */
.app-header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.header-actions{
    display:flex;
    align-items:center;
    gap:.5rem;
}

.logo-small {
    display: flex;
    align-items: center;
}

.header-title {
    display: flex;
    flex-direction: column;
    margin-left: 0.75rem;
}

.header-title span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.header-title small {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── IA modal (global) ─────────────────────────────────────────────────────── */
.ai-modal{
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.ai-modal.active{ display:flex; }

.ai-modal-card{
    width: 100%;
    max-width: 720px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 45px rgba(0,0,0,.25);
    border: 1px solid var(--border);
    padding: 1rem;
}

.ai-modal-header{
    display:flex;
    align-items:flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}
.ai-modal-title{
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}
.ai-modal-subtitle{
    font-size: .85rem;
    color: var(--text-secondary);
    margin-top: .15rem;
}

.ai-modal-actions{
    display:flex;
    justify-content:flex-end;
    margin-top: .75rem;
}

.ai-modal-output{
    margin-top: .75rem;
    padding: .875rem 1rem;
    border-radius: 12px;
    background: var(--background);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    line-height: 1.5;
    color: var(--text-primary);
    max-height: 40vh;
    overflow: auto;
}

@media (min-width: 760px){
    .ai-modal{ align-items: center; }
    .ai-modal-card{ padding: 1.25rem; }
}

/* Navigation du bas */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
    background: var(--secondary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

/* Responsive */
@media (max-width: 640px) {
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .patient-card-large {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .patient-avatar-large {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

/* Loading & Error states */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--error);
}

/* Amélioration des modales */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--secondary);
    color: var(--primary);
    font-size: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: var(--primary);
    color: white;
}

/* Section subtitle */
.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Form help text */
.form-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Amélioration des textarea */
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* Amélioration des select */
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Harmonisation responsive globale */
* {
    max-width: 100%;
}

.main-content,
.section-card,
.profil-card,
.patient-card-large,
.result-card {
    width: 100%;
}

.info-row {
    flex-wrap: wrap;
}

.info-label {
    min-width: 105px;
}

@media (max-width: 680px) {
    .page-header {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.1rem;
    }

    .result-card,
    .patient-card-large,
    .profil-card,
    .section-card {
        padding: 1rem;
        margin: .75rem 0;
    }

    .code-badge {
        display: inline-flex;
        margin: .5rem 0 0;
        font-size: 1rem;
        letter-spacing: 1.5px;
    }
}
/* ─────────────────────────────────────────────────────────────
   FIX: bottom-nav cache la zone de saisie (messagerie)
   ───────────────────────────────────────────────────────────── */

:root{
  --bottom-nav-height: 72px; /* approx : 0.75rem padding + icone+texte */
}

/* Laisse de la place au menu fixe en bas */
.app-container{
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

/* La messagerie ne doit pas aller sous le menu */
.messages-layout{
  height: calc(100vh - 132px - var(--bottom-nav-height) - env(safe-area-inset-bottom));
}

/* La barre d'envoi doit rester visible */
.chat-input-bar{
  position: sticky;
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  z-index: 50;
  background: var(--surface);
}
/* ─────────────────────────────────────────
   FIX LISTE PATIENT (CHEVAUCHEMENT)
   ───────────────────────────────────────── */

.patient-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Avatar */
.patient-avatar {
    flex-shrink: 0;
}

/* Infos */
.patient-info {
    flex: 1;
    min-width: 0; /* 🔥 OBLIGATOIRE */
}

/* Nom */
.patient-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Code */
.patient-code {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bouton */
.patient-card button {
    flex-shrink: 0;
    margin-left: auto;
}

/* 📱 MOBILE FIX */
@media (max-width: 767px) {
    .patient-card {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .patient-card button {
        width: 100%;
        margin-top: 0.5rem;
        margin-left: 0;
    }
}