/* =============================================
   VyomED ERP — Upgraded Master Design System
   File: /public/assets/css/erp.css
============================================= */

:root {
  --font-base: 'Inter', 'Noto Sans Gujarati', sans-serif;
  --font-gu: 'Noto Sans Gujarati', 'Inter', sans-serif;

  /* ── Midnight Blue Palette ── */
  --brand-primary: #3b82f6;
  --brand-secondary: #6366f1;
  --brand-accent: #22d3ee;
  --brand-success: #10b981;
  --brand-warning: #f59e0b;
  --brand-danger: #ef4444;

  /* ── Sidebar ── */
  --sidebar-bg: #252b36;
  --sidebar-text: #ffffff;
  --sidebar-active: #3b82f6;
  --sidebar-hover: rgba(59, 130, 246, 0.18);
  --sidebar-width: 260px;

  /* ── Body & Cards ── */
  --body-bg: #ffffff;
  --card-bg: #ffffff;
  --card-border: #cbd1dd;
  --input-border: #aab3c4;
  --muted-surface: #eef1f6;
  --text-muted-c: #5b6472;
  --text-main: #0f172a;

  /* ── Topbar & Search ── */
  --topbar-bg: #ffffff;
  --topbar-border: #dbe1ea;
  --search-bg: #eef1f6;
  --search-border: #d3dae6;
  --search-text: #0f172a;

  --erp-gu-bg: #EEF2FF;
  --erp-gu-text: #4338CA;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .07);
  --shadow-md: 0 8px 28px rgba(16, 24, 40, .14);
  --radius: 14px;
}

/* ── Dark Theme ── */
[data-bs-theme="dark"] {
  --body-bg: #0d1117;
  --card-bg: #161b22;
  --card-border: #30363d;
  --input-border: #454e5a;
  --muted-surface: #1c2230;
  --text-muted-c: #9aa4b2;
  --text-main: #e6edf3;
  --sidebar-bg: #1a1f2b;

  --topbar-bg: #0d1117;
  --topbar-border: #30363d;
  --search-bg: #161b22;
  --search-border: #30363d;
  --search-text: #e6edf3;

  --erp-gu-bg: #312E81;
  --erp-gu-text: #A5B4FC;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .4), 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 6px 28px rgba(0, 0, 0, .5);
}

/* =============================================
   2. BASE & RESET
============================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Safety net: a wide grid/table/long-word anywhere on a page (dashboards
   in particular pack in a lot of grid content) must never force the whole
   document to scroll sideways — clip it here instead of letting the fixed
   header/sidebar appear to "need" horizontal scrolling along with it. This
   doesn't replace fixing individual overflow causes (see min-width:0 below),
   it's the last line of defense for anything still missed. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-base);
  background-color: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  transition: background-color .3s ease, color .3s ease;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
}

a:hover {
  color: #4338ca;
}

/* =============================================
   3. SIDEBAR (With Collapse Fixes)
============================================= */
#sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - 64px);
  background: var(--sidebar-bg);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

#sidebar.collapsed {
  transform: translateX(-100%);
}

@media (max-width: 991.98px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.show {
    transform: translateX(0);
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  text-decoration: none;
  min-height: 64px;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
  transition: all .3s ease;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--brand-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: #fff;
}

.sidebar-brand .brand-name {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
}

.sidebar-brand .brand-name span {
  color: #a5b4fc;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 4px;
}

.nav-category {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, .3);
  padding: 14px 20px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 8px;
  margin: 2px 10px;
  white-space: nowrap;
  overflow: hidden;
  transition: background .2s, color .2s;
  cursor: pointer;
}

.sidebar-link i {
  font-size: 1.05rem;
  flex-shrink: 0;
  text-align: center;
  width: 20px;
}

.sidebar-link .link-text {
  flex: 1;
}

