/* =========================================================================
   MIVAZEM — Portail Web d'administration
   Design system : couleurs, typographie, composants.
   Pile technique conforme au cahier des charges (HTML5 / CSS3 / JS / Bootstrap).
   ========================================================================= */

:root {
  --color-navy: #142544;
  --color-navy-2: #1d3363;
  --color-navy-3: #274582;
  --color-gold: #c89b3c;
  --color-gold-soft: #f6ecd4;
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-text: #191d29;
  --color-muted: #6b7280;
  --color-border: #e6e9f2;
  --color-success: #1f8a5f;
  --color-success-soft: #e4f5ee;
  --color-danger: #c0392b;
  --color-danger-soft: #fbe7e4;
  --color-warning: #a8730d;
  --color-warning-soft: #fbf0dc;
  --color-info: #2563a8;
  --color-info-soft: #e5eefb;

  --brand-primary: var(--color-navy);
  --brand-secondary: var(--color-gold);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(20, 37, 68, 0.04), 0 8px 24px rgba(20, 37, 68, 0.06);
  --font-display: 'Sora', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

a { color: var(--brand-primary); text-decoration: none; }

/* ---------- Layout global ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--color-navy) 0%, #0d1830 100%);
  color: #dfe6f5;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand img {
  height: 34px;
  width: 34px;
  border-radius: 9px;
  object-fit: cover;
  background: rgba(255,255,255,0.08);
}

.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  line-height: 1.1;
}

.sidebar-brand .brand-slogan {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}

.sidebar-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 14px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.75);
  font-size: 13.6px;
  font-weight: 500;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  transition: background .15s ease, color .15s ease;
}

.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }

.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(200,155,60,0.14);
  color: #fff;
  border-left-color: var(--color-gold);
}

.sidebar-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.main-area {
  margin-left: 264px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 66px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 700;
}

.topbar-sub { font-size: 12.5px; color: var(--color-muted); margin-top: 1px; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--color-gold-soft);
  color: var(--color-warning);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.content { padding: 26px 28px 60px; flex: 1; }

/* ---------- Cartes / KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  border-left: 4px solid var(--brand-secondary);
}

.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.kpi-card .kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
}

.kpi-card.accent-navy { border-left-color: var(--color-navy-3); }
.kpi-card.accent-danger { border-left-color: var(--color-danger); }
.kpi-card.accent-success { border-left-color: var(--color-success); }

.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  margin-bottom: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-head h2 { font-size: 15.5px; margin: 0; font-weight: 700; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }

table.mv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.mv-table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  padding: 10px 12px;
  white-space: nowrap;
}

table.mv-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

table.mv-table tbody tr:hover { background: #fafbfe; }

/* ---------- Badges de statut (encode l'information réelle du statut) ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-success { background: var(--color-success-soft); color: var(--color-success); }
.status-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.status-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.status-info { background: var(--color-info-soft); color: var(--color-info); }
.status-muted { background: #eef0f5; color: var(--color-muted); }

/* ---------- Boutons ---------- */
.btn-mv {
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: filter .15s ease, transform .05s ease;
}
.btn-mv:active { transform: translateY(1px); }
.btn-mv-primary { background: var(--color-navy); color: #fff; }
.btn-mv-primary:hover { filter: brightness(1.15); color: #fff; }
.btn-mv-gold { background: var(--color-gold); color: #241a04; }
.btn-mv-gold:hover { filter: brightness(1.08); color: #241a04; }
.btn-mv-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-mv-outline:hover { background: #f2f4f9; }
.btn-mv-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.btn-mv-danger:hover { filter: brightness(0.97); }
.btn-mv-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

/* ---------- Formulaires ---------- */
.form-label-mv {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 5px;
  display: block;
}
.form-control-mv, select.form-control-mv, textarea.form-control-mv {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  background: #fff;
  font-family: var(--font-body);
}
.form-control-mv:focus {
  outline: none;
  border-color: var(--color-navy-3);
  box-shadow: 0 0 0 3px rgba(39, 69, 130, 0.12);
}
.form-hint { font-size: 11.5px; color: var(--color-muted); margin-top: 4px; }

/* ---------- Onglets de paramétrage ---------- */
.settings-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; flex-wrap: wrap; }
.settings-tab {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.settings-tab.active { color: var(--color-navy); border-bottom-color: var(--color-gold); }

.logo-preview {
  width: 84px; height: 84px;
  border-radius: 16px;
  border: 1px dashed var(--color-border);
  display: flex; align-items: center; justify-content: center;
  background: #fafbfe;
  overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(200,155,60,0.16), transparent 45%),
    linear-gradient(160deg, #0d1830 0%, var(--color-navy) 55%, #1d3363 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255,255,255,0.98);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
}
.login-logo { display:flex; align-items:center; gap: 12px; margin-bottom: 22px; }
.login-logo img { height: 40px; width: 40px; border-radius: 10px; }
.login-logo .name { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--color-navy); }

/* ---------- Empty / loading states ---------- */
.empty-state { text-align: center; padding: 40px 10px; color: var(--color-muted); }
.empty-state svg { width: 40px; height: 40px; opacity: .35; margin-bottom: 10px; }

.skeleton-row { height: 14px; background: linear-gradient(90deg, #eef0f5 25%, #e4e7f0 37%, #eef0f5 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.toast-mv {
  position: fixed;
  bottom: 22px; right: 22px;
  background: var(--color-navy);
  color: #fff;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  z-index: 100;
  display: none;
  max-width: 340px;
}
.toast-mv.show { display: block; animation: toastin .2s ease; }
.toast-mv.error { background: var(--color-danger); }
.toast-mv.success { background: var(--color-success); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

.pagination-mv { display: flex; justify-content: flex-end; gap: 6px; margin-top: 14px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
}
