/* ==========================================================================
   CỔNG QUẢN TRỊ GIẢNG VIÊN (INSTRUCTOR ADMIN PORTAL) - TDMU
   Học phần: Năng lực số · Chuyên đề Đồ án Công nghệ số · Lớp 26NS007
   Giảng viên phụ trách: ThS. Võ Tấn Bàn (TDMU387)
   ========================================================================== */

/* ---------- Color Tokens & Layout Variables ---------- */
:root {
  --admin-primary: #1e40af;
  --admin-primary-dark: #1e3a8a;
  --admin-primary-light: #3b82f6;
  --admin-primary-soft: #eff6ff;

  --admin-bg: #f8fafc;
  --admin-surface: #ffffff;
  --admin-surface-alt: #f1f5f9;
  --admin-border: #e2e8f0;
  --admin-border-focus: #3b82f6;
  --admin-text-main: #0f172a;
  --admin-text-muted: #64748b;
  --admin-text-sub: #334155;

  --admin-emerald: #059669;
  --admin-emerald-soft: #ecfdf5;
  --admin-emerald-border: #a7f3d0;

  --admin-amber: #d97706;
  --admin-amber-soft: #fffbeb;
  --admin-amber-border: #fde68a;

  --admin-rose: #dc2626;
  --admin-rose-soft: #fef2f2;
  --admin-rose-border: #fecaca;

  --admin-indigo: #4f46e5;
  --admin-indigo-soft: #eef2ff;

  --admin-font-sans: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --admin-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --admin-radius-sm: 6px;
  --admin-radius-md: 10px;
  --admin-radius-lg: 16px;
  --admin-radius-xl: 20px;

  --admin-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --admin-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --admin-shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.06);
  --admin-shadow-xl: 0 20px 32px -6px rgba(15, 23, 42, 0.18);
}

body.admin-body {
  margin: 0;
  padding: 0;
  font-family: var(--admin-font-sans);
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 1. SECURE PIN LOCK SCREEN ---------- */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #1e3a8a 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  backdrop-filter: blur(8px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.pin-lock-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pin-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--admin-radius-xl);
  padding: 32px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.pin-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #1e3a8a, #3b82f6, #059669);
}

.pin-logo-box {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 16px -4px rgba(30, 64, 175, 0.4);
  margin-bottom: 16px;
}

.pin-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.pin-subtitle {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 0 20px 0;
  line-height: 1.4;
}

.teacher-identity-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 9999px;
  margin-bottom: 24px;
  font-size: 13px;
  color: #1e3a8a;
  font-weight: 600;
}

.teacher-identity-chip .badge-gv {
  background: #1e40af;
  color: #fff;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pin-dots-container {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
  background: #1e40af;
  border-color: #1e40af;
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(30, 64, 175, 0.4);
}

.pin-dot.error {
  background: #dc2626;
  border-color: #dc2626;
}

.pin-input-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* Numeric Keypad */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 0 auto 20px auto;
}

.pin-key {
  aspect-ratio: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key span.sub {
  font-size: 9px;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 1.5px;
  margin-top: 2px;
}

.pin-key:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.pin-key:active {
  background: #cbd5e1;
  transform: translateY(1px);
}

.pin-key.key-action {
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
}

.pin-key.key-submit {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
  font-size: 18px;
}

.pin-key.key-submit:hover {
  background: #1d4ed8;
}

.pin-remember-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
  margin-bottom: 16px;
  cursor: pointer;
}

.pin-error-alert {
  padding: 10px 14px;
  background: var(--admin-rose-soft);
  border: 1px solid var(--admin-rose-border);
  color: var(--admin-rose);
  border-radius: var(--admin-radius-md);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}

.pin-card.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.pin-back-link {
  font-size: 13px;
  color: #64748b;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  transition: color 0.15s;
}

.pin-back-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* ---------- 2. ADMIN MAIN APP LAYOUT ---------- */
.admin-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Navbar */
.admin-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.admin-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.admin-nav-badge {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 20px;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.3);
}

