:root {
  --app-primary: #163A70;
  --app-primary-dark: #102e59;
  --app-primary-soft: #eaf1fb;
  --app-text: #1f2937;
  --app-text-soft: #4b5563;
  --app-border: #d9e2ef;
  --app-bg: #f5f8fc;
  --app-card: #ffffff;
  --app-success: #198754;
  --app-warning: #f59e0b;
  --app-danger: #dc3545;
  --app-info: #0d6efd;
}

body.app-body {
  background: var(--app-bg);
  color: var(--app-text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.app-navbar {
  background: linear-gradient(90deg, var(--app-primary) 0%, #1c4d8f 100%);
  box-shadow: 0 3px 14px rgba(15, 23, 42, 0.12);
}

.app-brand {
  color: #fff !important;
  font-weight: 700;
  letter-spacing: .2px;
}

.app-navbar .nav-link {
  color: rgba(255,255,255,.9) !important;
  font-weight: 500;
  border-radius: 10px;
  padding: .55rem .85rem;
  transition: .2s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
  background: rgba(255,255,255,.14);
  color: #fff !important;
}

.app-user-pill {
  background: rgba(255,255,255,.14);
  color: #fff;
  padding: .45rem .8rem;
  border-radius: 999px;
  font-size: .92rem;
}

.app-main { padding-top: 1.35rem; padding-bottom: 2rem; }

.app-page-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--app-primary);
  margin-bottom: .25rem;
}

.app-page-subtitle {
  color: var(--app-text-soft);
  margin-bottom: 1.4rem;
}

.app-card {
  background: var(--app-card);
  border: 1px solid #e6edf6;
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
}

.app-card .card-header {
  background: transparent;
  border-bottom: 1px solid #eef2f7;
  color: var(--app-primary);
  font-weight: 700;
}

.app-stat-card {
  border-radius: 18px;
  border: 1px solid #e7ecf3;
  background: #fff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
  padding: 1rem 1.1rem;
  height: 100%;
}

.app-stat-label { color: var(--app-text-soft); font-size: .92rem; margin-bottom: .3rem; }
.app-stat-value { font-size: 1.9rem; font-weight: 800; color: var(--app-primary); line-height: 1.1; }

.app-filter-box {
  background: #fff;
  border: 1px solid #e7ecf3;
  border-radius: 18px;
  padding: 1rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
}

.app-section-title {
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--app-primary);
  margin-bottom: .85rem;
}

.table.app-table { background: #fff; margin-bottom: 0; }
.table.app-table thead th {
  background: var(--app-primary-soft);
  color: var(--app-primary);
  border-bottom: 1px solid #dbe5f3;
  font-size: .92rem;
  white-space: nowrap;
}
.table.app-table tbody tr:hover { background: #f8fbff; }

.app-thumb {
  width: 52px;
  height: 62px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--app-border);
  background: #fff;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .38rem .65rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
}
.app-badge-success { background: rgba(25,135,84,.12); color: var(--app-success); }
.app-badge-warning { background: rgba(245,158,11,.14); color: #b45309; }
.app-badge-danger { background: rgba(220,53,69,.12); color: var(--app-danger); }
.app-badge-info { background: rgba(13,110,253,.12); color: var(--app-info); }
.app-badge-secondary { background: rgba(107,114,128,.12); color: #4b5563; }

.btn { border-radius: 12px; font-weight: 600; }
.btn-app-primary { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.btn-app-primary:hover { background: var(--app-primary-dark); border-color: var(--app-primary-dark); color: #fff; }

.app-alert { border-radius: 14px; }
.app-footer {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 1rem 1.25rem;
  color: var(--app-text-soft);
}

.form-control, .form-select { border-radius: 12px; border-color: #d8dee8; }
.form-control:focus, .form-select:focus {
  border-color: #8fb1e4;
  box-shadow: 0 0 0 .2rem rgba(22,58,112,.12);
}

.app-soft-box {
  background: #fff;
  border: 1px solid #e6edf6;
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
}

@media (max-width: 768px) {
  .app-page-title { font-size: 1.4rem; }
  .app-stat-value { font-size: 1.45rem; }
}

.app-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255,255,255,.1);
  padding: 2px;
}

.login-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.students-page-card .card-header {
  gap: .75rem;
}

.students-bulk-actions,
.student-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
}

.students-bulk-actions .btn,
.student-actions .btn,
.student-actions a.btn {
  padding: .28rem .55rem;
  font-size: .82rem;
  white-space: nowrap;
}

.students-table td,
.students-table th {
  vertical-align: middle;
}

.students-table .actions-col {
  width: 285px;
  min-width: 285px;
}

.students-table td code {
  font-size: .9rem;
}

.students-table td .fw-semibold {
  line-height: 1.2;
}

.app-main .col-xl-11 {
  max-width: 98%;
}

@media (max-width: 1400px) {
  .students-table .actions-col {
    width: 250px;
    min-width: 250px;
  }
  .students-bulk-actions .btn,
  .student-actions .btn,
  .student-actions a.btn {
    font-size: .78rem;
    padding: .25rem .45rem;
  }
}

@media (max-width: 992px) {
  .app-main .col-xl-11 {
    max-width: 100%;
  }
  .students-table .actions-col {
    width: 220px;
    min-width: 220px;
  }
}

/* Scroll horizontal haut + bas pour la page étudiants */
.double-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 18px;
    margin-bottom: 6px;
}

.double-scroll-top-inner {
    height: 1px;
}

.app-table-responsive {
    overflow-x: auto !important;
    overflow-y: visible;
}

.app-table {
    min-width: 1400px;
}

/* Optimisation affichage desktop */
@media (min-width: 1200px) {
    .app-page-title {
        font-size: 1.8rem;
    }

    .app-card .card-header {
        font-weight: 700;
    }

    .app-actions .btn {
        margin-bottom: 4px;
    }

    .name-col {
        min-width: 220px;
    }

    .filiere-col {
        min-width: 240px;
    }

    .niveau-col {
        min-width: 100px;
    }

    .actions-col {
        min-width: 300px;
    }
}
