/*
 * Portail client TunisieStr & QM2S — style « tableau de bord » (menu latéral, cartes, thème sombre / clair).
 * Couleurs des logos : marine #1F3F86 · bleu #1A6FB0 · cyan #10A0E0 · orange #F08A12.
 * CSS simple, sans compilation. Le thème est porté par <html data-theme="sombre|clair">.
 */

/* ========== Thèmes ========== */

:root,
[data-theme="sombre"] {
    color-scheme: dark;
    --p-fond: #0e1014;
    --p-lateral: #121419;
    --p-surface: #171a20;
    --p-surface-2: #1d2128;
    --p-survol: #222731;
    --p-bord: #262b33;
    --p-bord-fort: #343a45;
    --p-texte: #dfe3ea;
    --p-titre: #f5f7fa;
    --p-doux: #9aa2b2;
    --p-pale: #7d8697;
    --p-input: #12151a;
    --p-accent: #10a0e0;
    --p-accent-fort: #38b4ec;
    --p-accent-fond: rgb(16 160 224 / 0.14);
    --p-bouton: #1a6fb0;
    --p-bouton-survol: #2380c7;
    --p-orange: #f08a12;
    --p-orange-fond: rgb(240 138 18 / 0.15);
    --p-orange-texte: #f5a54a;
    --p-vert: #34c77b;
    --p-vert-fond: rgb(52 199 123 / 0.14);
    --p-rouge: #f26464;
    --p-rouge-fond: rgb(242 100 100 / 0.14);
    --p-gris-fond: rgb(138 147 164 / 0.14);
    --p-grille: #232832;
    --p-ombre: none;
    --p-logo-fond: #ffffff;
}

[data-theme="clair"] {
    color-scheme: light;
    --p-fond: #f4f6fa;
    --p-lateral: #ffffff;
    --p-surface: #ffffff;
    --p-surface-2: #f6f8fb;
    --p-survol: #eef2f8;
    --p-bord: #e6eaf1;
    --p-bord-fort: #d3d9e3;
    --p-texte: #1f2937;
    --p-titre: #0f1b33;
    --p-doux: #5d6677;
    --p-pale: #6c7586;
    --p-input: #ffffff;
    --p-accent: #1a6fb0;
    --p-accent-fort: #155a90;
    --p-accent-fond: rgb(26 111 176 / 0.1);
    --p-bouton: #1a6fb0;
    --p-bouton-survol: #155a90;
    --p-orange: #f08a12;
    --p-orange-fond: rgb(240 138 18 / 0.12);
    --p-orange-texte: #9a5408;
    --p-vert: #15803d;
    --p-vert-fond: rgb(22 163 74 / 0.1);
    --p-rouge: #dc2626;
    --p-rouge-fond: rgb(220 38 38 / 0.08);
    --p-gris-fond: #eef1f6;
    --p-grille: #edf0f5;
    --p-ombre: 0 1px 2px rgb(15 35 80 / 0.04), 0 2px 10px -4px rgb(15 35 80 / 0.08);
    --p-logo-fond: transparent;
}

:root {
    --p-rayon: 0.75rem;
    --p-rayon-petit: 0.5rem;
    --p-largeur-menu: 15.5rem;
}

/* ========== Base ========== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

[x-cloak] {
    display: none !important;
}

body {
    margin: 0;
    font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    color: var(--p-texte);
    background: var(--p-fond);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
    margin: 0;
}

.p-icone {
    flex-shrink: 0;
}

html:not([data-theme="clair"]) .p-si-clair,
[data-theme="clair"] .p-si-sombre {
    display: none;
}

.p-titre {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--p-titre);
}

.p-surtitre {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--p-orange-texte);
    margin-bottom: 0.3rem;
}

.p-texte-doux {
    color: var(--p-doux);
    margin-top: 0.3rem;
}

.p-petit {
    font-size: 0.8125rem;
}

.p-bloc {
    display: block;
}

.p-gras {
    font-weight: 600;
    color: var(--p-titre);
}

.p-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.p-nowrap {
    white-space: nowrap;
}

.p-lien {
    color: var(--p-accent);
    font-weight: 600;
    text-decoration: none;
}

.p-lien:hover {
    color: var(--p-accent-fort);
    text-decoration: underline;
}

.p-marge-haut {
    margin-top: 1rem;
}

.p-marge-haut-petite {
    margin-top: 0.5rem;
}

.p-marge-bas {
    margin: 0 0 1rem;
}

.p-masque {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.p-logos {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.55rem;
    border-radius: 0.6rem;
    background: var(--p-logo-fond);
}

.p-logos img {
    height: 2rem;
    width: auto;
    display: block;
}

/* ========== Coque : menu latéral + zone principale ========== */

