:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-secondary: #f59e0b;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --accent-purple: #8b5cf6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  --transition-fast: 0.2s ease;
  --sidebar-w: 240px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: auto;
}

/* APP LAYOUT - PRESERVES EXACT DESKTOP RATIOS & POSITIONING */
.app-container {
  display: flex;
  min-height: 100vh;
  min-width: 900px; /* Ensures desktop layout ratios & side-by-side positioning are always preserved */
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background-color: #1e293b;
  border-right: 1px solid var(--border-color);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  height: 100vh;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-logo-container {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 2px;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  flex-shrink: 0;
}

.brand h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.brand p {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
  width: 100%;
}

.nav-item i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.wa-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  justify-content: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
}

.wa-status-pill.connected .status-dot {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.wa-status-pill.connected {
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-width: 0;
  position: relative;
  min-height: 100vh;
}

/* SUBTLE LOGO WATERMARK BACKGROUND FOR ADMIN PORTAL */
.main-content::before {
  content: '';
  position: fixed;
  top: 50%;
  left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2);
  transform: translate(-50%, -50%);
  width: 540px;
  height: 540px;
  max-width: 70vw;
  max-height: 70vh;
  background: url('assets/logo_watermark.png') no-repeat center center;
  background-size: contain;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.topbar, .tab-content {
  position: relative;
  z-index: 1;
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.topbar-title h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.topbar-title p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-clock {
  background: #1e293b;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-accent {
  background-color: var(--accent-secondary);
  color: #0f172a;
}

.btn-accent:hover {
  background-color: #d97706;
  color: #fff;
}

.btn-secondary {
  background-color: #334155;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #475569;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background-color: #ef4444;
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.btn-outline-primary:hover {
  background-color: rgba(59, 130, 246, 0.15);
  color: #fff;
  border-color: var(--accent-primary-hover);
}

.subject-config-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s ease;
}

.subject-config-row:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

/* CARDS */
.card {
  background-color: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header-flex h2 {
  font-size: 18px;
  font-weight: 700;
}

.card-header-flex p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.search-filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-filter-group input,
.search-filter-group select {
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background-color: #334155;
  color: #cbd5e1;
  display: inline-block;
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* METRICS GRID - 4 CARDS ROW */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
  padding: 16px;
}

.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.metric-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.metric-icon.purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.metric-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.metric-icon.orange { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.metric-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.metric-value { font-size: 22px; font-weight: 800; color: var(--text-main); margin: 2px 0; }
.metric-sub { font-size: 11px; color: var(--text-muted); }

/* GRID 2 COL (CLASS RATIOS & FREQUENT ABSENTEES) */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.class-ratio-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.class-ratio-item {
  background-color: #0f172a;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.class-ratio-item:hover {
  border-color: #38bdf8;
}

.class-ratio-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

.progress-bar-bg {
  background-color: #1e293b;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.class-ratio-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.absentees-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.absentee-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.absentee-info h4 { font-size: 13px; font-weight: 700; color: #fff; }
.absentee-info p { font-size: 11px; color: #fca5a5; margin-top: 2px; }

.absentee-badge {
  background-color: #991b1b;
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* CLASSES GRID MANAGER */
.section-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border: 1px solid #4338ca;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.section-banner h2 { font-size: 18px; font-weight: 700; color: #fbbf24; }
.section-banner p { font-size: 12px; color: #c7d2fe; margin-top: 2px; }

.classes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.class-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.class-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.class-card-title { font-size: 16px; font-weight: 700; color: var(--text-main); }
.section-tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.section-tag {
  background-color: #0f172a;
  border: 1px solid #3b82f6;
  color: #60a5fa;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* DATA TABLE */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: #0f172a;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  font-size: 13px;
}

.data-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.phone-badge {
  color: #38bdf8;
  font-weight: 600;
  font-family: monospace;
}

/* WHATSAPP PORTAL CARD */
.wa-portal-card {
  text-align: center;
  padding: 30px;
}

.wa-portal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.wa-big-logo {
  font-size: 48px;
  color: #25d366;
}

.wa-qr-box {
  background-color: #0f172a;
  border-radius: var(--radius-lg);
  padding: 24px;
  display: inline-block;
}

.wa-qr-box img {
  width: 220px;
  height: 220px;
  border-radius: var(--radius-md);
  border: 4px solid #fff;
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  padding: 24px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  margin: auto;
  position: relative;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-dialog::-webkit-scrollbar {
  width: 6px;
}
.modal-dialog::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}
.modal-dialog::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
.modal-dialog::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent-secondary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover { color: #fff; }

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 13px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-readonly {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* TAB SWITCHING */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: var(--accent-success);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 200;
  pointer-events: none;
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

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

/* RESULTS MODULE & SUBNAV PILLS */
.subnav-pills {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
}

.subnav-btn {
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.subnav-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-main);
}

.subnav-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.results-subtab {
  display: none;
}

.results-subtab.active {
  display: block;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
}
.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  border: none;
  font-weight: 600;
}
.btn-whatsapp:hover {
  background: linear-gradient(135deg, #1ea952, #0d6e63);
  color: #fff;
}

.btn-call {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: none;
}
.btn-call:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  color: #fff;
}

/* MARKS INPUT GRID */
.mark-num-input {
  width: 75px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 6px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}

.mark-num-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.pass-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid #10b981;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 11px;
}

.fail-pill {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid #ef4444;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 11px;
}

.tpl-item-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.tpl-item-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.tpl-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tpl-body-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
}

/* FEE MANAGEMENT STYLING */
.badge-fee-paid {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-fee-partial {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-fee-unpaid {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.fee-status-select {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.fee-status-select.fee-status-paid {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.45);
}
.fee-status-select.fee-status-partial {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
}
.fee-status-select.fee-status-unpaid {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.45);
}
.fee-status-select option {
  background: #1e293b;
  color: #f8fafc;
}

.fee-status-toggle-group {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.fee-status-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: rgba(30, 41, 59, 0.6);
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: all 0.2s ease;
  color: var(--text-muted);
  user-select: none;
}
.fee-status-btn input[type="radio"] {
  display: none;
}
.fee-status-btn:hover {
  background: rgba(51, 65, 85, 0.6);
}
.fee-status-btn.active.status-btn-paid {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #34d399;
}
.fee-status-btn.active.status-btn-partial {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fbbf24;
}
.fee-status-btn.active.status-btn-unpaid {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #f87171;
}

.fees-subtab {
  display: none;
}

.fees-subtab.active {
  display: block;
}

.fee-struct-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.fee-struct-card:hover {
  border-color: var(--accent-primary);
  background: rgba(30, 41, 59, 0.6);
}

.fee-struct-info h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.fee-struct-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.fee-struct-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fee-struct-input {
  width: 120px;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 14px;
  text-align: right;
}

.fee-struct-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* -------------------------------------------------------------
   TEACHER MANAGEMENT & AUTH UI STYLES
   ------------------------------------------------------------- */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.role-badge.principal {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.role-badge.teacher {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.role-badge.admin {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-badge.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.incharge-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.user-avatar-initials {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.login-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* WHATSAPP BROADCAST MEDIA ATTACHMENTS */
.broadcast-media-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md, 8px);
  padding: 10px 14px;
  margin-top: 10px;
  backdrop-filter: blur(8px);
  animation: fadeInMedia 0.25s ease-out;
}

@keyframes fadeInMedia {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.broadcast-media-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.broadcast-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.broadcast-media-thumb i {
  font-size: 22px;
}

.broadcast-media-meta {
  flex: 1;
  min-width: 0;
}

.broadcast-media-name {
  font-weight: 600;
  font-size: 13px;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.broadcast-media-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
}

.btn-remove-media {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-remove-media:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #fff;
  transform: scale(1.08);
}

/* -------------------------------------------------------------
   WHATSAPP BROADCAST ENHANCEMENTS: TAG CHIPS & LIVE PHONE PREVIEW
   ------------------------------------------------------------- */
.tag-chips-wrapper {
  background: rgba(15, 23, 42, 0.65);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md, 8px);
  padding: 8px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-chips-label {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tag-chips-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}

.tag-chip:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.2);
}

.tag-chip:active {
  transform: translateY(0);
  background: rgba(59, 130, 246, 0.4);
}

/* PHONE PREVIEW CONTAINER */
.broadcast-preview-card {
  display: flex;
  flex-direction: column;
}

.sample-student-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.sample-student-picker label {
  font-size: 11px;
  color: #94a3b8;
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}

.sample-student-picker select {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  padding: 2px 4px;
}

.sample-student-picker select option {
  background: #0f172a;
  color: #fff;
}

/* SMARTPHONE MOCKUP FRAME */
.wa-phone-frame {
  background: #0b141a;
  border-radius: 24px;
  border: 4px solid #1e293b;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  position: relative;
}

/* WHATSAPP TOP BAR */
.wa-chat-header {
  background: #1f2c34;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 2;
}

.wa-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-back-icon {
  color: #aebac1;
  font-size: 14px;
  cursor: pointer;
}

.wa-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: #059669;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wa-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-contact-info {
  display: flex;
  flex-direction: column;
}

.wa-contact-name {
  color: #e9edef;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.wa-verified-badge {
  color: #25d366;
  font-size: 12px;
}

.wa-contact-status {
  color: #25d366;
  font-size: 11px;
  font-weight: 500;
}

.wa-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #aebac1;
  font-size: 15px;
}

/* WHATSAPP CHAT BODY & WALLPAPER */
.wa-chat-screen {
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 16px 16px;
  padding: 16px 14px;
  min-height: 400px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.wa-encrypted-pill {
  background: #182229;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  color: #ffe599;
  text-align: center;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  max-width: 88%;
  margin: 0 auto;
}

.wa-encrypted-pill i {
  color: #f59e0b;
  margin-right: 4px;
}

.wa-date-pill {
  background: #182229;
  color: #8696a0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 12px;
  align-self: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* OUTGOING / INCOMING MESSAGE BUBBLE */
.wa-bubble-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.wa-bubble {
  background: #005c4b;
  color: #e9edef;
  border-radius: 10px 0 10px 10px;
  padding: 9px 13px;
  max-width: 88%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  position: relative;
  font-size: 13.5px;
  line-height: 1.48;
  word-break: break-word;
  animation: popInBubble 0.2s ease-out;
}

@keyframes popInBubble {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.wa-bubble::after {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: #005c4b;
  border-top-color: #005c4b;
}

.wa-bubble-media {
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.wa-media-doc-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-media-doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f43f5e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.wa-media-doc-details {
  min-width: 0;
  flex: 1;
}

.wa-media-doc-name {
  font-weight: 600;
  font-size: 12.5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-media-doc-meta {
  font-size: 10.5px;
  color: #8696a0;
  margin-top: 2px;
}

.wa-bubble-text {
  white-space: pre-wrap;
  font-family: inherit;
}

.wa-bubble-text strong {
  font-weight: 700;
  color: #ffffff;
}

.wa-bubble-text em {
  font-style: italic;
  opacity: 0.95;
}

.wa-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  color: #8696a0;
  user-select: none;
}

.wa-msg-time {
  font-size: 11px;
}

.wa-double-ticks {
  color: #53bdeb;
  font-size: 12px;
  display: flex;
  align-items: center;
}

/* MARKS ENTRY SPREADSHEET INPUTS */
.mark-num-input {
  width: 72px;
  padding: 6px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  color: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.mark-num-input:focus {
  border-color: #38bdf8 !important;
  background: rgba(15, 23, 42, 0.95) !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35) !important;
  outline: none;
}

.mark-num-input.input-exceeded-flash {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.2) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.45) !important;
  animation: markInputShake 0.35s ease-in-out;
}

@keyframes markInputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}






