:root {
  --sidebar-w: 288px;
  --sidebar-w-collapsed: 78px;
  --app-radius: 18px;
  --app-shadow: 0 10px 30px rgba(0, 0, 0, .06);
  --app-border: rgba(0, 0, 0, .08);

  /* Brand palette (single source of truth) */
  --brand-dark: #0b1220;
  --brand-gradient: linear-gradient(120deg, var(--brand-pep-darker) 0%, var(--brand-pep) 90%, var(--brand-pep-darker) 100%);
  --brand-pep: rgb(112, 172, 0);  /* primary normale */
  --brand-pep-darker: rgb(75, 112, 7);  /* primary foncée */
  --brand-pep-darker-transparent: rgba(75, 112, 7,0.2);  /* primary foncée */
  --brand-pep-light: rgba(112, 172, 0, 0.8);  /* primary transparente XX */
  --brand-soft: rgb(244, 246, 243);  /* very light gray */
  --brand-none: none;  /* vide */

  --sidebar-bg: var(--brand-dark);
  --sidebar-muted: rgba(255, 255, 255, .72);
  --sidebar-hover: var(--brand-pep);
  --sidebar-active: var(--brand-pep-light);
  --sidebar-active-border: var(--brand-none);


  --topbar-h: 75px;

  /* Bootstrap primary override */
  --bs-primary: var(--brand-pep);
  --bs-primary-rgb: 69, 186, 186;
  --bs-link-color: var(--brand-pep);
  --bs-link-hover-color: var(--brand-pep);
}

/* Force primary usage for core components (Bootstrap sometimes compiles colors) */
.btn-primary {
  --bs-btn-bg: var(--brand-pep);
  --bs-btn-border-color: var(--brand-pep);
  --bs-btn-hover-bg: var(--brand-pep);
  ;
  --bs-btn-hover-border-color: var(--brand-pep);
  ;
  --bs-btn-active-bg: var(--brand-pep-darker);
  ;
  --bs-btn-active-border-color: var(--brand-pep-darker);
  ;
}

.btn-outline-primary {
  --bs-btn-color: var(--brand-pep);
  --bs-btn-border-color: var(--brand-pep);
  --bs-btn-hover-bg: var(--brand-pep);
  --bs-btn-hover-border-color: var(--brand-pep);
  --bs-btn-active-bg: var(--brand-pep-darker);
  ;
  --bs-btn-active-border-color: var(--brand-pep-darker);
  ;
}

.text-bg-primary {
  background-color: var(--brand-pep) !important;
}

.link-primary {
  color: var(--brand-pep) !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  /* desktop: only central scroll */
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-pep-darker-transparent), transparent 60%),
    radial-gradient(1000px 600px at 90% 0%, rgba(14, 165, 233, .12), transparent 60%),
    var(--brand-soft);
}

/* Layout */
.app-shell {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

/* Topbar */
.navbar-nav .nav-item.active{
  border-bottom: 3px solid ;
  border-color:var(--brand-pep);
  /* border-radius: 3px; */
}


/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, .08);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: .6rem .6rem 1rem .6rem;
}

/* Collapsed sidebar */
.sidebar-collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
}

.sidebar-collapsed .sidebar .label,
.sidebar-collapsed .sidebar .chev {
  display: none;
}

.sidebar-collapsed .sidebar .submenu {
  display: none !important;
}

.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
}

.sidebar-collapsed .sidebar .nav-link i {
  margin: 0 !important;
}

/* Sidebar top line (collapse btn) */
.sidebar-topline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: .35rem;
}

.sidebar-toggle {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .9);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, .12);
}

.sidebar .nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.sidebar .nav .nav-link {
  color: var(--sidebar-muted);
  border-radius: 12px;
  padding: .55rem .7rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  transition: background .14s ease, color .14s ease;
}

.sidebar .nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar .nav .nav-link:active {
  transform: none;
}

.sidebar .nav .nav-link.active {
  padding-left: calc(.7rem - 3px);
}
.sidebar .nav .submenu .nav-link.active {
  padding-left: 2.2rem;
}

.sidebar .nav .nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left: 3px solid var(--sidebar-active-border);
}

.sidebar .nav .nav-link .chev {
  margin-left: auto;
  opacity: .75;
  transition: transform .18s ease;
}