.admin-nav-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.admin-nav-sub {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
}

.admin-nav-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tag-class-pill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-lecturer-pill {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-weight: 600;
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

/* Banner Strip */
.admin-subbanner {
  background: linear-gradient(90deg, #1e3a8a 0%, #1e40af 50%, #0369a1 100%);
  color: #ffffff;
  padding: 16px 24px;
}

.admin-subbanner-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.subbanner-left h1 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.subbanner-left p {
  font-size: 13px;
  margin: 0;
  opacity: 0.9;
}

.subbanner-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse 2s infinite;
}

.pulse-dot.dot-warning {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.pulse-dot.dot-error {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Container */
.admin-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}

/* ---------- 3. OVERVIEW KPIS SECTION ---------- */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-kpi-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  padding: 20px;
  box-shadow: var(--admin-shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.admin-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--admin-shadow-md);
}

.admin-kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #cbd5e1;
}

.admin-kpi-card.kpi-total::after { background: #3b82f6; }
.admin-kpi-card.kpi-completed::after { background: #059669; }
.admin-kpi-card.kpi-inprogress::after { background: #d97706; }
.admin-kpi-card.kpi-pending::after { background: #dc2626; }
.admin-kpi-card.kpi-graded::after { background: #4f46e5; }

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

.kpi-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--admin-surface-alt);
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-number {
  font-family: var(--admin-font-mono);
  font-size: 32px;
  font-weight: 800;
  color: var(--admin-text-main);
  line-height: 1;
}

.kpi-total-ref {
  font-size: 13px;
  color: var(--admin-text-muted);
  font-weight: 600;
}

.kpi-subtext {
  font-size: 12px;
  color: var(--admin-text-muted);
}

.kpi-progress-bar {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 10px;
}

.kpi-progress-fill {
  height: 100%;
  background: #059669;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* ---------- 4. GOOGLE SHEETS LIVE SYNC TOOLBAR ---------- */
.admin-sync-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  padding: 20px 24px;
  box-shadow: var(--admin-shadow-sm);
  margin-bottom: 24px;
}

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

.sync-card-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid #a7f3d0;
}

.sync-card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0;
}

.sync-card-desc {
  font-size: 12.5px;
  color: var(--admin-text-muted);
  margin: 2px 0 0 0;
}

.sync-inputs-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.sync-url-wrapper {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.sync-url-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-md);
  font-family: var(--admin-font-mono);
  font-size: 12.5px;
  color: var(--admin-text-main);
  background: var(--admin-surface-alt);
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.sync-url-input:focus {
  outline: none;
  border-color: var(--admin-primary-light);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.sync-url-prefix-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--admin-text-muted);
  pointer-events: none;
}

.sync-actions-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--admin-radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-admin:active {
  transform: scale(0.98);
}

.btn-admin:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-admin-primary {
  background: var(--admin-primary);
  color: #ffffff;
}

.btn-admin-primary:hover {
  background: var(--admin-primary-dark);
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.25);
}

.btn-admin-emerald {
  background: var(--admin-emerald);
  color: #ffffff;
}

.btn-admin-emerald:hover {
  background: #047857;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.btn-admin-outline {
  background: #ffffff;
  border-color: var(--admin-border);
  color: var(--admin-text-sub);
}

.btn-admin-outline:hover {
  background: var(--admin-surface-alt);
  border-color: #cbd5e1;
}

.btn-admin-rose {
  background: var(--admin-rose-soft);
  color: var(--admin-rose);
  border-color: var(--admin-rose-border);
}

.btn-admin-rose:hover {
  background: #fee2e2;
}

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

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

.sync-info-note {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- 5. FILTER & SEARCH CONTROLS ---------- */
.admin-toolbar-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  padding: 16px 20px;
  box-shadow: var(--admin-shadow-sm);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-search-box {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.toolbar-search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-md);
  font-size: 13.5px;
  background: var(--admin-surface-alt);
  box-sizing: border-box;
}

