:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #0f172a;
  --accent: #f59e0b;
  
  --color-avail: #10b981;
  --color-avail-bg: #ecfdf5;
  --color-avail-border: #a7f3d0;
  
  --color-prereg: #ef4444;
  --color-prereg-bg: #fef2f2;
  --color-prereg-border: #fecaca;
  
  --color-selected: #3b82f6;
  --color-selected-bg: #eff6ff;
  --color-selected-border: #bfdbfe;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

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

body {
  font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Background Atmospheric Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}
.bg-glow-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #3b82f6, #60a5fa 70%);
  top: -150px;
  right: -100px;
}
.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #10b981, #34d399 70%);
  bottom: -150px;
  left: -100px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.main-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 20px;
  flex-wrap: wrap;
}

.university-branding {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo-mark {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}
.logo-text { font-size: 1.1rem; line-height: 1; }
.logo-sub { font-size: 0.65rem; opacity: 0.85; }

.uni-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.dept-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.2;
}
.doc-subtitle {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.header-student-panel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.student-profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.student-profile-chip:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.student-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.student-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}
.student-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.student-info strong {
  font-size: 0.88rem;
  color: var(--text-main);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-edit-profile {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Stats Section */
.stats-section {
  padding: 24px 0 10px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.stat-card-available .stat-icon { background: var(--color-avail-bg); }
.stat-card-prereg .stat-icon { background: var(--color-prereg-bg); }
.stat-card-selected .stat-icon { background: var(--color-selected-bg); }

.stat-meta {
  display: flex;
  flex-direction: column;
}
.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}
.stat-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* My Selection Banner */
.my-selection-banner {
  margin-top: 16px;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.banner-badge {
  display: inline-block;
  background: #fbbf24;
  color: #78350f;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}
.banner-details h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.banner-details p {
  font-size: 0.88rem;
  opacity: 0.9;
}

/* Controls & Filters */
.controls-section {
  padding: 16px 0;
}
.controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.search-box {
  position: relative;
  width: 100%;
}
.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-box input {
  width: 100%;
  padding: 14px 48px 14px 44px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.clear-btn {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #e2e8f0;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.filter-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.pill.active {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
.pill-green.active {
  background: var(--color-avail);
  border-color: var(--color-avail);
  color: #fff;
}
.pill-blue.active {
  background: var(--color-selected);
  border-color: var(--color-selected);
  color: #fff;
}
.pill-red.active {
  background: var(--color-prereg);
  border-color: var(--color-prereg);
  color: #fff;
}

.supervisor-select-wrap select {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.view-toggle {
  display: flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: var(--radius-md);
}
.view-btn {
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.view-btn.active {
  background: #fff;
  color: var(--secondary);
  box-shadow: var(--shadow-sm);
}

/* Legend */
.legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
  background: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.red { background: var(--color-prereg); }
.legend-dot.blue { background: var(--color-selected); }
.legend-dot.green { background: var(--color-avail); }

/* Live Toast Bar */
.live-activity-toast {
  background: #1e293b;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s;
}
.toast-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse-ring 1.5s infinite;
}

/* Projects Cards Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.project-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Card States */
.project-card.card-prereg {
  border-color: var(--color-prereg-border);
  background: linear-gradient(180deg, #fff, var(--color-prereg-bg) 140%);
}
.project-card.card-prereg::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--color-prereg);
}

.project-card.card-available {
  border-color: var(--color-avail-border);
}
.project-card.card-available::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--color-avail);
}
.project-card.card-available:hover {
  border-color: var(--color-avail);
}

.project-card.card-selected {
  border-color: var(--color-selected-border);
  background: linear-gradient(180deg, #fff, var(--color-selected-bg) 140%);
}
.project-card.card-selected::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--color-selected);
}

.project-card.card-mine {
  border-color: #818cf8;
  background: #fdf4ff;
  box-shadow: 0 0 0 2px #c084fc;
}
.project-card.card-mine::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: #a855f7;
}

/* Card Header */
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-id-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
}

.card-status-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-prereg {
  background: #fee2e2;
  color: #b91c1c;
}
.badge-available {
  background: #d1fae5;
  color: #065f46;
}
.badge-selected {
  background: #dbeafe;
  color: #1e40af;
}
.badge-mine {
  background: #f3e8ff;
  color: #6b21a8;
}

/* Card Body */
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--secondary);
  margin-bottom: 14px;
  font-family: 'Inter', 'Cairo', sans-serif;
  direction: ltr;
  text-align: left;
}

.card-title.prereg-title {
  color: #dc2626;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.supervisor-tag {
  font-weight: 700;
  color: #1e293b;
}

/* Card Selection Status Info */
.card-selection-info {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px dashed var(--border);
}
.card-selection-info.active-selected {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.selection-user-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.user-name-highlight {
  font-weight: 800;
  color: var(--primary);
}
.selection-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-block { width: 100%; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-success {
  background: #10b981;
  color: #fff;
}
.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #f1f5f9;
}

.btn-outline-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #f87171;
  color: #f87171;
}
.btn-outline-danger:hover {
  background: #ef4444;
  color: #fff;
}

.btn-disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  border: 1px solid #e2e8f0;
}

/* Official Table View */
.table-container {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  margin-bottom: 40px;
}
.table-header-caption {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.table-header-caption h3 {
  font-size: 1.15rem;
  color: var(--secondary);
}
.table-header-caption p {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
}

.official-projects-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.9rem;
}
.official-projects-table th {
  background: #f1f5f9;
  color: var(--secondary);
  font-weight: 800;
  padding: 12px 16px;
  border: 1px solid var(--border);
}
.official-projects-table td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  vertical-align: middle;
}
.official-projects-table tr:hover {
  background: #f8fafc;
}
.official-projects-table tr.row-prereg {
  background: #fff5f5;
}
.official-projects-table tr.row-prereg td.project-title-cell {
  color: #dc2626;
  font-weight: 700;
}
.official-projects-table tr.row-selected {
  background: #f0f9ff;
}
.official-projects-table tr.row-mine {
  background: #faf5ff;
}

