/* Couleurs et typographies : charte graphique Université de Montpellier (2023) */
:root {
  --um-rouge: #E7314B;
  --um-rouge-fonce: #C4223A;
  --um-bleu: #4BC2BC;
  --midnight-blue: #273C50;
  --wet-asphalt: #31485F;
  --asbestos: #7D8C8E;
  --silver: #BBC3C8;
  --clouds: #ECF0F1;
  --noir: #1A1A1A;
  --blanc: #FFFFFF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--noir);
  background: var(--clouds);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2 {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--midnight-blue);
  margin: 0 0 .6em;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.25rem; display: flex; align-items: center; gap: .6em; }

a { color: var(--wet-asphalt); }
code { font-size: .9em; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; width: 100%; padding-top: 32px; padding-bottom: 48px; }

/* En-tête */
.site-header {
  background: var(--midnight-blue);
  border-bottom: 6px solid var(--um-rouge);
  color: var(--blanc);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-family: "Oswald", sans-serif;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.brand img { width: 36px; height: 36px; }
.user { display: flex; align-items: center; gap: 12px; }
.user small { color: var(--silver); }

/* Cartes et formulaires */
.card {
  background: var(--blanc);
  border-top: 4px solid var(--um-rouge);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(39, 60, 80, .12);
}
.card.login { max-width: 620px; margin: 40px auto; }
.step {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  background: var(--um-rouge);
  color: var(--blanc);
  font-size: .85em;
}
.hint { color: var(--asbestos); margin-top: -.3em; }
.muted { color: var(--asbestos); }

.btn {
  display: inline-block;
  font-family: "Oswald", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-decoration: none;
  padding: .55em 1.4em;
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--um-rouge); color: var(--blanc); }
.btn-primary:hover { background: var(--um-rouge-fonce); }
.btn-primary:disabled { background: var(--silver); cursor: wait; }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.card .btn-ghost { color: var(--wet-asphalt); }
.card .btn-ghost:hover { background: var(--clouds); }
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

textarea { resize: vertical; font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: .9rem; }
textarea, .filter {
  font: inherit;
  width: 100%;
  padding: .55em .7em;
  border: 1px solid var(--silver);
  background: var(--blanc);
}
.filter:focus, textarea:focus { outline: 2px solid var(--um-bleu); outline-offset: -1px; }

/* Arbre des groupes */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { margin-top: 12px; max-height: 420px; overflow-y: auto; border: 1px solid var(--clouds); padding: 6px; }
.tree ul { margin-left: 22px; border-left: 1px dashed var(--silver); }
.node { display: flex; align-items: center; gap: 4px; }
.node label {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 8px;
  cursor: pointer;
  min-width: 0;
}
.node label:hover { background: var(--clouds); }
.node label.disabled { cursor: not-allowed; }
.node label.disabled:hover { background: none; }
.node label.disabled .node-name { color: var(--asbestos); font-weight: 400; }
.node label:has(input:checked) { background: rgba(75, 194, 188, .18); box-shadow: inset 3px 0 0 var(--um-bleu); }
.node input { accent-color: var(--um-rouge); align-self: center; }
.node-name { font-weight: 600; }
.node-path { color: var(--asbestos); font-size: .82em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toggle, .toggle-spacer { width: 22px; height: 22px; flex: none; }
.toggle {
  border: 0;
  background: none;
  color: var(--wet-asphalt);
  cursor: pointer;
  font-size: .9rem;
  transition: transform .15s;
}
.toggle[aria-expanded=true] { transform: rotate(90deg); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th {
  font-family: "Oswald", sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  text-align: left;
  color: var(--blanc);
  background: var(--wet-asphalt);
  padding: 8px 10px;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--clouds); vertical-align: top; overflow-wrap: anywhere; }
tr:nth-child(even) td { background: #F7F9F9; }

/* Messages et statuts */
.alert { padding: 12px 16px; margin-bottom: 20px; border-left: 5px solid; background: var(--blanc); }
.alert-error { border-color: var(--um-rouge); background: #FDECEE; }
.alert-warning { border-color: #E6A23C; background: #FDF6EC; }
.invalid { margin: .4em 0 0; }

.summary { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: .85em;
  font-weight: 600;
  border-radius: 2px;
  white-space: nowrap;
}
.badge-added { background: var(--um-bleu); color: var(--midnight-blue); }
.badge-invited { background: #D8F1EF; color: var(--midnight-blue); }
.badge-already { background: var(--clouds); color: var(--wet-asphalt); }
.badge-error { background: var(--um-rouge); color: var(--blanc); }
.message { font-size: .85em; color: var(--asbestos); margin-top: 4px; }

@media (max-width: 600px) {
  .card { padding: 18px 16px; }
  .node-path { display: none; }
}
