/* Caisse RCR — thème rouge, mobile first.
   Les styles de base ciblent le téléphone ; les media queries min-width enrichissent tablette et desktop. */

:root {
  --brand: #c8102e;
  --brand-dark: #9b0c23;
  --brand-soft: #fde8eb;
  --bg: #f6f4f4;
  --surface: #ffffff;
  --surface-2: #f3efef;
  --text: #1f1a1b;
  --muted: #6e6466;
  --border: #e6dfe0;
  --ok: #1e7f45;
  --ok-bg: #e1f3e8;
  --warn: #a35d00;
  --warn-bg: #fdf0d9;
  --bad: #b3261e;
  --bad-bg: #fbe1de;
  --virement: #2f6fd0;
  --liquide: #2f9e5b;
  --cheque: #8a56c9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 0, 10, .06), 0 4px 14px rgba(60, 0, 10, .05);
  --nav-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #e0233f;
    --brand-dark: #a8132b;
    --brand-soft: #3a161c;
    --bg: #141011;
    --surface: #1d1718;
    --surface-2: #272022;
    --text: #efe9ea;
    --muted: #a3979a;
    --border: #352c2e;
    --ok: #62cf8f;
    --ok-bg: #16351f;
    --warn: #f0b354;
    --warn-bg: #3a2b12;
    --bad: #ff8a80;
    --bad-bg: #44201d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; line-height: 1.2; }
h1 small { display: block; font-size: .9rem; font-weight: 500; color: var(--muted); margin-top: .2rem; }
h2 { font-size: 1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.warn-text { color: var(--warn); }
.error { color: var(--bad); background: var(--bad-bg); padding: .7rem .9rem; border-radius: 10px; margin: 0; }
p { margin: 0 0 1rem; }

/* ---------- En-tête & navigation ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: calc(.55rem + env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) .55rem max(1rem, env(safe-area-inset-left, 0px));
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 10px rgba(80, 0, 15, .25);
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; min-width: 0; flex: 1; }
.logo { height: 40px; width: auto; flex: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 1rem; }
.brand-text span { font-size: .75rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout { margin: 0; }
.rib-btn {
  display: inline-flex; align-items: center; gap: .35rem; height: 40px; padding: 0 .75rem; border-radius: 10px;
  background: #fff; color: var(--brand); border: 0; font: inherit; font-weight: 750; font-size: .9rem; cursor: pointer; flex: none;
}
.rib-btn svg { width: 18px; height: 18px; }

/* Fiche RIB */
dialog.rib-dialog .serie-inner { padding: 1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom, 0px)); display: grid; gap: .9rem; }
dialog.rib-dialog h2 { margin: 0; font-size: 1.15rem; }
.rib { margin: 0; display: grid; gap: .2rem; background: var(--surface-2); border-radius: 12px; padding: .85rem .9rem; }
.rib dt { font-size: .75rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .3px; margin-top: .45rem; }
.rib dt:first-child { margin-top: 0; }
.rib dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-weight: 600; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .3px; }
.rib-actions { display: grid; gap: .5rem; }
.ok-text { color: var(--ok) !important; font-weight: 600; }
.bad-text { color: var(--bad) !important; font-weight: 600; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255, 255, 255, .12); border: 0; color: #fff; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* Mobile : barre d'onglets en bas */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--nav-h); color: var(--muted); font-size: .68rem; font-weight: 600; position: relative;
}
.nav a svg { width: 23px; height: 23px; }
.nav a.on { color: var(--brand); }
.nav a.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }

main {
  max-width: 1200px; margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right, 0px)) calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
}
.is-login main, .is-public main { padding-bottom: 2rem; }
.page-head { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }
.tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tools input[type="search"] { flex: 1 1 100%; }

