/* Tableau de bord graphique */
:root {
    --primary: #17365d; --primary-light: #315f91;
    --header-desktop-height: 82px;
    --brand-red: #9b2530;
    --success: #187548; --danger: #b42332; --warning: #a45a12;
    --bg: #f4f5f7; --card: #ffffff; --text: #202833; --text-light: #596575; --border: #e1e5eb;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; flex: none; }
.ico-lg { width: 1.3em; height: 1.3em; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }

/* Connexion */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; min-height: 100dvh; padding: 20px; background: linear-gradient(135deg, var(--brand-red), var(--primary)); }
.auth-container[hidden] { display: none; }
.startup-message { color:#fff; font-size:16px; font-weight:600; }
.auth-card { background: var(--card); padding: 30px; border-radius: 12px; width: 100%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,.2); }
.auth-card h2 { text-align: center; margin-bottom: 6px; color: var(--primary); }
.auth-sub { text-align: center; margin-bottom: 20px; color: var(--text-light); font-size: 14px; }
.app-copyright { margin-top: 20px; color: var(--text-light); font-size: 13px; text-align: center; }
.login-password-field { display: flex; gap: 8px; }
.login-password-field input { flex: 1; min-width: 0; }
.login-password-field .btn { flex: none; width: auto; }
.login-password-field input::-ms-reveal { display: none; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px; }
.form-group input[type=text], .form-group input[type=email], .form-group input[type=password], .form-group input[type=tel],
.form-group input[type=search], .form-group input[type=number], .form-group input[type=date], .form-group input[type=time], .form-group input[type=datetime-local], select {
    width: 100%; padding: 12px 10px; border: 1px solid #9ca3af; border-radius: 6px; font-size: 16px; min-height: 44px; background: #fff; color: var(--text); }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 400 !important; min-height: 44px; }
.check input { width: 22px; height: 22px; flex: none; }
.error-msg { color: var(--danger); font-size: 14px; margin-bottom: 10px; min-height: 18px; }

.btn { width: 100%; padding: 12px; min-height: 44px; border: none; border-radius: 6px; font-size: 16px; font-weight: 600; cursor: pointer; transition: opacity .2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:disabled { opacity: .5; cursor: wait; }
.btn:hover { opacity: .92; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: var(--border); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 14px; width: auto; }

/* Structure */
.app-container { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
header { background: var(--brand-red); color: #fff; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(16px + env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,.15); z-index: 10; }
body[data-role=coach] #app-screen > header { background: var(--primary); }
header h1 { font-size: 18px; }
.header-identity { min-width:0; }
#connected-role { color:#fff;font-size:13px;font-weight:600;margin:4px 0 0; overflow-wrap:anywhere; }
#connected-date { color:#fff;font-size:12px;margin:3px 0 0; }
.header-actions { flex-shrink:0; }
.header-actions { display: flex; gap: 4px; }
.icon-btn { background: none; border: none; color: #fff; min-width: 44px; min-height: 44px; font-size: 20px; cursor: pointer; border-radius: 8px; }
.icon-btn:active { background: rgba(255,255,255,.15); }
#notifications-bureau-btn { position:relative; }
#notifications-bureau-compteur { position:absolute; top:1px; right:0; min-width:17px; padding:2px 4px; border-radius:12px; background:#fff; color:var(--brand-red); font-size:11px; font-weight:700; }
.notifications-liste { list-style:none; }
.notification-item { padding:12px 0; border-bottom:1px solid var(--border); }
.notification-item:last-child { border-bottom:0; }
.notification-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.main-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.view-title { font-size: 20px; margin-bottom: 14px; }
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.view-head .view-title { margin-bottom: 0; }
.hint { font-size: 13px; color: var(--text-light); margin-top: 8px; line-height: 1.5; }

nav.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 6px 0; padding-bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
nav.bottom-nav button { background: none; border: none; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-light); font-size: 11px; cursor: pointer; gap: 3px; flex: 1; min-height: 48px; }
nav.bottom-nav button .ico { font-size: 22px; }
nav.bottom-nav button.active { color: var(--primary); font-weight: 700; }
.nav-aide-icone { width:22px; height:22px; border:2px solid currentColor; border-radius:50%; display:grid; place-items:center; font-size:14px; font-weight:700; line-height:1; }

.view { display: none; }
.view.active { display: block; }
body[data-role=coach] .admin-only { display: none !important; }

.banner { background: #fef3c7; color: #78350f; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
#vue-entraineur-bandeau { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }

/* Cartes */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); padding: 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1); text-align: center; }
.stat-card h3 { font-size: 26px; color: var(--primary); margin-bottom: 4px; }
.stat-card p { font-size: 12px; color: var(--text-light); text-transform: uppercase; }
.card { background: var(--card); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1); margin-bottom: 16px; overflow: hidden; }
.card-header { padding: 14px 15px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-body { padding: 4px 15px 8px; }
.card-body:has(> select) { padding: 15px; }
.empty { padding: 14px 0; color: var(--text-light); font-size: 14px; }

.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item-info { min-width: 0; flex: 1; }
.list-item-info h4 { font-size: 15px; margin-bottom: 3px; overflow-wrap: anywhere; }
.list-item-info p { font-size: 13px; color: var(--text-light); line-height: 1.5; overflow-wrap: anywhere; }
.list-item-info a { color: var(--primary); text-decoration: none; }
.item-actions { display: flex; gap: 6px; flex: none; }
.item-actions .btn { min-width: 44px; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; vertical-align: middle; }
.badge-ok { background: #dcfce7; color: var(--success); }
.badge-ko { background: #fee2e2; color: var(--danger); }
.badge-warn { background: #fef3c7; color: var(--warning); }
.badge-contact { background: #1d4ed8; color: #fff; }
.dashboard-filters,.dashboard-cards { display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin-bottom:16px; }
.dashboard-filters input { width:100%;min-height:44px;font:inherit;padding:8px;box-sizing:border-box; }
.dashboard-cards button { min-height:90px;background:var(--card);color:var(--text);border:1px solid var(--border);border-radius:10px;padding:14px;text-align:left;cursor:pointer;font:inherit; }
.dashboard-cards strong { display:block;font-size:26px; }
#dashboard-detail { padding:16px; }
@media(max-width:480px) { .dashboard-cards,.dashboard-filters { grid-template-columns:1fr; } }
.badge-grey { background: var(--border); color: var(--text-light); }

/* Pointage */
.attendance-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.attendance-item:last-child { border-bottom: none; }
.attendance-item h4 { font-size: 15px; overflow-wrap: anywhere; }
.attendance-actions { display: flex; gap: 8px; flex: none; }
.att-btn { min-width:84px; min-height:44px; border-radius:7px; border:2px solid transparent; padding:0 8px; display:flex; align-items:center; justify-content:center; gap:6px; cursor:pointer; font-size:14px; font-weight:650; }
.att-btn.present { color:#14643c; background:#edf8f1; border-color:#8bbfa1; }
.att-btn.absent { color:#92202d; background:#fff0f1; border-color:#d8a3a8; }
.att-btn.present.selected { color:#fff; background:var(--success); border-color:var(--success); }
.att-btn.absent.selected { color:#fff; background:var(--danger); border-color:var(--danger); }
.att-summary { padding: 12px 15px; font-size: 13px; color: var(--text-light); background: #f9fafb; border-top: 1px solid var(--border); }
.btn-sticky { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); box-shadow: 0 4px 12px rgba(0,0,0,.25); }

/* Fenêtres */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; justify-content: center; align-items: flex-end; z-index: 100; padding: 0; }
.modal { background: var(--card); border-radius: 14px 14px 0 0; width: 100%; max-width: 520px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
.modal-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--card); }
.modal-header h3 { font-size: 17px; }
.modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.modal-footer .btn { flex: 1; width: auto; }
.modal-footer .btn-danger { flex: none; }
@media (min-width: 768px) { .modal-overlay { align-items: center; padding: 20px; } .modal { border-radius: 10px; } }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #111827; color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 14px; max-width: 90vw; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--success); }

/* Grand écran */
@media (min-width: 768px) {
    .app-container { flex-direction: row; }
    header { position: fixed; top: 0; left: 0; right: 0; height: var(--header-desktop-height); padding-top: 10px; }
    #connected-role { white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
    nav.bottom-nav { top: var(--header-desktop-height); bottom: auto; left: 0; width: 240px; height: calc(100vh - var(--header-desktop-height)); flex-direction: column; justify-content: flex-start; padding: 16px 0; border-top: none; border-right: 1px solid var(--border); }
    nav.bottom-nav button { flex: none; flex-direction: row; gap: 14px; padding: 0 22px; font-size: 15px; width: 100%; justify-content: flex-start; min-height: 52px; }
    .main-content { margin-left: 240px; margin-top: var(--header-desktop-height); padding: 28px; padding-bottom: 40px; max-width: 980px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .btn-sticky { bottom: 16px; }
    .toast { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Présences AJES v2 — identité sobre inspirée du site du club */
.view-title { color: var(--primary); }
.stat-card { border-top: 3px solid var(--brand-red); }
.version-label { display:inline-block; margin:8px 0 0; color:var(--text-light); font-size:11px; }
.season-filter { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 14px; padding:10px 12px; background:var(--card); border:1px solid var(--border); border-radius:10px; }
.season-filter label { font-size:13px; font-weight:600; }
.season-filter select { flex:1; min-width:150px; min-height:44px; }
/* Tableau de bord : valeurs et libellés accessibles sans couleur. */
#dashboard-cards { display:block; }
.dash-section { margin:22px 0; }
.dash-section h3 { color:var(--primary); font-size:19px; margin-bottom:12px; }
.dash-section .hint { margin:10px 0; line-height:1.5; }
.dash-summary,.dash-priorities,.dash-frequentation { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.dash-navy { --dash-color:var(--primary); --dash-tint:#edf2f8; }
.dash-blue { --dash-color:#225fa5; --dash-tint:#edf5ff; }
.dash-amber { --dash-color:#93500e; --dash-tint:#fff6e6; }
.dash-green { --dash-color:#187548; --dash-tint:#edf8f1; }
.dash-red { --dash-color:#b42332; --dash-tint:#fff0f1; }
#dashboard-cards .dash-tile { display:flex; flex-direction:column; gap:8px; border-top:4px solid var(--dash-color); background:var(--dash-tint); padding:18px; }
#dashboard-cards .dash-tile strong { font-size:36px; line-height:1.1; color:var(--dash-color); }
.dash-tile small { color:var(--text-light); margin-top:auto; }
.dash-frequentation .dash-tile { border-radius:12px; }
.dash-course-bars,.dash-admin-group { padding:16px; border:1px solid var(--border); background:white; border-radius:12px; }
.dash-admin { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.dash-admin-group h4 { margin-bottom:10px; color:var(--primary); }
#dashboard-cards .dash-bar { display:block; width:100%; min-height:64px; padding:10px 0; border:0; border-radius:4px; background:transparent; }
.dash-bar-label { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:9px; font-size:14px; }
.dash-bar-label span { overflow-wrap:anywhere; }
.dash-bar-label b { color:var(--dash-color); font-size:21px; flex-shrink:0; }
.dash-track { display:block; height:10px; border-radius:10px; background:#e9edf2; overflow:hidden; }
.dash-track > span { display:block; height:100%; border-radius:10px; background:var(--dash-color); }
#dashboard-cards button:hover { box-shadow:0 0 0 2px var(--dash-color); }
.dash-notice { margin-top:12px; padding:14px; border-left:4px solid #225fa5; background:#edf5ff; line-height:1.5; }
#dashboard-filters { padding:16px; border:1px solid var(--border); background:white; border-radius:12px; align-items:end; }
#dashboard-filters label { font-size:14px; font-weight:600; }
#dashboard-filters select,#dashboard-filters input { margin-top:6px; }
.dashboard-filter-indicator { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; margin:0 0 12px; padding:12px; border:1px solid #d29849; border-left:5px solid #a45a12; border-radius:8px; background:#fff6e6; color:#703d0b; }
.dashboard-filter-indicator > div { min-width:0; }
.dashboard-filter-indicator .btn { background:#fff; color:#703d0b; border:1px solid #a45a12; }
.dashboard-filter-values { list-style:none; display:flex; flex-wrap:wrap; gap:6px; margin-top:7px; }
.dashboard-filter-values li { padding:4px 9px; border-radius:12px; background:#fce6bc; font-size:13px; overflow-wrap:anywhere; }
#dashboard-filters .dash-filtre-actif { border-color:#a45a12; background:#fff6e6; }
#dashboard-detail { scroll-margin-top:80px; border:2px solid var(--primary); }
#dashboard-detail h3 { margin-bottom:14px; }
@media(min-width:1200px) { .dash-summary { grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media(max-width:700px) { .dash-admin { grid-template-columns:1fr; } }
@media(max-width:480px) { .dash-summary,.dash-priorities,.dash-frequentation { grid-template-columns:1fr; } #dashboard-cards .dash-tile { padding:14px; } }

/* Repères temporels des séances, avec libellés indépendants des couleurs. */
.list-item.seance-ongoing,.list-item.seance-upcoming,.list-item.seance-today { margin:8px 0; padding:14px 12px; border-radius:8px; border-left:5px solid; }
.list-item.seance-ongoing { background:#edf8f1; border-left-color:#187548; }
.list-item.seance-upcoming { background:#edf5ff; border-left-color:#225fa5; }
.list-item.seance-today { background:#fff6e6; border-left-color:#93500e; }
.badge-presences { margin:5px 0; padding:6px 10px; background:#edf2f8; color:#17365d; font-size:13px; border:1px solid #cbd8e8; }

.import-liste { margin: 12px 0; padding-left: 22px; }
.import-liste li { margin: 6px 0; overflow-wrap: anywhere; }
#import-fichier,#import-saisonnier-fichier { max-width:100%; padding:8px 0; }

body:not([data-role=coach]) .coach-only { display:none; }
.seance-filtres,.fiche-grille { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.seance-filtres { padding:12px; margin-bottom:12px; background:var(--card); border:1px solid var(--border); border-radius:8px; }
.favoris-raccourcis { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.seance-filtres label { display:grid; gap:6px; font-weight:600; font-size:14px; }
.fiche-grille { row-gap:0; }
.fiche-section { border:1px solid var(--border); border-radius:8px; margin:10px 0; }
.fiche-section summary { padding:13px; min-height:44px; cursor:pointer; color:var(--primary); font-weight:600; overflow-wrap:anywhere; }
.fiche-section summary span { display:block; margin:4px 0 0 16px; color:var(--text-light); font-size:13px; font-weight:500; }
.fiche-section-corps { padding:12px; border-top:1px solid var(--border); }
.fiche-resume { padding:12px; border-radius:8px; background:#edf2f8; }
.fiche-resume ul,.presence-historique { padding-left:20px; margin-top:8px; }
.fiche-resume li { margin:4px 0; font-size:14px; }
.fiche-groupe { padding:12px; border:1px solid var(--border); border-radius:8px; margin:10px 0; min-width:0; }
.fiche-groupe legend,.fiche-titre { font-weight:700; color:var(--primary); }
.fiche-inscriptions { padding-left:20px; margin:8px 0; }
.fiche-inscriptions li { margin:5px 0; }
#dossier-modifier-inscriptions { margin-top:8px; }
.fiche-groupe legend { padding:0 6px; overflow-wrap:anywhere; }
.fiche-titre { margin-top:16px; }
.inscription-toggle { width:22px; height:22px; vertical-align:middle; accent-color:var(--primary); }
.inscription-label { display:inline-flex; align-items:center; min-height:44px; vertical-align:middle; cursor:pointer; margin-left:6px; }
.inscription-toggle:not(:checked) ~ .inscription-champs { display:none; }
.inscription-champs { padding:10px 0 0; margin:4px 0 0; border-top:1px solid var(--border); }
.inscription-creneaux { border:none; min-width:0; }
.inscription-creneaux legend { padding:0; font-size:14px; }
.inscription-creneaux .check { padding:5px 0; }
.fiche-section-corps .form-group:last-child,.fiche-groupe .form-group:last-child { margin-bottom:0; }
.modal-header,.modal-footer { z-index:1; }
.modal-footer { position:sticky; bottom:0; background:var(--card); }
button.badge-presences { cursor:pointer; text-align:left; min-height:44px; }
button.badge-presences:hover { background:#dae7f8; }
.presence-historique li { margin:8px 0; padding:6px 0; }
.presence-historique li span { display:block; color:var(--text-light); font-size:14px; }
#pointage-ajout-essai { margin:14px 0 0; }
.guide-titre,.guide-entraineur > summary { color:var(--primary); font-size:18px; font-weight:700; margin-bottom:12px; }
.guide-entraineur { margin-top:16px; }
.guide-entraineur > summary { padding:10px 0; min-height:44px; cursor:pointer; }
.guide-entraineur > summary h3 { display:inline; font:inherit; }
.guide-cartes { display:grid; gap:12px; align-items:start; }
.guide-carte { margin-bottom:0; }
.guide-carte .card-header { font-size:16px; color:var(--primary); }
.guide-carte .card-body { padding:12px 15px; line-height:1.55; }
.guide-carte p + p,.guide-carte ol + p,.guide-carte .btn { margin-top:10px; }
.guide-carte ol { padding-left:23px; }
.guide-carte li + li { margin-top:7px; }
@media(min-width:1100px) { .guide-cartes { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:420px) {
    .seance-filtres,.fiche-grille { grid-template-columns:minmax(0,1fr); }
    .attendance-item { display:block; }
    .attendance-actions { margin-top:6px; }
    .attendance-actions .att-btn { flex:1; }
    .modal-footer { flex-wrap:wrap; }
}
