/*
  Agape Language Academy - Stable Beautiful UI Theme v4
  Purpose: brighten and polish the portal while preserving the app's original
  layout, sizing, overflow, and module behavior.
*/

:root {
  --bg: #edf6ff !important;
  --sidebar-bg: #0b1235 !important;
  --surface: #ffffff !important;
  --surface-hover: #f4f9ff !important;
  --border: rgba(37, 99, 235, 0.16) !important;
  --text: #13203a !important;
  --text-dim: #5f6e87 !important;
  --text-muted: #7b879a !important;
  --teal: #0d9488 !important;
  --teal-dim: rgba(13, 148, 136, 0.14) !important;
  --purple: #7c3aed !important;
  --purple-dim: rgba(124, 58, 237, 0.14) !important;
  --amber: #f59e0b !important;
  --amber-dim: rgba(245, 158, 11, 0.15) !important;
  --red: #ef4444 !important;
  --red-dim: rgba(239, 68, 68, 0.14) !important;
  --green: #10b981 !important;
  --green-dim: rgba(16, 185, 129, 0.14) !important;
  --blue: #2563eb !important;
  --blue-dim: rgba(37, 99, 235, 0.14) !important;
  --orange: #f97316 !important;
  --orange-dim: rgba(249, 115, 22, 0.14) !important;
  --teal-glow: 0 12px 28px rgba(13, 148, 136, 0.16) !important;
  --purple-glow: 0 12px 28px rgba(124, 58, 237, 0.16) !important;
  --amber-glow: 0 12px 28px rgba(245, 158, 11, 0.16) !important;
  --red-glow: 0 12px 28px rgba(239, 68, 68, 0.14) !important;
  --green-glow: 0 12px 28px rgba(16, 185, 129, 0.14) !important;
}

html,
body,
.shell,
.main {
  color: #13203a !important;
  background:
    radial-gradient(circle at 12% 4%, rgba(45, 212, 191, 0.22), transparent 28%),
    radial-gradient(circle at 78% 0%, rgba(124, 58, 237, 0.13), transparent 30%),
    linear-gradient(135deg, #f8fcff 0%, #eef7ff 52%, #fff7ed 100%) !important;
}

.content {
  background: transparent !important;
}

/* Sidebar */
.sidebar {
  background:
    linear-gradient(180deg, rgba(15, 23, 66, 0.98), rgba(7, 12, 38, 0.99)),
    linear-gradient(135deg, #312e81, #0f766e) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 16px 0 38px rgba(15, 23, 42, 0.2) !important;
}

.sidebar,
.sidebar * {
  -webkit-text-fill-color: currentColor !important;
}

.sidebar-logo-text strong,
.sidebar-user .user-name {
  color: #ffffff !important;
}

.sidebar-logo-text span,
.sidebar .nav-item,
.sidebar-user,
.sidebar-user * {
  color: rgba(226, 238, 255, 0.78) !important;
}

.agape-original-brand-hidden {
  display: none !important;
}

.agape-brand-logo {
  box-sizing: border-box !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.agape-brand-logo img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
}

.agape-brand-logo-sidebar {
  width: 100% !important;
  min-height: 128px !important;
  padding: 18px 18px 14px !important;
  margin: 0 0 8px !important;
}

.agape-brand-logo-sidebar img {
  max-width: 178px !important;
  max-height: 128px !important;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.24)) !important;
}

.agape-brand-logo-login {
  width: min(100%, 420px) !important;
  margin: 0 auto 26px !important;
  padding: 4px 4px 2px !important;
}

.agape-brand-logo-login img {
  max-height: 104px !important;
}

.agape-ai-footer {
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 28px auto 0 !important;
  padding: 18px 16px 22px !important;
  text-align: center !important;
  color: #52637d !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  -webkit-text-fill-color: currentColor !important;
}

.sidebar .agape-ai-footer {
  color: rgba(226, 238, 255, 0.72) !important;
}

