:root {
  --font-base: "Avenir", "Open Sans", "Segoe UI", sans-serif;
  --accent: #ff8c24;
  --text: #212529;
  --text-sub: #6c757d;
  --page-bg: #f5f6fa;
  --sidebar-w: 180px;
  --navbar-h: 56px;
  --radius: 14px;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.05);
  --chart-max-h: 150px;
}

/* ── BASE RESET ───────────────────────────── */
html,
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--page-bg);
  font-family: var(--font-base);
  color: var(--text);
}
a {
  color: var(--text-sub);
  text-decoration: none;
}
a:not(.nav-link):hover {
  text-decoration: underline;
}

/* ── BUTTON ───────────────────────────── */
.btn-primary {
  padding: 10px 16px;
  font-weight: 600;
  border-radius: 6px;
  background: var(--accent);
  border-color: var(--accent);
  transition: background 0.3s;
}
.btn-primary:hover {
  background: #e6781f;
  border-color: #e6781f;
}

/* ── KPI CARDS ───────────────────────────── */
.kpi-card {
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.kpi-card::after {
  content: "";
  position: absolute;
  inset: 0 0 0 40%;
  background: radial-gradient(circle at 100% 0, rgba(0, 0, 0, 0.01) 0%, rgba(0, 0, 0, 0) 45%);
  pointer-events: none;
}
.kpi-icon {
  position: absolute;
  top: 10px !important;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, #202228, #323340);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 3px 5px rgba(255, 255, 255, 0.05), 0 6px 12px rgba(0, 0, 0, 0.15);
}
.kpi-icon .material-icons {
  font-size: 12px;
  color: #fff;
}
.kpi-delta {
  display: block;
  margin-top: 0.35rem;
  padding-top: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}
.kpi-delta.positive {
  color: #28a745;
}
.kpi-delta.negative {
  color: #dc3545;
}
.kpi-label {
  margin-top: 0 !important;
  margin-bottom: 0.25rem !important;
}
.kpi-value {
  margin: 0 !important;
  font-size: 2rem;
}
.kpi-card .card-body {
  padding: 0.75rem 1.25rem 0.65rem !important;
}
@media (max-width: 575.98px) {
  .kpi-card .card-body {
    padding: 0.5rem !important;
  }
  .kpi-icon {
    top: 36px;
    right: 10px;
    width: 40px;
    height: 40px;
  }
  .kpi-icon .material-icons {
    font-size: 20px;
  }
}

/* ── GRAPH METRICS ───────────────────────────── */
.graph-divider {
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  margin: 0.75rem 0 0.4rem;
}
.graph-delta {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}
.graph-delta.positive {
  color: #28a745;
}
.graph-delta.negative {
  color: #dc3545;
}
.plotly-graph-div .plot-container {
  background: transparent !important;
}
.plotly-graph-div {
  max-width: 100% !important;
}

/* ── NAVBAR ───────────────────────────── */
#top-navbar {
  background: transparent !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  border-bottom: none !important;
}
#top-navbar .dropdown-toggle::after {
  display: none;
}
#top-navbar .dropdown-menu::before {
  display: none !important;
}
#top-navbar .dropdown-menu {
  margin-top: 0.25rem !important;
}
#top-navbar h1,
.page-title {
  margin-left: 0 !important;
  margin-top: 0 !important;
}
@media (max-width: 991.98px) {
  #top-navbar {
    left: 0;
    width: 100%;
  }
  #top-navbar .d-flex.align-items-center.d-lg-none {
    margin-right: 0 !important;
  }
}

/* ── SIDEBAR ───────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
  border-radius: 0 14px 14px 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0 1.25rem;
}
.sidebar::after {
  content: "";
  display: block;
  height: 1rem;
  flex-shrink: 0;
}
.sidebar-brand {
  justify-content: center;
  padding: 1rem 0 0.5rem;
}
.logo-icon {
  font-size: 1.5rem;
}

/* nav-menu */
.nav-menu {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 1.75rem 0 1.75rem;
  padding-left: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #fff !important;
}
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6c757d !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.55rem 1rem;
  margin: 2px 0 0.25rem 0.75rem;
  border-radius: 10px;
  transition: background 0.25s, color 0.25s;
}
.sidebar .nav-link:hover {
  background: rgba(20, 23, 39, 0.05);
  color: #141727 !important;
}
.sidebar .nav-link:hover .material-icons {
  color: #141727 !important;
}
.sidebar .nav-link.active {
  background: linear-gradient(135deg, #141727, #2d3040) !important;
  color: #fff !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.sidebar .nav-link.active .material-icons {
  color: #fff !important;
}
.sidebar .nav-link .material-icons {
  font-size: 1.05rem;
  color: #888;
  margin-left: -0.1rem;
  vertical-align: middle;
}

/* ── CONTENT ───────────────────────────── */
.has-sidebar #page-content {
  margin-left: var(--sidebar-w);
  padding-top: calc(var(--navbar-h) + 1rem);
  min-height: calc(100vh - var(--navbar-h));
  overflow-y: auto;
}
@media (max-width: 991.98px) {
  .has-sidebar #page-content {
    margin-left: 0;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar-open {
    transform: translateX(0);
  }
  .page-content-open {
    position: fixed;
    inset: 0;
    overflow: hidden;
  }
}

/* ── HAMBURGER ───────────────────────────── */
#nav-toggle {
  font-size: 1.9rem;
  line-height: 1;
  left: 16px !important;
  top: 16px !important;
  position: absolute !important;
  box-shadow: none !important;
  z-index: 1040 !important;
}
.dropdown-toggle::after {
    display: none !important;
}

/* KPI card container */
.kpi-card {
    border-radius: 14px;
    padding: 1.5rem;
    background-color: #fff;
    transition: box-shadow 0.2s ease;
}

/* Top header section: flex row with icon + label */
.kpi-header {
  position: absolute;
  top: 10px !important;
  right: 12px;
  width: 24px;         /* ← was 48px */
  height: 24px;        /* ← was 48px */
  border-radius: 7px;  /* ← scale down proportionally */
  background: linear-gradient(135deg, #202228, #323340);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 3px 5px rgba(255, 255, 255, 0.05), 0 6px 12px rgba(0, 0, 0, 0.15);
    max-width: 75%;
}

/* Main metric value */
.kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: #1e1e2f;
}

/* Delta indicators */
.kpi-delta {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
}
.kpi-delta.positive {
    color: #4caf50;
}
.kpi-delta.negative {
    color: #f44336;
}

/* Icon wrapper */
.kpi-icon-wrapper {
    background: linear-gradient(195deg, #42424a, #191919);
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
}

/* Material icon itself */
.kpi-icon {
    font-size: 1.2rem;
    color: white;
    line-height: 1;
}