.sidebar-link .badge-pill {
  background: rgba(79, 70, 229, .35);
  color: #a5b4fc;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}

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

.sidebar-link.active {
  background: var(--brand-primary);
  color: #fff;
}

.sidebar-link.active i {
  color: #fff;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-footer .user-info .name {
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
}

.sidebar-footer .user-info .role {
  font-size: .72rem;
  color: rgba(199, 210, 254, .6);
}

/* --- CRITICAL BUG FIXES FOR COLLAPSED SIDEBAR --- */
#sidebar.collapsed .nav-category,
#sidebar.collapsed .sidebar-footer .user-info {
  display: none;
}

/* Fix 1: Keep Brand Name and Logo visible but stacked */
#sidebar.collapsed .sidebar-brand {
  flex-direction: column;
  padding: 14px 4px;
  gap: 6px;
  justify-content: center;
}

#sidebar.collapsed .sidebar-brand .brand-icon {
  width: 30px;
  height: 30px;
  margin: 0 auto;
  font-size: .95rem;
}

#sidebar.collapsed .sidebar-brand .brand-name {
  display: block;
  font-size: .55rem;
  white-space: normal;
  text-align: center;
  line-height: 1.1;
}

/* Fix 2: Keep Icons visible and centered, hide link text */
#sidebar.collapsed .sidebar-link {
  justify-content: center;
  gap: 0;
  margin: 2px 8px;
  padding: 10px 0;
}

#sidebar.collapsed .sidebar-link i {
  display: block !important;
  margin: 0 auto;
  font-size: 1.1rem;
}

#sidebar.collapsed .sidebar-link .link-text {
  display: none;
}

#sidebar.collapsed .sidebar-link .badge-pill {
  display: none;
}

/* =============================================
   4. MAIN LAYOUT WRAPPER & TOP NAVBAR
============================================= */
#mainWrapper {
  margin-left: var(--sidebar-width);
  padding-top: 64px;
  transition: margin-left .3s cubic-bezier(.4, 0, .2, 1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#mainWrapper.sidebar-collapsed {
  margin-left: 0;
}

@media (max-width: 991.98px) {
  #mainWrapper {
    margin-left: 0 !important;
  }
}

#topNavbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1050;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: background .3s, border-color .3s;
}

@media (max-width: 480px) {
  #topNavbar {
    padding: 0 10px;
    gap: 6px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: .9rem;
  }

  .theme-toggle {
    padding: 3px 4px;
  }

  .theme-toggle .toggle-icon {
    width: 24px;
    height: 24px;
    font-size: .75rem;
  }

  .user-avatar-btn {
    padding: 4px;
    gap: 0;
  }
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.topbar-search input {
  width: 100%;
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  color: var(--search-text);
  border-radius: 20px;
  padding: 8px 16px 8px 38px;
  font-size: 0.875rem;
  transition: all 0.25s ease;
}

.topbar-search input::placeholder {
  color: var(--text-muted-c);
}

.topbar-search input:focus {
  outline: none;
  background: var(--card-bg);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.topbar-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted-c);
  font-size: .95rem;
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
  position: relative;
}

.icon-btn:hover {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.icon-btn .notif-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background: var(--brand-danger);
  border-radius: 50%;
  border: 1.5px solid var(--topbar-bg);
}

.theme-toggle {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  transition: background .3s, border-color .3s;
}

.theme-toggle .toggle-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  transition: background .2s, color .2s;
}

.theme-toggle .toggle-icon.active {
  background: var(--brand-primary);
  color: #fff;
}

.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 5px 10px 5px 5px;
  cursor: pointer;
  transition: border-color .2s;
}

.user-avatar-btn:hover {
  border-color: var(--brand-primary);
}

.user-avatar-btn .uname {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-avatar-btn .urole {
  font-size: .68rem;
  color: var(--text-muted-c);
}

.dropdown-menu {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
}

.dropdown-item {
  color: var(--text-main);
  font-size: .85rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--muted-surface);
  color: var(--brand-primary);
}

.dropdown-divider {
  border-top-color: var(--card-border);
}

/* =============================================
   5. MAIN CONTENT & TYPOGRAPHY
============================================= */
#mainContent {
  flex: 1;
  padding: 28px 28px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -.3px;
}

.text-muted-c {
  color: var(--text-muted-c) !important;
}