.nav-item {
  border-radius: 14px !important;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease !important;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

.nav-item.active {
  color: #061b2b !important;
  background: linear-gradient(135deg, #5eead4, #38bdf8 58%, #a78bfa) !important;
  border-color: rgba(255, 255, 255, 0.58) !important;
  box-shadow: 0 14px 30px rgba(45, 212, 191, 0.28) !important;
}

/* Topbar */
.topbar {
  background: rgba(255, 255, 255, 0.7) !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.08) !important;
  backdrop-filter: blur(16px);
}

.topbar,
.topbar *,
.page-title,
.page-sub {
  color: #13203a !important;
  -webkit-text-fill-color: currentColor !important;
}

.page-title {
  font-weight: 800 !important;
}

.page-sub {
  color: #65748c !important;
}

.icon-btn,
.topbar-user,
select,
input,
textarea,
.form-control {
  color: #13203a !important;
  -webkit-text-fill-color: currentColor !important;
  background: #ffffff !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  box-shadow: 0 10px 24px rgba(35, 52, 102, 0.08) !important;
}

.icon-btn:hover,
.topbar-user:hover,
select:hover,
input:hover,
textarea:hover,
.form-control:hover {
  border-color: rgba(13, 148, 136, 0.28) !important;
}

input::placeholder,
textarea::placeholder {
  color: #79869b !important;
  opacity: 1 !important;
}

/* General surfaces */
.card,
.batches-card,
.holidays-card,
.leads-card,
.chart-card,
.modal-content,
.table-wrap {
  color: #13203a !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  box-shadow: 0 18px 42px rgba(31, 41, 90, 0.1) !important;
}

.card,
.modal-content {
  overflow: hidden !important;
}

/* Dashboard live operations expands metric cards outside normal flow in the
   compiled app. Reserve space only when that first dashboard card contains
   metric cards, so the main KPI row never overlaps it. */
.content > .card:first-child:has(.stat-card) {
  min-height: 248px !important;
  margin-bottom: 18px !important;
}

.content > .card:first-child:has(.stat-card):has(button) {
  min-height: 840px !important;
  overflow: visible !important;
  margin-bottom: 28px !important;
}

.content > .card:first-child:has(.stat-card) > div:last-child {
  margin-top: 12px !important;
}

.card *,
.modal-content *,
.table-wrap * {
  text-shadow: none !important;
}

.card-title,
.card h1,
.card h2,
.card h3,
.card h4,
.modal-content h1,
.modal-content h2,
.modal-content h3,
.modal-content h4,
label,
.batch-name {
  color: #13203a !important;
  -webkit-text-fill-color: currentColor !important;
}

.card-meta,
.card small,
.batch-sub,
.stat-desc {
  color: #66748c !important;
  -webkit-text-fill-color: currentColor !important;
}

/* KPI/stat cards: color them without changing layout. */
.stats-grid > .stat-card,
.stat-card.purple,
.stat-card.amber,
.stat-card.red,
.stat-card.teal {
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 18px 38px rgba(31, 41, 90, 0.18) !important;
}

.stats-grid > .stat-card:nth-child(4n+1),
.stat-card.purple {
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%) !important;
}

.stats-grid > .stat-card:nth-child(4n+2),
.stat-card.amber {
  background: linear-gradient(135deg, #f97316 0%, #facc15 100%) !important;
}

.stats-grid > .stat-card:nth-child(4n+3),
.stat-card.red {
  background: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%) !important;
}

.stats-grid > .stat-card:nth-child(4n),
.stat-card.teal {
  background: linear-gradient(135deg, #0d9488 0%, #06b6d4 100%) !important;
}

.stats-grid > .stat-card *,
.stat-card.purple *,
.stat-card.amber *,
.stat-card.red *,
.stat-card.teal * {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
}

.stat-icon {
  background: rgba(255, 255, 255, 0.18) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22) !important;
}

/* Tables */
.table-wrap {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100% !important;
  min-width: 720px;
  background: #ffffff !important;
  border-collapse: collapse !important;
}

