@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

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

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --secondary: #0ea5e9;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --dark: #1e293b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --sidebar-width: 260px;
  --header-height: 60px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

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

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-group label i { margin-right: 6px; color: var(--primary); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
  background: white;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group.inline {
  display: flex;
  gap: 12px;
}
.form-group.inline > * { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}
.btn i { font-size: 14px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #ca8a04; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
}
.btn-icon:hover { background: var(--gray-100); color: var(--dark, #1e293b); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover { background: var(--gray-100); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-warning { background: #fefce8; color: #ca8a04; }
.badge-info { background: #eff6ff; color: #2563eb; }

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.role-superadmin { background: #fef2f2; color: #dc2626; }
.role-principal { background: #faf5ff; color: #9333ea; }
.role-admin { background: #eff6ff; color: #2563eb; }
.role-teacher { background: #f0fdf4; color: #16a34a; }
.role-student { background: #fefce8; color: #ca8a04; }
.role-parent { background: #fff7ed; color: #ea580c; }

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 32px; }
.logo-icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.logo-icon i { font-size: 28px; color: white; }
.login-header h1 { font-size: 24px; color: var(--dark); margin-bottom: 4px; }
.login-header p { color: var(--gray-500); font-size: 14px; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; }

/* Dashboard Layout */
.dashboard-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-700);
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo i { font-size: 18px; color: white; }
.sidebar-header h3 { font-size: 16px; font-weight: 600; flex: 1; }
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 18px;
  cursor: pointer;
  display: flex;
}
.sidebar-toggle:hover { color: white; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-700);
}
.sidebar-avatar i { font-size: 36px; color: var(--primary-light); }
.sidebar-user .user-name { font-weight: 600; font-size: 14px; }
.sidebar-user .user-role { font-size: 12px; color: var(--gray-400); text-transform: capitalize; }

.sidebar-nav { padding: 12px 0; }
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-item:hover {
  color: white;
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}
.sidebar-nav .nav-item.active {
  color: white;
  background: rgba(79,70,229,0.15);
  border-left-color: var(--primary);
}
.sidebar-nav .nav-item i { width: 20px; text-align: center; font-size: 16px; }
.sidebar-nav .nav-item.hidden { display: none; }
.sidebar-nav .nav-section {
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
}

.sidebar-category { border-bottom: 1px solid var(--gray-800); }
.sidebar-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.sidebar-category-header:hover { color: var(--gray-300); background: rgba(255,255,255,0.03); }
.sidebar-category-header i:first-child { width: 20px; text-align: center; font-size: 12px; }
.sidebar-cat-toggle { margin-left: auto; font-size: 10px; transition: transform 0.2s; }
.sidebar-category.collapsed .sidebar-cat-toggle { transform: rotate(-90deg); }
.sidebar-category-items { overflow: hidden; max-height: 500px; transition: max-height 0.3s; }
.sidebar-category.collapsed .sidebar-category-items { max-height: 0; }
.sidebar-category-items .nav-item { padding-left: 28px; font-size: 13px; }
.sidebar-category.cat-active > .sidebar-category-header { color: var(--primary-light); }
.sidebar-close { background: none; border: none; color: var(--gray-400); font-size: 22px; cursor: pointer; margin-left: auto; line-height: 1; }
.sidebar-close:hover { color: white; }

/* Sidebar user info */
.sidebar-user-info { display: flex; flex-direction: column; }
.sidebar-user-info #sidebar-user-name { font-weight: 600; font-size: 14px; }
.sidebar-user-info #sidebar-user-role { font-size: 12px; color: var(--gray-400); text-transform: capitalize; }

/* Logout button */
.nav-item.logout-btn { margin-top: 4px; color: #f87171 !important; }
.nav-item.logout-btn:hover { background: rgba(248,113,113,0.1) !important; }

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.top-bar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-bar h2 { font-size: 18px; color: var(--dark); font-weight: 600; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }
.welcome-text { font-size: 14px; color: var(--gray-500); }
.welcome-text span { color: var(--dark); font-weight: 600; }
.breadcrumb { font-size: 13px; color: var(--gray-400); }
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--primary); }

.content-area { padding: 24px; }

.focus-controls {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.focus-controls select {
  cursor: pointer;
  appearance: auto;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-icon i { font-size: 22px; }
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #f0fdf4; color: #16a34a; }
.stat-icon.yellow { background: #fefce8; color: #ca8a04; }
.stat-icon.purple { background: #faf5ff; color: #9333ea; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-card .stat-info h3 { font-size: 28px; font-weight: 700; color: var(--dark); }
.stat-card .stat-info p { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.card-header h3 { font-size: 16px; color: var(--dark); }
.card-header h3 i { margin-right: 8px; color: var(--primary); }
.card-body { padding: 20px; }

/* Tables */
.table-container { overflow-x: auto; }
@media (min-width: 769px) {
  .table-container:has(select),
  .table-container:has(.cs-wrapper) {
    overflow-x: visible;
    overflow-y: visible;
  }
}
table { width: 100%; border-collapse: collapse; }
table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
table td {
  padding: 10px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
}
table tr:hover { background: var(--gray-50); }

.actions { display: flex; gap: 6px; }
.actions .btn { padding: 4px 10px; font-size: 12px; }

/* Search / Filter Bar */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-bar input {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
}
.search-bar input:focus { outline: none; border-color: var(--primary); }
.search-bar select {
  padding: 8px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  background: white;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray-400);
  line-height: 1;
}
.modal-close:hover { color: var(--dark); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--gray-400);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 16px; }

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0%); opacity: 1; }
}

/* Profile Grid */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.profile-grid .full-width { grid-column: 1 / -1; }
.profile-label {
  font-weight: 600;
  color: var(--gray-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.profile-value { font-size: 15px; color: var(--dark); }

/* ===== ID Card Styles ===== */
.id-card-wrapper {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.id-card {
  width: 320px;
  min-height: 520px;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  position: relative;
  flex-shrink: 0;
}

.id-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 24px;
  text-align: center;
  color: white;
  position: relative;
}

.id-card-header .school-logo {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 24px;
}

.id-card-header .school-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.id-card-header .school-tagline {
  font-size: 10px;
  opacity: 0.8;
  margin-top: 2px;
}

.id-card-photo {
  text-align: center;
  margin-top: -40px;
  position: relative;
  z-index: 2;
}

.id-card-photo .avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gray-200);
  border: 4px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 36px;
  color: var(--gray-500);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.id-card-body {
  padding: 16px 20px 20px;
  text-align: center;
}

.id-card-body .card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 2px;
}

.id-card-body .card-role {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

.id-card-details {
  text-align: left;
  margin-bottom: 12px;
}

.id-card-details .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 12px;
}

.id-card-details .detail-row:last-child { border-bottom: none; }

.id-card-details .detail-label {
  color: var(--gray-500);
  font-weight: 500;
}

.id-card-details .detail-value {
  color: var(--dark);
  font-weight: 600;
  text-align: right;
}

.id-card-qr {
  text-align: center;
  padding: 8px 0;
}

.id-card-qr img {
  width: 100px;
  height: 100px;
  display: inline-block;
}

.id-card-qr .qr-hint {
  font-size: 9px;
  color: var(--gray-400);
  margin-top: 4px;
}

.id-card-footer {
  text-align: center;
  padding: 8px 20px;
  border-top: 1px solid var(--gray-200);
  font-size: 9px;
  color: var(--gray-400);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.id-card-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 60px;
  font-weight: 900;
  color: rgba(79,70,229,0.04);
  pointer-events: none;
  white-space: nowrap;
  text-transform: uppercase;
}

.id-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.card-item {
  transition: transform 0.2s;
}

.card-item:hover { transform: translateY(-2px); }

.id-card.id-card-sm {
  width: 280px;
  min-height: 440px;
  font-size: 90%;
}

.id-card.id-card-sm .id-card-header { padding: 16px; }
.id-card.id-card-sm .id-card-header .school-logo { width: 44px; height: 44px; font-size: 18px; }
.id-card.id-card-sm .id-card-photo { margin-top: -32px; }
.id-card.id-card-sm .id-card-photo .avatar-placeholder { width: 64px; height: 64px; font-size: 28px; }
.id-card.id-card-sm .id-card-body { padding: 12px 16px 16px; }
.id-card.id-card-sm .id-card-body .card-name { font-size: 15px; }
.id-card.id-card-sm .id-card-qr img { width: 80px; height: 80px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--gray-200); padding-bottom: 0; }
.tab-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.2s;
  font-family: inherit;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Assignment Cards */
.assignment-card {   cursor: pointer;
}

.activities-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); gap:16px; }
.activity-card { background:#fff; border:1px solid #dce3ec; display:flex; flex-direction:column; transition:box-shadow .2s; }
.activity-card:hover { box-shadow:0 8px 18px rgba(16,43,82,0.08); }
.activity-type-badge { display:flex; align-items:center; gap:6px; padding:8px 12px; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid #dce3ec; }
.activity-body { flex:1; padding:12px; }
.activity-title { font-size:14px; font-weight:700; color:#172a44; margin:0 0 6px; }
.activity-desc { font-size:12px; color:#5a6a7e; margin:0 0 8px; line-height:1.5; }
.activity-meta { display:flex; flex-wrap:wrap; gap:6px 12px; font-size:11px; color:#7a8a9e; }
.activity-meta span { display:inline-flex; align-items:center; gap:4px; }
.activity-file { margin-top:8px; font-size:11px; }
.activity-file a { color:var(--primary); text-decoration:none; }
.activity-file a:hover { text-decoration:underline; }
.activity-actions { display:flex; gap:4px; padding:8px 12px; border-top:1px solid #dce3ec; justify-content:flex-end; }

.print-queue, .print-my-requests { display:flex; flex-direction:column; gap:12px; }
.print-card { background:#fff; border:1px solid #dce3ec; border-left:4px solid #dce3ec; }
.print-card.pending { border-left-color:#f59e0b; }
.print-card.printing { border-left-color:#3b82f6; }
.print-card.done { border-left-color:#10b981; }
.print-top { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; border-bottom:1px solid #dce3ec; }
.print-status { padding:3px 10px; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.print-date { font-size:11px; color:var(--gray-400); }
.print-body { padding:12px 14px; }
.print-body h3 { font-size:14px; font-weight:700; color:#172a44; margin:0 0 4px; }
.print-notes { font-size:12px; color:#5a6a7e; margin:0 0 8px; }
.print-meta { display:flex; gap:12px; font-size:11px; color:#7a8a9e; }
.print-meta span { display:inline-flex; align-items:center; gap:4px; }
.print-file { margin-top:6px; font-size:11px; }
.print-file a { color:var(--primary); text-decoration:none; }
.print-actions { display:flex; gap:8px; padding:10px 14px; border-top:1px solid #dce3ec; align-items:center; }
.print-filters select { padding:7px 11px; border:1px solid #cbd5e1; font-size:13px; min-width:140px; }
.btn-sm { padding:5px 10px; font-size:11px; font-weight:600; border:1px solid transparent; cursor:pointer; display:inline-flex; align-items:center; gap:4px; }
.btn-success { color:#fff; background:#10b981; border-color:#10b981; }
.btn-success:hover { background:#059669; }
.assignment-card .card-body { padding: 20px; }
.assign-type-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  font-size: 18px;
}
.assign-type-icon.large { width: 48px; height: 48px; font-size: 22px; }
.assign-title { font-size: 15px; font-weight: 600; color: var(--dark); margin-bottom: 10px; }
.assign-meta { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.assign-meta span { font-size: 12px; color: var(--gray-500); display: flex; align-items: center; gap: 6px; }
.assign-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.assign-marks { font-size: 13px; font-weight: 600; color: var(--warning); }
.assign-marks i { margin-right: 4px; }

/* Assignment Detail */
.assign-detail-header { display: flex; align-items: flex-start; gap: 16px; }
.file-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s;
}
.file-link:hover { background: var(--gray-100); text-decoration: none; }

/* Modal Large */
.modal-lg { max-width: 680px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-group.inline { flex-direction: column; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-grid .full-width { grid-column: 1; }
}

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

/* ==========================================================================
   Bluebells Portal UI — 2026 redesign
   The public website uses /site/css/style.css and is intentionally unaffected.
   ========================================================================== */

:root {
  --primary: #1658ad;
  --primary-dark: #0a2d66;
  --primary-light: #4c66b1;
  --secondary: #342c84;
  --success: #14805e;
  --warning: #b66a0a;
  --danger: #c33a43;
  --dark: #101827;
  --gray-50: #f7f9fc;
  --gray-100: #eef2f7;
  --gray-200: #dde3ec;
  --gray-300: #c7d0dd;
  --gray-400: #8b98aa;
  --gray-500: #647286;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0b1830;
  --sidebar-width: 284px;
  --header-height: 82px;
  --radius: 0;
  --shadow: 0 1px 2px rgba(12, 33, 69, 0.05);
  --shadow-lg: 0 16px 44px rgba(8, 28, 61, 0.16);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', 'Inter', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background:
    linear-gradient(rgba(22, 88, 173, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 88, 173, 0.024) 1px, transparent 1px),
    #f4f6fa;
  background-size: 28px 28px;
  color: #172033;
  font-size: 14px;
  line-height: 1.55;
}

h1, h2, h3, h4, h5, h6,
.stat-card .stat-info h3,
.sidebar-brand-name {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}

::selection {
  color: #fff;
  background: var(--primary);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Sharp, structured components */
.card,
.stat-card,
.modal,
.btn,
.badge,
.role-badge,
.form-group input,
.form-group select,
.form-group textarea,
.search-bar input,
.search-bar select,
.toast,
.file-link,
.tabs,
.tab-btn,
.id-card,
.card-item,
.chat-layout,
.chat-search input,
.chat-search .btn,
.chat-message .bubble,
.profile-header,
.profile-section,
.doc-item,
.doc-item .doc-icon,
.upload-zone,
.ac-calendar,
.ac-list-item,
.ac-list-type,
.ac-event-dot,
.ac-month-nav button,
.tt-controls select,
.tt-controls input,
.tt-period,
.tt-settings-form input,
.tt-settings-form select,
.fixture-item,
.announcement-badge,
.announcement-view-btn,
.announcement-modal {
  border-radius: 0 !important;
}

a {
  color: var(--primary);
  text-underline-offset: 3px;
}

/* Application shell */
.dashboard-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), transparent 180px),
    #0a1933;
  border-right: 1px solid #18315c;
  box-shadow: 12px 0 36px rgba(8, 24, 51, 0.08);
  scrollbar-width: thin;
  scrollbar-color: #31517e transparent;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #31517e;
}

.sidebar-header {
  min-height: 88px;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  padding: 3px;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.55);
  flex: 0 0 48px;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-brand-name {
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-brand-subtitle {
  margin-top: 4px;
  color: #87a3ca;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1;
  text-transform: uppercase;
}

.sidebar-close {
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 18px;
}

.sidebar-user {
  position: relative;
  gap: 11px;
  margin: 14px 14px 8px;
  padding: 13px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user::after {
  content: '';
  position: absolute;
  top: 13px;
  right: 12px;
  width: 6px;
  height: 6px;
  background: #39b886;
  box-shadow: 0 0 0 3px rgba(57,184,134,0.13);
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  background: #234578;
  border: 1px solid #3a5d91;
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}

.sidebar-avatar i {
  font-size: 17px;
  color: #fff;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-info #sidebar-user-name {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-info #sidebar-user-role {
  margin-top: 2px;
  color: #8ea9ce;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 4px 10px 24px;
}

.sidebar-category {
  margin-top: 2px;
  border: 0;
}

.sidebar-category-header {
  width: 100%;
  min-height: 35px;
  gap: 9px;
  padding: 10px 9px 6px;
  color: #6f8db7;
  background: transparent;
  border: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 2px;
}

.sidebar-category.collapsed > .sidebar-category-header {
  border-bottom-color: transparent;
  margin-bottom: 0;
}

.sidebar-category-header:hover {
  color: #afc4df;
  background: transparent;
}

.sidebar-category.cat-active > .sidebar-category-header {
  color: #a9c4e9;
}

.sidebar-category-header i:first-child {
  width: 16px;
  font-size: 10px;
}

.sidebar-category-items {
  max-height: 700px;
}

.sidebar-nav .nav-item,
.sidebar-category-items .nav-item {
  position: relative;
  min-height: 40px;
  gap: 11px;
  margin: 2px 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  color: #a4b5cd;
  font-size: 12.5px;
  font-weight: 520;
}

.sidebar-nav .nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.06);
}

.sidebar-nav .nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(25,92,179,0.52), rgba(25,92,179,0.18));
  border-color: rgba(87,145,219,0.26);
  border-left-color: #69a6ef;
  box-shadow: inset 3px 0 0 0 #69a6ef;
}

.sidebar-nav .nav-item.active::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 11px;
  width: 6px;
  height: 6px;
  background: #90c1ff;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 6px rgba(144,193,255,0.5);
}

.sidebar-nav .nav-item i {
  width: 18px;
  color: #6f91bf;
  font-size: 13px;
}

.sidebar-nav .nav-item:hover i,
.sidebar-nav .nav-item.active i {
  color: #fff;
}

.sidebar-cat-toggle {
  font-size: 8px;
}

.nav-item.logout-btn {
  margin-top: 8px;
  color: #e9a6a9 !important;
  border-top: 1px solid rgba(255,255,255,0.08) !important;
}

.nav-item.logout-btn:hover {
  color: #fff !important;
  background: rgba(195,58,67,0.16) !important;
}

.main-content {
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.top-bar {
  position: relative;
  z-index: 100;
  height: var(--header-height);
  padding: 0 clamp(20px, 3vw, 42px);
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid #dce3ed;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
}

.top-bar > div:first-child {
  display: flex;
  gap: 13px;
  align-items: center;
}

.top-bar-context {
  min-width: 0;
  flex: 1;
}

.top-bar-title {
  min-width: 0;
}

.top-bar h2 {
  color: #101a2c;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 750;
  line-height: 1.25;
}

.top-bar .breadcrumb {
  display: block;
}

.breadcrumb {
  margin-top: 3px;
  color: #91a0b3;
  font-size: 11px;
  font-weight: 500;
}

.breadcrumb a {
  color: #66758a;
  font-weight: 600;
}

.sidebar-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  grid-row: 1 / span 2;
  color: var(--primary);
  background: #f4f7fb;
  border: 1px solid #dbe3ee;
  font-size: 15px;
}

.top-bar-right {
  gap: 14px;
  flex: 0 0 auto;
}

.welcome-text {
  padding-left: 14px;
  border-left: 1px solid var(--gray-200);
  color: #7a8799;
  font-size: 12px;
}

.welcome-text span {
  color: #172033;
  font-weight: 700;
}

.notif-btn {
  width: 40px !important;
  height: 40px !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  color: #42536a !important;
  background: #f5f8fc !important;
  border: 1px solid #dbe3ed !important;
  border-radius: 12px !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-date,
.topbar-site-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: #627086;
  background: #f8fafc;
  border: 1px solid #dce3ec;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.topbar-date i,
.topbar-site-link i {
  color: #4973a5;
  font-size: 11px;
}

.topbar-site-link:hover {
  color: var(--primary);
  background: #eef5fd;
  border-color: #c7d8eb;
  text-decoration: none;
}

.topbar-notifications {
  position: relative;
}

.notif-btn:hover {
  color: var(--primary) !important;
  background: #edf3fb !important;
}

.notif-badge {
  top: -5px !important;
  right: -5px !important;
  border: 2px solid #fff;
  border-radius: 50% !important;
  width: 20px !important;
  height: 20px !important;
  font-size: 10px !important;
  font-weight: 700;
}

.notif-dropdown {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  right: -10px !important;
  z-index: 120 !important;
  display: none;
  width: min(400px, calc(100vw - 32px)) !important;
  max-height: min(580px, calc(100vh - 110px));
  margin-top: 0;
  overflow: hidden;
  background: #fff !important;
  border: 1px solid #dce3ee !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(8,28,61,0.2), 0 4px 16px rgba(8,28,61,0.08) !important;
}

.notif-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 26px;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid #dce3ee;
  border-right: 0;
  border-bottom: 0;
  transform: rotate(45deg);
  z-index: 1;
}

.notif-dropdown.open {
  display: block;
  animation: notifFadeIn 0.2s ease;
}

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

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  background: #fff;
  border-bottom: 1px solid #eef2f7;
}

.notif-dropdown-header > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-dropdown-header span {
  color: #8b98aa;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.notif-dropdown-header h4 {
  color: #172033;
  font-size: 17px;
  font-weight: 750;
  margin: 0;
}

.notif-dropdown-header button {
  min-height: 32px;
  padding: 6px 14px;
  color: #3f5067;
  background: #f0f4f9;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notif-dropdown-header button:hover {
  background: #e4eaf2;
  border-color: #c7d0dd;
}

.notif-list,
#notifList {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #dde3ec transparent;
}

.notif-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 120px;
  color: #8b98aa;
  font-size: 13px;
}

.notif-item {
  position: relative;
  padding: 16px 20px 16px 60px !important;
  background: #fff;
  border-bottom: 1px solid #eef2f7 !important;
  cursor: pointer;
  transition: background 0.12s ease;
}

.notif-item:last-child {
  border-bottom: 0 !important;
}

.notif-item::before {
  content: '\f0f3';
  position: absolute;
  top: 16px;
  left: 18px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #5276a3;
  background: #edf4fc;
  border-radius: 10px;
  font-family: 'Font Awesome 6 Free';
  font-size: 11px;
  font-weight: 900;
}

.notif-item:hover {
  background: #f7faff;
}

.notif-item.unread {
  background: #f4f9ff;
}

.notif-item.unread::after {
  content: '';
  position: absolute;
  top: 20px;
  right: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,88,173,0.15);
}

.notif-title {
  color: #172033 !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  line-height: 1.35;
}

.notif-item.unread .notif-title {
  font-weight: 750 !important;
}

.notif-msg {
  margin-top: 4px;
  color: #647286 !important;
  font-size: 12px !important;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.notif-origin {
  margin-top: 6px;
  color: #1658ad !important;
  font-size: 11px !important;
  font-weight: 600;
}

.notif-origin i {
  margin-right: 4px;
  font-size: 10px;
}

.notif-time {
  margin-top: 6px;
  color: #98a4b3 !important;
  font-size: 11px !important;
  font-weight: 500;
  text-transform: uppercase;
}

.topbar-user {
  min-width: 165px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 13px;
  border-left: 1px solid #dfe5ed;
}

.topbar-user-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: 1px solid #244f89;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
}

.topbar-user-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar-user-copy strong {
  max-width: 125px;
  overflow: hidden;
  color: #25344a;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user-copy small {
  max-width: 125px;
  overflow: hidden;
  margin-top: 2px;
  color: #8290a2;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.content-area {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 38px) clamp(18px, 3vw, 42px) 48px;
}

/* Cards and dashboard grids */
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  position: relative;
  min-height: 116px;
  gap: 16px;
  padding: 21px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dce3ec;
  border-top: 3px solid var(--primary);
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -28px;
  bottom: -34px;
  width: 88px;
  height: 88px;
  border: 18px solid rgba(22,88,173,0.035);
  transform: rotate(18deg);
}

.stat-card:hover {
  z-index: 1;
  border-color: #b8c8dc;
  box-shadow: 0 10px 26px rgba(16,43,82,0.1);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 46px;
  height: 46px;
  border: 1px solid currentColor;
  border-radius: 0;
}

.stat-card .stat-icon i {
  font-size: 18px;
}

.stat-icon.blue { color: #1658ad; background: #edf5ff; }
.stat-icon.green { color: #14805e; background: #edf9f5; }
.stat-icon.yellow { color: #9d650d; background: #fff8e8; }
.stat-icon.purple { color: #4c4098; background: #f3f0ff; }
.stat-icon.orange { color: #b25820; background: #fff3eb; }

.stat-card .stat-info {
  min-width: 0;
}

.stat-card .stat-info h3 {
  color: #101a2b;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 770;
  line-height: 1.15;
}

.stat-card .stat-info p {
  margin-top: 6px;
  color: #69778a;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.055em;
  line-height: 1.35;
  text-transform: uppercase;
}

.card {
  overflow: visible;
  background: #fff;
  border: 1px solid #dce3ec;
  box-shadow: var(--shadow);
}

.card-header {
  min-height: 60px;
  gap: 14px;
  padding: 15px 20px;
  background: linear-gradient(90deg, #fff, #fbfcfe);
  border-bottom: 1px solid #dfe5ed;
}

.card-header::before {
  content: '';
  align-self: stretch;
  width: 3px;
  margin: -15px 1px -15px -20px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.card-header h3 {
  flex: 1;
  color: #151f31;
  font-size: 14px;
  font-weight: 750;
}

.card-header h3 i {
  color: var(--primary);
}

.card-body {
  padding: 20px;
}

.portal-welcome {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  min-height: 200px;
  padding: clamp(26px, 4vw, 46px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(110deg, rgba(10,45,102,0.98), rgba(22,88,173,0.94) 58%, rgba(52,44,132,0.92));
  border: 1px solid #244e89;
}

.portal-welcome::before,
.portal-welcome::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(255,255,255,0.12);
  transform: rotate(35deg);
}

.portal-welcome::before {
  right: 8%;
  width: 180px;
  height: 180px;
}

.portal-welcome::after {
  right: -70px;
  width: 260px;
  height: 260px;
}

.portal-welcome-copy,
.portal-welcome-mark {
  position: relative;
  z-index: 1;
}

.portal-eyebrow {
  margin-bottom: 11px;
  color: #b8d6fb;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.portal-welcome h2 {
  max-width: 720px;
  color: #fff;
  font-size: clamp(25px, 3.5vw, 39px);
  font-weight: 760;
  line-height: 1.15;
}

.portal-welcome p {
  max-width: 660px;
  margin-top: 12px;
  color: #d8e8fb;
  font-size: 14px;
}

.portal-welcome-mark {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 38px;
}

.portal-section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 14px;
  color: #344155;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.portal-section-label::after {
  content: '';
  height: 1px;
  flex: 1;
  background: #dce3ec;
}

.portal-page-intro {
  position: relative;
  min-height: 150px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 28px;
  align-items: center;
  margin-bottom: 22px;
  padding: 28px 30px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(105deg, #0a2d66 0%, #1555a6 66%, #332b82 100%);
  border: 1px solid #214b86;
}

.portal-page-intro::before {
  content: '';
  position: absolute;
  right: 13%;
  bottom: -92px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 0 0 38px rgba(255,255,255,0.025);
  transform: rotate(34deg);
}

.portal-page-intro-copy,
.portal-page-intro-mark {
  position: relative;
  z-index: 1;
}

.portal-page-intro .portal-eyebrow {
  margin-bottom: 9px;
  color: #a9cef8;
}

.portal-page-intro h1 {
  color: #fff;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 760;
  line-height: 1.15;
}

.portal-page-intro p {
  max-width: 700px;
  margin-top: 8px;
  color: #d6e5f7;
  font-size: 12.5px;
}

.portal-page-intro-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  justify-self: end;
  color: #fff;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.24);
  font-size: 25px;
}

/* Subject assignment workspace */
.subject-filter-card {
  margin-bottom: 16px;
}

.subject-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
}

.subject-filter-copy {
  display: flex;
  align-items: center;
  gap: 13px;
}

.subject-filter-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: #edf5ff;
  border: 1px solid #cdddf0;
}

.subject-filter-copy label {
  display: block;
  color: #26364d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.subject-filter-copy small {
  display: block;
  margin-top: 2px;
  color: #7d8999;
  font-size: 10px;
}

.subject-filter-control select {
  min-width: 230px;
  min-height: 40px;
  padding: 8px 12px;
  color: #26364d;
  background: #fff;
  border: 1px solid #cbd5e1;
}

.subject-assignment-layout {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.subject-teacher-panel,
.subject-detail-panel {
  min-height: 570px;
  margin: 0;
}

.subject-teacher-panel .card-body {
  padding: 0;
}

.subject-count {
  min-width: 27px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #1857a3;
  background: #edf5ff;
  border: 1px solid #cdddf0;
  font-size: 9px;
  font-weight: 800;
}

.subject-teacher-search {
  height: 48px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  margin: 13px;
  background: #f8fafc;
  border: 1px solid #d8e0ea;
}

.subject-teacher-search i {
  color: #7c8ba0;
  font-size: 11px;
  text-align: center;
}

.subject-teacher-search input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 11px 0 0;
  color: #26364d;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 11px;
}

.subject-teacher-search:focus-within {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.subject-teacher-list {
  max-height: 480px;
  overflow-y: auto;
  border-top: 1px solid #e2e7ee;
  scrollbar-width: thin;
}

.teacher-item {
  width: 100%;
  min-height: 66px;
  display: flex !important;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  color: #344155;
  background: #fff !important;
  border: 0;
  border-bottom: 1px solid #e6eaf0;
  border-left: 3px solid transparent;
  text-align: left;
  cursor: pointer;
}

.teacher-item:hover {
  background: #f5f8fc !important;
}

.teacher-item.active {
  color: #143f76;
  background: #edf5ff !important;
  border-left-color: var(--primary);
}

.teacher-item-avatar,
.subject-selected-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: 1px solid #224e8a;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}

.teacher-item-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.teacher-item-copy strong {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-item-copy small {
  overflow: hidden;
  margin-top: 3px;
  color: #8190a3;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-item > i {
  color: #a1acbb;
  font-size: 9px;
}

.subject-selected-teacher {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
  padding: 14px;
  background: #f2f7fd;
  border: 1px solid #d3e1f1;
  border-left: 3px solid var(--primary);
}

.subject-selected-teacher > div:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.subject-selected-teacher span {
  color: #7690b0;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subject-selected-teacher strong {
  margin-top: 2px;
  color: #172d4a;
  font-family: var(--font-display);
  font-size: 13px;
}

.subject-selected-teacher small {
  margin-top: 2px;
  color: #7b889a;
  font-size: 9.5px;
}

.subject-empty {
  min-height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* Gallery management */
.gallery-admin-toolbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 15px 18px;
  background: #fff;
  border: 1px solid #dce3ec;
}

.gallery-admin-toolbar > div {
  display: flex;
  align-items: center;
  gap: 13px;
}

.gallery-admin-toolbar-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #1858a8;
  background: #edf5ff;
  border: 1px solid #cdddf0;
}

.gallery-admin-toolbar strong {
  display: block;
  color: #25354b;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 750;
}

.gallery-admin-toolbar p {
  margin-top: 3px;
  color: #7b889a;
  font-size: 10px;
}

.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: 16px;
}

.gallery-event-card {
  margin: 0;
}

.gallery-event-header {
  min-height: 112px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  background: linear-gradient(110deg, #f8fafc, #fff);
  border-bottom: 1px solid #e0e6ed;
}

.gallery-event-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gallery-event-kicker > span:first-child {
  color: #4f6d91;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.gallery-event-header h3 {
  color: #1c2d45;
  font-size: 16px;
  font-weight: 760;
}

.gallery-event-date {
  margin-top: 7px;
  color: #6e7d90;
  font-size: 9.5px;
  font-weight: 600;
}

.gallery-event-date i {
  margin-right: 5px;
  color: #4675aa;
}

.gallery-event-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gallery-event-description {
  margin: 15px 18px 0;
  color: #647286;
  font-size: 10.5px;
  line-height: 1.65;
}

.gallery-event-image-count {
  margin: 15px 18px 9px;
  color: #4b5d74;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.gallery-event-image-count i {
  margin-right: 5px;
  color: var(--primary);
}

.gallery-admin-images {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 18px 18px;
  overflow: hidden;
  background: #dce3ec;
  border: 1px solid #dce3ec;
}

.gallery-admin-images figure {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #eef2f7;
}

.gallery-admin-images img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 180ms ease;
}

.gallery-admin-images figure:hover img {
  transform: scale(1.04);
}

.gallery-admin-images figure button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(112,25,34,0.88);
  border: 1px solid rgba(255,255,255,0.45);
  font-size: 9px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease;
}

.gallery-admin-images figure:hover button,
.gallery-admin-images figure button:focus-visible {
  opacity: 1;
}

.gallery-no-images {
  grid-column: 1 / -1;
  padding: 28px;
  color: #8794a5;
  background: #f8fafc;
  font-size: 10px;
  text-align: center;
}

.gallery-admin-empty .btn {
  margin-top: 16px;
}

.modal-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #73839a;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gallery-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.gallery-form-full {
  grid-column: 1 / -1;
}

.gallery-upload-zone {
  min-height: 142px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  color: #50637c !important;
  background: #f7faff;
  border: 1px dashed #9db4cf;
  cursor: pointer;
  text-align: center;
}

.gallery-upload-zone:hover {
  color: var(--primary) !important;
  background: #eef5fd;
  border-color: var(--primary);
}

.gallery-upload-zone i {
  color: #4b78ad;
  font-size: 25px;
}

.gallery-upload-zone strong {
  color: #2b4566;
  font-size: 11px;
}

.gallery-upload-zone span {
  color: #8491a2;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.gallery-upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.gallery-file-summary {
  margin-top: 7px;
  color: #6d7d91;
  font-size: 9px;
  font-weight: 650;
}

/* Controls */
.btn {
  min-height: 38px;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: #0f4a96;
  border-color: #0f4a96;
  box-shadow: 0 7px 16px rgba(22,88,173,0.18);
}

.btn-success { background: #147658; border-color: #147658; }
.btn-danger { background: #b93640; border-color: #b93640; }
.btn-warning { color: #fff; background: #a65f08; border-color: #a65f08; }
.btn-secondary { color: #38485d; background: #eef2f7; border-color: #d7dfe9; }
.btn-outline { color: #3f5067; background: #fff; border-color: #cdd6e2; }
.btn-sm { min-height: 30px; padding: 6px 11px; font-size: 11px; }

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

.form-group label {
  margin-bottom: 7px;
  color: #46556a;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.form-group label i {
  color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea,
.search-bar input,
.search-bar select {
  min-height: 42px;
  padding: 9px 12px;
  color: #172033;
  background: #fff;
  border: 1px solid #cbd5e1;
  font-size: 13px;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover,
.search-bar input:hover,
.search-bar select:hover {
  border-color: #9eacbd;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-bar input:focus,
.search-bar select:focus {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.cs-wrapper {
  position: relative;
  min-width: 120px;
  min-height: 42px;
  font-size: 13px;
  color: #172033;
}

.form-group .cs-wrapper {
  width: 100%;
}

.form-group.inline .cs-wrapper {
  flex: 1;
  min-width: 0;
}

.search-bar .cs-wrapper {
  flex: 0 1 auto;
  min-width: 160px;
}

.search-bar .cs-wrapper:first-child {
  flex: 1;
  min-width: 200px;
}

.cs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  background: #fff;
  border: 1px solid #d0d8e3;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cs-trigger:hover {
  border-color: #8a9bb0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.cs-wrapper.open .cs-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(22,88,173,0.12);
}

.cs-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #172033;
  font-size: 13px;
  line-height: 1.4;
}

.cs-value.placeholder {
  color: #8b98aa;
}

.cs-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transition: transform 0.25s ease;
}

.cs-wrapper.open .cs-arrow {
  transform: rotate(180deg);
}

.cs-arrow svg {
  width: 12px;
  height: 8px;
  display: block;
}

.cs-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d0d8e3;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(8,28,61,0.18);
  display: none;
  padding: 4px;
}

.cs-wrapper.open .cs-dropdown {
  display: block;
  animation: csFadeIn 0.18s ease;
}

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

.cs-option {
  padding: 10px 14px;
  color: #172033;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-option:hover {
  background: #f0f4f9;
}

.cs-option.highlighted {
  background: #e8edf5;
}

.cs-option.selected {
  background: #eef3fa;
  color: var(--primary);
  font-weight: 600;
}

.cs-option.disabled {
  color: #b0bbca;
  cursor: not-allowed;
}

.cs-option.disabled:hover {
  background: transparent;
}

.cs-optgroup-label {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #8b98aa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: default;
}

.cs-native {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
}

.search-bar {
  gap: 8px;
  margin-bottom: 18px;
  padding: 13px;
  background: #f8fafc;
  border: 1px solid #e0e6ee;
}

/* Data tables */
.table-container {
  width: 100%;
  border: 1px solid #e0e6ed;
  scrollbar-width: thin;
}

table {
  min-width: 680px;
}

table th {
  padding: 11px 14px;
  color: #56667b;
  background: #f3f6fa;
  border-bottom: 1px solid #d7dfe9;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.085em;
}

table td {
  height: 52px;
  padding: 11px 14px;
  color: #344155;
  border-bottom: 1px solid #e7ebf1;
  font-size: 12.5px;
}

table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

table tbody tr:hover {
  background: #f0f6fd;
}

table tbody tr:last-child td {
  border-bottom: 0;
}

.actions {
  flex-wrap: wrap;
}

.badge,
.role-badge {
  min-height: 23px;
  padding: 4px 8px;
  border: 1px solid currentColor;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.badge-success { color: #126b50; background: #edfaf5; }
.badge-danger { color: #a62c35; background: #fff1f2; }
.badge-warning { color: #94600e; background: #fff8e8; }
.badge-info { color: #1857a3; background: #edf5ff; }

/* Dialogs, empty and feedback states */
.modal-overlay {
  padding: 24px;
  background: rgba(6,19,40,0.66);
  backdrop-filter: blur(3px);
}

.modal {
  border: 1px solid #cfd8e5;
  box-shadow: 0 24px 70px rgba(4,18,40,0.26);
}

.modal-header {
  min-height: 64px;
  padding: 16px 22px;
  background: #f8fafc;
}

.modal-header h3 {
  color: #172033;
  font-size: 16px;
  font-weight: 750;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #637187;
  border: 1px solid #d7dfe8;
  font-size: 20px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 14px 22px;
  background: #f8fafc;
}

.empty-state {
  padding: 54px 24px;
}

.empty-state i {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 15px;
  color: #7793b8;
  background: #eef4fb;
  border: 1px solid #d8e4f2;
  font-size: 24px;
}

.empty-state p {
  color: #6a788c;
  font-size: 13px;
  font-weight: 600;
}

#toast-container {
  top: 22px;
  right: 22px;
}

.toast {
  min-width: 280px;
  border-left: 4px solid rgba(255,255,255,0.5);
  box-shadow: 0 16px 38px rgba(8,28,61,0.18);
}

/* Mobile navigation layer */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  background: rgba(5,18,39,0.62);
}

body.sidebar-open,
body.sidebar-open html {
  overflow: hidden;
}

body.sidebar-open .sidebar-scrim {
  display: block;
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 264px;
  }

  .content-area {
    padding-right: 24px;
    padding-left: 24px;
  }

  .topbar-date {
    display: none;
  }

  .topbar-site-link span {
    display: none;
  }

  .topbar-site-link {
    width: 38px;
    justify-content: center;
    padding: 0;
  }
}

@media (min-width: 901px) {
  body.sidebar-closed .sidebar {
    transform: translateX(-104%);
  }
  body.sidebar-closed .main-content {
    margin-left: 0;
  }
}

.sidebar-toggle {
  display: flex;
}

@media (max-width: 900px) {
  .sidebar {
    width: min(86vw, 300px);
    transform: translateX(-104%);
    box-shadow: 20px 0 55px rgba(4,18,40,0.28);
    z-index: 1000;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .top-bar {
    padding-right: 20px;
    padding-left: 20px;
  }

  .topbar-user {
    min-width: 0;
  }

  .portal-welcome-mark {
    width: 88px;
    height: 88px;
  }

  .subject-assignment-layout {
    grid-template-columns: 1fr;
  }

  .subject-teacher-panel,
  .subject-detail-panel {
    min-height: 0;
  }

  .subject-teacher-list {
    max-height: 310px;
  }

  /* collapse fixed 3-col inline grids to 2-col on tablet */
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* collapse fixed 4-col inline grids to 2-col on tablet */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 680px) {
  :root {
    --header-height: 72px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .top-bar {
    padding: 0 14px;
  }

  .top-bar-right {
    gap: 8px;
  }

  .topbar-site-link {
    display: none;
  }

  .topbar-user {
    padding-left: 8px;
  }

  .topbar-user-copy {
    display: none;
  }

  .topbar-user-avatar,
  .notif-btn {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px;
  }

  .welcome-text {
    display: none;
  }

  .content-area {
    padding: 16px 12px 34px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    min-height: 140px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .stat-card .stat-info h3 {
    font-size: 19px;
  }

  .stat-card .stat-info p {
    font-size: 9px;
  }

  .card-header,
  .card-body {
    padding-right: 15px;
    padding-left: 15px;
  }

  .card-header::before {
    margin-left: -15px;
  }

  .portal-welcome {
    min-height: 220px;
    grid-template-columns: 1fr;
    padding: 26px 22px;
  }

  .portal-welcome-mark {
    display: none;
  }

  .portal-page-intro {
    min-height: 140px;
    grid-template-columns: 1fr;
    margin-bottom: 16px;
    padding: 24px 20px;
  }

  .portal-page-intro-mark {
    display: none;
  }

  .form-group.inline {
    gap: 0;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
  }

  .modal-body {
    padding: 20px 16px;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    padding: 12px 16px;
  }

  .search-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-bar input,
  .search-bar select,
  .search-bar .btn {
    width: 100%;
    min-width: 0;
  }

  .subject-filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .subject-filter-control select {
    width: 100%;
    min-width: 0;
  }

  .gallery-admin-toolbar,
  .gallery-event-header {
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-admin-toolbar .btn {
    width: 100%;
  }

  .gallery-event-actions {
    justify-content: flex-start;
  }

  .gallery-admin-images {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery-form-grid {
    grid-template-columns: 1fr;
  }

  .gallery-form-full {
    grid-column: 1;
  }

  /* collapse ALL fixed inline grids to 1-col on phone */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* collapse 4-col repeat inline grids to 1-col on phone */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 420px) {
  .top-bar h2 {
    max-width: 160px;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .breadcrumb {
    display: none;
  }

  .top-bar > div:first-child {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-bar h2 {
    grid-column: 2;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    min-height: 100px;
    padding: 14px;
    gap: 10px;
  }

  .stat-card .stat-info h3 {
    font-size: 17px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .sidebar,
  .top-bar,
  .sidebar-scrim,
  #toast-container {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .content-area {
    max-width: none;
    padding: 0;
  }

  .card,
  .stat-card {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* Portal sign-in */
body.login-page {
  min-height: 100vh;
  display: block;
  padding: 0;
  overflow-x: hidden;
  color: #172033;
  background: #fff;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(440px, 1.08fr) minmax(500px, 0.92fr);
}

.login-brand-panel {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(34px, 5vw, 70px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.045) 25%, transparent 25%) 0 0 / 54px 54px,
    linear-gradient(315deg, rgba(255,255,255,0.025) 25%, transparent 25%) 0 0 / 54px 54px,
    linear-gradient(125deg, #071a38 0%, #0b326c 58%, #302778 100%);
}

.login-brand-panel::before {
  content: '';
  position: absolute;
  right: -170px;
  bottom: -190px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 0 0 60px rgba(255,255,255,0.025),
    0 0 0 120px rgba(255,255,255,0.018);
  transform: rotate(32deg);
}

.login-brand-top,
.login-brand-content,
.login-brand-footer {
  position: relative;
  z-index: 1;
}

.login-brand-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-brand-logo {
  width: 72px;
  height: 72px;
  display: block;
  object-fit: contain;
  background: #fff;
  border: 3px solid rgba(255,255,255,0.48);
}

.login-brand-name {
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.25;
}

.login-brand-motto {
  margin-top: 6px;
  color: #9fc0ea;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.login-brand-content {
  width: 100%;
  max-width: 690px;
  margin: auto 0;
  padding: 70px 0;
}

.login-kicker {
  color: #3775bd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.login-brand-panel .login-kicker {
  color: #9fc5f3;
}

.login-brand-content h1 {
  margin-top: 17px;
  color: #fff;
  font-size: clamp(42px, 5.3vw, 72px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.99;
}

.login-brand-lead {
  max-width: 580px;
  margin-top: 25px;
  color: #c7d9ef;
  font-size: clamp(14px, 1.4vw, 17px);
  line-height: 1.75;
}

.login-feature-grid {
  max-width: 650px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 40px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.14);
}

.login-feature {
  min-height: 128px;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  padding: 20px;
  background: rgba(8,31,66,0.58);
  backdrop-filter: blur(8px);
}

.login-feature > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #d9eaff;
  border: 1px solid rgba(255,255,255,0.22);
}

.login-feature strong {
  display: block;
  margin: 1px 0 6px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 750;
}

.login-feature small {
  display: block;
  color: #9fb6d3;
  font-size: 10px;
  line-height: 1.55;
}

.login-brand-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #839fbe;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-brand-footer span {
  width: 26px;
  height: 1px;
  background: #6590c2;
}

.login-form-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 6vw, 84px);
  background:
    linear-gradient(rgba(22,88,173,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22,88,173,0.022) 1px, transparent 1px),
    #fff;
  background-size: 26px 26px;
}

.login-back-link {
  position: absolute;
  top: clamp(26px, 4vw, 48px);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #65748a;
  font-size: 11px;
  font-weight: 650;
}

.login-back-link:hover {
  color: var(--primary);
  text-decoration: none;
}

.login-card {
  width: 100%;
  max-width: 490px;
  margin: auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.login-mobile-brand {
  display: none;
  align-items: center;
  gap: 11px;
  margin-bottom: 42px;
  color: #13223a;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 750;
}

.login-mobile-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid #d7e0eb;
}

.login-header {
  margin-bottom: 36px;
  text-align: left;
}

.login-header h2 {
  margin-top: 10px;
  color: #101a2c;
  font-size: clamp(31px, 4vw, 42px);
  font-weight: 750;
  line-height: 1.15;
}

.login-header > p:last-child {
  max-width: 430px;
  margin-top: 10px;
  color: #6a788b;
  font-size: 13px;
  line-height: 1.65;
}

.login-page .form-group {
  margin-bottom: 20px;
}

.login-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-label-row > span {
  color: #9aa5b5;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-input {
  height: 50px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  box-shadow: inset 3px 0 0 transparent;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-input:focus-within {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary), 0 8px 22px rgba(22,88,173,0.08);
}

.login-input > i {
  color: #8290a3;
  font-size: 13px;
  text-align: center;
}

.login-input input {
  width: 100%;
  height: 48px;
  min-height: 0;
  padding: 0 10px 0 0;
  color: #132039;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 13px;
}

.login-input input:focus {
  border: 0;
  box-shadow: none;
}

.login-input input::placeholder {
  color: #a1acbb;
}

.password-toggle {
  width: 44px;
  height: 48px;
  display: grid;
  place-items: center;
  color: #758399;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--primary);
}

.login-page .error-msg {
  display: none;
  margin: -4px 0 16px;
  padding: 10px 12px;
  color: #a62c35;
  background: #fff1f2;
  border: 1px solid #f0c9cd;
  border-left: 3px solid #c33a43;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.login-page .error-msg.visible {
  display: block;
}

.login-submit {
  min-height: 50px;
  justify-content: space-between;
  margin-top: 8px;
  padding: 12px 18px;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.demo-access {
  margin-top: 28px;
  color: #5e6c80;
  background: #f7f9fc;
  border: 1px solid #dde4ed;
  font-size: 11px;
}

.demo-access summary {
  position: relative;
  padding: 12px 38px 12px 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.demo-access summary::-webkit-details-marker {
  display: none;
}

.demo-access summary::after {
  content: '+';
  position: absolute;
  top: 50%;
  right: 14px;
  font-size: 16px;
  font-weight: 500;
  transform: translateY(-50%);
}

.demo-access[open] summary::after {
  content: '−';
}

.demo-access > div {
  padding: 4px 14px 12px;
  border-top: 1px solid #e2e7ee;
}

.demo-access p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 9px;
}

.demo-access code {
  color: #173e72;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 10px;
}

.login-security-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 18px;
  color: #8a96a6;
  font-size: 9px;
  line-height: 1.6;
}

.login-security-note i {
  margin-top: 2px;
  color: #56779f;
}

.login-form-footer {
  max-width: 490px;
  width: 100%;
  margin: 28px auto 0;
  color: #9ba6b4;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 1080px) {
  .login-shell {
    grid-template-columns: minmax(390px, 0.9fr) minmax(480px, 1.1fr);
  }

  .login-feature-grid {
    grid-template-columns: 1fr;
  }

  .login-feature {
    min-height: 100px;
  }
}

@media (max-width: 860px) {
  .login-shell {
    display: block;
  }

  .login-brand-panel {
    display: none;
  }

  .login-form-panel {
    min-height: 100vh;
    padding: 90px clamp(28px, 9vw, 80px) 40px;
  }

  .login-mobile-brand {
    display: flex;
  }
}

@media (max-width: 520px) {
  .login-form-panel {
    justify-content: flex-start;
    padding: 74px 20px 28px;
  }

  .login-card,
  .login-form-footer {
    width: calc(100vw - 40px);
    max-width: none;
    margin-right: 0;
    margin-left: 0;
  }

  .login-input,
  .login-submit,
  .demo-access {
    max-width: 100%;
  }

  .login-input input {
    min-width: 0;
  }

  .login-back-link {
    top: 24px;
    left: 20px;
  }

  .login-mobile-brand {
    margin-bottom: 34px;
  }

  .login-header {
    margin-bottom: 28px;
  }

  .login-header h2 {
    font-size: 30px;
  }

  .demo-access p {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

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

.page-intro {
  display: flex;
  align-items: flex-start;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-left: 4px solid var(--primary, #2563eb);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.fee-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.fee-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.fee-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.fee-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fee-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.fee-label {
  color: var(--gray-500, #64748b);
  font-weight: 600;
}

.fee-value {
  color: var(--dark, #1e293b);
  font-weight: 500;
}

.fee-amount {
  font-weight: 700;
  color: var(--primary, #2563eb);
}

.fee-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.status-success { background: #dcfce7; color: #166534; }
.status-warning { background: #fef3c7; color: #92400e; }
.status-danger { background: #fee2e2; color: #991b1b; }

.fee-actions {
  display: flex;
  gap: 6px;
}

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

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

.plan-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.plan-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.plan-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.plan-card-title {
  font-size: 14px;
  color: var(--dark, #1e293b);
  line-height: 1.4;
}

.plan-card-status {
  flex-shrink: 0;
}

.plan-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.plan-label {
  color: var(--gray-500, #64748b);
  font-weight: 600;
}

.plan-value {
  color: var(--dark, #1e293b);
  font-weight: 500;
  text-align: right;
}

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

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

.book-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.book-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.book-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  cursor: pointer;
}

.book-card-cover {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--primary, #2563eb);
  background: rgba(37,99,235,0.08);
  border-radius: 8px;
  font-size: 18px;
  flex-shrink: 0;
}

.book-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.book-card-title {
  font-size: 14px;
  color: var(--dark, #1e293b);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-card-author {
  font-size: 12px;
  color: var(--gray-500, #64748b);
  margin-top: 2px;
}

.book-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.book-label {
  color: var(--gray-500, #64748b);
  font-weight: 600;
}

.book-value {
  color: var(--dark, #1e293b);
  font-weight: 500;
}

.book-avail {
  font-weight: 700;
  color: var(--success, #16a34a);
}

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

.tx-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.tx-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.tx-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.tx-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.tx-label {
  color: var(--gray-500, #64748b);
  font-weight: 600;
}

.tx-value {
  color: var(--dark, #1e293b);
  font-weight: 500;
  text-align: right;
}

.tx-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.tx-success { background: #dcfce7; color: #166534; }
.tx-warning { background: #fef3c7; color: #92400e; }
.tx-danger { background: #fee2e2; color: #991b1b; }

.tx-actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 768px) {
  .library-grid,
  .transactions-grid {
    grid-template-columns: 1fr;
  }
}

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

.result-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.result-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.result-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.result-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-badge {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  padding: 2px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
}

.result-gen-form .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .result-gen-form .form-row {
    grid-template-columns: 1fr;
  }
}

.exam-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.exam-checkboxes label:hover {
  background: var(--gray-50);
  border-radius: 4px;
}

.exam-checkboxes input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Print Queue */
.print-queue { display:flex;flex-direction:column;gap:12px; }
.print-card { background:#fff;border:1px solid var(--gray-200);border-radius:10px;padding:14px 16px;transition:box-shadow .2s; }
.print-card:hover { box-shadow:0 2px 8px rgba(0,0,0,.06); }
.print-card.printing { border-left:4px solid #3b82f6; }
.print-card.done { border-left:4px solid #10b981; opacity:.8; }
.print-card.pending { border-left:4px solid #f59e0b; }
.print-card.pending_approval { border-left:4px solid #8b5cf6; }
.print-top { display:flex;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap; }
.print-status { font-size:12px;font-weight:600;padding:3px 10px;border-radius:20px; }
.print-date { font-size:11px;color:var(--gray-400); }
.print-body h3 { font-size:15px;font-weight:600;margin-bottom:4px; }
.print-notes { font-size:13px;color:var(--gray-500);margin-bottom:6px; }
.print-meta { display:flex;gap:12px;font-size:12px;color:var(--gray-500);margin-bottom:6px; }
.print-meta span { display:flex;align-items:center;gap:4px; }
.print-file { margin-top:4px;font-size:13px; }
.print-file a { color:var(--primary);text-decoration:none; }
.print-actions { display:flex;gap:6px;align-items:center;margin-top:8px;flex-wrap:wrap; }

/* Switch Toggle */
.switch { position:relative;display:inline-block;width:44px;height:24px; }
.switch input { opacity:0;width:0;height:0; }
.switch-slider { position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#ccc;transition:.3s;border-radius:24px; }
.switch-slider:before { position:absolute;content:"";height:18px;width:18px;left:3px;bottom:3px;background:#fff;transition:.3s;border-radius:50%; }
.switch input:checked + .switch-slider { background:var(--primary); }
.switch input:checked + .switch-slider:before { transform:translateX(20px); }

/* Tabs */
.tabs .tab.active { font-weight:600; }
.tabs .tab:hover { opacity:.8; }

/* ── WhatsApp ── */
.wa-layout { display:grid;grid-template-columns:320px 1fr;gap:16px;align-items:start;overflow-x:hidden; }
.wa-side { display:flex;flex-direction:column;gap:16px; }
.wa-main { display:flex;flex-direction:column;gap:16px; }
.wa-status-row { display:flex;align-items:center;gap:8px;margin-bottom:12px; }
.wa-dot { width:12px;height:12px;border-radius:50%;display:inline-block;flex-shrink:0; }
.wa-dot.connected { background:var(--success);box-shadow:0 0 6px var(--success); }
.wa-dot.connecting { background:var(--warning);animation:pulse 1s infinite; }
.wa-dot.disconnected { background:var(--gray-300); }
@keyframes pulse { 0%{opacity:1}50%{opacity:.4}100%{opacity:1} }
.wa-connect-actions { display:flex;flex-direction:column;gap:6px;margin-top:12px; }
.wa-connect-actions .btn-block { width:100%; }
.wa-note { margin-top:10px;font-size:11px;color:var(--gray-400); }
.wa-qr-loading { text-align:center;padding:20px;color:var(--gray-400); }
.wa-qr-loading p { margin-top:8px;font-size:13px; }
.wa-qr-display { text-align:center;margin-top:12px; }
.wa-qr-hint { font-size:12px;color:var(--gray-500);margin-bottom:8px; }
.wa-qr-img { max-width:180px;border-radius:10px;border:2px solid var(--border);background:#fff;padding:6px; }
.wa-qr-fail { text-align:center;padding:20px;color:var(--gray-400);font-size:13px; }
.wa-tabs { display:flex;gap:0;margin-bottom:12px;border:1px solid var(--border);border-radius:8px;overflow:hidden; }
.wa-tab { flex:1;padding:10px;border:none;background:var(--gray-50);cursor:pointer;font-size:13px;font-weight:500;color:var(--gray-500);transition:all .15s; }
.wa-tab.active { background:var(--primary);color:#fff; }
.wa-tab i { margin-right:6px; }
.wa-chips-bar { display:flex;flex-wrap:wrap;gap:6px;padding:8px;background:var(--gray-50);border-radius:8px;margin-bottom:8px;min-height:40px;align-items:center; }
.wa-chip-empty { font-size:12px;color:var(--gray-400); }
.wa-chip { display:inline-flex;align-items:center;gap:6px;padding:4px 10px;background:var(--primary);color:#fff;border-radius:20px;font-size:12px;font-weight:500; }
.wa-chip i { cursor:pointer;font-size:10px;opacity:.7; }
.wa-chip i:hover { opacity:1; }
.wa-chip-count { font-size:11px;color:var(--gray-400);padding:2px 6px; }
.wa-search-bar { display:flex;align-items:center;gap:8px;margin-bottom:8px;padding:6px 10px;border:1px solid var(--border);border-radius:8px;background:#fff; }
.wa-search-bar i { color:var(--gray-400);font-size:14px; }
.wa-search-bar input { border:none;outline:none;flex:1;font-size:13px;background:transparent; }
.wa-search-bar select { border:none;font-size:12px;color:var(--gray-600);background:transparent;cursor:pointer;max-width:120px; }
.wa-recipient-list, .wa-group-list { max-height:180px;overflow-y:auto;border:1px solid var(--border);border-radius:8px; }
.wa-recipient-row { display:flex;align-items:center;gap:8px;padding:7px 10px;cursor:pointer;transition:background .1s;border-bottom:1px solid var(--gray-100);font-size:13px; }
.wa-recipient-row:hover { background:var(--gray-50); }
.wa-recipient-row.selected { background:#eef2ff; }
.wa-recipient-row:last-child { border-bottom:none; }
.wa-recipient-row input[type=checkbox] { accent-color:var(--primary); }
.wa-r-name { flex:1;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.wa-r-phone { font-size:11px;color:var(--gray-400);min-width:100px; }
.wa-r-class { font-size:10px;padding:1px 8px;border-radius:10px;background:var(--gray-100);color:var(--gray-500);white-space:nowrap; }
.wa-empty { padding:24px;text-align:center;color:var(--gray-400);font-size:13px; }
.wa-empty i { display:block;font-size:28px;margin-bottom:8px; }
.wa-empty-sm { padding:12px;text-align:center;color:var(--gray-400);font-size:12px; }
.wa-loading { text-align:center;padding:24px;color:var(--gray-400); }
.wa-template-bar { margin-bottom:8px;display:flex;gap:8px; }
.wa-template-bar select { flex:1;padding:8px 10px;border:1px solid var(--border);border-radius:8px;font-size:13px;background:#fff; }
.wa-ph-bar { display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px; }
.wa-ph-chip { padding:3px 10px;border:1px dashed var(--primary);border-radius:12px;background:#f4f1fa;color:var(--primary);font-size:11px;font-weight:600;cursor:pointer;transition:all .15s; }
.wa-ph-chip:hover { background:var(--primary);color:#fff;border-style:solid; }
.wa-textarea { width:100%;padding:10px 14px;border:1px solid var(--border);border-radius:8px;font-size:14px;resize:vertical;font-family:inherit;line-height:1.6; }
.wa-textarea:focus { outline:none;border-color:var(--primary);box-shadow:0 0 0 2px var(--primary-light); }
.wa-send-bar { display:flex;align-items:center;gap:12px;margin-top:8px;flex-wrap:wrap; }
.wa-char-count { font-size:11px;color:var(--gray-400);margin-left:auto; }
.wa-template-list { max-height:200px;overflow-y:auto; }
.wa-template-item { display:flex;align-items:center;gap:6px;padding:6px 8px;border-radius:6px;cursor:pointer;font-size:12px;border-bottom:1px solid var(--gray-100); }
.wa-template-item:hover { background:var(--gray-50); }
.wa-tpl-name { flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.wa-template-item i { color:var(--danger);opacity:.5;font-size:10px; }
.wa-template-item i:hover { opacity:1; }
.wa-manage-tpl-row { display:flex;align-items:center;gap:12px;padding:10px;border-bottom:1px solid var(--gray-100); }
.wa-manage-tpl-row:last-child { border-bottom:none; }
.wa-manage-tpl-row > div { flex:1; }
.wa-history-table th { font-size:12px; }
.wa-history-table td { font-size:13px; }
.wa-cell-phone { font-size:12px;color:var(--gray-500); }
.wa-cell-msg { max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--gray-600); }
.wa-cell-time { font-size:12px;color:var(--gray-400);white-space:nowrap; }

@media(max-width:768px) {
  .wa-layout { grid-template-columns:1fr; }
  .wa-side { order:2; }
  .wa-main { order:1; }
  .wa-recipient-list, .wa-group-list { max-height:200px; }
  .wa-chips-bar { gap:4px;padding:6px; }
  .wa-chip { padding:3px 8px;font-size:11px; }
  .wa-manual-row { flex-direction:column; }
  .wa-manual-row input, .wa-manual-row button { width:100%; }
  .wa-send-bar { flex-direction:column;align-items:stretch; }
  .wa-send-bar .btn { width:100%; }
  .wa-char-count { margin-left:0;margin-top:4px;text-align:center; }
  .wa-search-bar { flex-wrap:wrap; }
  .wa-search-bar input { flex-basis:100%;min-width:100%; }
  .wa-search-bar select { flex:1;max-width:none;padding:6px 0; }
  .wa-search-bar .btn { flex:0 0 auto; }
  .wa-section summary { padding:8px 10px;font-size:12px; }
  .wa-r-phone { min-width:0; }
  .wa-qr-img { max-width:150px; }
}

/* ── WhatsApp New Sections ── */
.wa-section { margin-bottom:12px;border:1px solid var(--border);border-radius:8px;overflow:visible;background:#fff; }
.wa-section summary { display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:var(--gray-50);cursor:pointer;font-weight:600;font-size:13px;color:var(--gray-700);list-style:none; }
.wa-section summary::-webkit-details-marker { display:none; }
.wa-section summary i { margin-right:8px;color:var(--primary); }
.wa-section-count { background:var(--primary);color:#fff;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:600; }
.wa-section[open] summary { background:#eef2ff;color:var(--primary); }
.wa-section-body { padding:10px 12px;animation:slideDown .2s ease; }
@keyframes slideDown { from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)} }

.wa-manual-row { display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap; }
.wa-manual-row input { flex:1;min-width:140px;padding:8px 10px;border:1px solid var(--border);border-radius:6px;font-size:13px; }
.wa-manual-row input:focus { outline:none;border-color:var(--primary);box-shadow:0 0 0 2px var(--primary-light); }
.wa-manual-row .btn-sm { padding:8px 14px;white-space:nowrap; }

.wa-manual-chips { display:flex;flex-wrap:wrap;gap:6px;min-height:28px; }
.wa-chip-parent { background:var(--primary); }
.wa-chip-group { background:var(--info); }
.wa-chip-manual { background:var(--warning);color:#fff; }

/* Resource media previews */
.resource-media-preview {
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  border-radius: 10px;
  margin: 4px 0 10px;
  display: block;
  background: #000;
  box-shadow: 0 2px 8px rgba(8,28,61,0.12);
}
.resource-media-preview video { max-height: 190px; }
.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.file-preview-item {
  position: relative;
  width: 130px;
  height: 96px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 11px;
  text-align: center;
  padding: 4px;
  word-break: break-all;
}
.file-preview-item img,
.file-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.activity-media {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
  margin: 10px 0;
  background: #000;
}
.activity-media + .activity-media {
  margin-top: 4px;
}