.p-coque {
    min-height: 100vh;
}

.p-lateral {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--p-largeur-menu);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem 0.8rem;
    background: var(--p-lateral);
    border-right: 1px solid var(--p-bord);
    overflow-y: auto;
}

.p-lateral-haut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.3rem 0.9rem;
}

.p-marque {
    text-decoration: none;
}

.p-lateral-section {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--p-pale);
    padding: 1rem 0.75rem 0.4rem;
}

.p-nav {
    display: grid;
    gap: 0.15rem;
}

.p-nav form {
    margin: 0;
}

.p-nav-lien {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: var(--p-rayon-petit);
    color: var(--p-doux);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}

.p-nav-bouton {
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
}

.p-nav-lien:hover {
    background: var(--p-survol);
    color: var(--p-titre);
}

.p-nav-actif,
.p-nav-actif:hover {
    background: var(--p-accent-fond);
    color: var(--p-accent);
}

.p-lateral-pied {
    margin-top: auto;
    padding: 1rem 0.75rem 0;
    font-size: 0.75rem;
    color: var(--p-pale);
}

.p-voile {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgb(0 0 0 / 0.5);
}

.p-principal {
    margin-left: var(--p-largeur-menu);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.p-barre {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.75rem;
    background: color-mix(in srgb, var(--p-fond) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--p-bord);
}

.p-barre-recherche {
    flex: 0 1 26rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 1rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 1px solid var(--p-bord);
    background: var(--p-surface);
    color: var(--p-doux);
}

.p-barre-recherche:focus-within {
    border-color: var(--p-accent);
}

.p-barre-recherche input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--p-texte);
    font: inherit;
    font-size: 0.875rem;
}

.p-barre-recherche input::placeholder {
    color: var(--p-pale);
}

.p-barre-droite {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.p-bouton-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--p-doux);
    cursor: pointer;
}

.p-bouton-icone:hover {
    background: var(--p-survol);
    color: var(--p-titre);
}

.p-utilisateur {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--p-texte);
}

.p-utilisateur:hover {
    background: var(--p-survol);
}

.p-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--p-bouton), #1f3f86);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.p-utilisateur-texte {
    display: grid;
    line-height: 1.25;
}

.p-utilisateur-texte strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--p-titre);
    white-space: nowrap;
}

.p-utilisateur-texte small {
    font-size: 0.75rem;
    color: var(--p-doux);
    white-space: nowrap;
}

.p-contenu {
    width: 100%;
    max-width: 90rem;
    padding: 1.75rem;
}

.p-seulement-mobile {
    display: none;
}

/* ========== Langues ========== */

.p-langues {
    display: flex;
    gap: 0.15rem;
    padding: 0.2rem;
    border-radius: 999px;
    background: var(--p-surface-2);
    border: 1px solid var(--p-bord);
}

.p-langues form {
    margin: 0;
}

.p-langue {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--p-doux);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
}

.p-langue-active {
    background: var(--p-accent-fond);
    color: var(--p-accent);
}

/* ========== Cartes ========== */

.p-carte {
    background: var(--p-surface);
    border: 1px solid var(--p-bord);
    border-radius: var(--p-rayon);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--p-ombre);
}

.p-carte-entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.p-carte-titre {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--p-titre);
}