.data-table th {
  color: #17345f !important;
  -webkit-text-fill-color: currentColor !important;
  background: linear-gradient(135deg, #dbeafe 0%, #ccfbf1 100%) !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.16) !important;
  font-weight: 800 !important;
}

.data-table td {
  color: #44536b !important;
  -webkit-text-fill-color: currentColor !important;
  background: #ffffff !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.08) !important;
}

.data-table tr:nth-child(even) td {
  background: #f8fbff !important;
}

.data-table tr:hover td {
  background: #f0fdfa !important;
}

.data-table td *,
.data-table th * {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

/* Badges, buttons, status pills */
.badge,
.active-badge,
.planned-badge {
  color: #065f46 !important;
  -webkit-text-fill-color: currentColor !important;
  background: #ccfbf1 !important;
  border: 1px solid rgba(13, 148, 136, 0.24) !important;
}

.btn-primary,
button[type="submit"] {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: linear-gradient(135deg, #2563eb, #14b8a6) !important;
  border-color: transparent !important;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.2) !important;
}

.btn-secondary {
  color: #17345f !important;
  -webkit-text-fill-color: currentColor !important;
  background: #e0f2fe !important;
  border-color: rgba(37, 99, 235, 0.16) !important;
}

/* Shared module polish and visibility */
.content > .card,
.content > .table-wrap,
.content > .batches-card,
.content > .holidays-card,
.content > .leads-card,
.content > .chart-card {
  border-radius: 18px !important;
}

.content > .card::before,
.content > .table-wrap::before,
.modal-content::before {
  content: "" !important;
  display: block !important;
  height: 4px !important;
  margin: -1px -1px 0 !important;
  background: linear-gradient(90deg, #14b8a6, #38bdf8 35%, #7c3aed 68%, #f59e0b) !important;
}

.card-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 14px !important;
  padding-bottom: 14px !important;
  margin-bottom: 16px !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.1) !important;
}

.card-header .card-title,
.table-wrap .card-title {
  margin: 0 !important;
}

.page-heading {
  color: #ffffff !important;
  background: linear-gradient(135deg, #0f766e 0%, #2563eb 100%) !important;
  border: 0 !important;
  border-radius: 18px !important;
  box-shadow: 0 18px 44px rgba(37, 99, 235, 0.2) !important;
}

.page-heading,
.page-heading * {
  -webkit-text-fill-color: currentColor !important;
  color: #ffffff !important;
}

.page-heading .badge {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.tab-btn,
.wa-tab {
  min-height: 44px !important;
  padding: 10px 18px !important;
  border-radius: 14px !important;
  color: #40506a !important;
  -webkit-text-fill-color: currentColor !important;
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  box-shadow: 0 10px 24px rgba(31, 41, 90, 0.08) !important;
  font-weight: 750 !important;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease !important;
}

.tab-btn:hover,
.wa-tab:hover {
  transform: translateY(-1px) !important;
  color: #0f766e !important;
  border-color: rgba(20, 184, 166, 0.34) !important;
  box-shadow: 0 14px 28px rgba(13, 148, 136, 0.14) !important;
}

.tab-btn.active,
.tab-btn[aria-selected="true"],
.wa-tab.active {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: linear-gradient(135deg, #0d9488, #2563eb) !important;
  border-color: transparent !important;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.22) !important;
}

.btn,
.action-btn,
.mobile-toggle-btn,
.modal-close,
.data-table td button {
  border-radius: 12px !important;
  font-weight: 750 !important;
  color: #17345f !important;
  -webkit-text-fill-color: currentColor !important;
  background: #e0f2fe !important;
  border: 1px solid rgba(37, 99, 235, 0.16) !important;
  box-shadow: 0 8px 18px rgba(31, 41, 90, 0.08) !important;
}

.btn:hover,
.action-btn:hover,
.mobile-toggle-btn:hover,
.modal-close:hover,
.data-table td button:hover {
  color: #0f766e !important;
  background: #ccfbf1 !important;
  border-color: rgba(13, 148, 136, 0.28) !important;
}

.btn-danger {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: linear-gradient(135deg, #dc2626, #f43f5e) !important;
  border-color: transparent !important;
}

.btn-primary:hover,
button[type="submit"]:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 16px 34px rgba(20, 184, 166, 0.22) !important;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn:disabled,
button:disabled {
  cursor: not-allowed !important;
  opacity: 0.62 !important;
  transform: none !important;
}

.form-grid {
  gap: 16px !important;
}

.form-group {
  color: #253654 !important;
}

.form-group input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  accent-color: #0d9488 !important;
  box-shadow: none !important;
}

.content select.form-control,
.content input.form-control,
.content textarea.form-control,
.content input[type="search"],
.content input[type="date"],
.content input[type="number"],
.content input[type="email"],
.content input[type="tel"],
.content input[type="password"],
.content select,
.content textarea {
  border-radius: 12px !important;
  min-height: 44px !important;
  color: #13203a !important;
  background: #ffffff !important;
}

.content textarea {
  line-height: 1.5 !important;
}

.modal-overlay {
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: blur(10px) !important;
}

.modal-header,
.modal-footer {
  background: linear-gradient(135deg, #f8fcff, #eff6ff) !important;
  border-color: rgba(37, 99, 235, 0.12) !important;
}

.modal-header h2,
.modal-header h3,
.modal-header h4 {
  color: #13203a !important;
}

.content [class$="-badge"]:not(.notif-badge),
.content [class*="-badge "]:not(.notif-badge),
.new-badge,
.followup-badge,
.converted-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 28px !important;
  padding: 5px 12px !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.new-badge {
  color: #1d4ed8 !important;
  background: #dbeafe !important;
  border-color: rgba(37, 99, 235, 0.22) !important;
}

.followup-badge {
  color: #92400e !important;
  background: #fef3c7 !important;
  border-color: rgba(245, 158, 11, 0.28) !important;
}

.converted-badge {
  color: #065f46 !important;
  background: #d1fae5 !important;
  border-color: rgba(16, 185, 129, 0.28) !important;
}

.data-table caption,
.data-table small,
.table-wrap small {
  color: #64748b !important;
  -webkit-text-fill-color: currentColor !important;
}

.data-table td strong {
  color: #18243d !important;
  -webkit-text-fill-color: currentColor !important;
}

.data-table td:first-child {
  color: #334155 !important;
}

.content .empty-state,
.content [class*="empty" i] {
  color: #64748b !important;
  background: #f8fbff !important;
  border: 1px dashed rgba(37, 99, 235, 0.2) !important;
  border-radius: 14px !important;
}

.content [style*="rgba(255, 255, 255, 0.05)"]:not(.stat-icon):not(.wa-bubble),
.content [style*="rgba(255,255,255,0.05)"]:not(.stat-icon):not(.wa-bubble) {
  color: #13203a !important;
  -webkit-text-fill-color: currentColor !important;
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(37, 99, 235, 0.14) !important;
}

.content [style*="rgba(255, 255, 255, 0.05)"]:not(.stat-icon):not(.wa-bubble) *,
.content [style*="rgba(255,255,255,0.05)"]:not(.stat-icon):not(.wa-bubble) * {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

.content button:focus-visible,
.content a:focus-visible,
.content input:focus-visible,
.content select:focus-visible,
.content textarea:focus-visible,
.sidebar .nav-item:focus-visible {
  outline: 3px solid rgba(20, 184, 166, 0.24) !important;
  outline-offset: 2px !important;
}

.mock-exam-fallback .stats-grid {
  margin: 18px 0 !important;
}

.mock-module-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr) !important;
  gap: 18px !important;
  align-items: stretch !important;
}

.mock-side-card {
  background: linear-gradient(135deg, #ffffff, #f0fdfa) !important;
}

.mock-side-card ul {
  margin: 12px 0 18px !important;
  padding-left: 20px !important;
  color: #40506a !important;
}

.mock-side-card li {
  margin: 10px 0 !important;
}

.route-empty-fallback {
  min-height: 220px !important;
}

.main.route-fallback-active > .content {
  display: none !important;
}

.route-fallback-overlay {
  flex: 1 1 auto !important;
  overflow: auto !important;
  padding: 8px 32px 32px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
  background: transparent !important;
}

.student-route-stabilized {
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%) !important;
  border: 1px solid rgba(37, 99, 235, 0.16) !important;
  box-shadow: 0 18px 45px rgba(31, 41, 90, 0.12) !important;
}

.student-route-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  gap: 14px !important;
  margin: 14px 0 !important;
}

.student-route-field {
  padding: 12px 14px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(20, 184, 166, 0.18) !important;
  background: linear-gradient(135deg, rgba(240, 253, 250, 0.95), rgba(239, 246, 255, 0.95)) !important;
}

.student-route-field span {
  display: block !important;
  color: #667795 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  margin-bottom: 5px !important;
}

.student-route-field strong {
  color: #14213d !important;
  font-size: 15px !important;
}

.student-route-batch-card {
  padding: 18px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(20, 184, 166, 0.22) !important;
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.96), rgba(239, 246, 255, 0.96)) !important;
  margin: 18px 20px !important;
}

