/* ============================================================
   Charte Com'Ain — plateforme d'édition
   Tokens repris à l'identique du site comain.fr
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Figtree:wght@400;500;600;700&family=Caveat:wght@600;700&display=swap');

:root {
  /* Palette exacte Com'Ain */
  --cream: #fff7f0;
  --peach: #ffebdc;
  --lilac: #f1eafd;
  --rose: #fde3f0;
  --white: #ffffff;
  --ink: #33203b;
  --ink-soft: #6e5c77;
  --pink: #e93e8f;
  --orange: #f7793b;
  --violet: #7a4fd0;
  --dark: #16121f;

  --grad: linear-gradient(100deg, var(--pink), var(--orange));
  --grad-v: linear-gradient(135deg, var(--violet), var(--pink));
  --line: rgba(51, 32, 59, 0.13);
  --shadow: 0 14px 40px -18px rgba(51, 32, 59, 0.28);
  --radius: 22px;

  --font-display: "Bricolage Grotesque", "Arial Black", sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Caveat", "Segoe Script", cursive;

  /* Rôles */
  --bg: var(--cream);
  --panel: var(--white);
  --accent: var(--orange);
  --border: var(--line);
  --warn: var(--pink);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}

/* Accent manuscrit (comme sur comain.fr) */
.hand { font-family: var(--font-hand); font-weight: 700; color: var(--violet); font-size: 1.5rem; }

button, input, select, textarea { font: inherit; }

/* ---------- Boutons ---------- */
.btn {
  background: var(--grad);
  background-size: 140% 140%;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 11px 22px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 20px -10px rgba(233, 62, 143, 0.65);
}
.btn:hover { filter: brightness(1.05) saturate(1.05); box-shadow: 0 12px 26px -10px rgba(233, 62, 143, 0.75); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--white);
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--peach); border-color: transparent; filter: none; }
.btn.danger { background: var(--pink); box-shadow: 0 8px 20px -10px rgba(233, 62, 143, 0.7); }
.btn.danger:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; filter: grayscale(0.3); }

/* ---------- Cartes ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* ---------- Formulaires ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(247, 121, 59, 0.18);
}
label { display: block; margin: 16px 0 5px; font-size: 0.9rem; font-weight: 600; color: var(--ink-soft); }

/* ---------- Barre supérieure ---------- */
.topbar {
  background: var(--ink);
  color: #fff7f0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 5;
}
.topbar h1 { font-size: 1.05rem; margin: 0; color: #fff7f0; font-weight: 700; }
.topbar .muted { color: rgba(255, 247, 240, 0.72); }

/* Logo Com'Ain (image officielle) */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; }
.brand img { height: 30px; width: auto; display: block; }
.brand small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8rem;
  color: rgba(255, 247, 240, 0.7);
  border-left: 1px solid rgba(255, 247, 240, 0.28);
  padding-left: 12px;
}

/* ---------- Mise en page ---------- */
.container { max-width: 1000px; margin: 40px auto; padding: 0 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.muted { color: var(--ink-soft); font-size: 0.9rem; }
.error { color: var(--pink); margin-top: 10px; font-weight: 600; }

/* ---------- Tableaux ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
th { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- Fenêtres modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(22, 18, 31, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(3px);
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 28px;
  width: min(560px, 92vw); max-height: 85vh; overflow: auto; box-shadow: var(--shadow);
}
