:root {
  --green-900: #12352a;
  --green-700: #1f5c46;
  --green-500: #2f8a62;
  --green-100: #e3f1ea;
  --sand: #f6f3ea;
  --ink: #1d2521;
  --muted: #6b766f;
  --line: #dde3de;
  --white: #fff;
  --red: #b3372b;
  --red-100: #fbe7e4;
  --amber: #9a6a00;
  --orange: #d97b0a;
  --blue-500: #2f6ea8;
  --blue-700: #23507b;
  --amber-100: #fdf1d3;
  --blue-100: #e5eef9;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--sand);
}
a { color: var(--green-700); }
h1 { font-size: 1.6rem; margin: 1.4rem 0 .8rem; color: var(--green-900); }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .6rem; color: var(--green-900); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 18px; }
main.wrap > :first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* En-tête */
.site-header { background: var(--green-900); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 8px; flex-wrap: wrap; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; }
.brand-logo { height: 46px; width: auto; background: #fff; border-radius: 8px; padding: 3px 6px; }
.brand strong { display: block; font-size: 1.1rem; }
.brand small { display: block; opacity: .75; font-size: .8rem; }
.user-box { display: flex; gap: 14px; align-items: center; font-size: .9rem; }
.user-box a { color: #d5eadf; }
.user-box .who { opacity: .8; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 10px; align-items: center; }
.main-nav a { color: #e6f2ec; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .92rem; }
.main-nav a:hover { background: rgba(255,255,255,.1); }
.main-nav a.active { background: #fff; color: var(--green-900); font-weight: 600; }
.main-nav .nav-sep { margin-left: 10px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }
.main-nav a.admin-link { color: #ffe7a8; }
.main-nav a.admin-link.active { color: var(--green-900); }

.site-footer { color: var(--muted); font-size: .85rem; padding-top: 24px; padding-bottom: 32px; }

/* Blocs */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.home-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.home-col h2:first-child { margin-top: 0; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 1.6rem; color: var(--green-700); line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }

.flash { padding: 10px 14px; border-radius: 8px; margin: 14px 0; border: 1px solid; }
.flash-success { background: var(--green-100); border-color: #b9dcc9; color: var(--green-900); }
.flash-error { background: var(--red-100); border-color: #efc1ba; color: var(--red); }
.flash-warning { background: var(--amber-100); border-color: #efd9a0; color: #6b4a00; }
.flash-info { background: var(--blue-100); border-color: #c4d5ec; color: #23466f; }

/* Tableaux */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f3f6f4; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcfb; }
tr.cut td { border-bottom: 2px dashed var(--green-500); }
tr.mine-row { background: #fff8e1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.team.winner { font-weight: 700; }
.team.loser { color: var(--muted); }
.team.mine { text-decoration: underline; text-decoration-color: #e0b100; text-decoration-thickness: 2px; }
.strokes { display: inline-block; background: var(--green-100); color: var(--green-700); border-radius: 10px; padding: 0 6px; font-size: .78rem; font-weight: 700; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--green-100); color: var(--green-700); }
.badge-todo { background: var(--blue-100); color: #23466f; }
.badge-late { background: var(--red-100); color: var(--red); }
.badge-warn { background: var(--amber-100); color: var(--amber); }
.badge-muted { background: #eceeed; color: var(--muted); }
.rank { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%; background: #eef2ef; font-weight: 700; font-size: .85rem; }
.rank.q-principal { background: var(--green-700); color: #fff; }
.rank.q-consolante { background: #c9a227; color: #fff; }

/* Formulaires */
form.inline { display: inline; }
label { display: block; font-weight: 600; font-size: .88rem; margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c8d1cb; border-radius: 7px; font: inherit; background: #fff;
}
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-500); outline-offset: 0; border-color: var(--green-500); }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: normal; }
.checkbox input { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.btn, button {
  display: inline-block; border: 1px solid var(--green-700); background: var(--green-700); color: #fff;
  padding: 8px 14px; border-radius: 7px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover, button:hover { background: var(--green-900); }
.btn-secondary { background: #fff; color: var(--green-700); }
.btn-secondary:hover { background: var(--green-100); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #8e2a20; }
.btn-small { padding: 4px 10px; font-size: .85rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 14px 14px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; color: var(--green-900); }

.login-box { max-width: 380px; margin: 40px auto; }

/* Choix gagnant */
.winner-choice { display: grid; gap: 8px; }
.winner-choice label { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; font-weight: 600; cursor: pointer; background: #fff; }
.winner-choice input { width: auto; }
.winner-choice label:has(input:checked) { border-color: var(--green-500); background: var(--green-100); }

/* Match cards (Mon équipe) */
.section-sep { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.notice { border-left: 4px solid var(--blue-500); }
.notice h2 { margin-top: 0; }
.notice-info { background: var(--blue-100); border-color: #c4d5ec; }
.notice-warning { background: var(--amber-100); border-color: #efd9a0; border-left-color: var(--orange); }
.notice-success { background: var(--green-100); border-color: #b9dcc9; border-left-color: var(--green-500); }
.proposal-card { border-left: 4px solid var(--blue-500); }
.quote { font-style: italic; color: var(--muted); }
.scheduled { color: var(--orange); }
.match-card { border-left: 4px solid var(--green-500); }
.match-card.played { border-left-color: #b7c2bb; }
.match-card .vs { font-size: 1.05rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .92rem; margin-top: 8px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--green-100); color: var(--green-900); border-radius: 12px; padding: 2px 10px; font-size: .82rem; }

/* Disponibilités */

/* Tableaux à élimination */
.bracket { display: flex; gap: 18px; overflow-x: auto; padding: 8px 2px 16px; }
.bracket-round { display: flex; flex-direction: column; min-width: 230px; }
.bracket-round h3 { text-align: center; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 4px; }
.bracket-round .deadline { text-align: center; font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.bracket-matches { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 10px; }
.b-match { background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; overflow: hidden; }
.b-match .b-team { display: flex; justify-content: space-between; gap: 6px; padding: 6px 9px; }
.b-match .b-team + .b-team { border-top: 1px solid var(--line); }
.b-match .b-team.winner { background: var(--green-100); font-weight: 700; }
.b-match .b-team.loser { color: var(--muted); }
.b-match .b-team.mine { box-shadow: inset 3px 0 0 #e0b100; }
.b-match .b-foot { background: #f6f8f7; padding: 3px 9px; font-size: .75rem; color: var(--muted); display: flex; justify-content: space-between; }
.b-seed { color: var(--muted); font-size: .75rem; min-width: 18px; }

/* Identifiants imprimables */
.credentials { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.credential { border: 1px dashed #9aa79f; border-radius: 8px; padding: 12px; background: #fff; page-break-inside: avoid; }
.credential-logo { height: 38px; width: auto; float: right; margin: 0 0 4px 8px; }
.credential code { font-size: 1rem; background: #f1f4f2; padding: 1px 6px; border-radius: 4px; }

/* Calendrier des disponibilités */
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.cal-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid #c8d1cb; background: #fff; vertical-align: -2px; }
.cal-swatch.oui { background: var(--green-500); border-color: var(--green-500); }
.cal-swatch.non { background: var(--red); border-color: var(--red); }
.cal-swatch.common { background: var(--green-500); border-color: var(--green-500); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--amber); margin: 0 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 16px; }
.cal-month { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.cal-head h2 { margin: 0; font-size: 1.05rem; }
.cal-tools { display: flex; gap: 4px; }
.cal-tools .btn-small { padding: 2px 8px; font-size: .75rem; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: .7rem; text-transform: uppercase; color: var(--muted); padding: 2px 0; }
.cal-dow.we { color: var(--green-900); font-weight: 700; }
.cal-day { min-height: 44px; border-radius: 6px; padding: 3px 4px; display: flex; flex-direction: column; align-items: flex-start;
           justify-content: space-between; font: inherit; font-size: .8rem; text-align: left; margin: 0; }
.cal-day.empty { background: transparent; }
.cal-day.off { background: #f5f7f6; color: #b3bbb6; }
.cal-day.we { background: #fff; border: 1px solid #c8d1cb; color: var(--ink); }
.cal-day.we.wknd { border-color: var(--green-700); }
button.cal-day.we { cursor: pointer; width: 100%; }
button.cal-day.we:hover { border-color: var(--green-500); background: var(--green-100); color: var(--ink); }
.cal-day.we.oui, button.cal-day.we.oui:hover { background: var(--green-500); border-color: var(--green-500); color: #fff; }
.cal-day.we.non, button.cal-day.we.non:hover { background: var(--red); border-color: var(--red); color: #fff; }
.cal-day.we.non.implicit { background: #fbecea; border-color: #edcac4; color: #96493f; }
button.cal-day.we.non.implicit:hover { background: #f6ddd9; border-color: var(--red); color: #96493f; }
.cal-swatch.non.implicit { background: #fbecea; border-color: #edcac4; }
.cal-day.past { opacity: .45; }
.cal-day.we.common, a.cal-day.we.common { background: var(--blue-500); border-color: var(--blue-500); color: #fff; text-decoration: none; }
a.cal-day.we.common:hover { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.cal-day.we.booked-mine { background: var(--orange); border-color: var(--orange); color: #fff; }
.cal-day.we.booked-other { background: var(--red); border-color: var(--red); color: #fff; }
.cal-swatch.common { background: var(--blue-500); border-color: var(--blue-500); box-shadow: none; margin: 0; }
.cal-swatch.booked-mine { background: var(--orange); border-color: var(--orange); }
.cal-swatch.booked-other { background: var(--red); border-color: var(--red); }
.cal-num { font-weight: 700; line-height: 1; }
.cal-state { font-size: .68rem; font-weight: 600; line-height: 1; min-height: .68rem; }
@media (max-width: 640px) {
  .cal-grid { grid-template-columns: 1fr; }
  .cal-day { min-height: 40px; }
}
@media print {
  .cal-day.we.oui { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cal-day.we.non { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media print {
  img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-header, .site-footer, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .card, .table-wrap { border: none; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .hide-mobile { display: none; }
  th, td { padding: 7px 6px; }
}
