/* ==========================================================================
   OptiGest Lead - Feuille de style principale
   Theme : fond blanc dynamique (degrades animes + verre depoli)
   ========================================================================== */

:root {
  /* Palette */
  --c-bg: #ffffff;
  --c-surface: rgba(255, 255, 255, 0.78);
  --c-surface-solid: #ffffff;
  --c-border: rgba(15, 23, 42, 0.08);
  --c-border-strong: rgba(15, 23, 42, 0.14);

  --c-text: #0f172a;
  --c-text-soft: #475569;
  --c-text-mute: #94a3b8;

  --c-primary: #4f46e5;
  --c-primary-dark: #4338ca;
  --c-primary-soft: #eef2ff;

  --c-accent: #0ea5e9;
  --c-success: #16a34a;
  --c-success-soft: #f0fdf4;
  --c-warn: #d97706;
  --c-warn-soft: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-soft: #fef2f2;

  /* Rayons + ombres */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  --sh-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sh-md: 0 6px 20px -6px rgba(15, 23, 42, 0.12);
  --sh-lg: 0 24px 60px -20px rgba(15, 23, 42, 0.22);

  --t-fast: 140ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-med: 260ms cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-w: 258px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ----- Fond blanc dynamique : taches de couleur animees ------------------ */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 8% -10%, #eef2ff 0%, transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, #ecfeff 0%, transparent 55%),
    radial-gradient(900px 700px at 50% 115%, #f5f3ff 0%, transparent 60%),
    #ffffff;
}

.bg-decor span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.bg-decor span:nth-child(1) {
  width: 460px; height: 460px; top: -140px; left: -90px;
  background: radial-gradient(circle at 30% 30%, #c7d2fe, transparent 70%);
  animation: float-a 22s ease-in-out infinite;
}
.bg-decor span:nth-child(2) {
  width: 520px; height: 520px; top: 8%; right: -170px;
  background: radial-gradient(circle at 60% 40%, #a5f3fc, transparent 70%);
  animation: float-b 27s ease-in-out infinite;
}
.bg-decor span:nth-child(3) {
  width: 400px; height: 400px; bottom: -150px; left: 28%;
  background: radial-gradient(circle at 50% 50%, #ddd6fe, transparent 70%);
  animation: float-c 31s ease-in-out infinite;
}
.bg-decor span:nth-child(4) {
  width: 320px; height: 320px; bottom: 12%; right: 18%;
  background: radial-gradient(circle at 50% 50%, #fce7f3, transparent 70%);
  animation: float-a 25s ease-in-out infinite reverse;
}

@keyframes float-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(70px, 60px) scale(1.12); }
}
@keyframes float-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-90px, 80px) scale(1.08); }
}
@keyframes float-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(60px, -70px) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-decor span { animation: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ----- Typographie de base ---------------------------------------------- */
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 1.62rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }
p  { margin: 0; }
a  { color: var(--c-primary); }

.muted { color: var(--c-text-soft); }
.mute-xs { color: var(--c-text-mute); font-size: 0.82rem; }
.txt-right { text-align: right; }
.txt-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* ----- Utilitaires ------------------------------------------------------- */
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ==========================================================================
   ECRANS PLEIN ECRAN (installation / connexion)
   ========================================================================== */
.fullscreen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--c-surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: 34px 32px 30px;
  animation: card-in var(--t-med) both;
}
.auth-card.wide { max-width: 560px; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand-logo {
  width: 46px; height: 46px;
  flex: none;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  box-shadow: 0 8px 22px -8px rgba(79, 70, 229, 0.7);
}
.brand-name { font-weight: 700; font-size: 1.06rem; letter-spacing: -0.02em; }
.brand-tag { font-size: 0.78rem; color: var(--c-text-mute); }

/* ==========================================================================
   FORMULAIRES
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-soft);
}
.field-hint { font-size: 0.76rem; color: var(--c-text-mute); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.col-span-2 { grid-column: span 2; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
}

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--c-text);
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  appearance: none;
}
textarea { min-height: 78px; resize: vertical; }

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3.5px rgba(79, 70, 229, 0.16);
}

input:disabled, input[readonly], select:disabled, textarea[readonly] {
  background: #f8fafc;
  color: var(--c-text-soft);
  cursor: not-allowed;
  box-shadow: none;
}
input[readonly]:focus { border-color: var(--c-border-strong); box-shadow: none; }

/* Champ calcule / figé mis en valeur */
.field.computed input {
  background: var(--c-primary-soft);
  border-color: rgba(79, 70, 229, 0.22);
  color: var(--c-primary-dark);
  font-weight: 650;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: #fff;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.check:hover { border-color: var(--c-primary); transform: translateY(-1px); }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--c-primary); flex: none; cursor: pointer; }
.check-body { display: flex; flex-direction: column; }
.check-title { font-weight: 600; font-size: 0.88rem; }
.check-sub { font-size: 0.76rem; color: var(--c-text-mute); }
.check.on { border-color: var(--c-primary); background: var(--c-primary-soft); }

/* ==========================================================================
   BOUTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  padding: 11px 17px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: #fff;
  color: var(--c-text);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn svg { width: 17px; height: 17px; flex: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), #6366f1);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(79, 70, 229, 0.9);
}
.btn-primary:hover { box-shadow: 0 14px 30px -12px rgba(79, 70, 229, 0.95); }

.btn-accent {
  background: linear-gradient(135deg, #0284c7, var(--c-accent));
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(14, 165, 233, 0.9);
}

.btn-success {
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(22, 163, 74, 0.85);
}

.btn-ghost { background: #fff; border-color: var(--c-border-strong); color: var(--c-text-soft); box-shadow: var(--sh-sm); }
.btn-ghost:hover { border-color: var(--c-primary); color: var(--c-primary); }

.btn-danger { background: var(--c-danger-soft); color: var(--c-danger); border-color: rgba(220, 38, 38, 0.22); }
.btn-danger:hover { background: var(--c-danger); color: #fff; border-color: transparent; }

.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 0.98rem; }
.btn-sm { padding: 7px 11px; font-size: 0.82rem; border-radius: var(--r-sm); }

/* Bouton icone dans les tableaux */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--c-text-soft);
  cursor: pointer;
  transition: all var(--t-fast);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--c-primary); border-color: var(--c-primary); background: var(--c-primary-soft); }
