/* SMH Basket — gestion des adhérents */
:root {
  --red: #d90429;
  --red-dark: #a8021f;
  --red-soft: #fdecef;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ok: #067647;
  --ok-soft: #dcfae6;
  --warn: #b54708;
  --warn-soft: #fef0c7;
  --ko: #b42318;
  --ko-soft: #fee4e2;
  --info: #175cd3;
  --info-soft: #d1e9ff;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--red-dark); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: .75rem 0; }
small, .muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }
.mt { margin-top: 1rem; }
.mb0 { margin-bottom: 0; }

/* --- structure --- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; height: 56px; padding: 0 1rem; background: var(--ink); color: #fff; }
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(217, 4, 41, .3); display: inline-block; }
.brand-dot.big { width: 36px; height: 36px; }
.season-badge { background: rgba(255,255,255,.12); padding: .15rem .55rem; border-radius: 99px; font-size: .85rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.user-link small { color: #b8bfcc; margin-left: .25rem; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
.shell { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 220px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); padding: .75rem .5rem; display: flex; flex-direction: column; }
@media (min-width: 901px) { .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; } }
.app-version { margin-top: auto; padding: 1rem .75rem .25rem; font-size: .75rem; color: var(--muted); }
.sidebar a { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; border-radius: 6px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
.sidebar a:hover { background: var(--bg); }
.sidebar a.active { background: var(--red-soft); color: var(--red-dark); font-weight: 600; }
.sidebar .ico { width: 1.3rem; text-align: center; }
.main { flex: 1; padding: 1.5rem; min-width: 0; }
@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .sidebar { position: fixed; top: 56px; left: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .user-link small, .season-badge { display: none; }
}
@media (max-width: 600px) {
  .topbar { gap: .5rem; padding: 0 .6rem; }
  .user-link, .assist-btn span { display: none; }
  .brand { font-size: .95rem; }
  .main { padding: 1rem; }
}

/* --- pages publiques --- */
body.public { background: linear-gradient(180deg, var(--ink) 0, var(--ink) 180px, var(--bg) 180px); min-height: 100vh; }
.public-wrap { max-width: 520px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.public-wrap.wide { max-width: 860px; }
.public-head { display: flex; align-items: center; gap: .75rem; color: #fff; margin-bottom: 1.25rem; }
.public-head small { color: #c7ccd6; }
.public-logo { height: 72px; width: auto; }
.brand-logo { height: 40px; width: auto; display: block; }
.public-foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 2rem; }

/* --- composants --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card > h2:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; align-items: start; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .5rem .9rem; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-danger { color: var(--ko); border-color: #fda29b; }
.btn-danger:hover { background: var(--ko-soft); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.3); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: .25rem .55rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: #abefc6; }
.alert-error { background: var(--ko-soft); color: var(--ko); border-color: #fecdca; }
.alert-warning { background: var(--warn-soft); color: var(--warn); border-color: #fedf89; }
.alert-info { background: var(--info-soft); color: var(--info); border-color: #b2ddff; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: #abefc6; }
.badge-ko { background: var(--ko-soft); color: var(--ko); border-color: #fecdca; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: #fedf89; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: #b2ddff; }
.badge-red { background: var(--red); color: #fff; border-color: var(--red); }

/* --- formulaires --- */
.form label, label.field { display: block; margin-bottom: .85rem; font-weight: 500; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=date], .form input[type=tel],
.form input[type=number], .form input[type=search], .form select, .form textarea,
input.input, select.input, textarea.input {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .65rem; border: 1px solid #d0d5dd; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
.form textarea { min-height: 80px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, .input:focus { outline: 2px solid rgba(217,4,41,.25); border-color: var(--red); }
.form .hint, .hint { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem .5rem; margin: 0 0 1.25rem; background: #fff; }
.form legend { font-weight: 700; padding: 0 .4rem; color: var(--red-dark); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.choices { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: .35rem 0 .85rem; }
.choices label, .check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin: 0; }
.check { margin-bottom: .6rem; }
.req::after { content: " *"; color: var(--red); }
.field-error { color: var(--ko); font-size: .85rem; font-weight: 500; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.reduc-line { border-top: 1px dashed var(--line); padding-top: .6rem; margin-top: .4rem; }
.price-box { background: var(--red-soft); border: 1px solid #fbc7d1; border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.price-box strong { font-size: 1.2rem; color: var(--red-dark); }

/* --- tableaux --- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .5rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #f9fafb; font-weight: 600; color: #475467; white-space: nowrap; position: sticky; top: 0; }
.table th a { color: inherit; text-decoration: none; }
.table tr:hover td { background: #fcfcfd; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; background: #f9fafb; }
.table .neg { color: var(--ko); font-weight: 600; }
.table .pos { color: var(--ok); }
.table select.quick { padding: .2rem .3rem; font-size: .85rem; border: 1px solid var(--line); border-radius: 4px; max-width: 170px; }
.table-compact td, .table-compact th { padding: .3rem .5rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters label { font-size: .85rem; font-weight: 500; color: #475467; }
.filters .input { margin-top: .2rem; min-width: 140px; padding: .4rem .5rem; }

/* --- tableau de bord --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.stat.red .value { color: var(--red-dark); }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--warn); }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--red); }
details > summary { cursor: pointer; list-style: none; display: inline-block; }
details > summary::-webkit-details-marker { display: none; }
select.saved { outline: 2px solid var(--ok); }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; word-break: break-all; }
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--red); }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--red-dark); border-color: var(--red); font-weight: 600; }
.pagination { display: flex; gap: .25rem; margin-top: 1rem; }
/* --- licence et trombinoscope --- */
.licence-thumb { display: block; max-width: 100%; max-height: 260px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: .5rem; }
.licence-upload { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.licence-upload .hint { flex-basis: 100%; }
.trombi-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .25rem 1rem; margin-top: .75rem; }
.trombi-pick-item { display: flex; gap: .6rem; align-items: center; padding: .55rem .4rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.trombi-pick-item input { width: 1.3rem; height: 1.3rem; flex-shrink: 0; }
.trombi { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.trombi-card { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; box-shadow: var(--shadow); break-inside: avoid; }
.trombi-card img { display: block; width: 100%; height: auto; border-radius: 4px; }
.trombi-card figcaption { padding: .4rem .2rem 0; font-size: .95rem; }
.trombi-missing { display: flex; align-items: center; justify-content: center; min-height: 160px; background: var(--warn-soft); color: var(--warn); border-radius: 4px; font-weight: 600; }
@media (max-width: 600px) { .trombi { grid-template-columns: 1fr; } }

@media print {
  .trombi { grid-template-columns: 1fr 1fr; gap: 4mm; }
  .trombi-card { box-shadow: none; padding: 2mm; }
  .page-head .actions { display: none; }
  .topbar, .sidebar, .filters, .actions, .btn { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}