.toolbar-search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--admin-primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.toolbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-muted);
  pointer-events: none;
  font-size: 15px;
}

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

.toolbar-select {
  padding: 8px 12px;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-md);
  font-size: 13px;
  background: #ffffff;
  color: var(--admin-text-sub);
  cursor: pointer;
}

.toolbar-select:focus {
  outline: none;
  border-color: var(--admin-primary-light);
}

.view-mode-toggle {
  display: flex;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-md);
  overflow: hidden;
  background: var(--admin-surface-alt);
}

.view-toggle-btn {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--admin-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-toggle-btn.active {
  background: #ffffff;
  color: var(--admin-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---------- 6. GROUPS & STUDENTS GRADING SECTION ---------- */
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-count {
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  font-family: var(--admin-font-mono);
}

/* Group Card Style (Default) */
.groups-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

.group-admin-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  box-shadow: var(--admin-shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.group-admin-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--admin-shadow-md);
}

.group-admin-card.is-graded {
  border-left: 5px solid var(--admin-emerald);
}

.group-admin-card.is-incomplete {
  border-left: 5px solid var(--admin-amber);
}

.group-admin-card.is-empty {
  border-left: 5px solid var(--admin-rose);
}

/* Card Header */
.group-card-header {
  background: #ffffff;
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.group-card-main-info {
  flex: 1;
  min-width: 280px;
}

.group-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.group-num-badge {
  font-family: var(--admin-font-mono);
  font-size: 13px;
  font-weight: 800;
  background: #1e3a8a;
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.group-topic-heading {
  font-size: 16px;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0 0 6px 0;
  line-height: 1.35;
}

.group-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.pill-faculty {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.pill-direction {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.group-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge-complete {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.status-badge-partial {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-badge-pending {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Card Body: 2 Columns (Left: Members & Links, Right: Rubric Grading) */
.group-card-body {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 960px) {
  .group-card-body {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Deliverables & Students */
.deliverables-box {
  margin-bottom: 18px;
}

.box-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

.link-item-card {
  background: var(--admin-surface-alt);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 72px;
}

.link-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.link-type-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--admin-text-muted);
  text-transform: uppercase;
}

.link-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s;
}

.link-btn-web {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.link-btn-web:hover { background: #dbeafe; }

.link-btn-trello {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.link-btn-trello:hover { background: #dcfce7; }

.link-btn-slide {
  background: #fefce8;
  color: #a16207;
  border: 1px solid #fef08a;
}
.link-btn-slide:hover { background: #fef9c3; }

.link-btn-empty {
  background: #ffffff;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  font-size: 11.5px;
  font-style: italic;
  cursor: default;
}

/* Members Roster */
.members-list-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  font-size: 12.5px;
}

.member-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-avatar-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e3a8a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.member-name {
  font-weight: 700;
  color: var(--admin-text-main);
}

.member-mssv {
  font-family: var(--admin-font-mono);
  font-size: 11.5px;
  color: #1e40af;
  background: #eff6ff;
  padding: 1px 6px;
  border-radius: 4px;
}

.member-role {
  font-size: 11.5px;
  color: var(--admin-text-muted);
  font-style: italic;
}

/* Right Column: In-line Rubric Grading */
.rubric-grading-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--admin-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rubric-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dcfce7;
}

.rubric-heading {
  font-size: 13.5px;
  font-weight: 800;
  color: #14532d;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rubric-weights-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 9999px;
}

/* Rubric 3 Inputs Grid */
.rubric-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.rubric-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rubric-label {
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  line-height: 1.2;
}

.rubric-label span.weight {
  color: #15803d;
  font-weight: 800;
}

.rubric-number-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-family: var(--admin-font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #14532d;
  background: #ffffff;
  box-sizing: border-box;
  text-align: center;
  transition: all 0.15s;
}

.rubric-number-input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Quick Grade Preset Buttons */
.quick-grades-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.quick-grade-label {
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  margin-right: 4px;
}

.btn-quick-grade {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid #86efac;
  background: #ffffff;
  color: #15803d;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-quick-grade:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

/* Feedback Field & Suggestions */
.feedback-box {
  margin-bottom: 14px;
}

.feedback-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 12.5px;
  background: #ffffff;
  color: var(--admin-text-main);
  box-sizing: border-box;
  resize: vertical;
  min-height: 52px;
  font-family: var(--admin-font-sans);
}

.feedback-textarea:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.feedback-presets-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn-feedback-chip {
  font-size: 10.5px;
  background: #ffffff;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s;
}

.btn-feedback-chip:hover {
  background: #dcfce7;
}

/* Total Score & Save Row */
.rubric-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #dcfce7;
  gap: 12px;
  flex-wrap: wrap;
}

.total-score-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.total-score-label {
  font-size: 12px;
  font-weight: 700;
  color: #166534;
}

.total-score-value {
  font-family: var(--admin-font-mono);
  font-size: 22px;
  font-weight: 800;
  color: #15803d;
}

.total-score-scale {
  font-size: 12px;
  color: #166534;
  font-weight: 600;
}

.score-rating-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.rating-excellent { background: #15803d; color: #fff; }
.rating-good { background: #2563eb; color: #fff; }
.rating-fair { background: #d97706; color: #fff; }
.rating-poor { background: #dc2626; color: #fff; }

.rubric-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 7. TABLE VIEW MODE (COMPACT FOR ALL 15 GROUPS) ---------- */
.admin-table-wrapper {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  box-shadow: var(--admin-shadow-sm);
  overflow-x: auto;
  margin-bottom: 40px;
}

.admin-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.admin-data-table th {
  background: #f8fafc;
  color: var(--admin-text-sub);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 14px;
  border-bottom: 2px solid var(--admin-border);
  white-space: nowrap;
}

.admin-data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.admin-data-table tbody tr:hover {
  background: #f8fafc;
}

/* ---------- 8. MODALS (APPS SCRIPT GUIDE & GROUP EXPAND) ---------- */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.admin-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.admin-modal-dialog {
  background: #ffffff;
  border-radius: var(--admin-radius-xl);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--admin-shadow-xl);
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.admin-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0;
}

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

.admin-modal-close:hover {
  color: var(--admin-text-main);
}

.admin-modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 13.5px;
  color: var(--admin-text-sub);
  line-height: 1.6;
}

.code-preview-box {
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--admin-radius-md);
  padding: 16px;
  font-family: var(--admin-font-mono);
  font-size: 12px;
  max-height: 300px;
  overflow-y: auto;
  margin: 12px 0;
  position: relative;
}

.guide-step-card {
  background: var(--admin-surface-alt);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.guide-step-card h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--admin-primary-dark);
}

/* ---------- 9. TOAST NOTIFICATIONS ---------- */
.admin-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.admin-toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--admin-radius-md);
  box-shadow: var(--admin-shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid var(--admin-emerald);
  max-width: 360px;
}

.admin-toast.toast-error {
  border-left-color: var(--admin-rose);
}

.admin-toast.toast-info {
  border-left-color: var(--admin-primary-light);
}

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

/* ---------- 10. RESPONSIVE UTILITIES ---------- */
@media (max-width: 768px) {
  .admin-nav-inner {
    padding: 0 16px;
  }
  .admin-container {
    padding: 16px;
  }
  .admin-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-nav-center {
    display: none;
  }
}

@media (max-width: 480px) {
  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }
  .sync-inputs-row {
    flex-direction: column;
    align-items: stretch;
  }
  .sync-actions-group {
    width: 100%;
    justify-content: stretch;
  }
  .sync-actions-group .btn-admin {
    flex: 1;
    justify-content: center;
  }
}
