/* =============================================================================
   POSTES DE SERVICE ET PASSATION
   =============================================================================
   Le style generique `.data-table` est taille pour quatre ou cinq colonnes :
   16 px de marge de chaque cote, corps 14, en-tetes en majuscules espacees.
   Sur un tableau de neuf colonnes de montants il deborde et devient illisible.
   `.table-compacte` reprend donc la main : marges serrees, chiffres a chasse
   fixe pour que les colonnes s'alignent verticalement, montants a droite.
   ========================================================================== */

.table-compacte {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 10px 0 18px;
}

.table-compacte th,
.table-compacte td {
    padding: 5px 8px;
    border: 1px solid #dfe6ee;
    vertical-align: middle;
}

.table-compacte thead th {
    background: #34495e;
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    text-align: center;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.table-compacte tbody tr:nth-child(even) td { background: #fafbfc; }
.table-compacte tbody tr:hover td { background: #f1f6fb; }

/* Les montants : a droite, chasse fixe, jamais coupes. */
.table-nombres .col-nombre,
.table-compacte .col-nombre {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.table-compacte .col-article { text-align: left; min-width: 180px; }
.table-compacte .col-lot     { text-align: left; white-space: nowrap; }
.table-compacte .col-date,
.table-compacte .col-sens    { text-align: center; white-space: nowrap; }
.table-compacte .col-fort    { font-weight: 700; }

/* Colonnes remplies a la main pendant le comptage physique.
   Le fond creme ne vaut QUE pour les cellules de corps : pose sur le , il
   passait apres la regle d'en-tete et rendait le titre blanc sur creme, donc
   illisible. */
.table-compacte td.col-compte { background: #fffdf3; }
.table-compacte .col-compte   { min-width: 62px; }

.table-compacte tfoot .ligne-totaux td {
    background: #eef3f8;
    font-weight: 700;
    border-top: 2px solid #34495e;
}

.table-compacte .ligne-perimee td { background: #fdf0ef; }
.table-compacte .ligne-perimee .col-date { color: #c0392b; font-weight: 700; }

.sens-entree { color: #1e8449; font-weight: 600; }
.sens-sortie { color: #c0392b; font-weight: 600; }

/* Un tableau large defile dans son propre cadre : jamais la page entiere. */
.table-large { width: 100%; overflow-x: auto; }

/* ------------------------------------------------------------------ chapeau */
.table-chapeau {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 12px;
}

.table-chapeau th,
.table-chapeau td { padding: 6px 10px; border: 1px solid #dfe6ee; text-align: left; }
.table-chapeau th { background: #f4f7fa; width: 110px; font-weight: 600; white-space: nowrap; }

.titre-section {
    font-size: 13px;
    font-weight: 700;
    color: #2c3e50;
    margin: 18px 0 4px;
    padding-bottom: 4px;
    border-bottom: 2px solid #e2e8f0;
}

.titre-precision { font-weight: 400; font-size: 11px; color: #7b8794; }

.avertissement {
    border-left: 4px solid #d68910;
    background: #fdf6e3;
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 12px;
}

.poste-message {
    border-left: 4px solid #1e8449;
    background: #eafaf1;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 12px;
}

.poste-note { font-size: 12px; color: #55606b; margin: 8px 0; }
.poste-aide { font-size: 11px; color: #7b8794; margin: 2px 0 6px; }

/* --------------------------------------------------------------- mon poste */
.poste-encadre { border: 1px solid #dfe6ee; border-radius: 6px; padding: 12px; margin-bottom: 14px; }
.poste-ouvert  { border-left: 4px solid #1e8449; }
.poste-ligne   { display: flex; gap: 12px; padding: 3px 0; font-size: 13px; }
.poste-etiquette { width: 120px; color: #7b8794; flex: none; }
.poste-valeur    { font-weight: 600; }

.poste-champ { margin-bottom: 14px; }
.poste-champ label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.poste-champ select,
.poste-champ textarea {
    width: 100%; max-width: 420px; padding: 7px 9px;
    border: 1px solid #cbd5e0; border-radius: 4px; font-size: 13px;
}
.poste-champ label.poste-case { display: block; font-weight: 400; font-size: 13px; padding: 2px 0; }

.poste-filtre { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; font-size: 12px; }
.poste-filtre select, .poste-filtre input { padding: 5px 8px; border: 1px solid #cbd5e0; border-radius: 4px; }

.etat { font-size: 11px; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.etat-ouvert { background: #eafaf1; color: #1e8449; }
.etat-clos   { background: #eef3f8; color: #34495e; }
.etat-alerte { background: #fdf6e3; color: #a1670a; }
.lien-fiche  { color: #2471a3; font-weight: 600; }

/* ------------------------------------------------------------- signatures */
.signatures { display: flex; gap: 18px; margin-top: 22px; page-break-inside: avoid; }
.signature { flex: 1; border: 1px solid #cbd5e0; border-radius: 4px; padding: 10px; }
.signature-titre { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #7b8794; }
.signature-nom   { font-size: 13px; font-weight: 600; margin: 6px 0 26px; }
.signature-trait { border-top: 1px solid #7b8794; font-size: 10px; color: #7b8794; padding-top: 3px; }

/* ---------------------------------------------------------------- papier */
@media print {
    /* Neuf colonnes ne tiennent pas en portrait. */
    @page { size: A4 landscape; margin: 10mm; }

    .no-print { display: none !important; }

    .table-compacte { font-size: 9px; }
    .table-compacte th, .table-compacte td { padding: 2px 4px; }
    .table-compacte thead th { background: #34495e !important; color: #fff !important;
                               -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .table-compacte td.col-compte { background: #fff !important; }

    /* L'en-tete se repete en haut de chaque page d'un long etat. */
    .table-compacte thead { display: table-header-group; }
    .table-compacte tr { page-break-inside: avoid; }

    .table-large { overflow-x: visible; }
    .titre-section { font-size: 11px; margin: 10px 0 3px; }
    .table-chapeau { font-size: 9px; }
    .avertissement { font-size: 9px; border-left-width: 3px; }
    .poste-note { font-size: 9px; }
}

/* ------------------------------------------------------- rapport financier */
.table-resume { margin-bottom: 6px; }
.table-resume thead th { font-size: 10px; }
.ligne-resume td { font-size: 17px; padding: 10px 8px; background: #f7fafc; }
.montant-du { color: #c0392b; }

.titre-sous-section {
    font-size: 11px;
    font-weight: 700;
    color: #55606b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 14px 0 2px;
}

@media print {
    .ligne-resume td { font-size: 12px; padding: 4px; }
    .titre-sous-section { font-size: 9px; margin: 8px 0 2px; }
}

/* Le Cheque Sante Universel se distingue des assureurs commerciaux : il ne
   partage ni leur circuit de remboursement ni leur logique, et c'est la ligne
   que la pharmacienne cherche du regard. */
.table-compacte tbody tr.ligne-csu td {
    background: #eef7fd;
    font-weight: 600;
}

@media print {
    .table-compacte tbody tr.ligne-csu td {
        background: #fff !important;
        border-left: 3px solid #34495e;
    }
}

/* ------------------------------------------------- feuille de comptage CSV */
.feuille-comptage {
    border: 1px solid #dfe6ee;
    border-left: 4px solid #2471a3;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 18px;
    background: #fbfdff;
}

.feuille-comptage-titre {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2471a3;
    margin-bottom: 8px;
}

.feuille-comptage-aide { font-size: 12px; color: #55606b; margin: 8px 0 0; }
.feuille-comptage-aide code {
    background: #eef3f8; padding: 1px 4px; border-radius: 3px; font-size: 11px;
}

.feuille-comptage-rapport {
    margin-top: 10px; padding: 8px 12px; font-size: 12px; border-radius: 4px;
}
.rapport-ok    { background: #eafaf1; border-left: 3px solid #1e8449; }
.rapport-echec { background: #fdf0ef; border-left: 3px solid #c0392b; }

/* ----------------------------------------------------------------- rayons */
.champ-rayon {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    font-size: 12px;
}
.champ-ordre { width: 70px; text-align: right; }

.btn-mini { padding: 3px 8px !important; font-size: 11px !important; }

.lien-supprimer { color: #c0392b; font-size: 11px; }
.lien-supprimer:hover { text-decoration: underline; }

.choix-rayon {
    border: 1px solid #dfe6ee;
    border-left: 4px solid #7b8794;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: #fcfdfe;
}
.choix-rayon-titre {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #55606b; margin-right: 10px;
}

.lien-inactif { color: #9aa5b1; font-size: 11px; cursor: help; }
