/* ============================================================
   3A+ TRANSIT-TRANSPORT — Charte Graphique Officielle
   Bleu: #1277BD | Orange: #EE7E23 | Gris: #666666
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Couleurs 3A+ officielles ── */
  --primary:      #1277BD;
  --primary-dark: #0d5a91;
  --primary-deep: #094876;
  --primary-light:#1a8fd4;
  --primary-pale: #e8f4fd;

  --accent:       #EE7E23;
  --accent-dark:  #d06b17;
  --accent-light: #f5a05a;
  --accent-pale:  #fef3e8;

  --grey:         #666666;
  --grey-light:   #999999;
  --grey-dark:    #444444;

  /* ── Sémantique ── */
  --success:      #16a34a;
  --success-pale: #dcfce7;
  --warning:      #d97706;
  --warning-pale: #fef3c7;
  --danger:       #dc2626;
  --danger-pale:  #fee2e2;
  --info:         #1277BD;
  --info-pale:    #e8f4fd;

  /* ── Layout ── */
  --sidebar-w:    265px;
  --sidebar-w-col:70px;
  --header-h:     62px;

  /* ── Surfaces ── */
  --bg:           #f0f5fa;
  --surface:      #ffffff;
  --surface-2:    #f8fbff;
  --border:       #dde8f0;
  --border-light: #eef4f9;

  /* ── Texte ── */
  --text:         #1a2535;
  --text-light:   #5a7a96;
  --text-muted:   #8fa8be;

  /* ── Ombres ── */
  --shadow-xs:    0 1px 2px rgba(18,119,189,.06);
  --shadow-sm:    0 2px 8px rgba(18,119,189,.08), 0 1px 3px rgba(18,119,189,.05);
  --shadow:       0 4px 16px rgba(18,119,189,.10), 0 2px 6px rgba(18,119,189,.06);
  --shadow-lg:    0 12px 32px rgba(18,119,189,.14), 0 4px 12px rgba(18,119,189,.08);
  --shadow-xl:    0 24px 48px rgba(18,119,189,.18);

  /* ── Formes ── */
  --radius-xs:    4px;
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    18px;
  --radius-xl:    24px;

  /* ── Transitions ── */
  --trans:        .2s cubic-bezier(.4,0,.2,1);
  --trans-slow:   .35s cubic-bezier(.4,0,.2,1);
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 14px; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========== LAYOUT ========== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary-deep) 0%, var(--primary-dark) 60%, #0a3d5e 100%);
  color: rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: width var(--trans-slow), transform var(--trans-slow);
  overflow: hidden;
  box-shadow: 4px 0 20px rgba(9,72,118,.25);
}

.sidebar.collapsed { width: var(--sidebar-w-col); }

/* Logo sidebar */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 72px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  flex-shrink: 0;
  background: rgba(0,0,0,.15);
  position: relative;
}

.sidebar-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

.sidebar-logo-text { overflow: hidden; white-space: nowrap; }
.sidebar-logo-text .brand {
  font-size: 15px; font-weight: 800; color: #fff;
  letter-spacing: -.3px; line-height: 1.2;
}
.sidebar-logo-text .brand span { color: var(--accent); }
.sidebar-logo-text .sub {
  font-size: 9px; color: rgba(255,255,255,.45);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 1px;
}

/* Nav */
.sidebar-nav { flex: 1; padding: 10px 0 8px; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.nav-section-label {
  padding: 10px 16px 3px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255,255,255,.28);
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--trans);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: rgba(255,255,255,.68);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  transition: all var(--trans);
  white-space: nowrap; overflow: hidden;
  position: relative; font-size: 13px; font-weight: 500;
}

.nav-item:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(238,126,35,.35);
}

.nav-icon {
  font-size: 17px; flex-shrink: 0; width: 22px;
  text-align: center; line-height: 1;
}

.sidebar.collapsed .nav-label { opacity: 0; width: 0; }
.nav-label { transition: opacity var(--trans); }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 10px 8px 12px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  overflow: hidden; white-space: nowrap;
  background: rgba(255,255,255,.05);
  margin-bottom: 4px;
}

.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(238,126,35,.4);
}

.sidebar-user-info .name { font-size: 12px; font-weight: 600; color: #fff; }
.sidebar-user-info .role { font-size: 10px; color: rgba(255,255,255,.4); text-transform: capitalize; }

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--trans-slow);
  min-width: 0;
}

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-col); }