.p-vide {
    color: var(--p-doux);
    padding: 2.5rem 0;
    text-align: center;
}

.p-entete-page,
.p-bienvenue {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.p-entete-page .p-titre,
.p-bienvenue .p-titre {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.p-fil {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.p-grille-2 {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.p-tableau-corps {
    transition: opacity 0.15s;
}

.p-chargement {
    opacity: 0.55;
}

/* ========== Chiffres clés (carte + mini-graphique) ========== */

.p-chiffres {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
    gap: 1rem;
}

.p-chiffres-haut {
    margin-top: 0;
}

.p-chiffre {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 0.75rem;
    background: var(--p-surface);
    border: 1px solid var(--p-bord);
    border-radius: var(--p-rayon);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--p-ombre);
    overflow: hidden;
}

.p-chiffre-corps {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.p-chiffre-titre {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--p-texte);
}

.p-chiffre-titre .p-icone {
    color: var(--p-doux);
}

.p-chiffre-valeur {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--p-titre);
    font-variant-numeric: tabular-nums;
    margin-top: 0.7rem;
    line-height: 1.15;
    white-space: nowrap;
}

.p-chiffre-accent .p-chiffre-valeur {
    color: var(--p-rouge);
}

.p-chiffre-variation {
    font-size: 0.78rem;
    font-weight: 500;
    margin-top: 0.45rem;
    color: var(--p-doux);
}

.p-chiffre-variation b {
    font-weight: 600;
}

.p-variation-bonne b {
    color: var(--p-vert);
}

.p-variation-mauvaise b {
    color: var(--p-rouge);
}

.p-etincelle {
    flex-shrink: 0;
    align-self: flex-end;
    width: 6rem;
    height: 3.6rem;
}

.p-etincelle rect {
    fill: currentColor;
    opacity: 0.28;
}

.p-etincelle rect.p-etincelle-derniere {
    opacity: 1;
}

.p-teinte-bleu { color: var(--p-accent); }
.p-teinte-vert { color: var(--p-vert); }
.p-teinte-orange { color: var(--p-orange); }
.p-teinte-rouge { color: var(--p-rouge); }

/* ========== Période ========== */

.p-periodes {
    display: grid;
    gap: 0.6rem;
    justify-items: end;
}

.p-segments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0.2rem;
    background: var(--p-surface);
    border: 1px solid var(--p-bord);
    border-radius: 0.65rem;
}

.p-segment {
    position: relative;
    border: 0;
    background: transparent;
    color: var(--p-doux);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.38rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

.p-segment:hover {
    color: var(--p-titre);
    background: var(--p-survol);
}

.p-segment-actif,
.p-segment-actif:hover {
    background: var(--p-accent-fond);
    color: var(--p-accent);
    font-weight: 600;
}

.p-segment:focus-visible,
.p-segment:focus-within {
    outline: 2px solid var(--p-accent);
    outline-offset: 1px;
}

.p-segments-clair {
    justify-self: start;
    flex-wrap: nowrap;
}

.p-dates {
    display: flex;
    gap: 0.6rem;
    font-size: 0.8125rem;
    color: var(--p-doux);
}

.p-dates label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ========== Formulaires ========== */

.p-formulaire {
    display: grid;
    gap: 1.1rem;
    margin-top: 1.5rem;
}

.p-formulaire-large {
    margin-top: 0;
}

.p-grille-champs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.1rem;
}

.p-champ {
    display: grid;
    gap: 0.4rem;
    align-content: start;
}

.p-champ label,
.p-libelle {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--p-texte);
}

.p-champ-ligne {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: 0.85rem;
}

.p-input {
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--p-bord-fort);
    border-radius: var(--p-rayon-petit);
    background: var(--p-input);
    color: var(--p-texte);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.p-input::placeholder {
    color: var(--p-pale);
}

.p-input:focus {
    outline: none;
    border-color: var(--p-accent);
    box-shadow: 0 0 0 3px var(--p-accent-fond);
}

textarea.p-input {
    resize: vertical;
    min-height: 5rem;
}