.icon-btn.danger:hover { color: #fff; background: var(--c-danger); border-color: var(--c-danger); }

/* ==========================================================================
   MISE EN PAGE APPLICATION
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-text-mute);
  padding: 0 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-weight: 550;
  color: var(--c-text-soft);
  background: transparent;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: rgba(79, 70, 229, 0.07); color: var(--c-primary); transform: translateX(2px); }
.nav-item.active { background: var(--c-primary-soft); color: var(--c-primary-dark); font-weight: 650; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--c-primary);
}
.nav-lock { margin-left: auto; opacity: 0.5; }
.nav-lock svg { width: 14px; height: 14px; }

.sidebar-user {
  margin-top: auto;
  padding: 12px;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid var(--c-border);
  box-shadow: var(--sh-sm);
}
.avatar {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
}
.user-name { font-weight: 650; font-size: 0.88rem; line-height: 1.3; }
.user-role { font-size: 0.74rem; color: var(--c-text-mute); }

/* Contenu principal */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.burger { display: none; }

.content { padding: 26px; flex: 1; }
.view { animation: view-in var(--t-med) both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head .subtitle { color: var(--c-text-soft); font-size: 0.9rem; margin-top: 3px; }

/* ==========================================================================
   CARTES
   ========================================================================== */
.card {
  background: var(--c-surface);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
}
.card-body { padding: 20px; }
.card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Cartes modules de l'accueil */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 18px;
}
.module-card {
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 22px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  background: var(--c-surface);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--sh-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.module-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.07), transparent 60%);
  opacity: 0;
  transition: opacity var(--t-med);
  pointer-events: none;
}
.module-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); border-color: rgba(79, 70, 229, 0.3); }
.module-card:hover::after { opacity: 1; }
.module-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--c-primary), #6366f1);
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, 0.8);
}
.module-icon svg { width: 23px; height: 23px; }
.module-card.i-stock .module-icon { background: linear-gradient(135deg, #0284c7, #22d3ee); box-shadow: 0 10px 22px -10px rgba(2, 132, 199, 0.8); }
.module-card.i-vente .module-icon { background: linear-gradient(135deg, #7c3aed, #a78bfa); box-shadow: 0 10px 22px -10px rgba(124, 58, 237, 0.8); }
.module-card.i-journal .module-icon { background: linear-gradient(135deg, #15803d, #4ade80); box-shadow: 0 10px 22px -10px rgba(21, 128, 61, 0.8); }
.module-card.i-acces .module-icon { background: linear-gradient(135deg, #db2777, #fb7185); box-shadow: 0 10px 22px -10px rgba(219, 39, 119, 0.8); }
.module-title { font-weight: 700; font-size: 1.04rem; letter-spacing: -0.02em; }
.module-desc { font-size: 0.85rem; color: var(--c-text-soft); }

/* Statistiques */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.stat {
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--sh-sm);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.stat-label {
  font-size: 0.74rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--c-text-mute);
}
.stat-value {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; margin-top: 4px;
}
.stat-sub { font-size: 0.78rem; color: var(--c-text-soft); }
.stat.pos .stat-value { color: var(--c-success); }
.stat.neg .stat-value { color: var(--c-danger); }
.stat.hl .stat-value { color: var(--c-primary); }

/* ==========================================================================
   TABLEAUX
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-mute);
  padding: 11px 14px;
  background: rgba(248, 250, 252, 0.85);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
table.data tbody tr { transition: background var(--t-fast); }
table.data tbody tr:hover { background: rgba(79, 70, 229, 0.045); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tfoot td {
  padding: 12px 14px;
  font-weight: 700;
  background: rgba(248, 250, 252, 0.9);
  border-top: 2px solid var(--c-border-strong);
}
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--c-text-mute);
}
.empty svg { width: 40px; height: 40px; opacity: 0.35; margin-bottom: 10px; }
.empty-title { font-weight: 650; color: var(--c-text-soft); }

/* ----- Badges ----------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-green  { background: var(--c-success-soft); color: #15803d; border-color: rgba(22, 163, 74, 0.2); }
.badge-amber  { background: var(--c-warn-soft); color: #b45309; border-color: rgba(217, 119, 6, 0.22); }
.badge-red    { background: var(--c-danger-soft); color: #b91c1c; border-color: rgba(220, 38, 38, 0.2); }
.badge-indigo { background: var(--c-primary-soft); color: var(--c-primary-dark); border-color: rgba(79, 70, 229, 0.2); }
.badge-cyan   { background: #ecfeff; color: #0e7490; border-color: rgba(14, 165, 233, 0.22); }
.badge-gray   { background: #f1f5f9; color: #475569; border-color: rgba(71, 85, 105, 0.18); }

/* ==========================================================================
   MODALES
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
  animation: fade-in var(--t-fast) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 560px;
  background: var(--c-surface-solid);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  border: 1px solid var(--c-border);
  overflow: hidden;
  animation: modal-in var(--t-med) both;
  margin: auto;
}
.modal.md { max-width: 680px; }
.modal.lg { max-width: 860px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--c-border);
}
.modal-title { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-sub { font-size: 0.82rem; color: var(--c-text-mute); margin-top: 2px; }
.modal-close {
  margin-left: auto;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-text-mute);
  cursor: pointer;
  transition: all var(--t-fast);
}
.modal-close:hover { background: #f1f5f9; color: var(--c-text); }
.modal-close svg { width: 17px; height: 17px; }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow-y: auto; }
.modal-foot {
  padding: 15px 22px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  background: #fbfcfe;
}

/* ==========================================================================
   ALERTES / NOTIFICATIONS
   ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 0.87rem;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-error { background: var(--c-danger-soft); color: #991b1b; border-color: rgba(220, 38, 38, 0.2); }
.alert-warn  { background: var(--c-warn-soft); color: #92400e; border-color: rgba(217, 119, 6, 0.22); }
.alert-info  { background: var(--c-primary-soft); color: var(--c-primary-dark); border-color: rgba(79, 70, 229, 0.2); }
.alert-ok    { background: var(--c-success-soft); color: #166534; border-color: rgba(22, 163, 74, 0.2); }

#toasts {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 44px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--c-border-strong);
  box-shadow: var(--sh-lg);
  font-size: 0.88rem;
  animation: toast-in var(--t-med) both;
  border-left: 4px solid var(--c-primary);
}
.toast.leaving { animation: toast-out var(--t-fast) both; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok    { border-left-color: var(--c-success); color: #14532d; }
.toast.err   { border-left-color: var(--c-danger); color: #7f1d1d; }
.toast.warn  { border-left-color: var(--c-warn); color: #78350f; }
.toast.info  { border-left-color: var(--c-primary); color: var(--c-primary-dark); }
@keyframes toast-in  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* ----- Ecran acces refuse ---------------------------------------------- */
.denied {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
  padding: 40px 30px;
  background: var(--c-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
}
.denied-icon {
  width: 66px; height: 66px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--c-danger);
  background: var(--c-danger-soft);
  border: 1px solid rgba(220, 38, 38, 0.2);
}
.denied-icon svg { width: 30px; height: 30px; }
.denied h2 { margin-bottom: 8px; }
.denied p { color: var(--c-text-soft); margin-bottom: 22px; }

/* ==========================================================================
   ETAT IMPRIMABLE DU JOURNAL
   ========================================================================== */
.print-sheet {
  background: #fff;
  color: #000;
  padding: 26px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.print-sheet h2 { text-align: center; }
.print-head { text-align: center; margin-bottom: 20px; }
.print-period { font-size: 0.9rem; color: #444; margin-top: 4px; }
.print-sheet table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.print-sheet th, .print-sheet td { border: 1px solid #cbd5e1; padding: 6px 9px; }
.print-sheet th { background: #f1f5f9; text-align: left; }
.print-sheet tfoot td { font-weight: 700; background: #f8fafc; }
.print-sign { margin-top: 34px; display: flex; justify-content: space-between; font-size: 0.82rem; }

@media print {
  body * { visibility: hidden !important; }
  #print-area, #print-area * { visibility: visible !important; }
  #print-area {
    position: absolute;
    inset: 0;
    display: block !important;
    padding: 0;
    border: 0;
  }
  .bg-decor { display: none !important; }
  .no-print { display: none !important; }
  @page { size: A4; margin: 14mm; }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .burger {
    display: inline-grid;
    place-items: center;
    width: 38px; height: 38px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-sm);
    background: #fff;
    cursor: pointer;
    color: var(--c-text-soft);
  }
  .burger svg { width: 18px; height: 18px; }
  .sidebar {
    position: fixed;
    z-index: 60;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform var(--t-med);
    box-shadow: var(--sh-lg);
    background: #fff;
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(15, 23, 42, 0.35);
    animation: fade-in var(--t-fast) both;
  }
  .content { padding: 18px 14px; }
  .topbar { padding: 12px 14px; }
}