.sidebar .nav .nav-link[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

.sidebar .submenu {
  margin: .1rem 0 .55rem 0;
  padding-left: .25rem;
}

.sidebar .submenu .nav-link {
  padding-left: 2.2rem;
  font-size: .93rem;
  opacity: .96;
}

/* Main: central scroll + footer pinned at bottom */
.main {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.main-inner {
  flex: 1;
}

.footer {
  padding: .75rem 0 0 0;
  color: rgba(17, 24, 39, .55);
  font-size: .875rem;
}

[data-bs-theme="dark"] .footer {
  color: rgba(255, 255, 255, .55);
}

/* Cards */
.card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
}

.card .card-header {
  background: rgba(255, 255, 255, .7);
  border-bottom: 1px solid var(--app-border);
  border-top-left-radius: var(--app-radius);
  border-top-right-radius: var(--app-radius);
}

/* Topbar vertical centering + spacing */
.navbar .container-fluid {
  align-items: center;
  padding-top: 6px;
  /* slight up */
  padding-bottom: 10px;
  /* more space below */
}
.navbar-brand{
  padding-left:5px;
  padding-right:30px;
}
.navbar-brand img {
  height: 45px;
  width: auto;
  max-width: 220px;
  border-radius: 0;
}

/* Icon buttons */
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, .10);
  background: rgba(255, 255, 255, .7);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, .95);
}

.icon-btn:focus {
  box-shadow: 0 0 0 .25rem var(--brand-pep-darker-transparent);
}

/* Search: same height as icon buttons */
.search-lite {
  height: 40px;
  border: 1px solid rgba(0, 0, 0, .08);
  background: rgba(255, 255, 255, .55);
  border-radius: 14px;
  display: flex;
  align-items: center;
}

.search-lite .input-group-text {
  border: 0;
  background: transparent;
  height: 40px;
}

.search-lite .form-control {
  border: 0;
  background: transparent;
  height: 40px;
  padding-top: 0;
  padding-bottom: 0;
}

.search-lite .form-control:focus {
  box-shadow: none;
}

/* Fields */
.fields-lite {
  height: 55px;
  border: 1px solid rgba(0, 0, 0, .08);
  background: rgba(255, 255, 255, .55);
  border-radius: 14px;
  display: flex;
  align-items: center;
}

.fields-lite .input-group-text {
  border: 0;
  background: transparent;
  height: 55px;
}

.fields-lite .form-control {
  border: 0;
  background: transparent;
  height: 55px;
  padding-top: 0;
  padding-bottom: 0;
}

.fields-lite .form-control:focus {
  box-shadow: none;
}

/* Account dropdown panel */
.account-menu {
  width: 320px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--app-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .12);
}

.account-hero {
  background: radial-gradient(800px 220px at 10% 0%, var(--brand-pep-darker-transparent), transparent 60%),
    radial-gradient(700px 220px at 90% 0%, rgba(14, 165, 233, .20), transparent 60%),
    #0b1220;
  color: white;
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Login */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow: auto;
}

.auth-card {
  max-width: 520px;
  width: 100%;
}

.login-logo {
  width: 400px;
  max-width: 90%;
  height: auto;
}

/* Card menu example */
.card-menu .list-group-item {
  border: 0;
  border-radius: 14px !important;
}

.card-menu .list-group-item:hover {
  background: rgba(0, 0, 0, .03);
}

/* Mobile offcanvas full height + modern nav buttons */
.offcanvas.sidebar {
  height: 100vh;
}

.mobile-navgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
}

.mobile-navbtn {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .75rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
}

.mobile-navbtn:hover {
  background: rgba(255, 255, 255, .10);
  color: #fff;
}

.mobile-navbtn i {
  width: 18px;
  text-align: center;
  opacity: .95;
}

/* Dark theme */
[data-bs-theme="dark"] body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(191, 46, 67, .18), transparent 60%),
    radial-gradient(1000px 600px at 90% 0%, rgba(14, 165, 233, .14), transparent 60%),
    #0b1220;
}

[data-bs-theme="dark"] .navbar {
  background: rgba(11, 18, 32, .72) !important;
  border-bottom-color: rgba(255, 255, 255, .10) !important;
}

[data-bs-theme="dark"] .icon-btn {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .92);
}

[data-bs-theme="dark"] .icon-btn:hover {
  background: rgba(255, 255, 255, .10);
}

[data-bs-theme="dark"] .search-lite {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
}

[data-bs-theme="dark"] .card {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .10);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .35);
}

[data-bs-theme="dark"] .card .card-header {
  background: rgba(255, 255, 255, .07);
  border-bottom-color: rgba(255, 255, 255, .10);
}

@media (max-width: 991.98px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
  }

  .main {
    overflow: visible;
    padding: 1rem;
    display: block;
  }
}

/* Brand logos (light/dark) */
.brand-logo {
  display: none;
}

.logo-on-light {
  display: inline-block;
}

[data-bs-theme="dark"] .logo-on-light {
  display: none;
}

[data-bs-theme="dark"] .logo-on-dark {
  display: inline-block;
}

/* Offcanvas: no collapse button on smartphone */
.offcanvas.sidebar .sidebar-topline {
  display: none;
}

/* When collapsed: center the toggle like other icons */
.sidebar-collapsed .sidebar-topline {
  justify-content: center;
}

/* Toggle button icon sizing */
.sidebar-toggle i {
  font-size: 0.95rem;
}

.offcanvas-title img.brand-logo {
  height: 40px;
  width: auto;
}