.erp-breadcrumb .breadcrumb {
  font-size: .8rem;
  margin: 0;
  background: transparent;
  padding: 0;
  font-weight: 500;
}

.erp-breadcrumb .breadcrumb-item a {
  color: var(--brand-primary);
  text-decoration: none;
}

.erp-breadcrumb .breadcrumb-item.active {
  color: var(--text-muted-c);
}

.text-gu {
  font-family: var(--font-gu) !important;
}

/* =============================================
   6. CARDS & KPI
============================================= */
.erp-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: background .3s, border-color .3s, box-shadow .2s;
  margin-bottom: 24px;
}

.erp-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
}

.erp-card .card-head,
.erp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
}

.erp-card .card-head h6,
.erp-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.erp-card .card-body,
.erp-card-body {
  padding: 20px;
}

.erp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, background .3s, border-color .3s;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
}

.kpi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.kpi-students::before {
  background: #3b82f6;
}

.kpi-teachers::before {
  background: #0ea5e9;
}

.kpi-attend::before {
  background: #10b981;
}

.kpi-revenue::before {
  background: #f59e0b;
}

.kpi-card .kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.kpi-students .kpi-icon {
  background: rgba(59, 130, 246, .12);
  color: #3b82f6;
}

.kpi-teachers .kpi-icon {
  background: rgba(14, 165, 233, .12);
  color: #0ea5e9;
}

.kpi-attend .kpi-icon {
  background: rgba(16, 185, 129, .12);
  color: #10b981;
}

.kpi-revenue .kpi-icon {
  background: rgba(245, 158, 11, .12);
  color: #f59e0b;
}

.kpi-card .kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-card .kpi-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted-c);
  margin-bottom: 5px;
}

.kpi-card .kpi-number {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -1px;
}

/* =============================================
   7. FORMS, INPUTS & BUTTONS
============================================= */
.btn-brand,
.erp-btn,
.erp-btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: .875rem;
  padding: 9px 20px;
  transition: background .2s, transform .15s, box-shadow .2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-brand:hover,
.erp-btn:hover,
.erp-btn-primary:hover {
  background: #4338ca;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}

.btn-brand-outline,
.erp-btn-outline {
  background: transparent;
  border: 1.5px solid var(--card-border);
  color: var(--text-main);
  border-radius: 10px;
  font-weight: 600;
  font-size: .875rem;
  padding: 9px 20px;
  transition: background .2s, border-color .2s, color .2s, transform .15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-brand-outline:hover,
.erp-btn-outline:hover {
  background: var(--muted-surface);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-1px);
}

.btn-icon-sq {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.erp-form-group {
  margin-bottom: 14px;
}

.erp-label,
.filter-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted-c);
  margin-bottom: 6px;
}

.erp-label.gu {
  font-family: var(--font-gu);
  text-transform: none;
  font-size: .85rem;
}

.erp-label .req {
  color: var(--brand-danger);
  margin-left: 3px;
}

.erp-input,
.erp-select,
.erp-textarea {
  background: var(--card-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .875rem;
  color: var(--text-main);
  width: 100%;
  transition: border-color .2s, box-shadow .2s, background .3s;
  font-family: var(--font-base);
}

.erp-input::placeholder {
  color: var(--text-muted-c);
}

.erp-input:focus,
.erp-select:focus,
.erp-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
  background: var(--card-bg);
}

.erp-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}

.erp-input-group {
  position: relative;
}

.erp-input-group .erp-input {
  padding-left: 38px;
}

.erp-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted-c);
  font-size: .95rem;
  pointer-events: none;
}

.erp-error-msg {
  font-size: .8rem;
  color: var(--brand-danger);
  margin-top: 4px;
  display: none;
}

.erp-error-msg.show {
  display: block;
}

/* =============================================
   8. TABLES & AVATARS
============================================= */
.erp-table {
  font-size: 0.9rem;
  color: #0f172a;
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.erp-table thead th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 20px;
  white-space: nowrap;
  border-bottom: 2px solid #f1f5f9;
  background: #ffffff;
  color: #64748b;
}

