/* ============================================================================
   Sodiscol PND — Design system (refonte 2026)
   Marque : navy + bleu confiance + orange solaire. Polices Space Grotesk
   (titres) / Hanken Grotesk (interface). Les classes utilitaires historiques
   (.card .btn .pill .alert .input table .grid .row .stack .muted .delete-x)
   sont conservées et restylées : les templates existants se modernisent sans
   réécriture. Layout = rail latéral fixe + zone de contenu scrollable.
   ============================================================================ */

:root {
  /* Palette */
  --navy: #0a2540;
  --navy-2: #0d2c50;
  --navy-3: #091f39;
  --blue: #1f5fa8;
  --blue-dark: #1a508f;
  --blue-soft: #e2ecf8;
  --blue-soft-2: #f1f6fc;
  --orange: #f6a821;
  --orange-hi: #ffb733;
  --orange-ink: #3d2600;

  --bg: #f4f7fb;
  --surface: #ffffff;
  --border: #e3e8ef;
  --border-2: #eef2f7;

  --text: #0a2540;
  --muted: #51617a;
  --muted-2: #8493a8;
  --muted-3: #9aa8bb;

  --ok: #16a34a;        --ok-ink: #15803d;   --ok-soft: #e8f6ee;
  --danger: #dc2626;    --danger-ink: #b91c1c; --danger-soft: #fdecea;
  --warn: #b45309;      --warn-soft: #fef3e2;

  /* Compat : ancien thème basé sur --primary/--secondary */
  --primary: var(--blue);
  --secondary: var(--navy);

  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --r-card: 14px;
  --r-btn: 11px;
  --r-input: 10px;
  --shadow-card: 0 1px 2px rgba(16, 27, 45, 0.04);
  --shadow-pop: 0 20px 50px -20px rgba(10, 37, 64, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
::selection { background: #f6a82144; }

h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 28px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
p, ul, ol { line-height: 1.55; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-head); font-size: .92em; }

/* ===== Scrollbar ===== */
.scrollin::-webkit-scrollbar, .main::-webkit-scrollbar { width: 10px; }
.scrollin::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb {
  background: #cdd9e8; border-radius: 99px; border: 3px solid var(--bg);
}

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================================
   LAYOUT — rail latéral + contenu
   ============================================================================ */
.app-shell { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }

.sidebar {
  width: 236px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-2), var(--navy-3));
  display: flex; flex-direction: column;
  padding: 18px 14px; color: #cddbed;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #ffd267, var(--orange) 60%, #ef8a1e);
}
.brand-mark img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: #fff; line-height: 1; }
.brand-sub { font-size: 10px; color: #7e96b5; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 2px; }

.sidebar-cta {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; height: 46px; margin-bottom: 22px;
  background: var(--orange); color: var(--orange-ink);
  border: none; border-radius: var(--r-btn);
  font-family: var(--font-head); font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: 0 6px 16px -6px #f6a82188; text-decoration: none;
}
.sidebar-cta:hover { background: var(--orange-hi); text-decoration: none; }

.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #5d7499; padding: 0 8px; margin-bottom: 8px; opacity: 0.6;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; font-size: 14.5px; font-weight: 600;
  color: #cddbed; text-decoration: none;
}
.nav-link:hover { background: #ffffff14; text-decoration: none; }
.nav-link.active { background: #ffffff1f; color: #fff; }
.nav-link svg { flex-shrink: 0; }
.sidebar-spacer { flex: 1; }
.sidebar-divider { height: 1px; background: #ffffff14; margin: 12px 4px; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--orange); color: var(--orange-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-head);
}
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who .name { font-size: 13.5px; font-weight: 600; color: #fff; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who .role { font-size: 11px; color: #7e96b5; }
.sidebar-user .logout { background: transparent; border: 0; padding: 4px; cursor: pointer;
  color: #7e96b5; display: flex; align-items: center; }
.sidebar-user .logout:hover { color: #fff; }

.main { flex: 1; overflow-y: auto; position: relative; }
.main-inner { max-width: 1080px; margin: 0 auto; padding: 40px 44px 90px; }
.main-inner.wide { max-width: 1180px; }

/* Layout centré pour les pages sans session (login) */
.bare-shell { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 20px; background: var(--bg); }
.bare-shell .bare-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; }

/* ===== Eyebrow / hero ===== */
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-head); font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--blue); background: var(--blue-soft);
  padding: 5px 11px; border-radius: 7px; margin-bottom: 14px;
}
.page-sub { font-size: 14.5px; color: var(--muted); margin: 0 0 24px; max-width: 600px; line-height: 1.5; }

/* ============================================================================
   COMPOSANTS
   ============================================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.card h2:first-child, .card h2[style*="margin-top:0"] { margin-top: 0; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-btn);
  background: var(--navy-2); color: #fff; text-decoration: none; border: 0;
  font-family: var(--font-head); font-size: 14px; font-weight: 600; cursor: pointer;
  line-height: 1; transition: background .15s ease;
}
.btn:hover { background: #143a66; text-decoration: none; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -8px var(--blue); }
.btn.primary:hover { background: var(--blue-dark); }
.btn.accent { background: var(--orange); color: var(--orange-ink); box-shadow: 0 6px 16px -6px #f6a82188; }
.btn.accent:hover { background: var(--orange-hi); }
.btn.secondary { background: #fff; color: var(--blue); border: 1px solid #cfdcec; box-shadow: none; }
.btn.secondary:hover { background: var(--blue-soft-2); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f4cfcf; box-shadow: none; }
.btn.danger:hover { background: var(--danger-soft); }

/* Champs */
.input, select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid #cfdcec; border-radius: var(--r-input);
  font-size: 14.5px; font-family: var(--font-body); color: var(--text); background: #fff;
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border-2); font-size: 14px; vertical-align: top; }
th {
  background: var(--bg); font-family: var(--font-head); font-weight: 600; font-size: 10.5px;
  color: var(--muted-3); text-transform: uppercase; letter-spacing: .06em;
}

/* Pills / badges */
.pill { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.gap { background: var(--danger-soft); color: var(--danger-ink); }
.pill.info { background: var(--blue-soft); color: var(--blue); }
.badge-ready { font-size: 12px; font-weight: 600; color: var(--ok-ink); background: var(--ok-soft); padding: 4px 10px; border-radius: 999px; }
.badge-draft { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 4px 10px; border-radius: 999px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--r-input); font-size: 14px; margin-bottom: 16px; }
.alert.error { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid #f6c9c9; }
.alert.success { background: var(--ok-soft); color: var(--ok-ink); border: 1px solid #b7e3c6; }
.alert.info { background: var(--blue-soft); color: var(--blue); border: 1px solid #c9ddf3; }

/* Utilitaires */
.muted { color: var(--muted-2); font-size: 13px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
@media (max-width: 760px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}

/* Stat cards (dashboard / admin) */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow-card); }
.stat-big { font-family: var(--font-head); font-size: 34px; font-weight: 700; line-height: 1; }
.stat-ico { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }

/* Chips (filtres catalogue) */
.chip {
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: #fff; border: 1px solid #dde6f1; padding: 7px 14px; border-radius: 999px;
  cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }

/* Croix de suppression générique */
.delete-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--danger-ink);
  font-size: 18px; line-height: 1; padding: 0; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.delete-x:hover { background: var(--danger-soft); }
.delete-x[disabled] { opacity: .4; cursor: wait; }

footer.app-footer { text-align: center; font-size: 12px; color: var(--muted-2); padding: 18px; }
