:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1a1f2e;
  --sidebar-text: #a8b2c8;
  --sidebar-active: #4f8ef7;
  --topbar-h: 60px;
  --primary: #1a6e3c;
  --primary-light: #28a745;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f0f2f5;
  margin: 0;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  overflow-y: auto;
  z-index: 1000;
  transition: transform .3s ease;
}

.sidebar-brand {
  padding: 1.2rem 1.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
}

.sidebar-nav { list-style: none; padding: .5rem 0; margin: 0; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .9rem;
  transition: all .2s;
}
.sidebar-nav li a:hover, .sidebar-nav li a.active {
  background: rgba(79,142,247,.15);
  color: #fff;
  border-left: 3px solid var(--sidebar-active);
}
.sidebar-nav li a.active { color: var(--sidebar-active); }
.sidebar-section {
  padding: 1rem 1.5rem .3rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #5a647a;
}

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin .3s ease;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── Cards ── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.stat-card .stat-icon {
  width: 50px; height: 50px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: #1a202c; }
.stat-card .stat-label { font-size: .8rem; color: #718096; text-transform: uppercase; letter-spacing: .5px; }

/* ── Tables ── */
.table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  overflow: hidden;
}
.table-card .table { margin: 0; }
.table th { background: #f8fafc; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: #64748b; }
.table td { vertical-align: middle; font-size: .9rem; }

/* ── Badges statut ── */
.badge-brouillon { background: #94a3b8; }
.badge-envoyee { background: #3b82f6; }
.badge-payee { background: #22c55e; }
.badge-annulee { background: #ef4444; }
.badge-retard { background: #f97316; }

/* ── Forms ── */
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* ── Ligne facture formset ── */
.ligne-row { background: #f8fafc; border-radius: 8px; padding: .75rem; margin-bottom: .5rem; }
.ligne-row:hover { background: #f0f4ff; }

/* ── Login page ── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1f2e 0%, #1a6e3c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { font-size: 2.5rem; color: var(--primary); }

/* ── Responsive mobile ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .stat-value { font-size: 1.3rem !important; }
}

/* ── Chart containers ── */
.chart-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin: 0 !important; }
  body { background: #fff !important; }
}

/* ── Overlay mobile ── */
.sidebar-overlay {
  display: none;
  position: fixed; top:0; left:0;
  width:100%; height:100%;
  background: rgba(0,0,0,.5);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }
