/* =====================================================================
   E-Cortexa — Design System & Stylesheet
   Modern, responsive, glassmorphic UI with vibrant accents
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-sidebar: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: #1e293b;
  --sidebar-active-bg: rgba(59, 130, 246, 0.15);
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.25);

  --secondary: #0ea5e9;
  --secondary-light: #f0f9ff;

  --success: #10b981;
  --success-light: #ecfdf5;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-text: #991b1b;

  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

a:hover {
  color: var(--primary-hover);
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: 270px;
  background: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: var(--shadow-xl);
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.brand-info h2 {
  font-size: 18px;
  color: #fff;
  line-height: 1.2;
}

.brand-info span {
  font-size: 11px;
  color: var(--secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  padding: 20px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 12px 12px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--sidebar-text);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  transform: translateX(3px);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
  font-weight: 600;
}

.nav-item .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cndp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

/* Main Content Area */
.app-main {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navbar */
.top-navbar {
  height: 70px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.navbar-left h1 {
  font-size: 20px;
  color: var(--text-main);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Notification Bell Dropdown */
.notif-wrapper {
  position: relative;
}

.notif-bell-btn {
  background: var(--bg-main);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.notif-bell-btn:hover {
  background: var(--border-light);
  border-color: var(--text-light);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-surface);
}

.notif-dropdown {
  position: absolute;
  top: 50px;
  right: 0;
  width: 360px;
  max-width: 90vw;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  display: none;
  flex-direction: column;
  z-index: 1000;
  max-height: 480px;
  overflow: hidden;
}

.notif-dropdown.show {
  display: flex;
}

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

.notif-header h4 {
  font-size: 15px;
}

.notif-list {
  overflow-y: auto;
  max-height: 360px;
}

.notif-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

.notif-item:hover {
  background: var(--bg-main);
}

.notif-item.unread {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}

.notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.notif-msg {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.notif-time {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 4px;
}

/* User Profile Badge */
.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-main);
  border: 1px solid var(--border);
  cursor: pointer;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-details {
  text-align: left;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* Content Area */
.content-body {
  padding: 32px;
  flex: 1;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.stat-content h3 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-content p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

/* Glass Panel / Cards */
.panel {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h3 {
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 24px;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.table-custom th {
  background: var(--bg-main);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-custom td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

.table-custom tr:hover td {
  background: var(--bg-main);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px var(--primary-glow);
}

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

.btn-secondary {
  background: var(--bg-main);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

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

.btn-success:hover {
  background: #059669;
}

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

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

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: var(--success-light); color: var(--success-text); }
.badge-orange { background: var(--warning-light); color: var(--warning-text); }
.badge-red { background: var(--danger-light); color: var(--danger-text); }
.badge-blue { background: var(--primary-light); color: var(--primary); }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green { background: var(--success); }
.status-dot.orange { background: var(--warning); }
.status-dot.red { background: var(--danger); }

/* Student Card Grid */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.student-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
}

.student-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.student-card-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e2e8f0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  border: 3px solid #fff;
  box-shadow: var(--shadow-md);
}

.student-card h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.student-card p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.student-card-actions {
  width: 100%;
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* 2-Column Responsive Layout Helper */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .two-col-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  max-width: 750px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-sidebar);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--primary);
  animation: toastIn 0.3s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Progress Slider */
.progress-bar-wrap {
  background: #e2e8f0;
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  background: linear-gradient(90deg, #3b82f6, #10b981);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Star Rating */
.star-rating {
  display: inline-flex;
  gap: 4px;
  color: #cbd5e1;
  font-size: 18px;
  cursor: pointer;
}

.star-rating .star.active {
  color: #f59e0b;
}

/* Navigation Buttons & Mobile Drawer Controls */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 20px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  margin-left: auto;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  box-sizing: border-box;
}

.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 600;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  transition: var(--transition);
  text-align: center;
}

.mob-nav-item label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: pointer;
}

.mob-nav-item span {
  font-size: 19px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mob-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.mob-nav-item.active span {
  transform: scale(1.15);
}

/* Responsive Rules & Mobile Drawer */
@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar-close-btn {
    display: block;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .app-sidebar {
    width: 280px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    z-index: 1100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.6);
  }

  .app-main {
    margin-left: 0 !important;
    width: 100%;
    padding-bottom: 74px; /* Space for bottom nav */
  }

  .top-navbar {
    height: 62px;
    padding: 0 14px;
  }

  .top-navbar .navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 60%;
  }

  .top-navbar h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-navbar .user-details {
    display: none;
  }

  .content-body {
    padding: 14px;
  }

  /* Grid Stack on Mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .student-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .panel {
    border-radius: var(--radius-md);
  }

  .panel-header {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .panel-body {
    padding: 14px 16px;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-custom th,
  .table-custom td {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Questionnaires on Mobile */
  .q-progress-sticky {
    top: 62px;
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .q-tabs-nav {
    width: 100%;
  }

  .q-tab-btn {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    font-size: 12px;
  }

  .segmented-3 {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .segmented-3 .segment-pill {
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 13.5px;
  }

  .segmented-5 {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .segmented-5 .segment-pill-5 {
    padding: 8px 2px;
    font-size: 11px;
  }

  /* Questionnaire Mobile Bar */
  body.has-bottom-bar .mobile-bottom-nav {
    display: none !important;
  }

  .q-bottom-bar {
    position: fixed;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    z-index: 120;
  }

  .q-bottom-bar .q-student-info {
    display: none;
  }

  .q-bottom-bar .q-actions-wrap {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
  }

  .q-bottom-bar .btn-cancel {
    flex: 0 0 auto;
    padding: 10px 14px;
    font-size: 13px;
  }

  .q-bottom-bar .btn-save {
    flex: 1 1 auto;
    padding: 11px 16px;
    font-size: 13.5px;
    font-weight: 700;
    justify-content: center;
    text-align: center;
  }

  /* Notifications & Toasts on Mobile */
  .notif-dropdown {
    position: fixed;
    top: 66px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    max-height: 70vh;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1000;
  }

  .toast-container {
    bottom: 74px; /* Above mobile bottom navigation */
    left: 14px;
    right: 14px;
    width: auto;
  }

  .toast {
    width: 100%;
    box-sizing: border-box;
  }

  /* Kid Theme on Mobile */
  .kid-hero-banner {
    padding: 22px 16px;
    border-radius: 20px;
    text-align: center;
  }

  .kid-hero-banner > div {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .kid-hero-banner > div > div:first-child {
    flex-direction: column;
    text-align: center;
  }

  /* Parent Theme on Mobile */
  .parent-summary-card {
    padding: 20px 16px;
    border-radius: 18px;
    text-align: center;
  }

  .parent-summary-card > div {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  .parent-summary-card > div > div:first-child {
    flex-direction: column;
    text-align: center;
  }

  .home-tip-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .home-tip-row form,
  .home-tip-row form button {
    width: 100%;
  }

  /* Modals on Mobile */
  .modal-content {
    width: 95vw !important;
    max-height: 88vh;
    padding: 20px 16px;
    margin: 10px;
    border-radius: 18px;
  }
}

@media (max-width: 540px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   5. Interactive Questionnaire Redesign (SDQ + Informal)
   ===================================================================== */
.questionnaire-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding-bottom: 100px;
}

.q-progress-sticky {
  position: sticky;
  top: 70px;
  z-index: 80;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.q-tabs-nav {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
}

.q-tab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.q-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.q-item-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 14px;
  transition: all 0.25s ease;
  position: relative;
}

.q-item-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.06);
}

.q-item-card.answered {
  border-color: #cbd5e1;
  background: #fafafa;
}

.q-item-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
}

.q-scale-chip {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #475569;
}

/* 3-State SDQ Segmented Button Group */
.segmented-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.segmented-3 label {
  cursor: pointer;
  margin: 0;
}

.segmented-3 input[type="radio"] {
  display: none;
}

.segmented-3 .segment-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.segmented-3 .segment-pill:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.segmented-3 input[type="radio"]:checked + .segment-pill.opt-0 {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.segmented-3 input[type="radio"]:checked + .segment-pill.opt-1 {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.segmented-3 input[type="radio"]:checked + .segment-pill.opt-2 {
  background: #fff7ed;
  border-color: #f97316;
  color: #9a3412;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* 5-State Informal Dimension Rating Group */
.segmented-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.segmented-5 label {
  cursor: pointer;
  margin: 0;
}

.segmented-5 input[type="radio"] {
  display: none;
}

.segmented-5 .segment-pill-5 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.segmented-5 .segment-pill-5:hover {
  border-color: #60a5fa;
  background: #f8fafc;
}

.segmented-5 input[type="radio"]:checked + .segment-pill-5 {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
  transform: scale(1.02);
}

/* Sticky Action Bar at Bottom */
.q-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 270px;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 16px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.06);
  z-index: 90;
}

@media (max-width: 900px) {
  .q-bottom-bar {
    left: 70px;
    padding: 12px 16px;
  }
}

/* =====================================================================
   6. Student Portal Kid-Friendly Theme (Playful & Engaging)
   ===================================================================== */
body.role-student {
  background: #f0fdf4 radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.08) 0%, rgba(240, 253, 244, 1) 100%);
}

body.role-student .app-sidebar {
  background: #0f172a;
}

body.role-student h1,
body.role-student h2,
body.role-student h3 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.01em;
}

.kid-hero-banner {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
  border-radius: 28px;
  padding: 36px;
  color: #ffffff;
  box-shadow: 0 20px 35px -10px rgba(124, 58, 237, 0.35);
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
}

.kid-hero-banner::after {
  content: '✨';
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 40px;
  opacity: 0.6;
  animation: floatSparkle 3s ease-in-out infinite;
}

@keyframes floatSparkle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(15deg); }
}

.kid-game-card {
  background: #ffffff;
  border-radius: 24px;
  border: 2px solid transparent;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.kid-game-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.15);
  border-color: #3b82f6;
}

.kid-game-banner-memory {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

.kid-game-banner-puzzle {
  background: linear-gradient(135deg, #10b981, #84cc16);
}

.kid-game-banner-reading {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
}

.kid-btn-play {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  padding: 14px 20px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
  width: 100%;
}

.kid-btn-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.45);
}

.kid-badge-item {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.25s ease;
}

.kid-badge-item.unlocked {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 8px 18px rgba(251, 191, 36, 0.2);
}

.kid-badge-item.unlocked:hover {
  transform: translateY(-4px);
}

/* =====================================================================
   7. Parent Portal Theme (Warm & Reassuring)
   ===================================================================== */
body.role-parent {
  background: #f8fafc;
}

.parent-summary-card {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 12px 24px rgba(13, 148, 136, 0.2);
  margin-bottom: 24px;
}

.home-tip-row {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
}

.home-tip-row:hover {
  border-color: #0d9488;
}

.home-tip-row.completed {
  background: #f0fdf4;
  border-color: #86efac;
}

.home-tip-row.completed .tip-title {
  text-decoration: line-through;
  color: #64748b;
}

/* =====================================================================
   8. Teacher Mobile Responsiveness & Layout Helpers (CUA 2.0)
   ===================================================================== */
.cua-layout-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  margin-bottom: 24px;
  align-items: stretch;
}

.teacher-filter-bar {
  display: flex;
  gap: 10px;
  flex: 1;
  max-width: 600px;
  flex-wrap: wrap;
}

.action-plan-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 2fr 1.4fr 1.2fr auto;
  gap: 12px;
  align-items: center;
}

.self-eval-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

@media (max-width: 960px) {
  .cua-layout-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .q-progress-sticky {
    position: relative !important;
    top: 0 !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 14px 18px !important;
    gap: 14px !important;
  }

  .q-tabs-nav {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap !important;
    display: flex !important;
    width: 100% !important;
    padding: 4px !important;
  }

  .q-tab-btn {
    flex: 0 0 auto !important;
    font-size: 12px !important;
    padding: 8px 14px !important;
  }
}

@media (max-width: 768px) {
  .action-plan-form {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .action-plan-form button {
    width: 100% !important;
    padding: 10px !important;
  }

  .teacher-filter-bar {
    max-width: 100% !important;
    width: 100% !important;
    flex-direction: column !important;
  }

  .teacher-filter-bar .form-control {
    width: 100% !important;
  }

  .teacher-filter-bar button {
    width: 100% !important;
  }

  .q-bottom-bar {
    left: 0 !important;
    padding: 10px 14px !important;
    gap: 8px !important;
  }

  .q-bottom-bar .btn {
    padding: 8px 12px !important;
    font-size: 12.5px !important;
  }
}

@media (max-width: 580px) {
  .segmented-3 {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .segmented-3 .segment-pill {
    flex-direction: row !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
  }

  .self-eval-slider-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .self-eval-slider-row .slider-label-start,
  .self-eval-slider-row .slider-label-end {
    font-size: 11px !important;
    width: auto !important;
  }

  .self-eval-slider-row input[type="range"] {
    width: 100% !important;
    order: 3;
    flex: 1 1 100% !important;
  }

  .self-eval-slider-row .slider-badge-val {
    margin-left: auto !important;
    order: 2;
  }
}

/* =====================================================================
   9. Mobile Overflow Protection & Live Score Cards (Universal)
   ===================================================================== */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
  width: 100% !important;
}

.app-container, .app-main, .content-body, .questionnaire-wrapper {
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

.live-score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.score-mini-card {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  text-align: center;
}

.score-mini-card-blue {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.score-mini-card-purple {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
}

.score-mini-card-green {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

@media (max-width: 600px) {
  .live-score-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .score-mini-card {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 14px !important;
  }

  .score-mini-card > div:last-child {
    margin-top: 0 !important;
  }

  .q-progress-sticky {
    padding: 12px 14px !important;
    margin-bottom: 16px !important;
  }

  .q-tabs-nav {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 4px !important;
    scrollbar-width: none;
  }

  .q-tabs-nav::-webkit-scrollbar {
    display: none;
  }

  .q-tab-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 11.5px !important;
    padding: 7px 12px !important;
  }

  .content-body {
    padding: 12px 10px !important;
  }

  .top-navbar {
    padding: 0 10px !important;
  }

  .top-navbar .navbar-left {
    max-width: 70% !important;
  }
}