.erp-table tbody td {
  padding: 16px 20px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.erp-table tbody tr {
  transition: background .15s;
}

.erp-table tbody tr:hover {
  background: #f8fafc;
}

.avatar-sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.avatar-xs {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.badge-active,
.badge-success {
  background: rgba(16, 185, 129, .12);
  color: #059669;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
}

.badge-pending,
.badge-warning {
  background: rgba(245, 158, 11, .12);
  color: #d97706;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
}

.badge-inactive,
.badge-danger {
  background: rgba(239, 68, 68, .12);
  color: #dc2626;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
}

.badge-primary,
.erp-badge {
  background: rgba(59, 130, 246, .12);
  color: var(--brand-primary);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  display: inline-flex;
  align-items: center;
}

.badge-gu {
  background: var(--erp-gu-bg);
  color: var(--erp-gu-text);
  font-family: var(--font-gu);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
}

[data-bs-theme="dark"] .badge-active,
[data-bs-theme="dark"] .badge-success {
  background: rgba(16, 185, 129, .2);
  color: #6ee7b7;
}

[data-bs-theme="dark"] .badge-pending,
[data-bs-theme="dark"] .badge-warning {
  background: rgba(245, 158, 11, .2);
  color: #fcd34d;
}

[data-bs-theme="dark"] .badge-inactive,
[data-bs-theme="dark"] .badge-danger {
  background: rgba(239, 68, 68, .2);
  color: #fca5a5;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted-c);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background .2s, color .2s, border-color .2s;
}

.action-btn:hover {
  background: var(--muted-surface);
  color: var(--brand-primary);
  border-color: var(--card-border);
}

/* =============================================
   9. UTILITIES, TOASTS & OVERLAYS
============================================= */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1039;
}

#sidebarOverlay.show {
  display: block;
}

.erp-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted-c);
}

.erp-empty i {
  font-size: 42px;
  margin-bottom: 14px;
  display: block;
  opacity: 0.35;
}

.erp-empty h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.erp-empty p {
  font-size: .875rem;
  margin-bottom: 16px;
}

#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.erp-toast {
  min-width: 300px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInToast .3s ease;
  font-size: .875rem;
}

.erp-toast .toast-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
}

.erp-toast .toast-title {
  font-weight: 700;
  font-size: .875rem;
  color: var(--text-main);
}

.erp-toast .toast-msg {
  font-size: .8rem;
  color: var(--text-muted-c);
  margin-top: 2px;
}

.erp-toast .toast-close {
  margin-left: auto;
  cursor: pointer;
  color: var(--text-muted-c);
  background: none;
  border: none;
  font-size: 1rem;
  padding: 0;
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── KPI / stat cards (erp-kpi-*) ── */
:root,
[data-bs-theme="dark"] {
  --erp-primary: var(--brand-primary);
  --erp-success: var(--brand-success);
  --erp-warning: var(--brand-warning);
  --erp-danger: var(--brand-danger);
  --erp-accent: #0ea5e9;
}

.erp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.erp-kpi {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.erp-kpi-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted-c);
  margin-bottom: 6px;
}

.erp-kpi-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -1px;
}

.erp-kpi-sub {
  font-size: .76rem;
  color: var(--text-muted-c);
  margin-top: 6px;
}

/* =============================================
   10. RESPONSIVE MEDIA QUERIES
============================================= */
@media (max-width: 992px) {
  .erp-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .erp-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #mainContent {
    padding: 16px;
  }

  .erp-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .erp-card-grid {
    grid-template-columns: 1fr;
  }

  .erp-card .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .erp-kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media print {

  #sidebar,
  #topNavbar,
  .theme-toggle,
  .user-avatar-btn,
  .btn-brand,
  .erp-btn,
  .app-footer,
  .no-print {
    display: none !important;
  }

  #mainWrapper {
    margin-left: 0 !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .erp-card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }
}

/* =============================================
   Top-navbar brand (moved out of the sidebar)
============================================= */
.navbar-brand-top {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: 6px;
  white-space: nowrap;
}

