/* ⭐ 2026-11-05 (patron : « restructurer pour améliorer le design de l'application de gestion des patients, dans tout
   son ensemble ») — couche de design commune, chargée après les styles de base.html : même palette (violet / bleu de
   GHP), mais une typographie plus nette, des cartes, tableaux, formulaires et boutons homogènes, un menu qui montre où
   l'on est, des en-têtes de page, tuiles de chiffres et états vides réutilisables. Rien n'est caché ni déplacé : seules
   les apparences changent. Les impressions (templates/impressions/*) ne chargent pas ce fichier. */

:root {
    --hp-bg: #f3f5fa;
    --hp-surface: #ffffff;
    --hp-border: #e4e8f1;
    --hp-card-border: #e4e8f1;
    --hp-text: #1f2a3d;
    --hp-text-muted: #66738a;
    --hp-radius: 14px;
    --hp-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
    --hp-shadow-hover: 0 4px 16px rgba(16, 24, 40, .08);
    --hp-focus: 0 0 0 .2rem rgba(102, 126, 234, .22);
    --police: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

body { font-family: var(--police); font-size: .935rem; color: var(--hp-text); background: var(--hp-bg);
       -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--hp-text); letter-spacing: -.01em; }
a { color: var(--hp-primary-dark); }
.text-muted { color: var(--hp-text-muted) !important; }