/* ========== TOP BAR ========== */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-toggle {
  width: 36px; height: 36px; border: none;
  background: none; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 20px;
  transition: all var(--trans); flex-shrink: 0;
}
.topbar-toggle:hover { background: var(--primary-pale); color: var(--primary); }

.topbar-brand {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
}

.topbar-brand-logo {
  height: 36px; width: auto; object-fit: contain;
  display: none;
}

.topbar-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.topbar-btn {
  width: 36px; height: 36px; border: none; background: none;
  border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 17px;
  transition: all var(--trans); position: relative;
}
.topbar-btn:hover { background: var(--primary-pale); color: var(--primary); }
.topbar-btn .notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--surface);
}

.topbar-period {
  display: none;
  align-items: center; gap: 6px;
  background: var(--primary-pale);
  padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; color: var(--primary);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .topbar-period { display: flex; }
}

/* ========== PAGE CONTENT ========== */
.page-content { flex: 1; padding: 20px; }

@media (min-width: 768px) { .page-content { padding: 24px; } }
@media (min-width: 1280px) { .page-content { padding: 28px 32px; } }

/* Page header */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: clamp(17px, 2.5vw, 22px);
  font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.page-header-left p {
  font-size: 12px; color: var(--text-light); margin-top: 3px;
}

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========== CARDS ========== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

.card-header h3 {
  font-size: 13px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}

.card-header h3 .icon { color: var(--primary); }

.card-body { padding: 18px; }

/* ========== KPI CARDS ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 480px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 640px)  { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
@media (min-width: 1200px) { .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; } }

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: transform var(--trans), box-shadow var(--trans);
  cursor: default;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary);
  border-radius: var(--radius) var(--radius) 0 0;
}

.kpi-card.accent::before  { background: var(--accent); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.danger::before  { background: var(--danger); }
.kpi-card.info::before    { background: var(--primary); }

.kpi-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-light); margin-bottom: 8px;
}

.kpi-value {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 5px;
}

.kpi-value.sm {
  font-size: clamp(14px, 2vw, 19px);
  font-weight: 700;
}

.kpi-sub {
  font-size: 11px; color: var(--text-light);
  display: flex; align-items: center; gap: 4px;
}

.kpi-icon {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: clamp(28px, 4vw, 40px); opacity: .07;
  pointer-events: none;
}

/* ========== TABLES ========== */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

thead th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 10px 12px;
  text-align: left; font-weight: 700;
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--trans); }
tbody tr:hover { background: var(--primary-pale); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 9px 12px; color: var(--text); vertical-align: middle; }

tfoot td {
  padding: 9px 12px; font-weight: 700;
  background: linear-gradient(0, var(--primary-pale), var(--surface));
  border-top: 2px solid var(--primary);
  font-size: 11px;
}

.td-num  { text-align: right; font-variant-numeric: tabular-nums; font-family: 'Inter', monospace; }
.td-mono { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 11.5px; }

/* ========== BADGES ========== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  white-space: nowrap; letter-spacing: .3px;
}

.badge-success   { background: var(--success-pale); color: #15803d; }
.badge-warning   { background: var(--warning-pale); color: #b45309; }
.badge-danger    { background: var(--danger-pale);  color: #b91c1c; }
.badge-info      { background: var(--info-pale);    color: var(--primary); }
.badge-primary   { background: var(--primary-pale); color: var(--primary); }
.badge-secondary { background: #f1f5f9; color: var(--grey); }
.badge-accent    { background: var(--accent-pale);  color: var(--accent-dark); }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: all var(--trans);
  white-space: nowrap; font-family: inherit;
  line-height: 1.4;
}

.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; box-shadow: 0 2px 8px rgba(18,119,189,.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  box-shadow: 0 4px 14px rgba(18,119,189,.4); transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff; box-shadow: 0 2px 8px rgba(238,126,35,.3);
}
.btn-accent:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(238,126,35,.4); transform: translateY(-1px);
}

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(1.1); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-pale);
}

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 7px; }

/* ========== FORMS ========== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 480px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .form-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 11px; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: .5px;
}

input, select, textarea {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; color: var(--text);
  background: var(--surface);
  transition: border-color var(--trans), box-shadow var(--trans);
  width: 100%; font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18,119,189,.12);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Validation inline des formulaires ─────────────────────── */