/* ---------- Cartes & indicateurs ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .85rem; box-shadow: var(--shadow); min-width: 0; }
.kpis.small { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.kpis.small .kpi-value { font-size: 1.1rem; }
.kpis.small .kpi { box-shadow: none; padding: .6rem; background: var(--surface-2); border: 0; }
.kpi-label { font-size: .78rem; color: var(--muted); }
.kpi-value { font-size: 1.3rem; font-weight: 750; font-variant-numeric: tabular-nums; margin: .1rem 0; }
.kpi-sub { font-size: .75rem; color: var(--muted); }
.kpi.accent-bad { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi.accent-bad .kpi-label, .kpi.accent-bad .kpi-sub { color: rgba(255, 255, 255, .85); }
.kpi.accent-ok { border-left: 4px solid var(--ok); }
.grid2 { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid2 .card { margin-bottom: 0; }

/* Barres */
.bars { display: grid; gap: .4rem; }
.bar-row { display: grid; grid-template-columns: 2.8rem 1fr 4rem; align-items: center; gap: .5rem; font-size: .85rem; }
.bar-track { background: var(--surface-2); border-radius: 5px; height: 14px; overflow: hidden; }
.bar { display: block; height: 100%; background: color-mix(in srgb, var(--brand) 45%, var(--surface-2)); border-radius: 5px; }
.bar-row.current .bar-label { font-weight: 750; color: var(--brand); }
.bar-row.current .bar { background: var(--brand); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.stack { display: flex; height: 14px; border-radius: 5px; overflow: hidden; gap: 2px; margin-bottom: .7rem; }
.seg.ok { background: var(--ok); } .seg.warn { background: var(--warn); } .seg.bad { background: var(--bad); }
.legend { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .35rem; }
.legend:last-child { margin-bottom: 0; }
.legend li { display: grid; grid-template-columns: 1rem 1fr auto 3.5rem; align-items: center; gap: .4rem; font-size: .9rem; }
.legend li .muted { text-align: right; font-size: .8rem; }
.legend-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.legend-inline span { display: inline-flex; align-items: center; gap: .3rem; }
.dot { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.dot.mode-virement { background: var(--virement); } .dot.mode-liquide { background: var(--liquide); } .dot.mode-chèque { background: var(--cheque); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
.card .table-wrap + h2 { margin-top: 1.1rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .65rem .7rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 650; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.inactive td { opacity: .55; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.hide-sm { display: none; }
td a { color: var(--text); font-weight: 600; }

.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

/* Grille des paiements : défilement horizontal, colonne des noms figée */
.pay-grid th, .pay-grid td { padding: 0 .3rem; height: 46px; text-align: center; }
.pay-grid .sticky {
  position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left;
  min-width: 8.5rem; max-width: 8.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-left: .7rem; box-shadow: 1px 0 0 var(--border);
}
.pay-grid thead .sticky, .pay-grid tfoot .sticky { background: var(--surface-2); }
.pay-grid th.current { color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand); }
.pay-grid tfoot th { border-top: 2px solid var(--border); border-bottom: 0; font-variant-numeric: tabular-nums; text-transform: none; }
.cell { cursor: pointer; min-width: 3.1rem; font-variant-numeric: tabular-nums; font-weight: 650; border-left: 1px solid var(--border); user-select: none; }
.cell:active { filter: brightness(.92); }
.cell.paid { color: #fff; }
.cell.mode-virement { background: var(--virement); }
.cell.mode-liquide { background: var(--liquide); }
.cell.mode-chèque { background: var(--cheque); }
.cell.due { background: var(--bad-bg); }
.cell.na { color: var(--muted); background: repeating-linear-gradient(45deg, transparent 0 4px, var(--surface-2) 4px 8px); }
.cell.current:not(.paid) { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }

/* Relances : cartes sur mobile */
.relances thead { display: none; }
.relances tbody tr { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; padding: .8rem .9rem; border-bottom: 1px solid var(--border); }
.relances tbody tr:last-child { border-bottom: 0; }
.relances td { border: 0; padding: 0; }
.relances td.actions { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .55rem; }
.relances td.actions .btn { flex: 1 1 auto; }

.relances tr.done td { opacity: .6; }
.relances tr.done td.actions { opacity: 1; }
.last-relance { color: var(--muted); margin-top: .15rem; }
.done-label { color: var(--ok); font-weight: 650; }
.tone { display: inline-block; font-size: .72rem; font-weight: 650; padding: .08rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tone-ferme { background: var(--brand-soft); color: var(--brand); }

/* Filtres en pastilles (défilement horizontal sur mobile) */
.chips { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem .6rem; padding: .1rem 1rem; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; padding: .3rem .85rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.chip b { font-size: .78rem; background: var(--surface-2); color: var(--muted); padding: .05rem .45rem; border-radius: 999px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on b { background: rgba(255, 255, 255, .25); color: #fff; }

/* Mode relance en série */
dialog.serie .serie-inner { padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom, 0px)); display: grid; gap: .75rem; }
.serie-head { display: flex; justify-content: space-between; align-items: center; }
.icon-btn.ghost { background: var(--surface-2); color: var(--text); width: 36px; height: 36px; font-size: 1rem; }
.serie-progress { height: 5px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.serie-progress span { display: block; height: 100%; background: var(--brand); transition: width .2s; }
dialog.serie h2 { margin: 0; font-size: 1.25rem; }
.serie-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.serie-meta b { font-size: 1.15rem; }
dialog.serie textarea { font-size: 15px; line-height: 1.4; }
.serie-send { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .45rem; }
.serie-send .wa { grid-column: 1 / -1; min-height: 50px; font-size: 1rem; }
.serie-nav { display: grid; grid-template-columns: auto auto 1fr; gap: .45rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 25%, transparent); } }

/* Encaisser : répartition sur plusieurs mois */
.rep-quick { margin: -.3rem 0 0; padding: 0; flex-wrap: wrap; }
.rep-preview ul { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .25rem; }
.rep-preview li { display: flex; gap: .5rem; align-items: baseline; padding: .35rem .6rem; background: var(--surface-2); border-radius: 8px; }
.rep-preview li b { margin-left: auto; color: var(--ok); }
.rep-preview .error { margin-top: .4rem; }

/* Contacts en série */
.contacts-cta { display: flex; flex-direction: column; gap: .75rem; border-left: 4px solid var(--brand); }

/* Page perso du joueur */
.perso-link { background: var(--surface-2); border-radius: 10px; padding: .65rem .8rem; font-size: .85rem; word-break: break-all; margin-bottom: .7rem; }
.perso-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.perso-actions .wa { grid-column: 1 / -1; }
.perso-reset { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .9rem; }
.perso-reset .hint { margin: 0; }

/* Journal */
.journal { list-style: none; margin: 0; padding: 0; }
.journal li { padding: .65rem 0; border-bottom: 1px solid var(--border); display: grid; gap: .2rem; }
.journal li:last-child { border-bottom: 0; }
.journal-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.journal a { color: var(--text); }

/* Accès */
.users { list-style: none; margin: 0 0 1rem; padding: 0; }
.users li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.users form { margin: 0; }
.user-add { padding-top: .5rem; }
.user-add .form-actions { margin-top: 0; }

.readonly-banner { background: var(--warn-bg); color: var(--warn); font-weight: 650; font-size: .88rem; padding: .55rem .8rem; border-radius: 10px; margin: 0 0 1rem; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.center { text-align: center; }
.btn.block { display: flex; width: 100%; margin-top: .9rem; }

/* Page publique du joueur */
.is-public main { max-width: 640px; }
.public-status { text-align: center; border-top: 5px solid var(--ok); }
.public-status.late { border-top-color: var(--brand); }
.public-amount { font-size: 2.2rem; font-weight: 800; margin: .2rem 0 .4rem; font-variant-numeric: tabular-nums; }
.public-status.late .public-amount { color: var(--brand); }
.months { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.months li { display: flex; justify-content: space-between; align-items: center; padding: .55rem .7rem; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.months li.paid { background: var(--ok-bg); color: var(--ok); }
.months li.part { background: var(--warn-bg); color: var(--warn); }
.months li.due { background: var(--bad-bg); color: var(--bad); }
.months li.na { opacity: .5; }
.months li.current { box-shadow: inset 0 0 0 2px var(--brand); }

/* ---------- Boutons & formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger[data-armed] { background: var(--bad); color: #fff; }
.btn.wa { background: #25d366; border-color: #25d366; color: #073b1c; }
.btn.sm { min-height: 40px; padding: .35rem .75rem; font-size: .85rem; }
.spacer { flex: 1; }

input, select, textarea {
  font: inherit; font-size: 16px; /* évite le zoom auto d'iOS */
  color: var(--text); background: var(--surface); width: 100%; min-height: 46px;
  border: 1px solid var(--border); border-radius: 10px; padding: .6rem .75rem; margin-top: .3rem;
}
textarea { min-height: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input[type="search"] { margin: 0; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; margin: 0 .6rem 0 0; accent-color: var(--brand); flex: none; }
label { display: block; font-size: .9rem; font-weight: 600; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; margin-top: .3rem; }
.form h2 { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.form h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
label.check { display: flex; align-items: center; font-weight: 500; }
.form-actions { display: flex; gap: .5rem; margin-top: 1.4rem; align-items: center; }
.form-actions .btn.primary { flex: 1; }
.preview pre { white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: .8rem; margin: .3rem 0 0; font: inherit; font-size: .9rem; }
.history { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; }

.login { max-width: 380px; margin: 10vh auto 0; text-align: center; display: grid; gap: 1rem; border-top: 5px solid var(--brand); }
.logo-big { width: 120px; height: auto; margin: 0 auto; filter: drop-shadow(0 4px 10px rgba(80, 0, 15, .2)); }
.login h1 { margin: 0; }
.login .club-name { margin: -.6rem 0 0; font-size: .9rem; letter-spacing: .5px; text-transform: uppercase; }
.login label { text-align: left; }

/* Fenêtre de saisie : feuille en bas d'écran sur mobile */
dialog {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%;
  border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(20, 0, 5, .45); }
dialog form { padding: 1.2rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom, 0px)); display: grid; gap: .85rem; }
dialog h2 { margin: 0; font-size: 1.1rem; }
.dialog-actions { display: flex; gap: .5rem; align-items: center; margin-top: .3rem; flex-wrap: wrap; }
.dialog-actions .btn.primary { flex: 1; }

.flash, .toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + .9rem + env(safe-area-inset-bottom, 0px));
  background: #1f1a1b; color: #fff; padding: .65rem 1.1rem; border-radius: 999px; box-shadow: var(--shadow); z-index: 50;
  max-width: calc(100vw - 2rem); text-align: center; font-size: .92rem;
}

/* ---------- Tablette ---------- */
@media (min-width: 720px) {
  h1 { font-size: 1.55rem; }
  h1 small { display: inline; margin: 0 0 0 .5rem; }
  .page-head { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .tools { flex-wrap: nowrap; flex: 0 1 auto; }
  .tools input[type="search"] { flex: 0 1 16rem; width: 16rem; min-width: 9rem; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: .8rem; }
  .kpis.small { grid-template-columns: repeat(3, 1fr); }
  .kpi { padding: 1rem 1.1rem; }
  .kpi-value { font-size: 1.6rem; }
  .grid2 { grid-template-columns: 3fr 2fr; }
  .card { padding: 1.1rem 1.25rem; }
  .hide-sm { display: table-cell; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid.three { grid-template-columns: repeat(3, 1fr); }
  label.check { align-self: end; padding-bottom: .7rem; }
  .form-actions .btn.primary, .dialog-actions .btn.primary { flex: 0 0 auto; }
  .pay-grid .sticky { min-width: 11rem; max-width: 14rem; }
  .pay-grid th, .pay-grid td { height: 40px; }

  .relances thead { display: table-header-group; }
  .relances tbody tr { display: table-row; padding: 0; }
  .relances td { padding: .65rem .7rem; border-bottom: 1px solid var(--border); }
  .relances tbody tr:last-child td { border-bottom: 0; }
  .relances td.actions { display: table-cell; margin: 0; text-align: right; }
  .relances td.actions .btn { margin: .15rem 0 .15rem .25rem; }

  dialog { margin: auto; width: min(400px, calc(100vw - 2rem)); border-radius: var(--radius); }
  dialog.serie, dialog.rib-dialog { width: min(520px, calc(100vw - 2rem)); }
  .contacts-cta { flex-direction: row; align-items: center; justify-content: space-between; }
  .perso-actions { grid-template-columns: repeat(4, auto); justify-content: start; }
  .perso-actions .wa { grid-column: auto; }
  .months { grid-template-columns: repeat(5, 1fr); }
  .months li { flex-direction: column; gap: .2rem; text-align: center; }
  .rib-actions { grid-template-columns: 1fr 1fr; }
  .rib-actions .btn:only-child, .rib-actions .js-share[hidden] + .btn { grid-column: 1 / -1; }
  .chips { margin: 0 0 .6rem; padding: .1rem 0; flex-wrap: wrap; }
  dialog form { padding: 1.3rem; }
}

/* ---------- Desktop : navigation dans l'en-tête ---------- */
@media (min-width: 1000px) {
  .top { padding-top: .6rem; padding-bottom: .6rem; gap: 1.5rem; }
  .brand { flex: none; }
  .nav {
    position: static; display: flex; gap: .25rem; flex: 1;
    background: none; border: 0; box-shadow: none; padding: 0;
  }
  .nav a { flex-direction: row; height: auto; gap: .45rem; padding: .5rem .8rem; border-radius: 10px; color: rgba(255, 255, 255, .85); font-size: .92rem; }
  .nav a svg { width: 18px; height: 18px; }
  .nav a:hover { background: rgba(255, 255, 255, .12); }
  .nav a.on { background: rgba(255, 255, 255, .2); color: #fff; }
  .nav a.on::before { display: none; }
  main { padding: 1.5rem 1.5rem 3rem; }
  .flash, .toast { bottom: 1.5rem; }
  tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
  tbody tr:hover td.cell.paid { background-blend-mode: normal; filter: brightness(1.08); }
  .cell:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
  a:hover { text-decoration: underline; }
  .btn:hover { filter: brightness(.97); text-decoration: none; }
}
