:root {
  /* Brand palette already used across pages */
  --tme-blue: #1F5AA6;
  --tme-red: #E53935;
  --tme-yellow: #F2C037;
  --tme-green: #2E7D32;
  --tme-purple: #6F56A5;
  --tme-teal: #0E9384;
  --ink: #0C1823;
  --muted: #8CA3AF;

  --app-bg: #f5f7fb;
  --sidebar-w: 270px;
  --sidebar-w-collapsed: 84px;
  --header-h: 60px;
  --radius: 14px;
}

html,
body {
  height: 100%;
}

body {
  background: var(--app-bg);
  color: var(--ink);
}

.modal-backdrop {
  position: fixed;
  inset: 0;              /* top:0 right:0 bottom:0 left:0 */
}

/* App shell */
.main-wrapper {
  min-height: 100vh;
}

.page-wrapper {
  min-height: 100vh;
}

/* Header (sticky) */
.navbar-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .16);

  /* Purple base + background image clipped to header only */
  background-color: var(--tme-purple);
  overflow: visible;
  isolation: isolate;
}

.navbar-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../images/navback.jpg") center/cover no-repeat;
  opacity: .55;
  z-index: -1;
  pointer-events: none;
}

.navbar-header .page-container {
  position: relative;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem 1rem;
  max-width: 100%;
}

.navbar-header .header-line {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, .25);
  margin: 0 .5rem;
}

/* Search input readable on purple/image */
.navbar-header .header-search .form-control {
  background: rgba(255, 255, 255, .92);
  border: none;
}

.navbar-header .header-search .input-group-text {
  background: rgba(255, 255, 255, .92);
  border: none;
}

/* Sidebar */
#sidebar.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid rgba(31, 90, 166, .10);
  overflow-y: auto;
  padding-bottom: 1rem;
  transform: translateX(-100%);
  transition: transform .2s ease;
  z-index: 1040;
}

body.sidebar-open #sidebar.sidebar {
  transform: translateX(0);
}

/* Desktop: sidebar always visible */
@media (min-width: 992px) {

  /* Desktop: sidebar always visible and content starts AFTER it */
  #sidebar.sidebar {
    transform: translateX(0);
  }

  body.sidebar-open #sidebar.sidebar {
    transform: translateX(0);
  }

  /* keep behavior consistent */

  .navbar-header {
    margin-left: var(--sidebar-w);
  }

  .page-wrapper {
    margin-left: var(--sidebar-w);
  }

  .sidebar-overlay {
    display: none !important;
  }

  /* Desktop collapse (icon-only sidebar) */
  body.sidebar-collapsed #sidebar.sidebar {
    width: var(--sidebar-w-collapsed);
  }

  body.sidebar-collapsed .navbar-header {
    margin-left: var(--sidebar-w-collapsed);
  }

  body.sidebar-collapsed .page-wrapper {
    margin-left: var(--sidebar-w-collapsed);
  }

  body.sidebar-collapsed #sidebar .sidebar-menu .menu-text {
    display: none;
  }

  body.sidebar-collapsed #sidebar .menu-title {
    display: none;
  }

  body.sidebar-collapsed #sidebar .sidebar-logo .brand-text {
    display: none;
  }

  body.sidebar-collapsed #sidebar .sidebar-menu a {
    justify-content: center;
  }

  body.sidebar-collapsed #sidebar .sidebar-menu i.bi {
    font-size: .95rem;
    width: 1.05rem;
  }
}

/* Overlay (mobile) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 24, 35, .45);
  z-index: 1035;
  display: none;
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

/* Content area */
.content {
  padding: 1rem 1rem 2rem;
}

@media (min-width: 992px) {
  .content {
    padding: 1.1rem 1.25rem 2.5rem;
  }
}

/* Sidebar menu */
#sidebar .sidebar-logo {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  padding: .85rem 1rem .65rem;
  border-bottom: 1px solid rgba(31, 90, 166, .10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

#sidebar .sidebar-logo a {
  text-decoration: none;
}

#sidebar .sidebar-menu {
  padding: .6rem .75rem 0;
}

#sidebar .sidebar-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#sidebar .menu-title {
  margin: .8rem .25rem .4rem;
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(12, 24, 35, .55);
}

#sidebar .sidebar-menu a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .40rem .55rem;
  margin: .15rem 0;
  border-radius: 12px;
  color: rgba(12, 24, 35, .88);
  text-decoration: none;
  font-weight: 600;

  font-size: .85rem;
}

#sidebar .sidebar-menu a:hover {
  background: rgba(111, 86, 165, .10);
  color: var(--tme-purple);
}

#sidebar .sidebar-menu i.bi {
  font-size: .95rem;
  width: 1.05rem;
}

/* Cards: keep your "same look" but bootstrap-based */
.card {
  border-radius: var(--radius);
  border: 1px solid rgba(31, 90, 166, .10);
  box-shadow: 0 8px 20px rgba(12, 24, 35, .06);
}

.card .card-header {
  background: #f7f9fc;
  border-bottom: 1px solid rgba(31, 90, 166, .10);
}

/* Utility: small icon buttons */
.btn-icon-sm {
  padding: .35rem .55rem;
  border-radius: 10px;
}

/* Daterange pill */
.daterangepick {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: .45rem .75rem;
}

/* Prevent template leftovers from adding bg */
body::before {
  content: none !important;
}

/* Topbar quick action pills */
.topbar-link.btn {
  border: none;
  padding: .48rem .55rem;
  line-height: 1;
  border-radius: 10px;
}

.topbar-sky-link {
  background-color: #93c5fd;
  color: #111 !important;
}

.topbar-indigo-link {
  background-color: #a5b4fc;
  color: #111 !important;
}

.topbar-orange-link {
  background-color: #fdba74;
  color: #111 !important;
}

.topbar-green-link {
  background-color: #86efac;
  color: #111 !important;
}

.topbar-red-link {
  background-color: #fca5a5;
  color: #111 !important;
}
