:root {
  --primary: #004aad;
  --primary-dark: #00285e;
  --ink: #14202b;
  --muted: #5d6b75;
  --bg: #f1f5fc;
  --line: #dbe3f0;
  --danger: #b42318;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); display: flex; min-height: 100vh; line-height: 1.5; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 20px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

.sidebar { width: 250px; background: var(--primary-dark); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 18px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand img { background: #fff; border-radius: 50%; padding: 2px; }
.side-brand small { display: block; font-weight: 400; font-size: .75rem; color: #9fbcf0; }
.sidebar nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar nav a { color: #dbe6fb; text-decoration: none; padding: 9px 12px; border-radius: 8px; display: flex; gap: 10px; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); }
.sidebar nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 6px; font-size: .88rem; }
.side-foot a { color: #9fbcf0; text-decoration: none; }
.content { flex: 1; padding: 28px 32px; min-width: 0; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; }
.alert-ok { background: #e3f4e8; color: #17603a; border: 1px solid #b9e2c6; }
.alert-err { background: #fde8e6; color: var(--danger); border: 1px solid #f5c2bd; }

.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; font: inherit; font-weight: 600; font-size: .9rem; }
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #f0c4bf; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-block { width: 100%; }

.form label { display: grid; gap: 5px; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
.form small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0,74,173,.25); border-color: var(--primary); }
input[type=checkbox] { width: auto; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 18px; }
.score-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form label { display: grid; gap: 4px; font-weight: 600; font-size: .85rem; }
.inline-form label.check { display: flex; align-items: center; gap: 6px; padding-bottom: 10px; }
.input-sm { width: 80px; }
.photo-field { display: flex; gap: 18px; align-items: center; margin-bottom: 14px; }
.photo-field img { border-radius: 12px; object-fit: cover; }
.cover-preview { max-width: 220px; border-radius: 8px; margin-top: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.inactive td { opacity: .55; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.thumb { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; display: block; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: #eceff3; color: var(--muted); font-weight: 600; }
.tag-ok { background: #dce8fb; color: var(--primary); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: var(--radius); padding: 18px; text-decoration: none; color: inherit; }
.stat strong { display: block; font-size: 1.8rem; color: var(--primary); }
.stat span { color: var(--muted); font-size: .9rem; }
.grid-2-admin { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 20px; }

.admin-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.admin-media { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; }
.admin-media .form { display: grid; gap: 6px; }
.admin-media input, .admin-media select { padding: 6px 8px; font-size: .85rem; }
.media-item { position: relative; display: block; border-radius: 8px; overflow: hidden; background: #000; aspect-ratio: 4/3; }
.media-item img, .media-item video, .media-item iframe { width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
.media-caption { display: none; }

.table-scroll { overflow-x: auto; }
.cotis-table th, .cotis-table td { text-align: center; padding: 6px; }
.cotis-table th:first-child, .cotis-table td:first-child { text-align: left; }
.cotis-table th.current { color: var(--primary); }
.cell { width: 46px; }
.cell-btn { width: 34px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; }
.cell.paid .cell-btn, .legend .cell.paid { background: var(--primary); color: #fff; border-color: var(--primary); }
.cell.late .cell-btn, .legend .cell.late { background: #fde8e6; color: var(--danger); border-color: #f5c2bd; }
.cell.current .cell-btn { outline: 2px solid rgba(0,74,173,.35); }
.legend { margin: 14px 0 0; color: var(--muted); font-size: .85rem; display: flex; gap: 8px; align-items: center; }
.legend .cell { display: inline-grid; place-items: center; width: 24px; height: 22px; border-radius: 5px; border: 1px solid var(--line); margin-left: 8px; font-weight: 700; }
.year-nav { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.dialog { border: 0; border-radius: var(--radius); padding: 24px; width: min(420px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(0,20,50,.5); }

.login-page { align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.login-box { background: #fff; padding: 32px; border-radius: 16px; width: min(380px, 92vw); display: grid; gap: 14px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-box img { margin: 0 auto; }
.login-box h1 { margin: 0; }
.login-box p { margin: -10px 0 0; }
.login-box label { display: grid; gap: 5px; text-align: left; font-weight: 600; font-size: .9rem; }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 20px 16px; }
}

/* Saisie des statistiques */
.who { display: flex; align-items: center; gap: 10px; }
.stats-input th, .stats-input td { text-align: center; }
.stats-input th:first-child, .stats-input td:first-child { text-align: left; }
.input-num { width: 70px; text-align: center; padding: 6px; }
.stats-input input[type=checkbox] { width: 18px; height: 18px; }