select.p-input {
    cursor: pointer;
}

.p-input-erreur {
    border-color: var(--p-rouge);
}

.p-input-date {
    padding: 0.35rem 0.5rem;
    width: auto;
    font-size: 0.8125rem;
}

.p-input-grand {
    margin-top: 0.5rem;
    font-size: 1.05rem;
    padding: 0.85rem 1rem;
}

.p-erreur {
    font-size: 0.8125rem;
    color: var(--p-rouge);
}

.p-aide {
    font-size: 0.8125rem;
    color: var(--p-doux);
}

.p-case,
.p-option {
    display: flex;
    gap: 0.6rem;
    font-size: 0.875rem;
    color: var(--p-texte);
    cursor: pointer;
}

.p-case {
    align-items: center;
    color: var(--p-doux);
}

.p-case input,
.p-option input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--p-accent);
    flex-shrink: 0;
}

.p-option {
    align-items: flex-start;
}

.p-option input {
    margin-top: 0.2rem;
}

.p-option span {
    display: grid;
    gap: 0.1rem;
}

.p-option small {
    color: var(--p-doux);
    font-size: 0.8125rem;
}

.p-option-ligne {
    align-items: center;
}

.p-option-ligne input {
    margin-top: 0;
}

.p-groupe {
    border: 1px solid var(--p-bord);
    border-radius: var(--p-rayon-petit);
    padding: 0.9rem 1rem 1rem;
    margin: 0;
    display: grid;
    gap: 0.7rem;
}

.p-groupe legend {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 0.35rem;
    color: var(--p-titre);
}

.p-ligne-formulaire {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.9rem;
    margin-top: 1rem;
}

.p-ligne-formulaire .p-champ {
    flex: 1 1 12rem;
}

.p-filtres {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.p-filtres .p-input {
    width: auto;
    min-width: 11rem;
}

.p-recherche {
    width: min(100%, 22rem);
}

/* ========== Boutons ========== */

.p-bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--p-rayon-petit);
    padding: 0.6rem 1.05rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.p-bouton-principal {
    background: var(--p-bouton);
    color: #fff;
}

.p-bouton-principal:hover {
    background: var(--p-bouton-survol);
}

.p-bouton-principal:disabled {
    opacity: 0.65;
    cursor: wait;
}

.p-bouton-discret {
    background: var(--p-surface-2);
    color: var(--p-texte);
    border-color: var(--p-bord);
    padding: 0.45rem 0.85rem;
    font-size: 0.8125rem;
}

.p-bouton-discret:hover {
    border-color: var(--p-bord-fort);
    color: var(--p-titre);
}

.p-bouton-lien {
    text-decoration: none;
}

.p-bouton-texte {
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.p-bouton:focus-visible,
.p-bouton-icone:focus-visible,
.p-langue:focus-visible,
.p-lien:focus-visible,
.p-nav-lien:focus-visible,
.p-onglet:focus-visible,
.p-utilisateur:focus-visible {
    outline: 2px solid var(--p-accent);
    outline-offset: 2px;
}

.p-actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

/* ========== Alertes, étiquettes, statuts ========== */

.p-alerte {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    border-radius: var(--p-rayon-petit);
    font-size: 0.9rem;
}

.p-alerte-succes {
    background: var(--p-vert-fond);
    color: var(--p-vert);
}

.p-alerte-erreur {
    background: var(--p-rouge-fond);
    color: var(--p-rouge);
}

.p-alerte-texte {
    color: var(--p-rouge);
    font-weight: 600;
}

.p-statut,
.p-etiquette,
.p-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}

.p-statut-en_attente,
.p-statut-facture-annulee,
.p-statut-demande-annulee {
    background: var(--p-gris-fond);
    color: var(--p-doux);
}

.p-statut-en_cours,
.p-statut-facture-validee,
.p-statut-facture-envoyee,
.p-statut-demande-en_etude {
    background: var(--p-accent-fond);
    color: var(--p-accent);
}