.navbar-brand-top .brand-badge {
  width: 34px;
  height: 34px;
  background: var(--brand-primary);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}

.navbar-brand-top .brand-txt {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: .3px;
}

.navbar-brand-top .brand-txt span {
  color: var(--brand-primary);
  font-weight: 500;
}

@media (max-width: 480px) {
  .navbar-brand-top .brand-txt {
    display: none;
  }
}

/* =============================================
   Teacher sidenav items (erp-nav-* -> themed like sidebar-link)
============================================= */
.erp-nav-section {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, .32);
  padding: 14px 20px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.erp-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 8px;
  margin: 2px 10px;
  white-space: nowrap;
  overflow: hidden;
  transition: background .2s, color .2s;
}

.erp-nav-item i {
  font-size: 1.05rem;
  flex-shrink: 0;
  text-align: center;
  width: 20px;
}

.erp-nav-item span {
  flex: 1;
}

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

.erp-nav-item.active {
  background: var(--brand-primary);
  color: #fff;
}

/* ── Global photo Lightbox (shared by Activity Register etc.) ── */
#lbOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, .92);
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
}

#lbOverlay .lb-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 70px;
  box-sizing: border-box;
}

#lbOverlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

#lbOverlay .lb-btn {
  position: absolute;
  background: rgba(255, 255, 255, .12);
  border: none;
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

#lbOverlay .lb-btn:hover {
  background: rgba(255, 255, 255, .28);
}

#lbOverlay .lb-prev {
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}

#lbOverlay .lb-next {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

#lbOverlay .lb-close {
  top: 14px;
  right: 14px;
}

#lbOverlay .lb-download {
  top: 14px;
  right: 70px;
  text-decoration: none;
}

#lbOverlay .lb-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .85);
  font-size: .82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, .12);
  padding: 4px 14px;
  border-radius: 20px;
}

@media (max-width: 640px) {
  #lbOverlay .lb-stage {
    padding: 50px 12px;
  }

  #lbOverlay .lb-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  #lbOverlay .lb-download {
    right: 60px;
  }
}

.erp-nav-item.active i {
  color: #fff;
}
/* Extracted from students.html inline styles */
.sidebar-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    margin: 2px 10px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background .2s, color .2s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-group-header:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-group-header .grp-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
    text-align: center;
    width: 20px;
}

.sidebar-group-header .link-text {
    flex: 1;
    transition: opacity .2s;
}

.sidebar-group-header .grp-arrow {
    font-size: .7rem;
    opacity: .6;
    transition: transform .2s;
}

.sidebar-group.open .grp-arrow {
    transform: rotate(90deg);
}

.sidebar-sub {
    display: none;
    padding-bottom: 4px;
    margin: 0 10px;
}

.sidebar-group.open .sidebar-sub {
    display: block;
}

.sidebar-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 8px 36px;
    border-radius: 8px;
    color: rgba(255, 255, 255, .6);
    font-size: .8rem;
    text-decoration: none;
    transition: all .2s;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-sub-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-sub-item.active {
    background: var(--brand-primary);
    color: #fff;
    font-weight: 500;
}

.sidebar-sub-item i {
    font-size: .75rem;
    min-width: 14px;
    text-align: center;
    opacity: .8;
}

#sidebar.collapsed .sidebar-group-header {
    justify-content: center;
    gap: 0;
    margin: 2px 8px;
    padding: 12px 0;
}

#sidebar.collapsed .sidebar-group-header .grp-icon {
    display: block !important;
    margin: 0 auto;
    font-size: 1.2rem;
}

#sidebar.collapsed .sidebar-group-header .link-text,
#sidebar.collapsed .sidebar-group-header .grp-arrow,
#sidebar.collapsed .sidebar-sub {
    display: none !important;
}

/* ── Card view ── */
.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.student-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s, border-color .2s;
    cursor: pointer;
}

.student-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-primary);
}

