/* =========================
   DASHBOARD (PREMIUM DARK)
========================= */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-right: max(24px, env(safe-area-inset-right));
  padding-left: max(24px, env(safe-area-inset-left));
  box-sizing: border-box;
}

/* =========================
   CONTAINER
========================= */
.container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-right: 4px;
  padding-bottom: env(safe-area-inset-bottom);
}

.container::-webkit-scrollbar { width: 5px; }
.container::-webkit-scrollbar-track { background: transparent; }
.container::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}
.container::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* =========================
   HEADER
========================= */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.dash-header h2 {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dash-header__date {
  font-size: 14px;
  color: var(--text-muted);
  background: var(--glass-bg);
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

/* =========================
   KPI GRID
========================= */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  flex-shrink: 0;
}

.card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  padding: 24px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
}

.card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
  transform: translateY(-5px);
}

.card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}

.card p {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.card.green p { color: #34d399; text-shadow: 0 0 15px rgba(52, 211, 153, 0.3); }
.card.orange p { color: #fbbf24; text-shadow: 0 0 15px rgba(251, 191, 36, 0.3); }
.card.red p    { color: #f87171; text-shadow: 0 0 15px rgba(248, 113, 113, 0.3); }

/* =========================
   SECTIONS & LISTS
========================= */
.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 32px;
  flex: 1;
  min-height: 300px;       /* ← hauteur minimum pour les sections */
}

.section {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.section__head {
  padding: 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.section__title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
}

.section__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.section__dot--red   { background: #f87171; box-shadow: 0 0 10px #f87171; }
.section__dot--amber { background: #fbbf24; box-shadow: 0 0 10px #fbbf24; }

.section__badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.section__badge--red   { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.section__badge--amber { background: rgba(251, 191, 36, 0.15);  color: #fbbf24; }

.section__body {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.section__body::-webkit-scrollbar { width: 5px; }
.section__body::-webkit-scrollbar-track { background: transparent; }
.section__body::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}
.section__body::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  transition: all 0.2s ease;
}

.list-item:hover { background: rgba(255, 255, 255, 0.03); }

.empty-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-style: italic;
  padding: 32px 0;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1000px) {
  .container {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  .main-content {
    /* La mobile-logo gère déjà env(safe-area-inset-top)
       donc ici on n'ajoute que le padding latéral et bas */
    padding: 16px;
    padding-top: 16px; /* PAS de safe-area-inset-top ici : déjà géré par mobile-logo */
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .dash-header h2 { font-size: 24px; }

  .sections { grid-template-columns: 1fr; }
}