/* Palette inspirée de la charte Swisscom : bleu marine, bleu vif et gris clairs. */
:root {
  --navy: #001155;
  --navy-dark: #000b33;
  --blue: #0a5aff;
  --blue-dark: #0044cc;
  --sky: #e6edfa;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --line: #d6dde9;
  --text: #16181d;
  --muted: #5b6676;
  --danger: #d2262b;
  --success: #0f8a5f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  background: var(--navy);
  color: #fff;
}

.topbar a { color: #fff; }
.topbar .brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar nav form { margin: 0; }
.topbar .user { color: var(--sky); font-size: .85rem; }

a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 2rem; }

h1 { margin-top: 0; color: var(--navy); font-size: 1.9rem; }
h2 { margin-top: 2rem; color: var(--navy); }
h3 { color: var(--navy); }

.flash { padding: .75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.flash.notice { background: #e6f5ef; border-left: 4px solid var(--success); }
.flash.alert { background: #fbeaea; border-left: 4px solid var(--danger); }
.flash ul { margin: 0; padding-left: 1.2rem; }

.panel, .card, .match {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.card h2, .card h3 { margin-top: 0; }

.badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 999px;
  background: var(--sky);
  color: var(--navy);
  font-size: .8rem;
  font-weight: 600;
}

.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }

.button, input[type="submit"] {
  display: inline-block;
  padding: .55rem 1rem;
  border-radius: 4px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.button:hover, input[type="submit"]:hover { background: var(--blue-dark); text-decoration: none; }
.button.secondary, input[type="submit"].secondary { background: var(--surface); color: var(--navy); border: 1px solid var(--navy); }
.button.secondary:hover { background: var(--sky); }
.button.danger { background: var(--danger); color: #fff; }
.button.small, input[type="submit"].small { padding: .3rem .65rem; font-size: .85rem; }

.form { max-width: 460px; }
.field { display: flex; flex-direction: column; margin-bottom: 1rem; }
.field label { margin-bottom: .3rem; color: var(--muted); font-size: .9rem; }

input, select {
  padding: .55rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.wide { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th { background: var(--sky); color: var(--navy); }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
tr.qualified td { background: #eef7ff; font-weight: 600; }
tr.unconfirmed td { background: #fff6e6; }
.pending { color: #a35a00; font-weight: 600; }

.hint { color: var(--muted); font-size: .85rem; }

.suggestion { margin-bottom: 1rem; }
.suggestion-head { display: flex; align-items: center; gap: 1rem; }
.suggestion-head h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.admin-response {
  background: var(--sky);
  border-left: 4px solid var(--blue);
  padding: .6rem .8rem;
  border-radius: 0 4px 4px 0;
}
.badge.status-acceptee, .badge.status-realisee { background: #d9f2e6; color: #0f6b4a; }
.badge.status-refusee { background: #fbe0df; color: #8f2320; }
.badge.status-etudiee { background: #fdeccd; color: #8a5a00; }

textarea {
  padding: .55rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
}

.match { margin-bottom: .75rem; }
.match.played { background: #fafbfd; }
.match-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; color: var(--muted); }
.match-head .date { display: inline-flex; align-items: center; gap: .4rem; }

.date-edit { position: relative; display: inline-block; }
.date-edit > summary {
  list-style: none;
  cursor: pointer;
  padding: .1rem .35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  line-height: 1.2;
}
.date-edit > summary::-webkit-details-marker { display: none; }
.date-edit > summary:hover { background: var(--sky); border-color: var(--blue); }
.date-edit[open] > summary { background: var(--sky); border-color: var(--blue); }
.date-edit[open] > .date-edit-panel {
  position: absolute;
  right: 0;
  top: 2rem;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .6rem;
  box-shadow: 0 6px 18px rgba(0, 17, 85, .15);
  white-space: nowrap;
}
.date-edit .hint { margin-top: .35rem; }
.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin: .6rem 0;
  font-size: 1.05rem;
}
.match-teams span:last-child { text-align: right; }
.match-teams .score { font-weight: 700; color: var(--navy); text-align: center; }
.match-teams .winner { font-weight: 700; color: var(--blue-dark); }

.match-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }

.score-edit > summary, .group-matches > summary {
  cursor: pointer;
  color: var(--blue-dark);
  font-size: .85rem;
  font-weight: 600;
}
.score-edit-panel { margin-top: .5rem; }
.group-matches { margin-top: .75rem; }
.group-matches .match { background: var(--bg); }
.group-matches[open] > summary { margin-bottom: .5rem; }
.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.score-input { width: 4rem; }

.bracket { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; align-items: start; }

.bracket-round, .round-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem;
}
.round-block { margin-bottom: 1.25rem; }

.round-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .6rem;
  margin: -.75rem -.75rem .75rem;
  background: var(--navy);
  color: #fff;
  border-radius: 8px 8px 0 0;
}
.round-header h2, .round-header h3 { margin: 0; color: #fff; font-size: 1rem; flex: 1; }
.round-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--blue);
  font-size: .8rem;
  font-weight: 700;
}
.round-count { font-size: .8rem; color: var(--sky); }

.bracket-round .match, .round-block .match { background: var(--bg); }