/* ========================================================
   Teacher & Principal Dashboard Core Layout Styles
======================================================== */
.md-top { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.md-search { position: relative; flex: 1; min-width: min(250px, 100%); }
.md-search input { width: 100%; padding: 12px 14px 12px 42px; border: 1px solid var(--card-border); border-radius: 12px; background: var(--card-bg); color: var(--text-main); font-size: .92rem; }
.md-search i.si { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted-c); }
.md-search .res { position: absolute; z-index: 50; top: 112%; left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: var(--shadow-md); max-height: 340px; overflow: auto; display: none; }
.md-search .res a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--card-border); }
.md-search .res a:hover { background: var(--muted-surface); }
.md-search .res .muted { color: var(--text-muted-c); font-size: .8rem; }
.md-act { display: flex; gap: 8px; flex-wrap: wrap; }
.md-act a { text-decoration: none; padding: 11px 16px; border-radius: 11px; font-weight: 700; font-size: .88rem; display: inline-flex; align-items: center; gap: 8px; }
.md-act .primary { background: var(--brand-primary); color: #fff; box-shadow: var(--shadow-sm); }
.md-act .secondary { background: var(--muted-surface); color: var(--text-main); border: 1px solid var(--card-border); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 1050px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpis { grid-template-columns: 1fr; } }
.kc { position: relative; overflow: hidden; border-radius: 16px; padding: 17px 18px; color: #fff; text-decoration: none; display: block; min-height: 96px; box-shadow: var(--shadow-sm); min-width: 0; }
.kc, .kc:hover, .kc:focus { color: #fff; }
.kc:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); filter: brightness(1.06); transition: .14s; }
.kc .kbg { position: absolute; right: -8px; bottom: -14px; font-size: 4.6rem; opacity: .18; }
.kc .klab { font-size: .74rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; opacity: .95; }
.kc .kval { font-size: 1.9rem; font-weight: 800; line-height: 1.15; margin-top: 4px; overflow-wrap: break-word; }
.kc .ksub { font-size: .76rem; opacity: .9; overflow-wrap: break-word; }
.kc.c1 { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.kc.c2 { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.kc.c3 { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.kc.c4 { background: linear-gradient(135deg, #16a34a, #22c55e); }
.kc.c5 { background: linear-gradient(135deg, #ca8a04, #eab308); }
.kc.c6 { background: linear-gradient(135deg, #db2777, #ec4899); }
.kc.c7 { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.kc.disabled { opacity: .75; cursor: default; }

.card2 { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.card2 h6 { font-weight: 800; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
@media (max-width: 480px) { .card2 h6 { flex-direction: column; align-items: flex-start; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.att-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.att-h .tools { display: flex; gap: 8px; align-items: center; }
@media (max-width: 480px) { .att-h { flex-direction: column; align-items: flex-start; } .att-h .tools { width: 100%; flex-wrap: wrap; } .att-h .tools input[type=date] { flex: 1; min-width: 0; } }
.att-h input[type=date] { padding: 7px 10px; border: 1px solid var(--card-border); border-radius: 9px; background: var(--card-bg); color: var(--text-main); }
.att-h .zbtn { background: rgba(220, 38, 38, .1); color: #dc2626; border: 1px solid rgba(220, 38, 38, .25); border-radius: 9px; padding: 7px 12px; font-weight: 700; font-size: .82rem; cursor: pointer; text-decoration: none; }
table.att { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.att th, table.att td { border: 1px solid var(--card-border); padding: 6px 7px; text-align: center; }
table.att th { background: var(--muted-surface); font-weight: 700; }
table.att td.l { text-align: left; font-weight: 600; }
table.att tr.tot td { background: var(--muted-surface); font-weight: 800; }

.ql-wrap { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 16px 18px; }
.ql-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 11px; }
.ql { position: relative; border: 1px solid var(--card-border); border-radius: 12px; padding: 13px; text-decoration: none; color: inherit; display: flex; gap: 11px; align-items: center; background: var(--card-bg); }
.ql:hover { border-color: var(--brand-primary); transform: translateY(-2px); transition: .12s; }
.ql .qi { width: 36px; height: 36px; border-radius: 10px; background: var(--muted-surface); color: var(--brand-primary); display: flex; align-items: center; justify-content: center; }
.ql .qn { font-weight: 700; font-size: .84rem; }
.ql .qpin { position: absolute; top: 6px; right: 8px; font-size: .7rem; color: var(--text-muted-c); cursor: pointer; opacity: .5; }
.ql .qpin.on { color: #ca8a04; opacity: 1; }
.pin-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pin-strip .pl { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; background: var(--card-bg); border: 1px solid var(--card-border); border-left: 3px solid #ca8a04; border-radius: 10px; padding: 9px 13px; font-weight: 600; font-size: .84rem; }
.sec-h { font-weight: 800; margin: 20px 2px 12px; font-size: .95rem; }

.mv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 420px) { .mv-grid { grid-template-columns: repeat(2, 1fr); } }
.mv { border: 1px solid var(--card-border); border-radius: 11px; padding: 11px; text-align: center; min-width: 0; }
.mv .n { font-size: 1.4rem; font-weight: 800; }
.mv .l { font-size: .72rem; color: var(--text-muted-c); font-weight: 600; }
.mv.new .n { color: #16a34a; }
.mv.re .n { color: #2563eb; }
.mv.tr .n { color: #7c3aed; }
.mv.lc .n { color: #dc2626; }

.feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--card-border); }
.feed-item:last-child { border-bottom: none; }
.feed-item .fi { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feed-item > div { min-width: 0; }
.feed-item .ft { font-weight: 700; font-size: .88rem; overflow-wrap: break-word; }
.feed-item .fm { font-size: .8rem; color: var(--text-muted-c); overflow-wrap: break-word; }

.zmodal { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding: 30px 14px; overflow: auto; }
.zbox { background: var(--card-bg); border-radius: 14px; width: min(680px, 100%); box-shadow: var(--shadow-md); }
.zhead { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--card-border); }
.zclose { cursor: pointer; font-size: 1.5rem; line-height: 1; color: var(--text-muted-c); }
.zctrl { display: flex; gap: 8px; align-items: center; padding: 12px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--card-border); }
.zctrl input[type=month] { padding: 7px 10px; border: 1px solid var(--card-border); border-radius: 8px; background: var(--card-bg); color: var(--text-main); }
.zctrl button { border: none; border-radius: 8px; padding: 7px 13px; font-weight: 600; cursor: pointer; font-size: .83rem; }
.zgo { background: var(--brand-primary); color: #fff; }
.zdl { background: #16a34a; color: #fff; }
.zsh { background: #0284c7; color: #fff; }
.zbody { padding: 16px 18px; max-height: 62vh; overflow: auto; }
.zfoot { padding: 12px 18px; border-top: 1px solid var(--card-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.zfoot .zbtn { border: none; border-radius: 8px; padding: 9px 18px; font-weight: 600; font-size: .85rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; line-height: 1.2; }
.zfoot .zbtn-ghost { background: var(--muted-surface); color: var(--text-main); border: 1px solid var(--card-border); }
.zfoot .zbtn-primary { background: var(--brand-primary); color: #fff; }

/* ── Teacher Sidebar erp-nav Items ── */
.erp-nav-section {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, .32);
  padding: 14px 20px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.erp-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 8px;
  margin: 2px 10px;
  white-space: nowrap;
  overflow: hidden;
  transition: background .2s, color .2s;
  cursor: pointer;
}

.erp-nav-item i {
  font-size: 1.05rem;
  flex-shrink: 0;
  text-align: center;
  width: 20px;
}

.erp-nav-item span {
  flex: 1;
}

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

.erp-nav-item.active {
  background: var(--brand-primary);
  color: #fff;
}

.erp-nav-item.active i {
  color: #fff;
}

.erp-nav-item.sub {
  padding-left: 46px;
  font-size: .83rem;
  margin-top: 0;
}

.erp-nav-group .grp-caret {
  margin-left: auto;
  font-size: .7rem;
  transition: transform .2s;
}

.erp-nav-group a[aria-expanded="true"] .grp-caret {
  transform: rotate(180deg);
}