.p-statut-suspendue,
.p-statut-facture-payee_partiellement,
.p-statut-demande-nouvelle {
    background: var(--p-orange-fond);
    color: var(--p-orange-texte);
}

.p-statut-cloturee,
.p-statut-facture-payee,
.p-statut-demande-acceptee {
    background: var(--p-vert-fond);
    color: var(--p-vert);
}

.p-statut-facturee {
    background: rgb(124 92 255 / 0.14);
    color: #9b87ff;
}

[data-theme="clair"] .p-statut-facturee {
    color: #5b45d6;
}

.p-statut-demande-refusee {
    background: var(--p-rouge-fond);
    color: var(--p-rouge);
}

.p-etiquette {
    margin-left: 0.35rem;
    border-radius: 0.35rem;
    background: var(--p-accent-fond);
    color: var(--p-accent);
}

.p-etiquette-avoir {
    margin: 0 0.35rem 0 0;
    background: var(--p-rouge-fond);
    color: var(--p-rouge);
}

.p-badge {
    margin-top: 0.9rem;
    background: var(--p-orange-fond);
    color: var(--p-orange-texte);
}

.p-urgence {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.p-urgence-normale {
    color: var(--p-doux);
}

.p-urgence-urgente {
    color: var(--p-orange-texte);
}

.p-urgence-tres_urgente {
    color: var(--p-rouge);
}

.p-direct {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--p-vert);
}

.p-direct i {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--p-vert);
    animation: p-pulse 1.6s infinite;
}

@keyframes p-pulse {
    0% { box-shadow: 0 0 0 0 rgb(52 199 123 / 0.55); }
    70% { box-shadow: 0 0 0 8px rgb(52 199 123 / 0); }
    100% { box-shadow: 0 0 0 0 rgb(52 199 123 / 0); }
}

@media (prefers-reduced-motion: reduce) {
    .p-direct i {
        animation: none;
    }
}

/* ========== Tableaux ========== */

.p-table-conteneur {
    overflow-x: auto;
    margin: 0 -0.25rem;
}

.p-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.p-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--p-doux);
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--p-bord);
    white-space: nowrap;
}

.p-table th.p-num {
    text-align: right;
}

.p-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--p-bord);
    vertical-align: middle;
}

.p-table tbody tr:last-child td {
    border-bottom: 0;
}

.p-table tbody tr:hover {
    background: var(--p-surface-2);
}

.p-table tfoot td {
    font-weight: 600;
    color: var(--p-titre);
    border-top: 1px solid var(--p-bord-fort);
    border-bottom: 0;
    background: var(--p-surface-2);
}

.p-table-fiches td,
.p-table-fiches th {
    padding: 0.55rem 0.6rem;
}

.p-table th.p-col-defaut {
    max-width: 7rem;
    min-width: 4.5rem;
    white-space: normal;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.25;
    vertical-align: bottom;
}

.p-zero {
    color: var(--p-pale);
}

.p-nc {
    color: var(--p-rouge);
    font-weight: 600;
}

.p-progression {
    width: 7rem;
    height: 0.4rem;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.4rem;
    background: var(--p-surface-2);
    border-radius: 999px;
    overflow: hidden;
}

[data-theme="sombre"] .p-progression {
    background: var(--p-bord);
}

.p-progression-barre {
    height: 100%;
    background: linear-gradient(90deg, var(--p-bouton), var(--p-accent));
    border-radius: 999px;
}

.p-progression-large {
    width: 100%;
    height: 0.5rem;
    margin: 1rem 0 0;
    display: block;
}

.p-pagination {
    margin-top: 1rem;
}

.p-pages {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.p-pages .p-bouton:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ========== Onglets ========== */

.p-onglets {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.p-onglet {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--p-bord);
    background: var(--p-surface);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--p-doux);
    padding: 0.42rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
}

.p-onglet:hover {
    color: var(--p-titre);
    border-color: var(--p-bord-fort);
}