.student-route-batch-card h3 {
  margin: 0 0 10px !important;
  color: #0f766e !important;
  display: flex !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
}

.student-route-batch-card h3 span {
  font-size: 12px !important;
  color: #0f766e !important;
  background: rgba(20, 184, 166, 0.14) !important;
  border: 1px solid rgba(20, 184, 166, 0.22) !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
}

.student-route-two-col {
  display: grid !important;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr) !important;
  gap: 18px !important;
  padding: 20px !important;
}

.student-route-ai {
  margin: 20px !important;
  padding: 18px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(37, 99, 235, 0.16) !important;
  background: linear-gradient(135deg, #eff6ff, #f0fdfa) !important;
  color: #14213d !important;
}

.tutor-ai-composer-enhanced {
  gap: 8px !important;
}

.tutor-ai-tools {
  display: grid !important;
  grid-template-columns: auto auto auto minmax(160px, 1fr) !important;
  gap: 8px !important;
  align-items: center !important;
  width: 100% !important;
}

.tutor-ai-tools button,
.tutor-ai-draft button {
  min-height: 36px !important;
  border: 1px solid rgba(37, 99, 235, 0.22) !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #ffffff, #e8fbff) !important;
  color: #163152 !important;
  font-weight: 800 !important;
  padding: 7px 12px !important;
  cursor: pointer !important;
}

.tutor-ai-tools button:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

.tutor-ai-tools > span {
  min-width: 0 !important;
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.tutor-ai-draft {
  grid-column: 1 / -1 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 10px !important;
  border: 1px solid rgba(13, 148, 136, 0.24) !important;
  border-radius: 12px !important;
  background: rgba(240, 253, 250, 0.96) !important;
  color: #134e4a !important;
  font-size: 12px !important;
}

.tutor-ai-draft[hidden] {
  display: none !important;
}

.tutor-ai-draft strong {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.tutor-ai-draft span {
  margin-left: auto !important;
  color: #0f766e !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
}

.tutor-ai-attachment-bubble {
  display: grid !important;
  gap: 6px !important;
  max-width: 360px !important;
  margin: 10px 18px 10px auto !important;
  padding: 12px 14px !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1) !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1) !important;
  color: #13203a !important;
}

.tutor-ai-attachment-bubble span {
  overflow-wrap: anywhere !important;
}

.tutor-ai-attachment-bubble audio {
  width: 100% !important;
}

.tutor-ai-attachment-bubble a {
  color: #1d4ed8 !important;
  font-weight: 900 !important;
}

@media (max-width: 760px) {
  .tutor-ai-tools {
    grid-template-columns: 1fr 1fr !important;
  }

  .tutor-ai-tools > span {
    grid-column: 1 / -1 !important;
    white-space: normal !important;
  }
}

.lms-chat-shell {
  display: grid !important;
  grid-template-columns: 230px minmax(0, 1fr) !important;
  gap: 16px !important;
  padding: 20px !important;
  min-height: 560px !important;
}

.lms-chat-side {
  display: grid !important;
  align-content: start !important;
  gap: 10px !important;
}

.lms-chat-side button {
  text-align: left !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  background: #ffffff !important;
  border-radius: 8px !important;
  padding: 12px !important;
  color: #13203a !important;
  box-shadow: 0 10px 22px rgba(31, 41, 90, 0.08) !important;
}

.lms-chat-side button.active {
  border-color: rgba(13, 148, 136, 0.36) !important;
  background: linear-gradient(135deg, #ecfeff, #f0fdf4) !important;
}

.lms-chat-side strong,
.lms-chat-side span {
  display: block !important;
}

.lms-chat-side span {
  color: #66748c !important;
  font-size: 12px !important;
  margin-top: 4px !important;
}

.lms-chat-panel {
  display: grid !important;
  grid-template-rows: minmax(260px, 1fr) auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #f8fcff, #ffffff) !important;
}

.lms-chat-thread {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  padding: 18px !important;
  overflow: auto !important;
  max-height: 520px !important;
}

.lms-chat-bubble {
  width: min(680px, 86%) !important;
  border: 1px solid rgba(37, 99, 235, 0.13) !important;
  border-radius: 8px !important;
  padding: 12px !important;
  background: #ffffff !important;
  box-shadow: 0 10px 24px rgba(31, 41, 90, 0.08) !important;
}

.lms-chat-bubble.mine {
  align-self: flex-end !important;
  background: linear-gradient(135deg, #e0f2fe, #dcfce7) !important;
}

.lms-chat-bubble.staff {
  align-self: flex-start !important;
}

.lms-chat-bubble-head {
  display: flex !important;
  justify-content: space-between !important;
  gap: 10px !important;
  margin-bottom: 8px !important;
}

.lms-chat-bubble p {
  margin: 0 0 10px !important;
  white-space: pre-wrap !important;
}

.lms-chat-attachment {
  display: grid !important;
  gap: 8px !important;
  padding: 10px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(13, 148, 136, 0.2) !important;
  background: rgba(255, 255, 255, 0.74) !important;
}

.lms-chat-attachment > span {
  width: fit-content !important;
  padding: 4px 7px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  color: #0f766e !important;
  background: rgba(20, 184, 166, 0.13) !important;
}

.lms-chat-attachment img,
.lms-chat-attachment video {
  max-width: 100% !important;
  max-height: 240px !important;
  border-radius: 8px !important;
  object-fit: contain !important;
  background: #0f172a !important;
}

.lms-chat-attachment audio {
  width: 100% !important;
}

.lms-chat-image button {
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  text-align: left !important;
}

.lms-chat-actions,
.lms-chat-tools,
.lms-chat-link-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
}

.lms-chat-action,
.lms-chat-tools button,
.lms-chat-draft button,
.lms-chat-link-row button {
  min-height: 34px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  background: #ffffff !important;
  color: #13203a !important;
  padding: 7px 10px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

.lms-chat-composer {
  display: grid !important;
  gap: 10px !important;
  padding: 14px !important;
  border-top: 1px solid rgba(37, 99, 235, 0.14) !important;
  background: #ffffff !important;
}

.lms-chat-link-row {
  flex-wrap: nowrap !important;
}

.lms-chat-link-row input {
  min-width: 0 !important;
}

.lms-chat-tools span {
  flex: 1 1 220px !important;
  color: #66748c !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.lms-chat-draft {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 9px 10px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(13, 148, 136, 0.22) !important;
  background: #ecfdf5 !important;
}

.lms-chat-draft span {
  color: #0f766e !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
}

.lms-chat-popup {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: grid !important;
  place-items: center !important;
  padding: 22px !important;
  background: rgba(15, 23, 42, 0.68) !important;
}

.lms-chat-popup-card {
  width: min(980px, 96vw) !important;
  max-height: 92vh !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  overflow: hidden !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32) !important;
}

.lms-chat-popup-card header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.14) !important;
}

