:root {
  --c-primary: #2e5485;
  --c-primary-dark: #1f3d66;
  --c-accent: #f1920a;
  --c-green: #3ba936;
  --c-bg: #f4f6f9;
  --c-card: #ffffff;
  --c-text: #1c2430;
  --c-muted: #667085;
  --c-line: #d9dfe7;
  --c-ok: #1a7f4b;
  --c-warn: #b45f06;
  --c-danger: #b42318;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--c-text); background: var(--c-bg); }
a { color: var(--c-primary); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 40px; min-height: 60vh; }
h1 { font-size: 1.7rem; margin: .2em 0 .6em; }
h2 { font-size: 1.3rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1.1rem; margin: 0 0 .3em; }
.muted { color: var(--c-muted); }
.small { font-size: .88rem; }

/* En-tête (fond blanc : le logo Palet 17 est sur fond clair) */
.site-header { background: #fff; color: var(--c-primary); position: sticky; top: 0; z-index: 50; border-bottom: 3px solid var(--c-accent); box-shadow: 0 1px 6px rgba(31, 61, 102, .12); }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; }
.brand { color: var(--c-primary); text-decoration: none; font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; line-height: 1.15; }
.brand img { height: 52px; width: auto; display: block; }
.brand small { display: block; font-weight: 600; color: var(--c-green); font-size: .78rem; letter-spacing: .02em; }
.main-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.main-nav a, .linklike { color: var(--c-primary); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; font-weight: 600; background: none; border: 0; cursor: pointer; font-family: inherit; }
.main-nav a:hover, .linklike:hover { background: #e8eef6; }
.main-nav a.active { background: var(--c-primary); color: #fff; }
.nav-toggle { display: none; background: none; border: 1px solid var(--c-primary); color: var(--c-primary); font-size: 1.3rem; border-radius: 8px; padding: 2px 10px; }
form.inline { display: inline; margin: 0; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  body.nav-open .main-nav { display: flex; }
}

/* Messages */
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid; }
.flash-ok { background: #e8f6ee; border-color: #9bd3b3; color: #14532d; }
.flash-error { background: #fdecea; border-color: #f2a8a1; color: #7a1c14; }
.flash-info { background: #e8f0fb; border-color: #a9c3ea; color: #12315e; }

/* Filtres */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; background: var(--c-card); padding: 12px; border-radius: var(--radius); border: 1px solid var(--c-line); margin-bottom: 18px; }
.filters label { display: flex; flex-direction: column; font-size: .82rem; color: var(--c-muted); gap: 2px; }

/* Formulaires */
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], input[type=month], select, textarea {
  font: inherit; padding: 9px 10px; border: 1px solid #b9c2cf; border-radius: 8px; background: #fff; color: var(--c-text); width: 100%;
}
.filters input, .filters select { width: auto; min-width: 150px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-primary); outline-offset: 1px; }
label.field { display: block; margin-bottom: 12px; font-weight: 600; font-size: .92rem; }
label.field span.hint { font-weight: 400; color: var(--c-muted); font-size: .82rem; }
label.field > input, label.field > select, label.field > textarea { margin-top: 4px; font-weight: 400; }
label.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; font-weight: 400; }
label.check input { margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-card); padding: 14px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--c-primary); background: var(--c-primary); color: #fff; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--c-primary-dark); }
.btn-secondary { background: #fff; color: var(--c-primary); }
.btn-accent { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn-secondary:hover { background: #eaf0f9; }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); }
.btn-danger:hover { background: #8f1c12; }
.btn-small { padding: 5px 10px; font-size: .85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.btn-icon { height: 22px; width: auto; vertical-align: middle; margin: -3px 8px -3px 0; }
.btn-google { background: #fff; color: #1a73e8; border-color: #1a73e8; }
.btn-waze { background: #33ccff; color: #05303f; border-color: #33ccff; }
.btn-waze:hover { background: #19b8ec; }

/* Cartes de tournois */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card.state-cancelled { opacity: .85; }
.card-poster { display: block; text-decoration: none; }
.card-body { padding: 12px 14px 14px; }
.card-body p { margin: 2px 0; }
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px !important; }
.card-when { font-weight: 600; }
.card-where, .card-org { color: var(--c-muted); font-size: .92rem; }
.card-places { font-size: .9rem; color: var(--c-text); margin-top: 6px !important; }
.card h3 a { text-decoration: none; color: var(--c-text); }
.card h3 a:hover { text-decoration: underline; }

.poster { position: relative; aspect-ratio: 3 / 4; background: #e7ecf3; overflow: hidden; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .poster-none { aspect-ratio: 16 / 9; }
.poster-full { aspect-ratio: auto; background: transparent; border-radius: var(--radius); }
.poster-full img { height: auto; object-fit: contain; }
.poster-empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 16px; gap: 8px; color: #44546a; background: repeating-linear-gradient(45deg, #e7ecf3, #e7ecf3 12px, #dfe6ef 12px, #dfe6ef 24px); }
.poster-full .poster-empty { position: relative; min-height: 280px; }
.poster-empty small { color: var(--c-muted); }
.banner { position: absolute; left: -10%; right: -10%; top: 42%; text-align: center; font-weight: 800; letter-spacing: .12em; font-size: 1.5rem; color: #fff; padding: 8px 0; transform: rotate(-12deg); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.banner-cancelled { background: rgba(180, 35, 24, .92); }
.banner-full { background: rgba(180, 95, 6, .92); }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #e7ecf3; color: #344054; }
.badge-ok { background: #dff3dc; color: #1c5a18; }
.badge-warn { background: #fdebd0; color: #7a4100; }
.badge-danger { background: #fbd8d4; color: #7a1c14; }
.badge-muted { background: #e4e7ec; color: #475467; }
.badge-info { background: #dbe7f8; color: #12315e; }
.badge-format { background: #fff; border: 1px solid var(--c-line); }

/* Fiche tournoi */
.fiche { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .fiche { grid-template-columns: 1fr; } }
.panel { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel h2 { margin-top: 0; }
dl.info { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
dl.info dt { color: var(--c-muted); }
dl.info dd { margin: 0; }
@media (max-width: 520px) { dl.info { grid-template-columns: 1fr; } dl.info dt { margin-top: 6px; } }
.places-big { font-size: 1.15rem; font-weight: 700; }
.minimap { height: 260px; border-radius: var(--radius); border: 1px solid var(--c-line); margin-bottom: 10px; z-index: 1; }
.map-picker { height: 300px; border-radius: var(--radius); border: 1px solid var(--c-line); margin: 8px 0; z-index: 1; }
.player-block { border: 1px dashed #b9c2cf; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fafbfd; }
.player-block h4 { margin: 0 0 6px; font-size: .95rem; }
.alert-box { border-radius: var(--radius); padding: 10px 12px; margin: 8px 0 14px; border: 1px solid #f1c27d; background: #fff6e5; color: #6b3d00; }
.alert-box ul { margin: 6px 0 0 18px; padding: 0; }

/* Tableaux */
table.tbl { width: 100%; border-collapse: collapse; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; }
table.tbl th, table.tbl td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--c-line); vertical-align: top; font-size: .93rem; }
table.tbl th { background: #eef2f7; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: #475467; }
table.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }
tr.is-cancelled td { color: var(--c-muted); }

/* Calendrier */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-head h1 { margin: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: .8rem; text-align: center; color: var(--c-muted); font-weight: 700; padding: 4px 0; }
.cal-day { background: var(--c-card); border: 1px solid var(--c-line); border-radius: 8px; min-height: 96px; padding: 4px 5px; font-size: .8rem; overflow: hidden; }
.cal-day.out { background: transparent; border-color: transparent; }
.cal-day.today { border-color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }
.cal-day.busy { background: #fff6e5; border-color: #f1c27d; }
.cal-num { font-weight: 700; color: var(--c-muted); display: block; margin-bottom: 2px; }
.cal-ev { display: block; text-decoration: none; background: #dbe7f8; color: #12315e; border-radius: 5px; padding: 2px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.cancelled { background: #fbd8d4; color: #7a1c14; text-decoration: line-through; }
.cal-ev.full { background: #fdebd0; color: #7a4100; }
.cal-list { display: none; }
@media (max-width: 760px) {
  .cal-grid { display: none; }
  .cal-list { display: block; }
}
.cal-list .day { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.cal-list .day.busy { background: #fff6e5; border-color: #f1c27d; }
.cal-list .day h3 { margin: 0 0 4px; }

/* Pied */
.site-footer { border-top: 1px solid var(--c-line); background: #fff; color: var(--c-muted); font-size: .88rem; padding: 14px 0; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.site-footer .btn { color: var(--c-primary); }

.login-box { max-width: 380px; margin: 30px auto; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 10px 14px; min-width: 120px; }
.stat strong { display: block; font-size: 1.4rem; }
@media print { .site-header, .site-footer, .btn-row, .filters { display: none; } }


/* ===== Accueil : bandeau + agenda (design A, disposition B) ===== */
main.home { padding: 0 0 40px; min-height: 60vh; }
.hero { background: linear-gradient(120deg, #1f3d66 0%, #2e5485 58%, #2a7d27 135%); color: #fff; padding: 40px 0 44px; }
.hero-in { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between; }
.hero-text { flex: 1 1 480px; min-width: 0; }
.eyebrow { margin: 0 0 8px; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #f8b04a; }
.hero h1 { color: #fff; font-size: 2.2rem; line-height: 1.12; margin: 0 0 12px; font-weight: 800; }
.hero-sub { margin: 0 0 20px; color: #dbe6f4; font-size: 1.05rem; max-width: 560px; }
.hero .btn-row { margin-top: 0; }
.btn-accent { color: #14233d; font-weight: 800; }
.btn-accent:hover { background: #d97f00; border-color: #d97f00; color: #fff; }
.btn-ghost { background: transparent; border: 2px solid #fff; color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .14); }
.hero-stats { flex: 0 1 300px; display: flex; flex-direction: column; gap: 10px; }
.hs { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28); border-radius: 14px; padding: 12px 18px; display: flex; align-items: baseline; gap: 10px; }
.hs strong { font-size: 2rem; line-height: 1; color: #f8b04a; font-weight: 800; }
.hs span { font-weight: 600; }

.agenda { max-width: 1100px; margin: 0 auto; padding: 28px 16px 0; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 30px; align-items: start; }
.agenda-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
.side-box { background: var(--c-card); border: 1px solid var(--c-line); border-radius: 14px; padding: 16px; box-shadow: 0 2px 8px rgba(31, 61, 102, .07); }
.side-box h2 { margin: 0 0 10px; font-size: 1rem; color: var(--c-primary-dark); }
.side-box.filters { display: flex; flex-direction: column; gap: 10px; margin: 0; align-items: stretch; }
.side-box.filters label { font-size: .8rem; font-weight: 700; color: #4a5a73; }
.side-box.filters select { width: 100%; min-width: 0; margin-top: 3px; font-weight: 400; }
.side-cta { text-align: center; padding: 12px; }

.minical .mc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--c-primary-dark); }
.minical .mc-head a { text-decoration: none; font-size: 1.4rem; line-height: 1; padding: 2px 12px; border-radius: 8px; color: var(--c-primary); }
.minical .mc-head a:hover { background: #e8eef6; }
.mc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.mc-dow { font-size: .75rem; font-weight: 700; color: var(--c-muted); padding-bottom: 2px; }
.mc-day { display: block; aspect-ratio: 1 / 1; max-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: .88rem; font-weight: 600; color: #3c4d68; text-decoration: none; }
.mc-day.mc-today { box-shadow: inset 0 0 0 2px var(--c-green); }
.mc-day.mc-has { background: var(--c-primary); color: #fff; }
.mc-day.mc-busy { background: #fdebd0; color: #7a4100; box-shadow: inset 0 0 0 2px var(--c-accent); font-weight: 800; }
.mc-day.mc-cancelled { background: #e4e7ec; color: #667085; text-decoration: line-through; }
a.mc-day:hover { filter: brightness(.93); }
.mc-legend { margin: 10px 0 0; font-size: .76rem; color: #3c4d68; display: flex; flex-direction: column; gap: 4px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.lg-has { background: var(--c-primary); }
.lg-busy { background: #fdebd0; box-shadow: inset 0 0 0 2px var(--c-accent); }

.month-title { margin: 0 0 8px; padding-bottom: 8px; border-bottom: 2px solid var(--c-primary); font-size: 1.35rem; color: var(--c-primary-dark); text-transform: capitalize; }
.month-title:not(:first-child) { margin-top: 28px; }
.rows { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.row-anchor { scroll-margin-top: 90px; }
.row { display: flex; gap: 16px; align-items: center; background: var(--c-card); border: 1px solid var(--c-line); border-radius: 16px; padding: 12px 14px; box-shadow: 0 2px 8px rgba(31, 61, 102, .07); transition: box-shadow .15s, transform .15s; }
.row:hover { box-shadow: 0 12px 28px rgba(31, 61, 102, .18); transform: translateY(-2px); }
.row.state-cancelled { opacity: .82; }
.row-date { flex: 0 0 62px; display: flex; flex-direction: column; align-items: center; text-decoration: none; background: #f3f6fa; border-radius: 12px; padding: 6px 4px; color: var(--c-primary-dark); }
.rd-dow { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: #b86a00; }
.rd-day { font-size: 1.7rem; font-weight: 800; line-height: 1.05; }
.rd-mon { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--c-muted); }
.row-poster { flex: 0 0 84px; display: block; text-decoration: none; }
.row-poster .poster { aspect-ratio: 1 / 1; border-radius: 12px; }
.row-poster .poster-empty { padding: 4px; }
.row-poster .poster-empty strong { font-size: .62rem; line-height: 1.1; }
.row-poster .poster-empty small { display: none; }
.row-poster .banner { font-size: .62rem; padding: 3px 0; letter-spacing: .06em; }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-main h3 { margin: 0 0 3px; font-size: 1.12rem; font-weight: 800; }
.row-main h3 a { color: var(--c-text); text-decoration: none; }
.row-main h3 a:hover { text-decoration: underline; }
.row-main p { margin: 2px 0; }
.row-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.chip-format { background: #e8eef6; color: var(--c-primary-dark); }
.chip-busy { background: #fdebd0; color: #7a4100; }
.row-info { font-weight: 600; color: #3c4d68; font-size: .93rem; }
.row-org { color: var(--c-muted); font-size: .88rem; }
.row-side { flex: 0 0 170px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.row-places { font-size: .82rem; font-weight: 700; color: var(--c-text); }
.meter { display: block; width: 100%; height: 8px; border-radius: 99px; background: #e3e9f2; overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 99px; }
.bar-ok { background: linear-gradient(90deg, #3ba936, #7fcf5f); }
.bar-warn { background: var(--c-accent); }
.bar-full { background: var(--c-danger); }

@media (max-width: 900px) {
  .agenda { grid-template-columns: 1fr; gap: 20px; padding-top: 20px; }
  .agenda-side { position: static; display: grid; grid-template-columns: 1fr; gap: 14px; }
  .agenda-side .side-box, .agenda-side .side-cta { width: 100%; }
  .mc-day { max-height: none; font-size: 1rem; }
  .hero h1 { font-size: 1.8rem; }
}
@media (max-width: 640px) {
  .row { flex-wrap: wrap; gap: 12px; }
  .row-date { flex: 0 0 56px; }
  .row-poster { flex: 0 0 64px; }
  .row-main { flex: 1 1 calc(100% - 150px); }
  .row-side { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; text-align: left; }
  .row-side .meter { flex: 1 1 100%; }
  .hero { padding: 28px 0 30px; }
  .hero-stats { flex: 1 1 100%; }
}


/* Dates du championnat / de la coupe : discrètes */
.row-champ { display: flex; align-items: center; gap: 10px; padding: 3px 14px; font-size: .8rem; color: var(--c-muted); }
.row-champ .rc-date { flex: 0 0 62px; text-align: center; font-weight: 700; font-size: .72rem; text-transform: uppercase; }
.rc-dot { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; flex: 0 0 7px; }
.rc-label { min-width: 0; }
.lg-champ { background: #98a2b3; border-radius: 50%; width: 9px; height: 9px; margin: 0 7px 0 1.5px; }
.mc-day.mc-champ { position: relative; }
.mc-day.mc-champ::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #98a2b3; }
.mc-day.mc-has.mc-champ::after { background: #fff; opacity: .8; }
.cal-champ { display: block; font-size: .68rem; line-height: 1.15; color: var(--c-muted); background: #eef0f3; border-radius: 4px; padding: 1px 4px; margin-bottom: 2px; }
.cal-champ-line { margin: 2px 0 6px; font-size: .82rem; color: var(--c-muted); }
@media (max-width: 640px) { .row-champ .rc-date { flex-basis: 56px; } }

.cal-day, .cal-list .day { scroll-margin-top: 90px; }
.cal-num-link { text-decoration: none; font-weight: 800; color: var(--c-primary-dark); border-bottom: 2px solid var(--c-accent); }
.cal-num-link:hover { background: #e8eef6; }
.cal-list .day:target { box-shadow: 0 0 0 3px var(--c-accent); border-radius: 10px; }
.row-anchor:target .row { box-shadow: 0 0 0 3px var(--c-accent); }