/* ------------------------------------------------------------ barre du haut et menu */
.topbar { background: var(--hp-surface); border-bottom: 1px solid var(--hp-border); box-shadow: none; min-height: 58px; }
.topbar-title { font-weight: 700; font-size: 1rem; letter-spacing: .01em; color: var(--hp-text); }
.topbar .logo-structure { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; border: 1px solid var(--hp-border); }
.topbar .dropdown > .btn { background: #f3f5fa; border: 1px solid var(--hp-border); font-weight: 600; font-size: .88rem; }
.topbar .role-utilisateur { font-size: .7rem; font-weight: 600; color: var(--hp-primary-dark); background: var(--hp-primary-light);
                            border-radius: 999px; padding: 1px 8px; }
.top-nav { background: var(--hp-surface); border-bottom: 1px solid var(--hp-border); }
.top-nav .nav-link-top { border-radius: 9px; font-weight: 500; color: #4b5870; }
.top-nav .nav-link-top:hover { background: #f1f3fb; color: var(--hp-primary-dark); }
.top-nav .nav-link-top.actif { background: var(--hp-primary-light); color: var(--hp-primary-dark); font-weight: 600; }
.top-nav .mega-menu { border-radius: 14px; border: 1px solid var(--hp-border); box-shadow: 0 12px 32px rgba(16, 24, 40, .12); }
.top-nav .menu-item { border-radius: 9px; }
.top-nav .menu-item.actif { background: var(--hp-primary-light); color: var(--hp-primary-dark); font-weight: 600; }
.content-inner { padding-top: 1.25rem; }

/* ------------------------------------------------------------ titres de page */
.content-inner h1.h3, .content-inner h2.h3, .titre-page { font-size: 1.4rem; font-weight: 700; margin-bottom: 0; display: flex;
                                                         align-items: center; gap: .55rem; }
.content-inner h1.h3 > i:first-child, .titre-page > i:first-child { color: var(--hp-primary); font-size: 1.15rem;
    width: 38px; height: 38px; border-radius: 11px; background: var(--hp-primary-light); display: inline-flex;
    align-items: center; justify-content: center; margin-right: .1rem !important; }
.entete-page { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.entete-page .sous-titre { color: var(--hp-text-muted); font-size: .85rem; margin-top: .2rem; padding-left: 48px; }

/* ------------------------------------------------------------ cartes */
.card { border: 1px solid var(--hp-card-border); border-radius: var(--hp-radius); box-shadow: var(--hp-shadow); background: var(--hp-surface); }
.card:hover { box-shadow: var(--hp-shadow); }
a.card:hover, .card.cliquable:hover { box-shadow: var(--hp-shadow-hover); }
.card-header { background: transparent; border-bottom: 1px solid var(--hp-border); padding: .8rem 1.1rem; font-weight: 600; }
.card-header:first-child { border-radius: var(--hp-radius) var(--hp-radius) 0 0; }
.card-header h5, .card-header h6 { font-size: .98rem; font-weight: 600; }
.card-body { padding: 1rem 1.1rem; }
.card-footer { background: #fafbfd; border-top: 1px solid var(--hp-border); }
.card-footer:last-child { border-radius: 0 0 var(--hp-radius) var(--hp-radius); }

/* ------------------------------------------------------------ tableaux */
.table { --bs-table-hover-bg: #f6f7fd; margin-bottom: 0; }
.table > thead > tr > th, .table > thead.table-light > tr > th { background: #f8f9fc; color: #5d6a80; font-size: .72rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--hp-border); padding: .65rem .75rem;
    white-space: nowrap; }
.table > tbody > tr > td { padding: .65rem .75rem; border-color: #eef1f6; vertical-align: middle; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: #fbfcfe; }
.card > .table-responsive:last-child, .card > .card-body.p-0 > .table-responsive:last-child { border-radius: 0 0 var(--hp-radius) var(--hp-radius); }

/* ------------------------------------------------------------ formulaires */
.form-control, .form-select { border-radius: 10px; border-color: #d9dfeb; font-size: .92rem; }
.form-control-sm, .form-select-sm { border-radius: 8px; font-size: .85rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--hp-primary); box-shadow: var(--hp-focus); }
.form-label { font-weight: 500; color: #3c475c; font-size: .88rem; }
.form-check-input:checked { background-color: var(--hp-primary); border-color: var(--hp-primary); }
.input-group-text { border-radius: 10px; border-color: #d9dfeb; background: #f8f9fc; }

/* ------------------------------------------------------------ boutons, badges, onglets */
.btn { border-radius: 10px; font-weight: 500; }
.btn-sm { border-radius: 8px; }
.btn-lg { border-radius: 12px; }
.btn:focus-visible { box-shadow: var(--hp-focus); }
.badge { font-weight: 600; border-radius: 6px; letter-spacing: .01em; }
.nav-tabs .nav-link { font-weight: 500; color: #5d6a80; }
.nav-tabs .nav-link.active { color: var(--hp-primary-dark); font-weight: 600; }
.nav-pills .nav-link { border-radius: 9px; font-weight: 500; color: #4b5870; }
.nav-pills .nav-link.active { background: var(--hp-primary); color: #fff; }
.nav-pills-sm .nav-link { padding: .35rem .75rem; font-size: .87rem; }

/* ------------------------------------------------------------ messages, fenêtres */
.alert { border-radius: 12px; border-width: 1px; }
.content-inner > .alert { box-shadow: var(--hp-shadow); }
.modal-content { border-radius: 16px; border: 0; box-shadow: 0 24px 60px rgba(16, 24, 40, .22); }
.modal-header { border-bottom: 1px solid var(--hp-border); }
.modal-footer { border-top: 1px solid var(--hp-border); }
.dropdown-menu { border-radius: 12px; border: 1px solid var(--hp-border); box-shadow: 0 12px 32px rgba(16, 24, 40, .12); padding: .35rem; }
.dropdown-item { border-radius: 8px; }
.list-group-item { border-color: #eef1f6; }

/* ------------------------------------------------------------ tuiles de chiffres */
.tuile-stat { display: flex; align-items: center; gap: .85rem; background: var(--hp-surface); border: 1px solid var(--hp-border);
              border-radius: var(--hp-radius); padding: .9rem 1rem; box-shadow: var(--hp-shadow); height: 100%; }
.tuile-stat .icone { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
                     font-size: 1.1rem; flex-shrink: 0; }
.tuile-stat .valeur { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.tuile-stat .libelle { font-size: .8rem; color: var(--hp-text-muted); font-weight: 500; }
.ton-orange .icone { background: #fff3e0; color: #c26a00; }
.ton-bleu .icone { background: #e8f0fe; color: #2f5fc4; }
.ton-vert .icone { background: #e6f6ec; color: #23824d; }
.ton-violet .icone { background: var(--hp-primary-light); color: var(--hp-primary-dark); }
.ton-rouge .icone { background: #fde8ea; color: #b4232f; }

/* ------------------------------------------------------------ état vide */
.etat-vide { text-align: center; padding: 2.5rem 1rem; color: var(--hp-text-muted); }
.etat-vide > i { font-size: 2rem; color: #c3cad8; display: block; margin-bottom: .6rem; }

/* ------------------------------------------------------------ petits écrans */
@media (max-width: 767.98px) {
    .content-inner { padding-left: 12px !important; padding-right: 12px !important; }
    .content-inner h1.h3, .titre-page { font-size: 1.2rem; }
    .entete-page .sous-titre { padding-left: 0; }
    .table > thead > tr > th, .table > tbody > tr > td { padding: .5rem .55rem; }
}

@media print {
    body { background: #fff; font-family: inherit; }
    .card { box-shadow: none; }
}

/* ------------------------------------------------------------ hiérarchie des boutons
   L'action principale d'une page (Enregistrer, Saisir, Nouveau…) en couleur pleine ; les autres restent claires.
   « text-white » écrit sur un bouton clair le rendait illisible (ex. « Nouvelle prescription » du tableau de bord). */
.btn-primary { background: linear-gradient(135deg, var(--hp-primary) 0%, var(--hp-primary-dark) 100%); border-color: transparent;
               color: #fff; box-shadow: 0 2px 6px rgba(102, 126, 234, .28); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: linear-gradient(135deg, #5a6fe0 0%, #6a4096 100%);
               border-color: transparent; color: #fff; }
.btn-primary:disabled, .btn-primary.disabled { background: #b8c1f3; color: #fff; box-shadow: none; }
.btn-info.text-white, .btn-success.text-white, .btn-warning.text-white, .btn-danger.text-white { color: inherit !important; }
.btn-info.text-white { color: var(--hp-info) !important; }
.btn-success.text-white { color: var(--hp-success) !important; }
.btn-warning.text-white { color: var(--hp-warning) !important; }
.btn-danger.text-white { color: var(--hp-danger) !important; }
.btn-info.text-white:hover, .btn-success.text-white:hover, .btn-warning.text-white:hover, .btn-danger.text-white:hover { color: #fff !important; }

/* ------------------------------------------------------------ flèches précédent / suivant (barre horizontale) */
.top-nav { display: flex; align-items: center; }
.nav-fleches { display: flex; gap: 4px; padding: 0 8px 0 4px; margin-right: 4px; border-right: 1px solid var(--hp-border); flex-shrink: 0; }
.nav-fleche { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--hp-border); background: #fff; color: var(--hp-primary-dark);
              display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; transition: background .15s; }
.nav-fleche:hover:not(:disabled) { background: var(--hp-primary-light); border-color: var(--hp-primary); }
.nav-fleche:disabled { color: #c3cad8; background: transparent; cursor: default; }