.lms-chat-popup-card header button {
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  padding: 7px 10px !important;
  font-weight: 800 !important;
}

.lms-chat-popup-body {
  display: grid !important;
  place-items: center !important;
  min-height: 320px !important;
  overflow: auto !important;
  padding: 14px !important;
}

.lms-chat-popup-body img,
.lms-chat-popup-body video {
  max-width: 100% !important;
  max-height: 76vh !important;
  object-fit: contain !important;
}

.lms-chat-popup-body audio {
  width: min(720px, 90vw) !important;
}

.lms-chat-popup-body iframe {
  width: 100% !important;
  height: 74vh !important;
  border: 0 !important;
}

.lms-chat-popup-file {
  text-align: center !important;
  display: grid !important;
  gap: 12px !important;
}

.live-lms-media-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 280px !important;
  max-width: 560px !important;
  padding: 8px !important;
  border: 1px solid rgba(20, 184, 166, 0.24) !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #ecfeff, #f0fdf4) !important;
  box-shadow: 0 10px 24px rgba(31, 41, 90, 0.08) !important;
}

.live-lms-media-toolbar button {
  min-height: 34px !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #13203a !important;
  padding: 7px 10px !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}

.live-lms-media-toolbar button:hover {
  border-color: rgba(13, 148, 136, 0.48) !important;
  background: #f8fcff !important;
}

