:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  --dark: #0f172a;
  --light: #f8fafc;
  --border: #e2e8f0;
}

html,
body {
  margin: 0;
  padding: 0;
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1e293b;
  background-color: var(--light);
}
.layout-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background-color: var(--light);
}
.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: auto;
  z-index: 1200;
}
.main-content {
  background: var(--light);
  padding: 1.5rem;
  height: auto;
  min-height: 100%;
  overflow: visible;
}

.main-content::after {
  content: "";
  display: block;
  height: 2rem; 
}

/* ---- Responsive: Stack Sidebar on Top ---- */
@media (max-width: 900px) {
  .layout-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    width: 100%;
  }
}


.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  border-color: var(--primary);
}


.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}
.btn-light {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.btn-light:hover {
  background: var(--light);
  border-color: var(--primary);
}


.form-select {
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  background-position: right 0.9rem center;
  background-size: 14px 10px;
  font-size: 0.95rem;
  line-height: 1.4;
}
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.table thead {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}
.table tbody tr:hover > td {
  background-color: #f1f3f5 !important;
}
.table tbody tr:last-child {
  border-bottom: none;
}
.table td,
.table th {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.table td .badge 
{ 
  background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; 
  font-weight: 500; 
  border-radius: 6px; 
  padding: 0.3rem 0.65rem; 
  font-size: 0.85rem; 
  min-width: 48px; 
  text-align: center; 
  display: inline-block; 
}

.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

h2.section-title {
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1.5rem;
}

#sidebar .nav-text {
  font-weight: 500;
  font-size: 0.95rem;
  color: #475569;
  transition: color 0.2s ease, transform 0.2s ease;
}

#sidebar a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  color: #475569;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

#sidebar a i {
  color: var(--primary);
  font-size: 1.05rem;
  transition: color 0.25s ease;
}

#sidebar a:hover:not(.active) {
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary-dark);
  transform: translateX(3px);
}
#sidebar a:hover i {
  color: var(--primary-dark);
}
#sidebar a.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff !important;
  font-weight: 600;
}
#sidebar a.active i {
  color: #fff;
}

#sidebar .logout-link {
  color: #dc2626;
}
#sidebar .logout-link:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}


@media (max-width: 768px) {
  .main-content {
    padding-bottom: 5rem;
  }
  .chart-container {
    height: 300px;
  }
}

#customDateInputs.hidden {
  display: none !important;
}

.navbar-dark.bg-dark {
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(6px);
}

.offcanvas.bg-dark {
  background: rgba(0, 0, 0, 0.9) !important;
}

.offcanvas .nav-link {
  color: #f8fafc !important;
  font-weight: 500;
  transition: color 0.2s ease, transform 0.2s ease;
}

.offcanvas .nav-link:hover {
  color: #a5b4fc !important; 
  transform: translateX(3px);
}

.offcanvas .nav-link i {
  color: #a5b4fc;
}

.offcanvas .nav-link.text-danger:hover {
  color: #f87171 !important;
}

.offcanvas-header h5 {
  color: #fff;
}

.navbar-toggler:focus {
  box-shadow: none;
}
.logo {
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  line-height: 1.2;
  text-transform: none;
}

.offcanvas-title.logo {
  font-size: clamp(1.3rem, 1vw + 0.9rem, 1.8rem);
}

.navbar-dark .logo {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.navbar-brand.logo:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  transition: all 0.25s ease;
}
.form-select,
.form-control {
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  background-position: right 0.9rem center;
  background-size: 14px 10px;
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.form-select:focus,
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Date range group spacing */
#customDateInputs {
  flex-wrap: wrap;
  gap: 0.75rem;
}
#customDateInputs > div {
  min-width: 130px;
}
#customDateInputs button {
  flex-shrink: 0;
}

/* Responsive adjustment */
@media (max-width: 480px) {
  .card-body {
    padding: 0.9rem 1rem;
  }
  .form-select,
  .form-control {
    font-size: 1rem;
    padding: 0.45rem 0.9rem;
  }
  #customDateInputs {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
  #customDateInputs button {
    width: 100%;
  }
}

/* === Responsive Font Scaling === */
html {
  font-size: clamp(15px, 1vw + 14px, 18.5px);
}


@media (min-width: 900px) and (max-width: 1199px) {
  html { font-size: 17.5px; } 
}

/* Minor tune-ups for visual balance */
#sidebar .nav-text {
  font-size: 0.98rem;
}
h2.section-title {
  font-size: 1.35rem;
}
.table td, .table th {
  font-size: 0.93rem;
}

.menu-divider {
border: none;
border-top: 2px solid white;
margin: 0.5rem 0;
width: 90%;
}

@media (max-width: 768px) {
  #utmPage .card-body.d-flex {
    flex-direction: column;
    align-items: stretch !important;
  }

  #utmPage #customDateInputs {
    width: 100%;
  }

  #utmPage #customDateInputs > div {
    width: 100%;
  }

  #utmPage #utmTypeSelect {
    width: 100%;
  }

  #utmPage #startDate,
  #utmPage #endDate {
    width: 100%;
  }
}