.project-title-cell {
  direction: ltr;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

/* Loading & Empty States */
.loading-state, .empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 40px;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}
.modal-badge-icon {
  width: 56px;
  height: 56px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 14px;
}
.modal-badge-icon.select-icon {
  background: #ecfdf5;
  color: #10b981;
}
.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--secondary);
}
.modal-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.input-group {
  margin-bottom: 16px;
  text-align: right;
}
.input-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--secondary);
}
.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.required { color: #ef4444; }

.modal-info-note {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.confirm-body {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}
.confirm-info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.confirm-info-row .label { color: var(--text-muted); }
.confirm-info-row strong.project-highlight {
  color: var(--primary);
  direction: ltr;
  text-align: left;
}

.modal-actions {
  display: flex;
  gap: 12px;
}
.modal-actions button { flex: 1; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #1e293b;
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlide 0.3s ease-out;
  max-width: 380px;
}
.toast.toast-success { border-left: 4px solid #10b981; }
.toast.toast-error { border-left: 4px solid #ef4444; }
.toast.toast-info { border-left: 4px solid #3b82f6; }

@keyframes toastSlide {
  from { transform: translateX(-40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer */
.main-footer {
  margin-top: auto;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 18px 0;
  font-size: 0.85rem;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-brand {
  display: flex;
  gap: 10px;
  color: var(--text-muted);
}
.footer-brand strong { color: var(--secondary); }
.footer-db-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #065f46;
  background: #ecfdf5;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}
.db-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* Utility */
.hidden { display: none !important; }

/* Responsive Design & Mobile Optimizations */
@media (max-width: 768px) {
  .container {
    padding: 0 14px;
  }

  /* Mobile Header */
  .main-header {
    padding: 6px 0;
  }
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .university-branding {
    gap: 12px;
  }
  .brand-logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .logo-text { font-size: 0.95rem; }
  .logo-sub { font-size: 0.6rem; }
  
  .uni-name {
    font-size: 0.75rem;
  }
  .dept-title {
    font-size: 1.15rem;
  }
  .doc-subtitle {
    font-size: 0.75rem;
    line-height: 1.3;
  }

  .header-student-panel {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .live-pill {
    padding: 5px 10px;
    font-size: 0.75rem;
    flex-shrink: 0;
  }
  .student-profile-chip {
    padding: 5px 10px;
    flex: 1;
    justify-content: space-between;
    min-width: 0;
  }
  .student-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    flex-shrink: 0;
  }
  .student-info {
    min-width: 0;
    overflow: hidden;
  }
  .student-info strong {
    max-width: 120px;
    font-size: 0.82rem;
  }

  /* 2x2 Stats Grid on Mobile */
  .stats-section {
    padding: 14px 0 6px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 12px 14px;
    gap: 10px;
    border-radius: var(--radius-sm);
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .stat-number {
    font-size: 1.25rem;
  }
  .stat-desc {
    font-size: 0.7rem;
    line-height: 1.2;
  }

  /* My Selection Banner on Mobile */
  .my-selection-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
    gap: 12px;
  }
  .my-selection-banner button {
    width: 100%;
  }

  /* Controls & Filter Pills on Mobile: Fully scrollable horizontally left/right */
  .controls-section {
    padding: 10px 0;
  }
  .controls-wrapper {
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .search-box input {
    padding: 12px 42px 12px 38px;
    font-size: 0.88rem;
  }
  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .filter-pills {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x !important;
    overscroll-behavior-x: contain !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 4px 4px 10px 4px !important;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
  }
  .filter-pills::-webkit-scrollbar {
    height: 4px !important;
    display: block !important;
  }
  .filter-pills::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
  }
  .filter-pills::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
  }
  .pill {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 8px 16px !important;
    font-size: 0.84rem !important;
    border-radius: var(--radius-full) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .supervisor-select-wrap select {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.88rem;
  }
  .view-toggle {
    align-self: flex-end;
  }

  /* Legend on Mobile */
  .legend-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    font-size: 0.76rem;
    margin-bottom: 14px;
  }

  /* Cards Grid on Mobile */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 24px;
  }
  .project-card {
    padding: 16px;
    border-radius: 14px;
  }
  .card-title {
    font-size: 0.96rem;
    margin-bottom: 10px;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .card-meta-row {
    font-size: 0.82rem;
    margin-bottom: 14px;
  }
  .card-selection-info {
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.8rem;
  }
  .btn {
    min-height: 44px;
    font-size: 0.88rem;
  }

  /* Table on Mobile */
  .table-container {
    margin-bottom: 24px;
    border-radius: 10px;
  }
  .official-projects-table th,
  .official-projects-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  /* Modals on Mobile */
  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }
  .modal-card {
    padding: 20px 16px;
    border-radius: 20px 20px 12px 12px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-header h2 {
    font-size: 1.15rem;
  }
  .modal-badge-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    margin-bottom: 10px;
  }
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  .modal-actions button {
    width: 100%;
    min-height: 44px;
  }

  /* Toast on Mobile */
  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 16px;
    align-items: stretch;
  }
  .toast {
    max-width: 100%;
    font-size: 0.84rem;
    padding: 12px 14px;
  }

  /* Footer on Mobile */
  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }
}

/* Extra small devices (phones < 380px) */
@media (max-width: 380px) {
  .dept-title {
    font-size: 1rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .header-student-panel {
    flex-direction: column;
  }
  .live-pill {
    width: 100%;
    justify-content: center;
  }
}

