/* Charte Avenches Tattoo — fond clair, bandeau noir, or #DFCDAB, rouge #B00500 */
:root {
    --or: #DFCDAB;
    --rouge: #B00500;
    --noir: #141414;
    --fond: #f7f4ee;
    --texte: #26221c;
    --gris: #6d675e;
    --bord: #ddd5c6;
    --blanc: #ffffff;
    --vert: #1d7a33;
    --vert-fond: #e2f2e5;
    --rouge-fond: #fbe4e2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---- Bandeau noir ---- */
.topbar { background: var(--noir); color: var(--blanc); border-bottom: 3px solid var(--or); }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: .06em; color: var(--blanc); text-decoration: none; }
.brand span { color: var(--or); }
.brand small { display: block; font-weight: 400; font-size: .78rem; letter-spacing: .12em; color: #cfc7b6; text-transform: uppercase; }

.nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.nav a {
    color: #e8e2d4; text-decoration: none; font-size: .9rem;
    padding: 6px 10px; border-radius: 6px;
}
.nav a:hover { background: #2b2b2b; color: var(--or); }
.nav a.active { background: var(--or); color: var(--noir); font-weight: 600; }
.nav a.logout { color: #d99; }

/* ---- Contenu ---- */
main.wrap { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h1::after { content: ""; display: block; width: 56px; height: 3px; background: var(--rouge); margin-top: 8px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
.sub { color: var(--gris); margin: 6px 0 20px; }

.card {
    background: var(--blanc); border: 1px solid var(--bord); border-radius: 10px;
    padding: 20px; margin-bottom: 20px;
}

.flash {
    background: var(--vert-fond); border: 1px solid var(--vert); color: var(--vert);
    border-radius: 8px; padding: 10px 14px; margin-bottom: 18px; font-weight: 600;
}
.errors {
    background: var(--rouge-fond); border: 1px solid var(--rouge); color: var(--rouge);
    border-radius: 8px; padding: 10px 14px; margin-bottom: 18px;
}
.errors ul { margin: 0; padding-left: 20px; }

/* ---- Formulaires ---- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=time], input[type=password], input[type=number], select, textarea {
    width: 100%; padding: 10px 12px; font-size: 1rem; font-family: inherit;
    border: 1px solid var(--bord); border-radius: 8px; background: var(--blanc); color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--or); border-color: var(--or); }
textarea { min-height: 80px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- Sections de formulaire (Coordonnées / Profil sapeur-pompier / Participation) ---- */
.form-section { border: none; border-top: 2px solid var(--or); padding: 14px 0 0; margin: 0 0 22px; }
.form-section legend {
    font-weight: 700; font-size: 1.05rem; color: var(--noir);
    padding-right: 12px; text-transform: uppercase; letter-spacing: .04em;
}
.field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.radios { display: flex; gap: 18px; }
.radios label { display: flex; align-items: center; gap: 7px; font-weight: 500; cursor: pointer; margin: 0; }
.radios input { width: 18px; height: 18px; accent-color: var(--rouge); }
.checks-inline { flex-direction: row; flex-wrap: wrap; }
.checks-inline label { flex: 0 0 auto; }

.checks { display: flex; flex-direction: column; gap: 8px; }
.checks label {
    display: flex; align-items: center; gap: 10px; font-weight: 500;
    background: var(--fond); border: 1px solid var(--bord); border-radius: 8px;
    padding: 10px 12px; cursor: pointer; margin: 0;
}
.checks label:has(input:checked) { border-color: var(--rouge); background: #fdf3f2; }
.checks input { width: 20px; height: 20px; accent-color: var(--rouge); flex-shrink: 0; }
.checks .hours { color: var(--gris); font-size: .85rem; margin-left: auto; white-space: nowrap; }

/* Encadré des conditions d'engagement (formulaire public) */
.conditions-box {
    background: var(--fond); border: 1px solid var(--or); border-left: 4px solid var(--or);
    border-radius: 8px; padding: 12px 14px; margin-bottom: 12px;
}
.conditions-box ul { margin: 0; padding-left: 20px; }
.conditions-box li { margin: 6px 0; }

.btn {
    display: inline-block; background: var(--rouge); color: var(--blanc);
    border: none; border-radius: 8px; padding: 12px 22px; font-size: 1rem;
    font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #8e0400; }
.btn-secondary { background: var(--noir); }
.btn-secondary:hover { background: #333; }
.btn-small { padding: 6px 12px; font-size: .85rem; font-weight: 600; }
.btn-ghost { background: transparent; color: var(--rouge); border: 1px solid var(--rouge); }
.btn-ghost:hover { background: var(--rouge-fond); }

/* Pot de miel : hors écran */
.hp-field { position: absolute; left: -9999px; top: -9999px; }

/* ---- Tableaux ---- */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--blanc); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--bord); font-size: .92rem; }
th { background: var(--noir); color: var(--or); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #faf7f0; }
td.num, th.num { text-align: center; }

.ok   { background: var(--vert-fond) !important; color: var(--vert); font-weight: 700; }
.bad  { background: var(--rouge-fond) !important; color: var(--rouge); font-weight: 700; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge-ok   { background: var(--vert-fond); color: var(--vert); }
.badge-wait { background: #f4ead2; color: #8a6d1d; }
.badge-apr  { background: #dbe9f7; color: #1a4e8a; }   /* porteur d'appareil respiratoire */
.badge-pn10 { background: #e7ddf3; color: #5b3a8e; }   /* cours ECA PN10-REGA suivi */
.badge-dps  { background: var(--vert-fond); color: var(--vert); }  /* membre DPS (vert) */
.badge-dap  { background: #f8e3cd; color: #a3591a; }   /* membre DAP (orange) */
.badge-autre { background: #e4e7ec; color: #47546b; }  /* autre org. (Samaritains, police, …) */
.badge-opt  { background: #efe9f8; color: #5b3a8e; font-size: .7rem; }  /* besoin optionnel (souhaité) */
.badge-bls  { background: #d9efe9; color: #0e6e5c; }   /* cours BLS-AED suivi et à jour */

/* Remarque sous un créneau sur le formulaire d'inscription. */
.slot-remark { display: block; width: 100%; font-size: .82rem; color: #6b6257; margin-top: 2px; }

/* Liste bénévoles condensée : infos empilées dans chaque cellule. */
.table-stack td { vertical-align: top; }
.cell-sub { font-size: .8rem; color: #6b6257; margin-top: 1px; }

/* Créneau complet sur l'inscription : grisé, non sélectionnable. */
.slot-complet { opacity: .55; cursor: not-allowed; }
.badge-complet { background: var(--rouge-fond); color: var(--rouge); }

/* Matrice des présences : case verte = disponible. */
.matrix td.cell-on { background: var(--vert-fond); color: var(--vert); font-weight: 700; }
.matrix th small { font-weight: 400; opacity: .8; }
.matrix tfoot td { border-top: 2px solid var(--noir); }

/* ---- Pastilles créneaux (affectations) ---- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pills a {
    text-decoration: none; color: var(--texte); background: var(--blanc);
    border: 1px solid var(--bord); border-radius: 999px; padding: 6px 14px; font-size: .85rem;
}
.pills a.active { background: var(--noir); color: var(--or); border-color: var(--noir); font-weight: 600; }

/* ---- Token / lien de modification ---- */
.token-box {
    background: #fbf7ee; border: 2px dashed var(--or); border-radius: 8px;
    padding: 14px; word-break: break-all; font-family: ui-monospace, Consolas, monospace;
    font-size: .9rem;
}

/* ---- Résumé besoins (affectations) ---- */
.needs-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.needs-summary .chip {
    border: 1px solid var(--bord); border-radius: 8px; padding: 6px 10px;
    font-size: .82rem; background: var(--blanc);
}
.needs-summary .chip.full { border-color: var(--vert); background: var(--vert-fond); }
.needs-summary .chip.miss { border-color: var(--rouge); background: var(--rouge-fond); }

footer { background: var(--noir); color: #a89f8d; text-align: center; padding: 16px; font-size: .8rem; }
footer a { color: var(--or); }

/* ---- Impression (planning) ---- */
@media print {
    .topbar, footer, .no-print, .flash { display: none !important; }
    body { background: var(--blanc); font-size: 12px; }
    main.wrap { max-width: none; padding: 0; }
    .card { border: none; padding: 0; }
    h1::after { display: none; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; }
    h2 { page-break-after: avoid; }
}

/* =============================================================
 * Portail staff — accueil, espace bénévole, PWA, main courante
 * ============================================================= */

/* ---- Accueil : deux grands boutons (mobile-first) ---- */
.home-hero { max-width: 560px; margin: 24px auto 0; text-align: center; }
.home-hero h1::after { margin-left: auto; margin-right: auto; }
.home-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; }
.home-btn {
    display: block; text-decoration: none; text-align: center;
    background: var(--rouge); color: var(--blanc);
    border-radius: 12px; padding: 22px 18px;
    border: 2px solid var(--rouge);
}
.home-btn:hover { background: #8e0400; border-color: #8e0400; }
.home-btn-alt { background: var(--noir); border-color: var(--noir); }
.home-btn-alt:hover { background: #2b2b2b; border-color: #2b2b2b; }
.home-btn-title { display: block; font-size: 1.3rem; font-weight: 800; letter-spacing: .03em; }
.home-btn-sub { display: block; margin-top: 4px; font-size: .88rem; color: var(--or); }

/* ---- Espace bénévole : onglets + cartes ---- */
.espace-nav {
    display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 6px; margin-bottom: 18px;
}
.espace-nav a {
    flex: 0 0 auto; text-decoration: none; color: var(--texte);
    background: var(--blanc); border: 1px solid var(--bord);
    border-radius: 999px; padding: 7px 14px; font-size: .88rem; white-space: nowrap;
}
.espace-nav a.active { background: var(--noir); color: var(--or); border-color: var(--noir); font-weight: 600; }

.espace-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .espace-cards { grid-template-columns: 1fr; } }
.espace-card {
    display: block; text-decoration: none; color: var(--texte);
    background: var(--blanc); border: 1px solid var(--bord); border-left: 4px solid var(--rouge);
    border-radius: 10px; padding: 18px 16px;
}
.espace-card:hover { border-color: var(--rouge); background: #fdf9f2; }
.espace-card-title { display: block; font-weight: 800; font-size: 1.05rem; }
.espace-card-sub { display: block; color: var(--gris); font-size: .85rem; margin-top: 4px; }

/* ---- Documents (fiches / plans) ---- */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-item {
    display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--texte);
    background: var(--blanc); border: 1px solid var(--bord); border-radius: 10px; padding: 14px;
}
.doc-item:hover { border-color: var(--rouge); }
.doc-icon {
    flex: 0 0 auto; background: var(--rouge); color: var(--blanc); font-weight: 800;
    font-size: .72rem; border-radius: 6px; padding: 8px 7px; letter-spacing: .05em;
}
.doc-label { font-weight: 600; }
.doc-size { margin-left: auto; color: var(--gris); font-size: .82rem; white-space: nowrap; }

/* ---- Main courante ---- */
.mc-entry { padding: 12px 14px; margin-bottom: 10px; }
.mc-meta { font-size: .85rem; color: var(--gris); margin-bottom: 4px; }
.mc-text { white-space: pre-wrap; }
.mc-pending-entry { border-left: 4px solid #c9a227; background: #fdf8ec; }
.badge-sync { background: #dbe9f7; color: #1a4e8a; }

/* ---- Numéros essentiels ---- */
.tel-big { font-weight: 800; font-size: 1.05rem; color: var(--rouge); text-decoration: none; }

/* ---- Bandeau mot de passe (affiché une fois) ---- */
.pw-banner {
    background: #fdf6e3; border: 2px solid var(--or); border-left: 6px solid var(--rouge);
    border-radius: 10px; padding: 14px 16px; margin-bottom: 18px;
}
.pw-code {
    font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem; font-weight: 800;
    background: var(--noir); color: var(--or); border-radius: 6px; padding: 3px 10px;
}
.pw-note { color: var(--gris); font-size: .88rem; }

/* ---- Bandeau hors ligne (PWA) ---- */
#offline-banner {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    background: var(--noir); color: var(--or); text-align: center;
    font-size: .85rem; padding: 8px 12px; border-top: 2px solid var(--or);
    transform: translateY(100%); transition: transform .25s ease;
}
#offline-banner.visible { transform: translateY(0); }
