/* AFES — charte tricolore (bleu / blanc / rouge) */
:root {
  --navy: #0b2a5b; --navy-2: #12397a; --royal: #0055a4; --royal-soft: #e6eefa;
  --red: #d7263d; --red-dark: #b01b2e; --red-soft: #fdecee;
  --ink: #17233b; --muted: #66728a; --line: #dfe5f0; --bg: #f4f6fb; --card: #ffffff;
  --ok: #1f8a5b; --ok-soft: #e3f5ec; --warn: #b7791f; --warn-soft: #fdf3dc;
  --radius: 12px; --shadow: 0 1px 2px rgba(11,42,91,.06), 0 4px 16px rgba(11,42,91,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--royal); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; color: var(--navy); }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .right { text-align: right; }
.ico { flex: none; vertical-align: -3px; }
.tricolor { height: 5px; background: linear-gradient(90deg, var(--navy) 0 33.3%, #fff 33.3% 66.6%, var(--red) 66.6% 100%); border-bottom: 1px solid var(--line); position: relative; z-index: 30; }

/* ---- Structure ---- */
.shell { display: flex; min-height: calc(100vh - 5px); }
.sidebar { width: 262px; flex: none; background: linear-gradient(180deg, var(--navy) 0%, #08204a 100%); color: #cfdaf2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; margin: 16px 16px 8px; background: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.brand img { width: 100%; display: block; }
.sidebar nav { padding: 6px 10px 12px; flex: 1; }
.nav-title { text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; color: #8ea3cf; margin: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #dbe5fa; border-left: 3px solid transparent; margin-bottom: 2px; }
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(255,255,255,.14); color: #fff; border-left-color: var(--red); font-weight: 600; }
.side-user { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.12); }
.side-user .who { display: flex; flex-direction: column; min-width: 0; } .side-user strong { color: #fff; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .side-user small { color: #9fb2da; font-size: .74rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .page-title { margin: 0; font-size: 1.3rem; flex: 1; }
.top-actions { display: flex; gap: 8px; align-items: center; } .top-actions form { margin: 0; }
.content { padding: 24px 28px 32px; flex: 1; width: 100%; max-width: 1480px; }
#menuToggle { display: none; }
.app-footer { padding: 14px 28px; text-align: center; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); background: #fff; word-break: break-word; }
.app-footer a { color: var(--royal); }

/* ---- Cartes & grilles ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.narrow { max-width: 560px; margin-inline: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; } .card-head h2 { margin: 0; }
.grid { display: grid; gap: 20px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: 2fr 1fr; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--royal); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi.red { border-top-color: var(--red); } .kpi.navy { border-top-color: var(--navy); } .kpi.green { border-top-color: var(--ok); } .kpi.amber { border-top-color: #e0a526; }
.kpi .lbl { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.kpi .val { font-size: 1.65rem; font-weight: 700; color: var(--navy); margin-top: 4px; } .kpi.red .val { color: var(--red-dark); }
.kpi .sub { color: var(--muted); font-size: .82rem; }
.chart-box { position: relative; height: 290px; } .chart-box.sm { height: 250px; }

/* ---- Boutons ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; line-height: 1.2; transition: .15s; }
.btn-primary { background: var(--royal); color: #fff; } .btn-primary:hover { background: var(--navy-2); }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover { background: var(--red-dark); }
.btn-outline { background: #fff; color: var(--navy); border-color: #c4cfe3; } .btn-outline:hover { background: var(--royal-soft); }
.btn-outline-danger { background: #fff; color: var(--red-dark); border-color: #f0b6bf; } .btn-outline-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; color: var(--navy); } .btn-ghost:hover { background: var(--royal-soft); }
.btn-sm { padding: 6px 11px; font-size: .85rem; } .btn-block { width: 100%; justify-content: center; padding: 11px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--navy); padding: 4px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .btn-row form { margin: 0; }

/* ---- Formulaires ---- */
.field { display: block; margin-bottom: 14px; } .field > span { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 5px; color: var(--navy); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #c4cfe3; border-radius: 9px; font: inherit; color: var(--ink); background: #fff; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0,85,164,.35); border-color: var(--royal); }
input[type=file] { font: inherit; max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
.span2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; } .check input { width: 17px; height: 17px; accent-color: var(--royal); }
.help { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.error-list { margin: 0 0 14px; padding: 12px 16px 12px 32px; background: var(--red-soft); border: 1px solid #f3b9c1; border-radius: 10px; color: var(--red-dark); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; flex: 1 1 150px; } .filters .field.grow { flex: 2 1 240px; }

/* ---- Alertes ---- */
.alert { position: relative; padding: 12px 40px 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--ok-soft); border-color: #a6dcc3; color: #145c3c; }
.alert-danger, .alert-error { background: var(--red-soft); border-color: #f3b9c1; color: var(--red-dark); }
.alert-warning { background: var(--warn-soft); border-color: #efd28f; color: #7a5210; }
.alert-info { background: var(--royal-soft); border-color: #b5cdee; color: var(--navy); }
.alert-x { position: absolute; right: 10px; top: 8px; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: inherit; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th { background: #eef3fb; color: var(--navy); text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #edf0f7; vertical-align: middle; } .tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f8faff; } .tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr.row-danger td { background: var(--red-soft); } .tbl tfoot td { font-weight: 700; background: #f4f7fd; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.cell-person { display: flex; align-items: center; gap: 10px; } .cell-person small { color: var(--muted); display: block; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: #145c3c; } .badge-danger { background: var(--red-soft); color: var(--red-dark); }
.badge-info { background: var(--royal-soft); color: var(--navy-2); } .badge-muted { background: #eceff5; color: #55627a; } .badge-warn { background: var(--warn-soft); color: #7a5210; }

/* ---- Avatars & photos ---- */
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--royal-soft); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; } .avatar.sm { width: 34px; height: 34px; font-size: .8rem; background: #fff; }
.avatar.xl { width: 120px; height: 120px; font-size: 2.2rem; border-width: 4px; }

/* ---- Pagination ---- */
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; flex-wrap: wrap; gap: 8px; } .pager-info { color: var(--muted); font-size: .85rem; margin-top: 10px; } .pager .pager-info { margin: 0; }
.pager-links { display: flex; gap: 4px; } .pg { min-width: 34px; text-align: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy); text-decoration: none !important; }
a.pg:hover { background: var(--royal-soft); } .pg.active { background: var(--royal); color: #fff; border-color: var(--royal); } .pg.disabled { color: #aab4c8; }

/* ---- Fiche adhérent ---- */
.profile-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.profile-head .info { flex: 1; min-width: 240px; } .profile-head h2 { font-size: 1.5rem; margin-bottom: 4px; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; margin: 0; } .dl dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; } .dl dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.note-box { background: #f8faff; border: 1px solid var(--line); border-left: 4px solid var(--royal); border-radius: 8px; padding: 10px 14px; white-space: pre-wrap; } .note-box.red { border-left-color: var(--red); }
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fam-item { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fbfcff; }

/* ---- Lignes dynamiques ---- */
.dyn-row { border: 1px dashed #b8c6e2; border-radius: 10px; padding: 12px 14px 4px; margin-bottom: 12px; background: #fbfcff; position: relative; }
.dyn-row .rm { position: absolute; right: 8px; top: 8px; }
.dyn-row .form-grid { padding-right: 36px; }
.thumb { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.photo-field { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* ---- Divers ---- */
.progress { height: 8px; background: #e6ebf5; border-radius: 99px; overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--royal); } .progress.ok > i { background: var(--ok); } .progress.late > i { background: var(--red); }
.big-code { font-size: 4rem; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 8px; } .big-code.danger { color: var(--red); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; } .tabs a { padding: 8px 14px; border-radius: 9px; background: #fff; border: 1px solid var(--line); color: var(--navy); } .tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); text-decoration: none; }
.perm-grid th:first-child, .perm-grid td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; font-weight: 600; }
.perm-grid td.c { text-align: center; } .perm-grid input { width: 18px; height: 18px; accent-color: var(--royal); }
.specifics { display: flex; flex-wrap: wrap; gap: 6px 16px; }
dialog { border: 0; border-radius: 14px; padding: 24px; box-shadow: 0 20px 60px rgba(11,42,91,.35); max-width: 480px; width: calc(100% - 32px); } dialog::backdrop { background: rgba(8,32,74,.55); }

/* ---- Connexion / pages simples ---- */
body.plain { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1200px 500px at 50% -10%, #dbe6fa 0, var(--bg) 60%); }
.plain-wrap { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 32px 18px; }
.login-card { max-width: 420px; margin: 4vh auto 0; background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: 0 10px 40px rgba(11,42,91,.15); border-top: 5px solid var(--navy); }
.login-logo { display: block; width: 78%; margin: 0 auto 14px; } .login-card h1 { text-align: center; margin-bottom: 2px; } .login-card .muted { text-align: center; margin: 0 0 18px; }

/* ---- Reçu imprimable ---- */
.receipt { background: #fff; border: 2px solid var(--navy); border-radius: 6px; padding: 28px 32px; max-width: 760px; margin: 0 auto; }
.receipt header { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px double var(--red); padding-bottom: 14px; margin-bottom: 18px; gap: 16px; } .receipt header img { width: 210px; }
.receipt .big { font-size: 1.6rem; font-weight: 800; color: var(--navy); } .receipt table { width: 100%; border-collapse: collapse; } .receipt td { padding: 7px 4px; border-bottom: 1px solid #e6eaf3; } .receipt td:first-child { color: var(--muted); width: 38%; }
.sign { display: flex; justify-content: space-between; margin-top: 40px; color: var(--muted); font-size: .85rem; } .sign div { width: 44%; border-top: 1px solid #999; padding-top: 6px; text-align: center; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-main, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .sidebar { position: fixed; z-index: 40; left: -290px; transition: left .25s; box-shadow: 0 0 40px rgba(0,0,0,.35); } .sidebar.open { left: 0; }
  #menuToggle { display: inline-flex; } .content { padding: 16px; } .topbar { padding: 12px 16px; } .top-actions .btn-ghost { display: none; }
  .g2, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
}
@media print {
  .sidebar, .topbar, .no-print, .tricolor, .alert, .btn { display: none !important; } body { background: #fff; } .content { padding: 0; max-width: none; }
  .card, .receipt { box-shadow: none; } .app-footer { border: 0; font-size: .7rem; } .plain-wrap { padding: 0; }
}

/* Sélection en lot des adhérents (nouveau paiement) */
[hidden] { display: none !important; }
.bulk-list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 14px; }
.bulk-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