.live-lms-draft-preview {
  flex: 1 1 100% !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(13, 148, 136, 0.22) !important;
  background: #ffffff !important;
}

.live-lms-draft-preview[hidden] {
  display: none !important;
}

.live-lms-draft-preview strong {
  max-width: 260px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.live-lms-draft-preview span {
  color: #0f766e !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
}

.live-lms-added-message {
  display: grid !important;
  justify-items: end !important;
  gap: 6px !important;
  margin: 12px 28px 12px auto !important;
}

.live-lms-added-meta {
  color: #7b879a !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.live-lms-added-bubble {
  max-width: 420px !important;
  padding: 10px !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #d1fae5, #bae6fd) !important;
}

@media (max-width: 900px) {
  .lms-chat-shell {
    grid-template-columns: 1fr !important;
    padding: 14px !important;
  }

  .lms-chat-side {
    grid-template-columns: 1fr 1fr !important;
  }

  .lms-chat-bubble {
    width: 100% !important;
  }

  .lms-chat-link-row {
    flex-wrap: wrap !important;
  }

  .student-route-two-col {
    grid-template-columns: 1fr !important;
    padding: 14px !important;
  }
}

/* Forms and settings */
.form-group label {
  color: #253654 !important;
  font-weight: 700 !important;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(20, 184, 166, 0.18) !important;
  border-color: rgba(13, 148, 136, 0.55) !important;
}

/* Login/auth screens */
.login-card,
.auth-card,
[class*="login" i] .card,
[class*="auth" i] .card {
  background: linear-gradient(180deg, #ffffff, #f8fcff) !important;
  color: #13203a !important;
  border: 1px solid rgba(37, 99, 235, 0.16) !important;
  box-shadow: 0 22px 60px rgba(31, 41, 90, 0.18) !important;
}

[class*="login" i],
[class*="auth" i] {
  color: #13203a !important;
}

/* WhatsApp module and dynamically injected admin hub */
.wa-module,
.wa-module *,
.wa-chat-app,
.wa-chat-app *,
.wa-profile-panel,
.wa-profile-panel * {
  -webkit-text-fill-color: currentColor !important;
  opacity: 1 !important;
}

.wa-module .card {
  color: #13203a !important;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 54%, #eff6ff 100%) !important;
  border: 1px solid rgba(20, 184, 166, 0.24) !important;
}

.wa-module .card:nth-of-type(2n) {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 48%, #eef2ff 100%) !important;
}

.wa-module .card-title,
.wa-module h2,
.wa-module h3 {
  color: #0f766e !important;
}

.wa-module p,
.wa-module label,
.wa-module .card-meta {
  color: #334155 !important;
}

.wa-module .data-table th {
  color: #ffffff !important;
  background: linear-gradient(135deg, #0f766e, #2563eb) !important;
}

.wa-module .data-table td {
  color: #1f2937 !important;
}

.wa-bubble,
.wa-bubble *,
.message-bubble,
.message-bubble * {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

.wa-bubble.out,
.message-bubble.outgoing {
  color: #052e16 !important;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0) !important;
}

.wa-bubble.in,
.message-bubble.incoming {
  color: #172554 !important;
  background: linear-gradient(135deg, #ffffff, #eff6ff) !important;
}

/* CRM Kanban pipeline cards were authored for a dark background with inline
   white text. Make those inline cards readable in the light portal theme. */
.content [style*="rgba(255, 255, 255, 0.01)"][style*="min-width: 180px"] {
  background: rgba(255, 255, 255, 0.86) !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  box-shadow: 0 12px 28px rgba(31, 41, 90, 0.08) !important;
}

.content [style*="rgba(255, 255, 255, 0.01)"][style*="min-width: 180px"] strong,
.content [style*="rgba(255, 255, 255, 0.01)"][style*="min-width: 180px"] div,
.content [style*="rgba(255, 255, 255, 0.01)"][style*="min-width: 180px"] span {
  color: #13203a !important;
  -webkit-text-fill-color: currentColor !important;
}

.content [style*="rgba(255, 255, 255, 0.01)"][style*="min-width: 180px"] > div:first-child {
  border-bottom-color: rgba(37, 99, 235, 0.14) !important;
}

.content [style*="rgba(255, 255, 255, 0.01)"][style*="min-width: 180px"] > div:first-child span {
  background: #dbeafe !important;
  color: #17345f !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
}

.content [style*="rgba(255, 255, 255, 0.02)"][style*="flex-direction: column"] {
  background: #ffffff !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  box-shadow: 0 10px 24px rgba(31, 41, 90, 0.08) !important;
}

.content [style*="rgba(255, 255, 255, 0.02)"][style*="flex-direction: column"] > div:first-child {
  color: #13203a !important;
  -webkit-text-fill-color: #13203a !important;
}

.content [style*="rgba(255, 255, 255, 0.02)"][style*="flex-direction: column"] button {
  background: #e0f2fe !important;
  color: #17345f !important;
  -webkit-text-fill-color: currentColor !important;
  border: 1px solid rgba(37, 99, 235, 0.12) !important;
}

@media (max-width: 900px) {
  .topbar {
    background: rgba(255, 255, 255, 0.88) !important;
  }

  .data-table {
    min-width: 680px;
  }

  .mock-module-grid {
    grid-template-columns: 1fr !important;
  }
}

/* CRM pages and lead-entry modal polish */
.main:has(.content):has(.card-title):has(.data-table) .content {
  padding-top: 18px !important;
}

.content:has(.card-title):has(.data-table) > div:first-child:has(.stat-card) {
  gap: 18px !important;
  margin-bottom: 20px !important;
}

.content:has(.card-title):has(.data-table) > div:first-child:has(.stat-card) .stat-card {
  min-height: 132px !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 38px rgba(31, 41, 90, 0.12) !important;
}

.content:has(.card-title):has(.data-table) > div:nth-child(2):has(button) {
  background: rgba(255, 255, 255, 0.72) !important;
  border: 1px solid rgba(37, 99, 235, 0.12) !important;
  border-radius: 16px !important;
  padding: 10px !important;
  margin-bottom: 22px !important;
  box-shadow: 0 14px 34px rgba(31, 41, 90, 0.08) !important;
}

.content:has(.card-title):has(.data-table) > div:nth-child(2):has(button) button {
  min-height: 58px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  background: linear-gradient(180deg, #ffffff, #f8fbff) !important;
  color: #253654 !important;
  font-weight: 800 !important;
  box-shadow: 0 8px 18px rgba(31, 41, 90, 0.06) !important;
}

.content:has(.card-title):has(.data-table) > div:nth-child(2):has(button) button:first-child,
.content:has(.card-title):has(.data-table) > div:nth-child(2):has(button) button[style*="linear-gradient"] {
  background: linear-gradient(135deg, #0f766e, #2563eb) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

.content .card:has(.card-title):has(.data-table) {
  border-radius: 18px !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  box-shadow: 0 22px 52px rgba(31, 41, 90, 0.10) !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  overflow: hidden !important;
}

.content .card:has(.card-title):has(.data-table) > .card-header,
.content .card:has(.card-title):has(.data-table) > div:first-child {
  border-bottom: 1px solid rgba(37, 99, 235, 0.12) !important;
}

.content .card:has(.card-title):has(.data-table) .form-grid {
  gap: 14px 18px !important;
  margin: 18px 0 20px !important;
}

.content .card:has(.card-title):has(.data-table) .form-control {
  min-height: 44px !important;
  border-radius: 10px !important;
}

.content .table-wrap {
  border-radius: 14px !important;
  border: 1px solid rgba(37, 99, 235, 0.12) !important;
  overflow: auto !important;
}

.content .data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.content .data-table th {
  height: 48px !important;
  padding: 12px 16px !important;
  white-space: nowrap !important;
  letter-spacing: 0 !important;
}

.content .data-table td {
  padding: 16px !important;
  vertical-align: middle !important;
}

.content .data-table tbody tr:hover td {
  background: #f7fbff !important;
}

.modal-overlay {
  align-items: center !important;
  justify-content: center !important;
  padding: 24px !important;
  backdrop-filter: blur(9px) saturate(115%) !important;
}

.modal-content {
  width: min(1180px, calc(100vw - 64px)) !important;
  max-height: calc(100vh - 88px) !important;
  border-radius: 18px !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  box-shadow: 0 34px 86px rgba(15, 23, 42, 0.32) !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.modal-content .modal-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 4 !important;
  background: linear-gradient(180deg, #ffffff, #f8fbff) !important;
  border-bottom: 1px solid rgba(37, 99, 235, 0.12) !important;
  padding: 18px 26px !important;
}

.modal-content .modal-header::before {
  content: "" !important;
  position: absolute !important;
  left: 26px !important;
  right: 26px !important;
  top: 0 !important;
  height: 4px !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #10b981, #38bdf8, #7c3aed, #f59e0b) !important;
}

.modal-content .modal-header .card-title,
.modal-content .modal-header h2 {
  font-size: 20px !important;
  line-height: 1.2 !important;
  color: #13203a !important;
}

.modal-content .modal-header button {
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  background: #eff6ff !important;
  color: #1e3a8a !important;
  border: 1px solid rgba(37, 99, 235, 0.16) !important;
  display: grid !important;
  place-items: center !important;
}

.modal-content > form,
.modal-content > div:not(.modal-header):not(.modal-footer) {
  overflow: auto !important;
}

.modal-content form {
  padding: 22px 26px 0 !important;
}

.modal-content .form-grid,
.modal-content form > div[style*="grid"] {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px 20px !important;
  align-items: end !important;
}

.modal-content .form-group {
  margin: 0 !important;
}

.modal-content .form-group label {
  display: block !important;
  margin-bottom: 7px !important;
  color: #253654 !important;
  font-size: 13px !important;
  font-weight: 850 !important;
}

.modal-content .form-control,
.modal-content input,
.modal-content select,
.modal-content textarea {
  min-height: 46px !important;
  border-radius: 11px !important;
  border: 1px solid rgba(37, 99, 235, 0.20) !important;
  background: #ffffff !important;
  color: #13203a !important;
  box-shadow: 0 4px 0 rgba(37, 99, 235, 0.04) !important;
}

.modal-content input[type="checkbox"] {
  min-height: 0 !important;
  width: 20px !important;
  height: 20px !important;
  accent-color: #0f766e !important;
  box-shadow: none !important;
}

.modal-content .modal-footer {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 4 !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), #ffffff) !important;
  border-top: 1px solid rgba(37, 99, 235, 0.12) !important;
  padding: 16px 26px !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 12px !important;
}

.modal-content .btn-primary,
.modal-content .btn.btn-primary {
  border: 0 !important;
  border-radius: 11px !important;
  min-height: 44px !important;
  padding: 0 22px !important;
  color: #ffffff !important;
  background: linear-gradient(135deg, #0f766e, #2563eb) !important;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18) !important;
}

.modal-content .btn-secondary,
.modal-content .btn.btn-secondary {
  border-radius: 11px !important;
  min-height: 44px !important;
  padding: 0 22px !important;
  color: #253654 !important;
  background: #eff6ff !important;
  border: 1px solid rgba(37, 99, 235, 0.16) !important;
}

@media (max-width: 1100px) {
  .modal-content .form-grid,
  .modal-content form > div[style*="grid"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  .modal-overlay {
    padding: 12px !important;
  }

  .modal-content {
    width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
  }

  .modal-content .form-grid,
  .modal-content form > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
}
