:root {
  --purple: #721CD1;
  --purple-light: #9b4dca;
  --purple-bg: rgba(114, 28, 209, 0.06);
  --purple-softer: rgba(114, 28, 209, 0.12);
  --text: #1a1a1a;
  --text-dim: hsl(0, 0%, 40%);
  --surface: hsl(0, 0%, 97%);
  --bg: #ffffff;
  --border: hsl(0, 0%, 88%);
  --border-light: hsl(0, 0%, 93%);
  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.08);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.08);
  --orange: #f97316;
  --orange-bg: rgba(249, 115, 22, 0.08);
  --yellow-bg: rgba(234, 179, 8, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Main content ───────────────────────────────────── */
main {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  flex: 1;
}

/* ── Typography ─────────────────────────────────────── */
h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

p { line-height: 1.6; }

a { color: var(--purple); }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link .card {
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card-link:hover .card {
  border-color: var(--purple);
  box-shadow: 0 2px 12px rgba(114, 28, 209, 0.1);
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
}

summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

.btn-primary {
  background: var(--purple);
  color: white;
}

.btn-primary:hover {
  background: var(--purple-light);
}

.btn-secondary {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--purple-softer);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.15);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover {
  color: var(--purple);
  background: var(--purple-bg);
}

/* ── Forms ──────────────────────────────────────────── */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.3rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(114, 28, 209, 0.12);
}

input::placeholder { color: var(--text-dim); opacity: 0.6; }

/* Une case garde sa taille : à 100 %, une case cachée en position
   absolue prend la largeur de l'écran et déborde (DCM2-23). */
input[type="checkbox"], input[type="radio"] { width: auto; }

.form-group { margin-bottom: 1rem; }

/* ── Tables ─────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

tr:hover td { background: var(--purple-bg); }

/* ── Listes (_list.html, DCM2-70) ───────────────────── */
.list-search { display: flex; gap: 0.5rem; flex-wrap: wrap; flex: 1 1 16rem; max-width: 36rem; }
.list-search input[type="search"] { flex: 1 1 12rem; width: auto; }
.list-search select { width: auto; }
.list-summary { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin-bottom: 0.5rem; }
.list-size { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; font-weight: 400;
  font-size: inherit; color: inherit; }
.list-size select { width: auto; padding: 0.2rem 0.4rem; }
.list-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.list-sort:hover { color: var(--purple); }
th[aria-sort] .list-sort { color: var(--text); }
.list-pager { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.list-region.htmx-request { opacity: 0.6; transition: opacity 0.15s; }
/* Un tableau plus large que l'écran défile dans sa carte, pas la page (DCM2-23). */
.list-region .card, .card > .list-region { overflow-x: auto; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success { background: var(--green-bg); color: var(--green); }
.badge-warning { background: var(--yellow-bg); color: #b45309; }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-info { background: var(--purple-bg); color: var(--purple); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-neutral { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }
/* La saison d'un projet à côté de son nom, partout où on l'écrit (DCM2-54, _season.html). */
.season-pill { flex: none; display: inline-block; margin-left: 0.35em; padding: 0 0.4em;
  border: 1px solid currentColor; border-radius: 999px; font-size: 0.75em; font-weight: 600;
  line-height: 1.4; vertical-align: 0.1em; opacity: 0.6; }

/* ── Flashes ────────────────────────────────────────── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }

/* ── Grid layout ───────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* ── Stats ──────────────────────────────────────────── */
.stat { text-align: center; padding: 1.25rem; }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--purple);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

/* ── Divider ────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* ── Step indicator ─────────────────────────────────── */
.steps {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0;
}

.step-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s;
}

.step-dot.active { background: var(--purple); }
.step-dot.done { background: var(--purple-light); }

/* ── Page header ───────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ── Empty state ───────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-dim);
}

/* ── Code ───────────────────────────────────────────── */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  background: var(--purple-bg);
  color: var(--purple);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
}

/* ── Utilities ──────────────────────────────────────── */
.text-muted { color: var(--text-dim); }
.text-sm { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ── Footer ─────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

footer a { color: var(--purple-light); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  main { padding: 1.5rem 1rem 3rem; }
  .grid { grid-template-columns: 1fr; }
}