.p-onglet-actif,
.p-onglet-actif:hover {
    background: var(--p-accent-fond);
    border-color: transparent;
    color: var(--p-accent);
    font-weight: 600;
}

.p-compteur {
    font-size: 0.72rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--p-surface-2);
    color: var(--p-doux);
}

.p-onglet-actif .p-compteur {
    background: var(--p-bouton);
    color: #fff;
}

/* ========== Graphiques ========== */

.p-graphique {
    width: 100%;
    height: auto;
    display: block;
}

.p-graphique-grille {
    stroke: var(--p-grille);
    stroke-width: 1;
}

.p-graphique-axe {
    font-size: 11px;
    fill: var(--p-doux);
    font-family: inherit;
}

.p-graphique-courbe {
    fill: none;
    stroke: var(--p-accent);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.p-graphique-courbe-nc {
    fill: none;
    stroke: var(--p-orange);
    stroke-width: 1.6;
    stroke-linejoin: round;
    stroke-dasharray: 4 3;
}

.p-graphique-aire-debut {
    stop-color: var(--p-accent);
    stop-opacity: 0.32;
}

.p-graphique-aire-fin {
    stop-color: var(--p-accent);
    stop-opacity: 0;
}

.p-graphique-repere {
    fill: var(--p-surface);
    stroke: var(--p-accent);
    stroke-width: 2;
    opacity: 0;
}

.p-graphique-ligne-survol {
    stroke: var(--p-bord-fort);
    stroke-width: 1;
    opacity: 0;
}

.p-graphique-survol {
    fill: transparent;
}

.p-graphique-point:hover .p-graphique-repere,
.p-graphique-point:hover .p-graphique-ligne-survol {
    opacity: 1;
}

.p-legende {
    display: flex;
    gap: 1.25rem;
    font-size: 0.8125rem;
    color: var(--p-doux);
    margin-top: 0.5rem;
}

.p-legende span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.p-puce {
    width: 0.75rem;
    height: 0.2rem;
    border-radius: 2px;
    display: inline-block;
}

.p-puce-conforme {
    background: var(--p-accent);
}

.p-puce-nc {
    background: var(--p-orange);
}

.p-barres-h {
    list-style: none;
    margin: 0.2rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.95rem;
}

.p-barres-h-ligne {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.p-barres-h-libelle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.p-barres-h-valeur {
    font-weight: 600;
    color: var(--p-titre);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.p-barres-h-valeur small {
    font-weight: 500;
    color: var(--p-doux);
    margin-left: 0.3rem;
}

.p-barres-h-fond {
    height: 0.4rem;
    background: var(--p-surface-2);
    border-radius: 999px;
    overflow: hidden;
}

[data-theme="sombre"] .p-barres-h-fond {
    background: var(--p-bord);
}

.p-barres-h-barre {
    height: 100%;
    background: var(--p-orange);
    border-radius: 999px;
}

/* ========== Blocs divers ========== */

.p-attention {
    margin-top: 1rem;
    border-color: color-mix(in srgb, var(--p-rouge) 35%, var(--p-bord));
    background: color-mix(in srgb, var(--p-rouge) 6%, var(--p-surface));
}

.p-attention ul {
    margin: 0.6rem 0 0.4rem;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.p-infos dl {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1rem;
}

.p-infos dt,
.p-infos-liste dt {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--p-doux);
}

.p-infos dd,
.p-infos-liste dd {
    margin: 0.2rem 0 0;
    font-weight: 600;
    color: var(--p-titre);
}

.p-infos-liste {
    margin: 0.9rem 0 0;
    display: grid;
    gap: 0.6rem;
}

.p-grille-compte {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1rem;
    align-items: start;
}

.p-fichiers {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.p-fichiers li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--p-bord);
    border-radius: var(--p-rayon-petit);
    background: var(--p-surface-2);
    font-size: 0.875rem;
}

.p-texte-long {
    margin-top: 0.5rem;
    white-space: pre-line;
}

.p-puce-texte {
    display: inline-block;
    margin: 0.1rem 0.25rem 0.1rem 0;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--p-orange-fond);
    color: var(--p-orange-texte);
}

.p-suivi {
    border-left: 3px solid var(--p-orange);
}

.p-suivi-acceptee {
    border-left-color: var(--p-vert);
}

.p-suivi-refusee {
    border-left-color: var(--p-rouge);
}

.p-suivi-annulee {
    border-left-color: var(--p-pale);
}

.p-jeton {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--p-rayon-petit);
    background: var(--p-orange-fond);
    border: 1px solid color-mix(in srgb, var(--p-orange) 40%, transparent);
    display: grid;
    gap: 0.6rem;
    justify-items: start;
}