.input-error, .input-error:focus {
  border-color: var(--danger) !important;
  background: #fff8f8 !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
  animation: shakeField .35s ease;
}
.field-error {
  font-size: 11px; color: var(--danger); font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  margin-top: 2px; line-height: 1.3;
}
.field-error::before { content: '⚠'; font-size: 10px; }
.form-group.has-error label { color: var(--danger); }

/* Bouton submit en état chargement */
.btn-saving {
  opacity: .75; cursor: wait; pointer-events: none;
}
.btn-saving::before {
  content: ''; display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
  margin-right: 6px;
}

@keyframes shakeField {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.input-group { position: relative; display: flex; align-items: center; }
.input-group input { padding-right: 36px; }
.input-group-icon {
  position: absolute; right: 10px; color: var(--text-light); pointer-events: none;
}

/* ========== FILTERS BAR ========== */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.filters-bar input, .filters-bar select {
  height: 34px; min-width: 120px; font-size: 12px;
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(9,72,118,.45);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; visibility: hidden; transition: all var(--trans);
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 740px; max-height: 92vh;
  display: flex; flex-direction: column;
  transform: scale(.94) translateY(12px);
  transition: transform var(--trans);
  border: 1px solid var(--border-light);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal.lg { max-width: 980px; }
.modal.sm { max-width: 460px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-pale), var(--surface));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 { font-size: 15px; font-weight: 800; color: var(--primary); }

.modal-close {
  width: 30px; height: 30px; border: none; background: none;
  border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 18px; transition: all var(--trans);
}
.modal-close:hover { background: var(--danger-pale); color: var(--danger); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ========== TOASTS ========== */
.toast-container {
  position: fixed; top: 74px; right: 16px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px; max-width: 360px;
  border-left: 4px solid var(--primary);
  pointer-events: all;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
}

.toast.success { border-color: var(--success); }
.toast.warning { border-color: var(--warning); }
.toast.error   { border-color: var(--danger); }

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-body .toast-title { font-weight: 700; font-size: 12.5px; color: var(--text); }
.toast-body .toast-msg   { font-size: 11.5px; color: var(--text-light); margin-top: 1px; }

/* ========== CHARTS ========== */
.chart-wrap { position: relative; height: 260px; }
.chart-wrap.sm { height: 190px; }
.chart-wrap.lg { height: 340px; }

/* ========== VALIDATION BAR ========== */
.validation-bar {
  background: linear-gradient(135deg, var(--accent-pale), var(--surface));
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}

.validation-bar .vb-icon { font-size: 22px; flex-shrink: 0; }
.validation-bar .vb-text { flex: 1; min-width: 200px; }
.validation-bar .vb-text strong { display: block; font-size: 13px; color: var(--text); }
.validation-bar .vb-text span   { font-size: 11.5px; color: var(--text-light); }

/* ========== STAT ROW ========== */
.stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row .label { color: var(--text-light); }
.stat-row .value { font-weight: 700; }

/* ========== PROGRESS ========== */
.progress-bar {
  height: 7px; background: var(--border);
  border-radius: 4px; overflow: hidden; margin-top: 4px;
}
.progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width .7s cubic-bezier(.4,0,.2,1);
}
.progress-fill.success { background: linear-gradient(90deg, var(--success), #22c55e); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #f59e0b); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--danger), #ef4444); }
.progress-fill.accent  { background: linear-gradient(90deg, var(--accent-dark), var(--accent)); }

/* ========== ALERT ITEMS ========== */
.alert-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  margin-bottom: 5px; background: var(--surface-2);
  border: 1px solid var(--border-light);
  transition: background var(--trans);
}
.alert-item:hover { background: var(--primary-pale); }
.alert-item.danger  { background: var(--danger-pale); border-color: #fca5a5; }
.alert-item.warning { background: var(--warning-pale); border-color: #fcd34d; }

.alert-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.alert-dot.danger  { background: var(--danger); }
.alert-dot.warning { background: var(--warning); }
.alert-dot.success { background: var(--success); }

/* ========== LOGIN PAGE ========== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg,
    var(--primary-deep) 0%,
    var(--primary) 40%,
    #1a8fd4 70%,
    #0d5a91 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
}

/* Décorations background */
.login-page::before {
  content: '';
  position: absolute; width: 600px; height: 600px;
  background: rgba(238,126,35,.08);
  border-radius: 50%; top: -250px; right: -150px;
  animation: pulse 6s ease-in-out infinite;
}

.login-page::after {
  content: '';
  position: absolute; width: 400px; height: 400px;
  background: rgba(255,255,255,.04);
  border-radius: 50%; bottom: -100px; left: -80px;
}

@keyframes pulse {
  0%,100% { transform: scale(1); opacity: .08; }
  50%      { transform: scale(1.1); opacity: .12; }
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 420px;
  padding: clamp(28px, 5vw, 44px);
  position: relative; z-index: 1;
  border: 1px solid rgba(255,255,255,.2);
}

.login-logo {
  text-align: center; margin-bottom: 28px;
}

.login-logo-img {
  width: clamp(80px, 20vw, 110px);
  height: auto; object-fit: contain;
  margin: 0 auto 14px; display: block;
  filter: drop-shadow(0 4px 12px rgba(18,119,189,.2));
}

.login-logo h1 {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 800; color: var(--text);
  letter-spacing: -.3px;
}

.login-logo h1 span { color: var(--accent); }
.login-logo p { font-size: 11.5px; color: var(--text-light); margin-top: 4px; line-height: 1.5; }

.login-card label { margin-bottom: 5px; display: block; }

.login-card input {
  padding: 11px 14px; font-size: 13.5px; margin-bottom: 12px;
}

.login-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all var(--trans); margin-top: 4px;
  box-shadow: 0 4px 16px rgba(18,119,189,.35);
  font-family: inherit;
}
.login-btn:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  box-shadow: 0 6px 20px rgba(18,119,189,.45); transform: translateY(-1px);
}

.login-footer {
  text-align: center; margin-top: 22px;
  font-size: 11px; color: var(--text-light);
}

.login-error {
  background: var(--danger-pale); border: 1px solid #fca5a5;
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12.5px; color: var(--danger); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* Diviseur */
.login-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0; color: var(--text-muted); font-size: 11px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ========== DASHBOARD GRID ========== */
.dash-grid { display: grid; gap: 18px; }

@media (min-width: 900px) {
  .dash-grid { grid-template-columns: 2fr 1fr; }
}

.dash-grid-3 { display: grid; gap: 16px; }

@media (min-width: 600px)  { .dash-grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 1024px) { .dash-grid-3 { grid-template-columns: repeat(3,1fr); } }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text-light);
}
.empty-state .empty-icon { font-size: 44px; margin-bottom: 10px; opacity: .35; }
.empty-state p { font-size: 13px; }

/* ========== SPINNER ========== */
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 36px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== ROW STATES ========== */
.row-danger  { background: #fff5f5 !important; }
.row-warning { background: #fffbeb !important; }
tbody tr.row-danger:hover  { background: #fee2e2 !important; }
tbody tr.row-warning:hover { background: #fef3c7 !important; }

/* ========== UTILITIES ========== */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.fw-bold      { font-weight: 700; }
.fw-800       { font-weight: 800; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }  .gap-8  { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }  .mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-100 { width: 100%; }

/* Gradient text 3A+ */
.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== RESPONSIVE — MOBILE FIRST ========== */

/* Topbar brand logo visible only when sidebar collapsed/hidden */
@media (max-width: 768px) {
  .topbar-brand-logo { display: block; }
}

/* Mobile sidebar */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }

  .topbar { padding: 0 14px; }
  .page-content { padding: 14px; }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { justify-content: flex-start; }

  .modal { max-width: 100% !important; border-radius: var(--radius); max-height: 96vh; }
  .modal-header, .modal-body, .modal-footer { padding: 14px; }

  .toast-container { right: 10px; left: 10px; }
  .toast { min-width: auto; max-width: 100%; }

  table { font-size: 11px; }
  thead th { padding: 8px 10px; font-size: 9px; }
  tbody td { padding: 7px 10px; }
}

/* Tablette */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
  .sidebar.collapsed { width: var(--sidebar-w-col); }
  .sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-col); }
}

/* Grand écran */
@media (min-width: 1400px) {
  .page-content { padding: 30px 40px; }
  .kpi-grid { gap: 18px; }
}

/* ========== PRINT ========== */
@media print {
  .sidebar, .topbar, .page-actions, .filters-bar,
  .modal-overlay, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .page-content { padding: 0; }
  thead th { background: #1277BD !important; -webkit-print-color-adjust: exact; }
}
