/* UniCA Sport Notifier : neutres ardoise, un seul accent, thème clair/sombre selon le système. */
:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #ede9fe;
  --accent-text: #6d28d9;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --radius: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #020617;
    --surface: #0f172a;
    --surface-2: #1e293b;
    --border: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-soft: rgb(76 29 149 / 0.35);
    --accent-text: #c4b5fd;
    --ok: #4ade80;
    --ok-soft: rgb(20 83 45 / 0.4);
    --warn: #fbbf24;
    --warn-soft: rgb(120 53 15 / 0.4);
    --danger: #f87171;
    --danger-soft: rgb(127 29 29 / 0.4);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.375rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.875rem; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }

.icon { width: 16px; height: 16px; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Barre du haut */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; border-radius: 6px; }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav .end { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }

main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.narrow { max-width: 640px; margin: 0 auto; }
.entrance { max-width: 400px; margin: 32px auto 0; }

.page-head { margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 4px; }

footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Panneaux */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-body { padding: 16px; }
.panel-body > * + * { margin-top: 12px; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }

.note { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.note.warn { border-left-color: var(--warn); }

/* Chiffres clés */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; }
.stats > div { padding: 12px 16px; }
.stats > div + div { border-left: 1px solid var(--border); }
.stats dt { font-size: 0.75rem; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 1.125rem; font-weight: 600; }

.columns { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* Listes et tableaux */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; }
.list > li + li { border-top: 1px solid var(--border); }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 0.8125rem; margin-top: 2px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta .icon { width: 13px; height: 13px; }
.thumb { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; background: var(--surface-2); }
.thumb.lg { width: 120px; height: 90px; }
details summary { cursor: pointer; color: var(--muted); font-size: 0.8125rem; margin-top: 6px; }
details p { margin-top: 6px; white-space: pre-line; }

/* Étiquettes */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.tag .icon { width: 12px; height: 12px; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.accent { background: var(--accent-soft); color: var(--accent-text); }

/* Formulaires (y compris ceux générés par allauth) */
label { display: block; font-weight: 500; margin-bottom: 4px; }
.field + .field, form > p + p { margin-top: 14px; }
.hint, .helptext { display: block; margin-top: 4px; color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="tel"], select, textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
textarea { height: auto; padding: 8px 10px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[disabled], input[readonly] { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 0; cursor: pointer; }
.check input { margin-top: 2px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.errorlist { list-style: none; margin: 0 0 8px; padding: 0; color: var(--danger); font-size: 0.8125rem; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button[type="submit"]:not(.btn), .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button[type="submit"]:not(.btn):hover, .btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 28px; padding: 0 8px; font-size: 0.8125rem; }
.btn.block { width: 100%; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* Messages */
.messages { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); border-left: 3px solid var(--accent); }
.messages .success { border-left-color: var(--ok); }
.messages .error { border-left-color: var(--danger); }
.messages .warning { border-left-color: var(--warn); }

.hero { max-width: 560px; margin: 40px auto 0; }
.hero h1 { font-size: 1.75rem; }
.hero > * + * { margin-top: 16px; }
.hero ul { padding-left: 18px; color: var(--muted); }
.hero li + li { margin-top: 6px; }
.hero li strong { color: var(--text); }

@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .nav { order: 2; flex-basis: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .columns, .grid-3 { grid-template-columns: 1fr; }
  .thumb.lg { width: 72px; height: 72px; }
}

/* Pages génériques d'allauth */
main.allauth { max-width: 440px; }
main.allauth h1 { margin-bottom: 12px; }
main.allauth p { margin-bottom: 12px; }
main.allauth form { margin-top: 8px; }

.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }
.stats.three { grid-template-columns: repeat(3, 1fr); margin: 0; }