.p-code,
.p-code-ligne,
.p-pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.p-code {
    display: block;
    width: 100%;
    font-size: 0.85rem;
    padding: 0.6rem 0.75rem;
    background: var(--p-input);
    border: 1px dashed var(--p-bord-fort);
    border-radius: var(--p-rayon-petit);
    word-break: break-all;
    cursor: copy;
}

.p-code-ligne {
    font-size: 0.8125rem;
    word-break: break-all;
}

.p-pre {
    margin: 0.9rem 0 0;
    padding: 1rem;
    border-radius: var(--p-rayon-petit);
    background: #0a0c10;
    border: 1px solid var(--p-bord);
    color: #dce6f5;
    font-size: 0.8125rem;
    overflow-x: auto;
}

.p-liste {
    margin: 0.7rem 0 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.35rem;
}

/* ========== Pages publiques (connexion, mot de passe) ========== */

.p-invite {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--p-accent) 22%, transparent), transparent 42%),
        radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--p-orange) 14%, transparent), transparent 40%),
        var(--p-fond);
}

.p-invite-centre {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.p-invite-carte {
    width: 100%;
    max-width: 26rem;
    background: var(--p-surface);
    border: 1px solid var(--p-bord);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 30px 60px -25px rgb(0 0 0 / 0.5);
}

.p-invite-entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.p-invite-outils {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.p-retour {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

.p-pied {
    margin-top: 1.5rem;
    color: var(--p-pale);
    font-size: 0.8125rem;
}

/* ========== Petits écrans ========== */

@media (max-width: 1200px) {
    .p-grille-2,
    .p-grille-compte {
        grid-template-columns: 1fr;
    }

    .p-utilisateur-texte small {
        display: none;
    }
}

@media (max-width: 960px) {
    .p-lateral {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 0 0 40px rgb(0 0 0 / 0.4);
    }

    .p-lateral-ouvert {
        transform: none;
    }

    .p-principal {
        margin-left: 0;
    }

    .p-seulement-mobile {
        display: inline-flex;
    }

    .p-barre {
        padding: 0.6rem 1rem;
        gap: 0.6rem;
    }

    .p-contenu {
        padding: 1.25rem 1rem;
    }

    .p-periodes {
        justify-items: start;
    }
}

@media (max-width: 640px) {
    .p-barre-recherche,
    .p-utilisateur-texte {
        display: none;
    }

    .p-chiffre-valeur {
        font-size: 1.55rem;
    }

    .p-invite-carte {
        padding: 1.5rem;
    }
}

/* Ajustements : 5 chiffres sur une ligne (tableau de bord), libellés longs des défauts. */

@media (min-width: 1280px) {
    .p-chiffres-5 {
        grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(10rem, 0.75fr);
    }
}

.p-chiffre-titre {
    white-space: nowrap;
}

.p-etincelle {
    width: 5.25rem;
}

.p-barres-h-libelle {
    flex: 1;
    min-width: 0;
}

/* Le contenu ne doit jamais dépasser à droite (tableaux larges : défilement dans leur carte). */
.p-principal,
.p-contenu,
.p-grille-2 > *,
.p-chiffres > * {
    min-width: 0;
}

.p-barres-h > li {
    min-width: 0;
}

/* Colonne de texte long (défauts relevés) : assez large pour éviter des lignes très hautes. */
.p-table th.p-col-large {
    min-width: 16rem;
}
