:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --fg: #1b1d21;
  --muted: #6b7280;
  --border: #dfe1e6;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --error-bg: #fdecec;
  --error-fg: #9b1c1c;
  --ok-bg: #e7f6ec;
  --ok-fg: #14532d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --card: #1d2026;
    --fg: #e8eaed;
    --muted: #9aa0ab;
    --border: #2e323a;
    --accent: #3b82f6;
    --error-bg: #3a1d1d;
    --error-fg: #f2b8b8;
    --ok-bg: #16301f;
    --ok-fg: #a7e3bd;
  }
}

* { box-sizing: border-box; }

/* Sans cette règle, les liens prennent le bleu puis le violet par défaut du
   navigateur ; définir `color` sur `a` couvre aussi l'état :visited. */
a {
  color: var(--accent);
  text-underline-offset: 2px;
}

a:hover { text-decoration: none; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 16px;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card {
  width: 100%;
  max-width: 24rem;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

h1 {
  margin: 0 0 .25rem;
  font-size: 1.25rem;
}

.sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: .875rem;
}

label {
  display: block;
  margin-bottom: .35rem;
  font-size: .8125rem;
  font-weight: 600;
}

input[type=text],
input[type=password] {
  width: 100%;
  margin-bottom: 1rem;
  padding: .625rem .75rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}

input[type=text]:focus,
input[type=password]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.check {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.25rem;
  font-size: .875rem;
  font-weight: 400;
}

button {
  width: 100%;
  padding: .7rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-fg);
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }

.alert {
  margin-bottom: 1.25rem;
  padding: .7rem .85rem;
  font-size: .875rem;
  color: var(--error-fg);
  background: var(--error-bg);
  border-radius: 7px;
}

.alert.ok {
  color: var(--ok-fg);
  background: var(--ok-bg);
}

.hint {
  margin: -.6rem 0 1rem;
  font-size: .8125rem;
  color: var(--muted);
}

.btn {
  display: block;
  padding: .7rem;
  font-weight: 600;
  color: var(--accent-fg);
  text-align: center;
  text-decoration: none;
  background: var(--accent);
  border-radius: 7px;
}

.retour {
  margin: 1.25rem 0 0;
  font-size: .875rem;
  text-align: center;
}

.retour a { color: var(--muted); }

.sites {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sites li + li { margin-top: .5rem; }

.sites a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sites a:hover { border-color: var(--accent); }

.role {
  color: var(--muted);
  font-size: .8125rem;
}

.logout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  font-size: .875rem;
  border-top: 1px solid var(--border);
}

.logout a { color: var(--muted); }

.logout button {
  color: var(--muted);
  background: none;
  font-weight: 400;
  font-size: .875rem;
  text-decoration: underline;
  cursor: pointer;
}

.actions {
  display: flex;
  gap: .75rem;
}

.actions > * { flex: 1; }

.actions form { display: flex; }
.actions form button { flex: 1; }

.actions .ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .7rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.foot {
  color: var(--muted);
  font-size: .8125rem;
}
