:root {
  --mj-navy: #1E3A8A;
  --mj-navy-dark: #142a63;
  --sidebar-bg: #0b0e18;
  --mj-red: #C81E3A;
  --mj-red-dark: #9c1730;
  --bg: #f3f4f8;
  --card-border: #eaeaf0;
  --text-soft: #6b7280;
}

* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

body { background: var(--bg); color: #1f2430; }

.app-shell { min-height: 100vh; }
.app-content-col { min-width: 0; }

/* ---------- Navbar ---------- */
.erp-navbar {
  background: var(--mj-navy);
  height: 58px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  z-index: 20;
}
.erp-navbar .navbar-brand { font-size: 1.05rem; letter-spacing: -.01em; }

.user-pill {
  background: rgba(255,255,255,.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: .3rem .7rem .3rem .3rem;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.user-pill:hover { background: rgba(255,255,255,.22); color: #fff; }
.user-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  color: var(--mj-navy);
  font-weight: 700;
  font-size: .72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Sidebar (custom, no Bootstrap offcanvas — avoids its forced !important resets) ---------- */
.erp-sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  flex: 0 0 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,.06);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
.erp-sidebar::-webkit-scrollbar { width: 6px; }
.erp-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 6px; }
.erp-sidebar::-webkit-scrollbar-track { background: transparent; }

.erp-sidebar-inner { min-height: 100%; }

.erp-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1039;
}

@media (max-width: 991.98px) {
  .erp-sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .erp-sidebar.show { transform: translateX(0); }
  .erp-sidebar-backdrop.show { display: block; }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: .3rem;
}
.sidebar-brand-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--mj-navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.sidebar-brand-title { font-weight: 800; font-size: .95rem; letter-spacing: -.01em; line-height: 1.1; color: #fff; }
.sidebar-brand-sub { font-size: .72rem; color: rgba(255,255,255,.45); }

.erp-sidebar .nav-link {
  color: rgba(255,255,255,.72);
  padding: .5rem .9rem;
  font-size: .865rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .65rem;
  border-radius: 8px;
  margin: .12rem .7rem;
  transition: background .15s, color .15s;
}

.nav-icon-chip {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,.14);
  color: rgba(255,255,255,.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.erp-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }

.erp-sidebar .nav-link.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 700;
  border-left: 3px solid #fff;
  margin-left: -3px;
  padding-left: calc(.9rem - 3px);
}
.erp-sidebar .nav-link.active .nav-icon-chip {
  background: #fff;
  color: var(--mj-navy);
}

.nav-section-label {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.32);
  padding: 1rem 1.4rem .35rem;
  font-weight: 700;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .9rem 1.1rem 1.1rem;
}
.sidebar-util-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  color: rgba(255,255,255,.5);
  padding: .35rem .3rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.sidebar-util-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-util-link i { width: 16px; text-align: center; }
.sidebar-version { font-size: .7rem; color: rgba(255,255,255,.28); margin-top: .5rem; padding-left: .3rem; }

.erp-main { min-height: calc(100vh - 58px); }

/* ---------- Business badges / dots ---------- */
.biz-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.biz-badge {
  font-size: .68rem;
  padding: .25rem .55rem;
  border-radius: 5px;
  color: #fff;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

/* ---------- KPI cards ---------- */
.kpi-card {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  border-top: 3px solid var(--mj-navy);
  padding: 1.1rem 1.25rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20,20,43,.04);
}
.kpi-card .kpi-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.kpi-card .kpi-label { font-size: .7rem; text-transform: uppercase; color: var(--text-soft); letter-spacing: .05em; font-weight: 600; }

/* ---------- Cards / tables ---------- */
.card {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(20,20,43,.04);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  border-radius: 10px 10px 0 0 !important;
  font-size: .92rem;
}

.table thead.table-dark th {
  background: var(--mj-navy);
  color: #e8ecf7;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  border-bottom: none;
}
.table-sm td, .table-sm th { padding: .55rem .65rem; }
.table-hover tbody tr:hover { background: #f8f9fc; }

.btn { border-radius: 6px; font-weight: 500; }
.btn-primary { background: var(--mj-navy); border-color: var(--mj-navy); }
.btn-primary:hover { background: var(--mj-navy-dark); border-color: var(--mj-navy-dark); }
.btn-dark { background: #1a1f2e; border-color: #1a1f2e; }
.btn-outline-primary { color: var(--mj-navy); border-color: var(--mj-navy); }
.btn-outline-primary:hover { background: var(--mj-navy); border-color: var(--mj-navy); }

.badge { font-weight: 600; letter-spacing: .01em; }

.form-control, .form-select { border-radius: 6px; border-color: #dfe1ea; }
.form-control:focus, .form-select:focus { border-color: var(--mj-navy); box-shadow: 0 0 0 3px rgba(30,58,138,.12); }

.alert { border-radius: 8px; border: none; }
