/* ==========================================================================
   AM-GRADING COCKPIT STUDIO - ULTRA MODERN DESIGN SYSTEM & STYLESHEET
   Engineered for Elite UI/UX, Instant Productivity & Dual-View Studio Mode
   ========================================================================== */

/* --- APP LAYOUT --- */
.app-cockpit-layout {
  display: flex;
  min-height: 100vh;
  background: var(--canvas-bg);
  position: relative;
}

/* ==========================================================================
   SYSTEM-WIDE LUMINOUS SAAS DESIGN SYSTEM (SQUIRCLE BADGES & ACCENT MOTIFS)
   Inspired by elite multi-module enterprise SaaS architecture
   ========================================================================== */

/* 1. Universal Squircle Icon Badges (Multi-module Color Coding) */
.squircle-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

/* Squircle Dimensions */
.squircle-sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.squircle-sm svg {
  width: 14px;
  height: 14px;
}

.squircle-md {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.squircle-md svg {
  width: 17px;
  height: 17px;
}

.squircle-lg {
  width: 42px;
  height: 42px;
  border-radius: 11px;
}
.squircle-lg svg {
  width: 21px;
  height: 21px;
}

/* Squircle Pastel Color-Coding Tokens */
.squircle-indigo {
  background: var(--squircle-indigo-bg);
  color: var(--squircle-indigo-fg);
  border: 1px solid var(--squircle-indigo-border);
}

.squircle-amber {
  background: var(--squircle-amber-bg);
  color: var(--squircle-amber-fg);
  border: 1px solid var(--squircle-amber-border);
}

.squircle-emerald {
  background: var(--squircle-emerald-bg);
  color: var(--squircle-emerald-fg);
  border: 1px solid var(--squircle-emerald-border);
}

.squircle-sky {
  background: var(--squircle-sky-bg);
  color: var(--squircle-sky-fg);
  border: 1px solid var(--squircle-sky-border);
}

.squircle-violet {
  background: var(--squircle-violet-bg);
  color: var(--squircle-violet-fg);
  border: 1px solid var(--squircle-violet-border);
}

.squircle-rose {
  background: var(--squircle-rose-bg);
  color: var(--squircle-rose-fg);
  border: 1px solid var(--squircle-rose-border);
}

.squircle-blue {
  background: var(--squircle-blue-bg);
  color: var(--squircle-blue-fg);
  border: 1px solid var(--squircle-blue-border);
}

.squircle-teal {
  background: var(--squircle-teal-bg);
  color: var(--squircle-teal-fg);
  border: 1px solid var(--squircle-teal-border);
}

.squircle-slate {
  background: var(--squircle-slate-bg);
  color: var(--squircle-slate-fg);
  border: 1px solid var(--squircle-slate-border);
}

/* 2. Signature Left Accent Indicator (Pill Strip Anchor) */
.has-left-indicator {
  position: relative;
  overflow: hidden;
}

.has-left-indicator::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: var(--indicator-width, 3.5px);
  border-radius: 0 var(--indicator-radius, 4px) var(--indicator-radius, 4px) 0;
  background: var(--nav-indicator-color, #f59e0b);
  opacity: 0;
  transform: scaleY(0.3);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.has-left-indicator.active::before,
.has-left-indicator.selected::before,
.has-left-indicator[aria-selected="true"]::before {
  opacity: 1;
  transform: scaleY(1);
}

.has-left-indicator.indicator-primary::before {
  background: var(--nav-indicator-primary, #2563eb);
}

/* 3. Hierarchy Connector Guide Lines */
.has-hierarchy-guide {
  position: relative;
  margin-left: 1.15rem;
  padding-left: 0.75rem;
  border-left: var(--hierarchy-guide-width, 1.5px) solid var(--hierarchy-guide-color, #e2e8f0);
}

/* 4. Unified Status Pill Badges */
.badge-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-status-pill.status-active,
.badge-status-pill.status-success {
  background: var(--squircle-emerald-bg);
  color: var(--squircle-emerald-fg);
  border: 1px solid var(--squircle-emerald-border);
}

.badge-status-pill.status-pending,
.badge-status-pill.status-warning {
  background: var(--squircle-amber-bg);
  color: var(--squircle-amber-fg);
  border: 1px solid var(--squircle-amber-border);
}

.badge-status-pill.status-archived,
.badge-status-pill.status-slate {
  background: var(--squircle-slate-bg);
  color: var(--squircle-slate-fg);
  border: 1px solid var(--squircle-slate-border);
}

.badge-status-pill.status-danger {
  background: var(--squircle-rose-bg);
  color: var(--squircle-rose-fg);
  border: 1px solid var(--squircle-rose-border);
}

/* --- LEFT NAVIGATION RAIL (SIDEBAR) --- */
.cockpit-sidebar {
  width: 290px;
  flex-shrink: 0;
  background: var(--rail-bg);
  color: var(--rail-text);
  border-right: 1px solid var(--border-color);
  padding: 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cockpit-sidebar::-webkit-scrollbar {
  width: 3px;
}
.cockpit-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

/* Sidebar Brand Header */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.2rem 0.35rem 0.5rem 0.35rem;
  border-bottom: 1px solid var(--border-color);
  min-width: 0;
}

.brand-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--primary-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--primary-glow);
}

.brand-meta {
  min-width: 0;
  overflow: hidden;
}

.brand-meta h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
  font-family: var(--font-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.brand-meta p {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

/* Unified Context Capsule (School & Year in Sidebar) */
.sidebar-context-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.context-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.context-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.context-select-styled {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-xs);
  padding: 0.38rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--fast-transition);
}

.context-select-styled:hover {
  border-color: var(--border-strong);
}

.context-select-styled:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(9, 9, 11, 0.08);
}

/* Teacher Switcher in Sidebar */
.sidebar-teacher-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.65rem;
  transition: var(--fast-transition);
  min-width: 0;
  max-width: 100%;
}

.sidebar-teacher-box:hover {
  border-color: var(--border-strong);
}

.teacher-avatar-circle {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}

.avatar-initials {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.sidebar-teacher-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 36px);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-teacher-select:disabled {
  opacity: 0.95;
  cursor: default;
  color: var(--text-main);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

/* Sidebar Nav Sections */
.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.35rem;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.btn-sidebar-add {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--fast-transition);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-sidebar-add:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

/* Subject & Class Nav Pills */
.subject-pill-tray {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.subject-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--fast-transition);
  min-width: 0;
}

.subject-pill:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

.subject-pill.active {
  background: var(--surface-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
  font-weight: 600;
}

/* Subject-Specific Accents (Toán, Tin, Sinh, Văn) */
.subject-pill.subject-toan.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.subject-pill.subject-toan.active .pill-badge {
  background: #ffffff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.subject-pill.subject-tin.active {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.subject-pill.subject-tin.active .pill-badge {
  background: #ffffff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.subject-pill.subject-sinh.active {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.subject-pill.subject-sinh.active .pill-badge {
  background: #ffffff;
  color: #047857;
  border-color: #a7f3d0;
}

.subject-pill.subject-van.active {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}
.subject-pill.subject-van.active .pill-badge {
  background: #ffffff;
  color: #c2410c;
  border-color: #fed7aa;
}

.subject-pill-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-badge {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  background: var(--surface-hover);
  color: var(--text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
}

.subject-pill.active .pill-badge {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-color);
}

.sidebar-class-picker {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.45rem;
  min-width: 0;
}

.class-dropdown-select {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-xs);
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--fast-transition);
}

.class-dropdown-select:hover {
  border-color: var(--border-strong);
}

.class-dropdown-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(9, 9, 11, 0.08);
}

/* Sidebar Nav Sections - Modern SaaS Edition */
.nav-section-title-modern {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.45rem 0.6rem 0.25rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

/* Sidebar Nav Item Card (Elite Reference Style) */
.nav-item-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.48rem 0.65rem;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  text-decoration: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.nav-item-card:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #f1f5f9;
}

.nav-item-card:hover .squircle-icon-box {
  transform: scale(1.05);
}

.nav-item-card.active {
  background: linear-gradient(90deg, #eff6ff 0%, #ffffff 100%);
  color: var(--text-main);
  font-weight: 700;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.nav-item-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-tree-group.expanded > .nav-item-card .nav-chevron,
.nav-tree-group[data-expanded="true"] > .nav-item-card .nav-chevron {
  transform: rotate(90deg);
}

.nav-submenu-list {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.2rem;
  margin-bottom: 0.25rem;
  margin-left: 1.15rem;
  padding-left: 0.65rem;
  border-left: var(--hierarchy-guide-width, 1.5px) solid var(--hierarchy-guide-color, #e2e8f0);
}

.nav-tree-group.expanded > .nav-submenu-list,
.nav-tree-group[data-expanded="true"] > .nav-submenu-list {
  display: flex;
}

.nav-subitem-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.55rem;
  border-radius: 8px;
  font-size: 0.79rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  width: 100%;
  text-decoration: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.nav-subitem-card:hover {
  background: #f8fafc;
  color: var(--text-main);
}

.nav-subitem-card:hover .squircle-icon-box {
  transform: scale(1.06);
}

.nav-subitem-card.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  border-color: #bfdbfe;
}

/* Sidebar Action Buttons (Enhanced with Squircle Alignment & Backward Compatibility) */
.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.48rem 0.65rem;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.sidebar-action-btn:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #f1f5f9;
}

.sidebar-action-btn:hover .squircle-icon-box,
.sidebar-action-btn:hover .nav-action-icon {
  transform: scale(1.05);
}

.sidebar-action-btn.active-portal,
.sidebar-action-btn.active {
  background: linear-gradient(90deg, #eff6ff 0%, #ffffff 100%);
  color: var(--text-main);
  border-color: #e2e8f0;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.nav-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-action-btn:hover .nav-action-icon,
.sidebar-action-btn.active-portal .nav-action-icon {
  color: var(--text-main);
}

.nav-action-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.command-hint-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--fast-transition);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.command-hint-badge:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text-main);
}

.command-hint-label {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kbd-chip {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  flex-shrink: 0;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* --- MAIN STUDIO CANVAS --- */
.studio-canvas {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas-bg);
}

/* Top Studio App Bar */
.studio-topbar {
  height: 56px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 2000;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-sidebar-toggle {
  display: none;
  font-size: 1.2rem;
  color: var(--text-main);
  padding: 0.25rem;
  border-radius: var(--radius-xs);
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.breadcrumb-trail #bc-school {
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.breadcrumb-sep {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.breadcrumb-active {
  color: #1d4ed8;
  font-weight: 700;
  background: #eff6ff;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid #bfdbfe;
}

/* Spotlight Search Trigger in Topbar */
.spotlight-trigger-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  min-width: 280px;
  transition: var(--fast-transition);
}

.spotlight-trigger-box:hover {
  border-color: var(--border-strong);
  background: #ffffff;
  color: var(--text-main);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Executive Topbar Utilities Popover (Streamlined B2B) */
.topbar-utilities-wrapper {
  position: relative;
}

.topbar-utilities-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  padding: 0.4rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: fadeInDown 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-util-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

.topbar-util-item:hover {
  background: #f8fafc;
}

.util-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.util-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.util-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.util-item-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.2;
}

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

/* --- MAIN WORKSPACE CONTAINER --- */
.workspace-container {
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  padding: 1.25rem 1.5rem 4rem 1.5rem;
  position: relative;
  z-index: 100;
}

/* Archived Year Warning Alert Banner */
.archived-year-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  color: #92400e;
}

.archived-alert-content { font-size: 0.82rem; line-height: 1.45; }
/* --- CLASSROOM CONTEXT HERO (Active Class & Subject Context Hub) --- */
.classroom-context-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: var(--fast-transition);
}

.context-hero-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.context-hero-school-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-chip-icon {
  font-size: 0.85rem;
}

.hero-chip-divider {
  color: var(--text-dim, #94a3b8);
}

.context-hero-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-subject-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full, 999px);
  font-size: 0.75rem;
  font-weight: 700;
}

.hero-class-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main, #0f172a);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}

.hero-student-count-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  background: var(--surface-subtle, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  padding: 0.18rem 0.65rem;
  border-radius: var(--radius-full, 999px);
}

.context-hero-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.context-hero-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-hero-action {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs, 6px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--fast-transition);
}

/* --- BENTO HUD METRIC CARDS (Luminous SaaS KPI Edition) --- */
.bento-hud-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.bento-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.bento-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.07), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
}

.bento-card:hover .squircle-icon-box,
.bento-card:hover .bento-icon {
  transform: scale(1.08);
}

.bento-card:nth-child(1) .bento-icon {
  background: var(--squircle-indigo-bg);
  color: var(--squircle-indigo-fg);
  border: 1px solid var(--squircle-indigo-border);
}

.bento-card:nth-child(2) .bento-icon {
  background: var(--squircle-emerald-bg);
  color: var(--squircle-emerald-fg);
  border: 1px solid var(--squircle-emerald-border);
}
.bento-card:nth-child(2) .bento-val {
  color: var(--squircle-emerald-fg);
}

.bento-card:nth-child(3) .bento-icon {
  background: var(--squircle-amber-bg);
  color: var(--squircle-amber-fg);
  border: 1px solid var(--squircle-amber-border);
}

.bento-card:nth-child(4) .bento-icon {
  background: var(--squircle-sky-bg);
  color: var(--squircle-sky-fg);
  border: 1px solid var(--squircle-sky-border);
}

.bento-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bento-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-val {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-feature-settings: 'tnum';
  margin-top: 0.1rem;
}

.bento-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.bento-subtext strong {
  color: var(--text-main);
  font-weight: 600;
}

/* --- EXAM HUB PRO: TRUNG TÂM QUẢN LÝ BÀI KIỂM TRA CẢ NĂM HỌC --- */
.exam-hub-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.25rem;
  transition: var(--fast-transition);
}

/* Exam Hub Header */
.exam-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.exam-hub-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.exam-hub-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.exam-hub-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin: 0;
}

/* Search Box */
.exam-hub-search-box {
  display: flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  gap: 0.5rem;
  flex: 1;
  max-width: 380px;
  min-width: 220px;
  transition: var(--fast-transition);
}

.exam-hub-search-box:focus-within {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.exam-hub-search-box svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.exam-hub-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.82rem;
  color: var(--text-main);
  width: 100%;
}

.exam-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 0.8rem;
  line-height: 1;
}

.exam-search-clear:hover {
  color: var(--text-main);
}

/* View Switcher */
.exam-hub-view-modes {
  display: flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  gap: 0.2rem;
}

.btn-hub-view {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--fast-transition);
}

.btn-hub-view:hover {
  color: var(--text-main);
}

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

/* Filter Ribbon */
.exam-hub-filter-ribbon {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
  scrollbar-width: none;
}

.exam-hub-filter-ribbon::-webkit-scrollbar {
  display: none;
}

.filter-pill-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.filter-pill-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  flex-shrink: 0;
}

.hub-filter-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--surface-subtle);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--fast-transition);
}

.hub-filter-pill:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text-main);
}

.hub-filter-pill.active {
  background: #ecfeff;
  border-color: rgba(0, 197, 223, 0.5);
  color: #082850;
  font-weight: 750;
  box-shadow: 0 1px 4px rgba(0, 197, 223, 0.18);
}

/* Exam Hub Body & View Modes */
.exam-hub-body {
  min-height: 80px;
  margin-bottom: 0.5rem;
}

/* 1. Grid Cards Mode */
.exam-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.exam-hub-card-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.exam-hub-card-item:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.1);
}

.exam-hub-card-item.active {
  border: 1.5px solid var(--primary);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.16);
  background: #fafcff;
}

.exam-hub-card-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--nav-indicator-color, #f59e0b);
  border-radius: 0 4px 4px 0;
}

.exam-hub-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.exam-cat-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.exam-cat-15p {
  background: #ecfeff;
  color: #0891b2;
  border: 1px solid #a5f3fc;
}

.exam-cat-45p {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

.exam-cat-term {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.exam-cat-special {
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
}

.exam-hub-card-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.exam-hub-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exam-hub-card-item.active .exam-hub-card-title {
  color: #1d4ed8;
}

/* Progress bar inside card */
.exam-hub-progress-track {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.2rem;
}

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

.exam-hub-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 0.25rem;
}

.exam-hub-card-stats strong {
  color: var(--text-main);
}

.exam-hub-card-badge-done {
  color: #059669;
  font-weight: 600;
  background: #ecfdf5;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
}

.exam-hub-card-badge-pending {
  color: #d97706;
  font-weight: 600;
  background: #fffbeb;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
}

/* 2. Timeline View Mode */
.exam-timeline-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.exam-timeline-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.exam-timeline-group-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* 3. Compact Tray Mode */
.exam-switcher-tray {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
}

.exam-switcher-tray::-webkit-scrollbar {
  height: 4px;
}
.exam-switcher-tray::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

.exam-card-chip {
  flex-shrink: 0;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  min-width: 200px;
  transition: var(--fast-transition);
}

.exam-card-chip:hover {
  background: #ffffff;
  border-color: var(--border-strong);
}

.exam-card-chip.active {
  background: #ffffff;
  border: 1.5px solid var(--primary);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.14);
}

.exam-card-chip.active .exam-chip-title {
  color: #1d4ed8;
}

.exam-card-chip.active .chip-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.exam-chip-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exam-chip-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.chip-badge {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  background: var(--surface-hover);
  color: var(--text-muted);
  font-weight: 500;
  font-family: var(--font-mono);
}

.chip-badge-count {
  background: var(--surface-active);
  color: var(--text-main);
  font-weight: 600;
}

/* Active Exam Hero Bar */
.exam-hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  margin-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.exam-hero-info h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.exam-hero-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.exam-hero-meta strong {
  color: var(--text-secondary);
}

.exam-hero-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Empty State */
.exam-hub-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.exam-hub-empty-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

/* Responsive Styles for Mobile & Tablet */
@media (max-width: 768px) {
  .exam-hub-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .exam-hub-search-box {
    max-width: 100%;
    min-width: 100%;
  }

  .exam-hub-view-modes {
    align-self: flex-start;
  }

  .exam-hub-grid {
    grid-template-columns: 1fr;
  }

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

  .exam-hero-action-buttons {
    justify-content: flex-start;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .exam-hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- DUAL-VIEW STUDIO TABS & TABLE WORKSPACE --- */
.studio-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.studio-mode-pills {
  display: flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  gap: 0.2rem;
}

.btn-mode-toggle {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: var(--fast-transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-mode-toggle.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Table Card */
.studio-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Variant Filter Tabs */
.variant-tab-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.v-tab {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: var(--fast-transition);
}

.v-tab:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

.v-tab.active {
  background: var(--surface-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
  font-weight: 600;
}

/* Table Styles - Stripe Grade */
.submissions-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.submissions-table th {
  padding: 0.55rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--canvas-bg);
  border-bottom: 1px solid var(--border-color);
}

.submissions-table td {
  padding: 0.55rem 0.5rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.submissions-table tbody tr {
  transition: background 0.1s ease;
}

.submissions-table tbody tr:hover {
  background: var(--surface-subtle);
}

.col-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 44px;
}

.col-id {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.8rem;
}

.submissions-table .col-stt {
  width: 44px;
  min-width: 40px;
  text-align: center;
}

.submissions-table .col-student {
  min-width: 170px;
  max-width: 250px;
}

.submissions-table .col-variant {
  width: 68px;
  min-width: 60px;
  text-align: center;
}

.submissions-table .col-pages {
  width: 88px;
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
}

.submissions-table .col-status {
  width: 92px;
  min-width: 85px;
  text-align: center;
  white-space: nowrap;
}

.submissions-table .col-score {
  width: 96px;
  min-width: 90px;
  text-align: center;
  white-space: nowrap;
}

.submissions-table td.col-pages,
.submissions-table th.col-pages {
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.submissions-table td.col-status,
.submissions-table th.col-status {
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

/* Table Action Cell & Group - Desktop Ergonomics & Zero Horizontal Overflow */
.submissions-table .col-actions {
  white-space: nowrap;
  min-width: 220px;
  text-align: right;
  vertical-align: middle;
}

/* Student Profile & Avatar Cell */
.student-profile-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.student-avatar-pill {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.student-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
}
.student-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-quick-rename {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 4px;
  opacity: 0.45;
  transition: all 0.15s ease;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-quick-rename:hover {
  opacity: 1;
  transform: scale(1.15);
  background: rgba(0, 0, 0, 0.05);
}
.student-meta-subrow {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.student-code-tag {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  font-size: 0.72rem;
  background: var(--surface-subtle, #f1f5f9);
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--primary-dark, #3b82f6);
}

/* Checkbox styling */
.sub-row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary, #2563eb);
  flex-shrink: 0;
  margin: 0;
}

/* Page Thumbnail & Proof Box */
.page-chip-composite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.sub-proof-thumb-box {
  width: 26px !important;
  height: 34px !important;
  max-width: 26px !important;
  max-height: 34px !important;
  border-radius: 4px;
  overflow: hidden !important;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  flex-shrink: 0 !important;
  background: #f8fafc;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-block;
}
.sub-proof-thumb-box:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}
.sub-proof-thumb-img {
  width: 26px !important;
  height: 34px !important;
  max-width: 26px !important;
  max-height: 34px !important;
  object-fit: cover !important;
  display: block !important;
}

/* Academic Score Cell Stack */
.score-cell-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 90px;
}
.score-micro-track {
  width: 100%;
  height: 3.5px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}
.score-micro-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.score-academic-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid;
  line-height: 1.2;
  white-space: nowrap;
}
.score-academic-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

/* Class Pulse Summary Bar */
.class-pulse-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  margin-bottom: 0.85rem;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  flex-wrap: wrap;
}
.pulse-stat-capsule {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pulse-capsule-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.pulse-capsule-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main, #0f172a);
  font-feature-settings: 'tnum';
}
.pulse-stat-distribution {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.pulse-dist-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-weight: 600;
}
.pulse-dist-chip .dist-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Exam Submissions Search & Filter Bar */
.exam-submissions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.submissions-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 240px;
  max-width: 380px;
}
.submissions-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  pointer-events: none;
}
.submissions-search-input {
  width: 100%;
  padding: 0.42rem 1.8rem 0.42rem 2rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  background: #ffffff;
  transition: all 0.15s ease;
}
.submissions-search-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.btn-clear-search {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 2px;
}
.submissions-filters-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tier-filter-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.tier-filter-select-wrap .filter-label {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.tier-select {
  padding: 0.38rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: #ffffff;
  font-weight: 500;
}

/* Floating Bulk Actions Bar - Apple / Stripe Glassmorphism HUD */
.floating-bulk-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #ffffff;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0.45rem 0.9rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
}

.floating-bulk-bar.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.bulk-bar-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: nowrap;
}

.bulk-bar-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  white-space: nowrap;
  padding-right: 0.65rem;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.bulk-selected-badge {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 2px 9px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

.bulk-selected-label {
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.8rem;
}

.btn-bulk-deselect {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 0.2rem;
  transition: all 0.15s ease;
}

.btn-bulk-deselect:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.bulk-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

/* Specific Bulk Action Buttons with Perfect Contrast & Semantic Themes */
.btn-bulk-action {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  padding: 0.32rem 0.68rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.16s ease !important;
  border: 1px solid transparent !important;
  line-height: 1.2 !important;
}

.btn-bulk-action:hover {
  transform: translateY(-1px);
}

.btn-bulk-action-stop {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #fcd34d !important;
  border: 1px solid rgba(251, 191, 36, 0.45) !important;
}
.btn-bulk-action-stop:hover {
  background: rgba(245, 158, 11, 0.36) !important;
  color: #ffffff !important;
  border-color: rgba(251, 191, 36, 0.7) !important;
}

.btn-bulk-action-variant {
  background: rgba(56, 189, 248, 0.2) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(125, 211, 252, 0.42) !important;
}
.btn-bulk-action-variant:hover {
  background: rgba(56, 189, 248, 0.34) !important;
  color: #ffffff !important;
  border-color: rgba(125, 211, 252, 0.68) !important;
}

.btn-bulk-action-zalo {
  background: linear-gradient(135deg, #0068ff 0%, #0052cc 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 2px 8px rgba(0, 104, 255, 0.35);
}
.btn-bulk-action-zalo:hover {
  background: linear-gradient(135deg, #1a78ff 0%, #005fe6 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.5);
}

.btn-bulk-action-zip {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6ee7b7 !important;
  border: 1px solid rgba(52, 211, 153, 0.42) !important;
}
.btn-bulk-action-zip:hover {
  background: rgba(16, 185, 129, 0.35) !important;
  color: #ffffff !important;
  border-color: rgba(52, 211, 153, 0.65) !important;
}

.btn-bulk-action-regrade {
  background: rgba(139, 92, 246, 0.22) !important;
  color: #d8b4fe !important;
  border: 1px solid rgba(192, 132, 252, 0.42) !important;
}
.btn-bulk-action-regrade:hover {
  background: rgba(139, 92, 246, 0.36) !important;
  color: #ffffff !important;
  border-color: rgba(192, 132, 252, 0.65) !important;
}

.btn-bulk-action-delete {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(248, 113, 113, 0.38) !important;
}
.btn-bulk-action-delete:hover {
  background: rgba(239, 68, 68, 0.32) !important;
  color: #ffffff !important;
  border-color: rgba(248, 113, 113, 0.6) !important;
}

/* Mobile & Tablet Safe-Area & Dock Adaptation */
@media (max-width: 768px) {
  .floating-bulk-bar {
    bottom: calc(var(--mobile-dock-height, 64px) + env(safe-area-inset-bottom, 12px) + 12px) !important;
    padding: 0.4rem 0.75rem;
    border-radius: 16px;
    max-width: calc(100vw - 20px);
  }
  .bulk-bar-content {
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .bulk-bar-content::-webkit-scrollbar {
    display: none;
  }
  .bulk-bar-info {
    font-size: 0.75rem;
    padding-right: 0.4rem;
  }
  .bulk-selected-label {
    display: none;
  }
  .btn-bulk-action {
    font-size: 0.72rem !important;
    padding: 0.28rem 0.5rem !important;
  }
}

.sub-row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary, #2563eb);
  border-radius: 4px;
  margin-right: 2px;
  flex-shrink: 0;
}

.table-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.table-action-group .btn {
  padding: 0.18rem 0.36rem;
  font-size: 0.72rem;
  min-height: 26px;
  line-height: 1.2;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  font-weight: 600;
}

.btn-action-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.76rem;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-action-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Status Dot Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.18rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.status-graded {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.status-graded .status-dot { background: #10b981; }

.status-grading {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.status-grading .status-dot { background: #f59e0b; }

.status-submitted {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.status-submitted .status-dot { background: #2563eb; }

.status-pending {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}
.status-pending .status-dot { background: #ea580c; }

#btn-submit-next-student:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-approve-submission:hover {
  background: #059669 !important;
  color: #ffffff !important;
}

.btn-reject-submission:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
}

.score-pill-table {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.85rem;
}

.score-max {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.score-placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.variant-select-inline {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.45rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  max-width: 100px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.variant-select-inline:hover {
  border-color: var(--border-strong);
}

/* Generic Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-submitted {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-graded {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.score-pill-table {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  border: 1px solid transparent;
}

.score-pill-table.score-high {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.score-pill-table.score-good {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.score-pill-table.score-mid {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.score-pill-table.score-low {
  background: #fff1f2;
  color: #9f1239;
  border-color: #fecdd3;
}

/* Buttons - Modern Luminous EdTech */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--fast-transition);
  cursor: pointer;
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.55rem; font-size: 0.72rem; }

.btn-primary {
  background: var(--primary-gradient, linear-gradient(135deg, #00c5df 0%, #00b4d8 50%, #0099b8 100%));
  color: #082850;
  font-weight: 750;
  border: 1px solid rgba(8, 40, 80, 0.15);
  box-shadow: 0 2px 8px rgba(0, 197, 223, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #00d5ee 0%, #00c5df 50%, #00b4d8 100%);
  color: #082850;
  box-shadow: 0 4px 14px rgba(0, 197, 223, 0.4);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-gradient, linear-gradient(135deg, #059669 0%, #10b981 100%));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 50%, #10b981 100%);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.38);
  transform: translateY(-1px);
}

.btn-iris, .btn-executive {
  background: var(--btn-executive-gradient, linear-gradient(135deg, #082850 0%, #0c3666 50%, #0284c7 100%));
  color: #ffffff;
  border: 1px solid rgba(0, 197, 223, 0.3);
  box-shadow: 0 3px 12px rgba(8, 40, 80, 0.25);
}

.btn-iris:hover, .btn-executive:hover {
  background: var(--btn-executive-hover-gradient, linear-gradient(135deg, #051c38 0%, #082850 50%, #00b4d8 100%));
  box-shadow: 0 6px 18px rgba(0, 197, 223, 0.35);
  transform: translateY(-1px);
}

.btn-royal {
  background: var(--accent-royal);
  color: #ffffff;
  border: 1px solid var(--accent-royal);
}

.btn-royal:hover {
  background: var(--accent-royal-hover);
}

.btn-outline {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

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

/* --- INLINE SPEEDGRADER SPLIT STUDIO (LUMINOUS EDTECH MODE) --- */
.speedgrader-studio-layout {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 0.75rem;
  min-height: 680px;
  background: var(--studio-bg);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: var(--studio-text);
  border: 1px solid var(--studio-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.speedgrader-roster {
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow-y: auto;
  max-height: none;
  align-self: stretch;
  height: 100%;
}

.speedgrader-roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--fast-transition);
  color: var(--studio-text);
}

.speedgrader-roster-item:hover {
  background: rgba(0, 197, 223, 0.05);
}

.speedgrader-roster-item.active {
  background: rgba(0, 197, 223, 0.08);
  border-left: 3.5px solid var(--primary, #00c5df);
  color: var(--brand-navy, #082850);
  font-weight: 750;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  box-shadow: inset 1px 0 0 rgba(0, 197, 223, 0.2);
}

.speedgrader-center-pane {
  background: #f8fafc;
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.speedgrader-canvas-toolbar {
  min-height: 44px;
  height: auto;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.85rem;
  border-bottom: 1px solid var(--studio-border);
  flex-wrap: wrap;
  gap: 0.45rem;
}

.speedgrader-canvas-toolbar button {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--fast-transition);
}

.speedgrader-canvas-toolbar button:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* SpeedGrader Multi-Page Switcher Tabs Bar */
.sg-page-tabs-bar {
  background: #f8fafc;
  border-bottom: 1px solid var(--studio-border);
  padding: 0.35rem 0.85rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
  align-items: center;
}

.sg-page-tab-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.sg-page-tab-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.sg-page-tab-btn.active {
  background: #1e293b;
  border-color: #0f172a;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(15,23,42,0.18);
}

.sg-page-tab-badge {
  font-size: 0.68rem;
  padding: 0.05rem 0.35rem;
  border-radius: 9999px;
  font-weight: 700;
}

.sg-page-tab-btn.active .sg-page-tab-badge {
  background: rgba(255,255,255,0.25);
  color: #ffffff;
}

.sg-page-tab-btn:not(.active) .sg-page-tab-badge {
  background: #f1f5f9;
  color: #475569;
}

.sg-rubric-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.sg-rubric-card:hover {
  transform: translateX(3px);
  border-color: #3b82f6 !important;
  box-shadow: 0 2px 6px rgba(59,130,246,0.12);
}

.speedgrader-canvas-viewport {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 1.5rem;
  position: relative;
  background: #f8fafc;
}

/* AnnotationViewer rendered inside SpeedGrader viewport (no toolbar mode) */
.speedgrader-canvas-viewport .viewer-canvas-area {
  width: 100%;
  height: 100%;
  align-items: flex-start;
  touch-action: pan-y pinch-zoom;
}

.speedgrader-canvas-viewport .document-page-image {
  max-height: 60vh;
}

.speedgrader-right-pane {
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  max-height: 100%;
  align-self: stretch;
  height: 100%;
  color: var(--studio-text);
}

/* SpeedGrader Visual Rubric & Lightbox */
.sg-tab-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary, #64748b);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.sg-tab-btn:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.05));
  color: var(--text-primary, #0f172a);
}

.sg-tab-btn.active {
  background: #ffffff;
  border-color: var(--border-color, #e2e8f0);
  color: var(--primary-color, #2563eb);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  font-weight: 600;
}

.sg-visual-rubric-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sg-visual-rubric-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  background: rgba(241, 245, 249, 0.5);
  border: 1px dashed var(--border-color, #cbd5e1);
  border-radius: var(--radius-sm, 6px);
  color: var(--text-secondary, #64748b);
}

.sg-visual-rubric-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.sg-visual-rubric-item {
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.sg-visual-rubric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #475569);
}

.sg-visual-rubric-img-wrap {
  width: 100%;
  max-height: 280px;
  overflow: hidden;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.sg-visual-rubric-img-wrap:hover img {
  transform: scale(1.02);
}

.sg-visual-rubric-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s ease;
}

/* Lightbox Modal */
.sg-rubric-lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.sg-rubric-lightbox-modal.active {
  display: flex;
}

.sg-rubric-lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}

.sg-rubric-lightbox-dialog {
  position: relative;
  background: #ffffff;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.sg-rubric-lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: #f8fafc;
}

.sg-rubric-lightbox-title {
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  font-size: 0.95rem;
}

.sg-rubric-lightbox-body {
  padding: 1rem;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

/* --- SPOTLIGHT COMMAND PALETTE (⌘K) --- */
.spotlight-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.spotlight-backdrop.active {
  display: flex;
}

.spotlight-modal {
  width: 100%;
  max-width: 620px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: spotlightPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes spotlightPop {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.spotlight-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
}

.spotlight-input {
  flex: 1;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
}

.spotlight-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.spotlight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--fast-transition);
}

.spotlight-item:hover, .spotlight-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* --- ALL MODALS (LEGACY COMPATIBILITY) --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex !important;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#modal-add-variant,
#modal-upload-rubric-files,
#modal-rubric-export {
  z-index: 10090 !important;
}

#modal-create-class,
#modal-edit-class {
  z-index: 10050;
}

#modal-edit-variant-content {
  z-index: 10090;
}

/* ==========================================================================
   CAMERA SCANNER VIEWPORT & CONTROLS (AUTOGRADING Live Document Scanner)
   ========================================================================== */
#modal-camera-scanner {
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#modal-camera-scanner .camera-modal-container {
  background: #090d16;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl, 20px);
  max-width: 680px;
  width: 95vw;
  max-height: 92vh;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
}

/* Top bar: Glassmorphic icon buttons and live status pill */
.camera-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  z-index: 10;
}

.btn-camera-glass-icon {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  outline: none;
}

.btn-camera-glass-icon:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: scale(1.05);
}

.camera-title-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.camera-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: cameraPulse 1.8s infinite;
}

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

/* Live Viewfinder */
.camera-viewfinder-box {
  background: #000000;
  border-radius: var(--radius-lg, 12px);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  flex: 1;
}

.camera-viewfinder-box video#camera-video-stream {
  width: 100%;
  height: 100%;
  max-height: 58vh;
  object-fit: contain;
  display: block;
}

/* Visual Flash Effect on Shutter Tap */
@keyframes cameraShutterFlashAnim {
  0% {
    opacity: 0.85;
  }
  30% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
  }
}

.camera-shutter-flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.2s ease-out;
}

.camera-shutter-flash.flash-active {
  animation: cameraShutterFlashAnim 0.25s ease-out forwards;
}

/* Document Frame Corner Guides (4 corners) */
.camera-doc-frame {
  position: absolute;
  inset: 16px;
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.doc-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: rgba(255, 255, 255, 0.85);
  border-style: solid;
}

.corner-tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-top-left-radius: 6px; }
.corner-tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-top-right-radius: 6px; }
.corner-bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 6px; }
.corner-br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 6px; }

.doc-hint-badge {
  align-self: center;
  margin-top: auto;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Filmstrip Tray for multi-page captures */
.camera-filmstrip-tray {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
  align-items: center;
  z-index: 10;
}

#modal-camera-scanner:not(.active) {
  display: none !important;
}

.camera-filmstrip-item {
  position: relative;
  width: 56px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid #4f46e5;
  background: #1e293b;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.camera-filmstrip-item img.filmstrip-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-filmstrip-item .filmstrip-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.camera-filmstrip-item .filmstrip-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  font-size: 0.62rem;
  text-align: center;
  color: #fff;
  font-weight: 700;
  padding: 2px 0;
}

.camera-filmstrip-item .btn-remove-filmstrip {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Bottom Action Bar */
.camera-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  gap: 0.75rem;
  z-index: 10;
}

.camera-bottom-side {
  flex: 1;
  display: flex;
  align-items: center;
}

.camera-bottom-side.left {
  justify-content: flex-start;
}

.camera-bottom-side.right {
  justify-content: flex-end;
}

.camera-status-indicator {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}

.camera-status-indicator .captured-count-num {
  color: #38bdf8;
  font-weight: 800;
}

.camera-bottom-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Tactile Shutter Button Ring */
.camera-shutter-trigger {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 4px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, background 0.15s ease;
  outline: none;
}

.camera-shutter-trigger:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.45);
}

.camera-shutter-trigger .shutter-inner-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s ease;
}

.camera-shutter-trigger:active .shutter-inner-circle {
  transform: scale(0.88);
}

/* Clean Finish Button: Never wrap, clear contrast */
.camera-finish-btn {
  white-space: nowrap !important;
  font-weight: 700 !important;
  font-size: 0.88rem !important;
  padding: 0.65rem 1.15rem !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
}

#modal-reset-student-password {
  z-index: 260;
}

#modal-reset-student-password .modal-content {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: modalPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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


.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  padding: 2rem;
  box-shadow: var(--shadow-float);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  transition: var(--fast-transition);
}

.form-control:focus {
  border-color: var(--primary, #0284c7);
  box-shadow: 0 0 0 3px rgba(0, 197, 223, 0.25);
}

/* Grading Workspace Modal */
.workspace-modal {
  width: 95vw;
  max-width: 1560px;
  height: 92vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.workspace-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.viewer-pane {
  flex: 3;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  position: relative;
}

.viewer-toolbar {
  height: 48px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 0.8rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tool-btn {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--fast-transition);
}

.tool-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.viewer-canvas-area {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 1.5rem;
  position: relative;
  background: #f1f5f9;
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 20px 20px;
}

.document-page-wrapper {
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.2s ease-out;
  background: #ffffff;
}

.document-page-image {
  max-width: 100%;
  max-height: 75vh;
  display: block;
}

.grading-pane {
  flex: 2;
  background: #ffffff;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.question-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: var(--fast-transition);
}

.question-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.q-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
}

.q-score-input {
  width: 60px;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-align: center;
}

.q-feedback {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.q-correction {
  font-size: 0.8rem;
  color: #1e40af;
  background: #eff6ff;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-top: 0.35rem;
}

.score-overview-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.total-score-badge {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary);
  font-family: var(--font-heading);
}

.teacher-comment-box {
  margin-top: 0.5rem;
}


/* Mobile Bottom Navigation Dock */
.mobile-bottom-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  z-index: 1100;
  align-items: center;
  justify-content: space-around;
  pointer-events: auto;
}

.dock-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--fast-transition);
  padding: 0.35rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.dock-item:hover {
  color: var(--text-main);
}

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

.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dock-icon svg {
  stroke: currentColor;
}

/* Floating Action Button (FAB) */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: 72px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--primary-glow);
  align-items: center;
  justify-content: center;
  z-index: 95;
  cursor: pointer;
  transition: var(--fast-transition);
}

.mobile-fab:hover {
  transform: scale(1.05);
}

/* Toast Container - Elevated Above All Modals (Apple-Grade Haute-Tech Toast) */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 99999;
  pointer-events: none;
  max-width: min(92vw, 440px);
}

.toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-md, 12px);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toastIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  word-break: break-word;
}

.toast-success {
  background: rgba(6, 78, 59, 0.94);
  border-color: rgba(52, 211, 153, 0.35);
  color: #ecfdf5;
  box-shadow: 0 12px 32px -4px rgba(6, 78, 59, 0.45), 0 0 0 1px rgba(52, 211, 153, 0.2);
}

.toast-error {
  background: rgba(127, 29, 29, 0.94);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fef2f2;
  box-shadow: 0 12px 32px -4px rgba(127, 29, 29, 0.45), 0 0 0 1px rgba(248, 113, 113, 0.2);
}

.toast-warning {
  background: rgba(120, 53, 15, 0.94);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fffbeb;
  box-shadow: 0 12px 32px -4px rgba(120, 53, 15, 0.45), 0 0 0 1px rgba(251, 191, 36, 0.2);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
  .toast-container {
    top: 1rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(92vw, 420px);
    align-items: center;
  }
}

/* --- RESPONSIVE ADAPTATIONS (HAUTE-TECH PRECISION) --- */
@media (max-width: 1200px) {
  .bento-hud-grid { grid-template-columns: repeat(2, 1fr); }
  .speedgrader-studio-layout { grid-template-columns: 200px 1fr 300px; }
}

@media (max-width: 1024px) {
  .cockpit-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-float);
    z-index: 150;
  }
  .cockpit-sidebar.open {
    transform: translateX(0);
  }
  .btn-sidebar-toggle { display: inline-flex; }
  .spotlight-trigger-box { min-width: 160px; }
  .speedgrader-studio-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .studio-topbar { padding: 0 0.85rem; }
  .workspace-container { padding: 0.85rem 0.85rem 5.5rem 0.85rem; }
  .spotlight-trigger-box { display: none; }
  .breadcrumb-trail #bc-school,
  .breadcrumb-trail #bc-year,
  .breadcrumb-trail .breadcrumb-sep:nth-of-type(1),
  .breadcrumb-trail .breadcrumb-sep:nth-of-type(2) {
    display: none;
  }
  .bento-hud-grid { grid-template-columns: 1fr; }
  .exam-hero-bar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .mobile-bottom-dock { display: flex; }
  .mobile-fab { display: flex; }
}

@media (max-width: 540px) {
  .studio-topbar { padding: 0 0.65rem; gap: 0.5rem; }
  .breadcrumb-trail #bc-school,
  .breadcrumb-trail #bc-year,
  .breadcrumb-trail #bc-subject,
  .breadcrumb-trail .breadcrumb-sep {
    display: none !important;
  }
  .breadcrumb-trail #bc-class {
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
  }
  .topbar-actions {
    gap: 0.35rem;
  }
  #btn-create-exam span {
    display: none;
  }
  #btn-create-exam {
    padding: 0.45rem 0.6rem;
  }
  #btn-batch-grade span {
    font-size: 0.75rem;
  }
  .modal-content {
    margin: 1rem 0.5rem;
    padding: 1.25rem;
  }
}

/* ==========================================================================
   VIEW WORK BUTTON - Distinctive Action Button for Viewing Submissions
   ========================================================================== */
.btn-view-work {
  background: var(--primary-light, #ecfeff) !important;
  color: var(--brand-navy, #082850) !important;
  border: 1.5px solid var(--primary, #00c5df) !important;
  font-weight: 700 !important;
  transition: all 0.15s ease;
}
.btn-view-work:hover {
  background: var(--primary, #00c5df) !important;
  color: var(--brand-navy, #082850) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 197, 223, 0.35);
}

/* ==========================================================================
   EXAM SHEET VIEWER - Modern Card-Based Document Viewer
   ========================================================================== */
.exam-sheet-card {
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 10px;
  overflow: hidden;
  max-width: 100%;
  width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  background: white;
  transition: box-shadow 0.2s ease;
}
.exam-sheet-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.exam-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bento-card-bg, #f8fafc);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  gap: 0.5rem;
}

.exam-sheet-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--border-color, #e2e8f0);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s ease, transform 0.1s ease;
  cursor: pointer;
  color: inherit;
}
.exam-sheet-action-btn:hover {
  background: var(--primary-color, #2563eb);
  color: white;
  transform: scale(1.08);
}

.exam-sheet-image {
  max-width: 100%;
  max-height: 700px;
  display: block;
  object-fit: contain;
  margin: 0 auto;
  background: #f8fafc;
  cursor: zoom-in;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.exam-sheet-image:hover {
  opacity: 0.96;
}

#btn-modal-view-create-rubric:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.exam-file-fallback {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
  line-height: 1.8;
  background: #fef2f2;
  border-radius: 0 0 10px 10px;
}
.exam-file-fallback a {
  color: var(--primary-color, #2563eb);
  text-decoration: underline;
  font-weight: 600;
}

@media (max-width: 600px) {
  .exam-sheet-header {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }
  .exam-sheet-image {
    max-height: 500px;
  }
  .exam-sheet-action-btn {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   PORTAL FLOW GRID RESPONSIVE
   ========================================================================== */
.portal-flow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .portal-flow-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ==========================================================================
   MULTI-VARIANT EXAM & RUBRIC VIEWER STYLES (NEO-MINIMALISM BENTO HUB)
   ========================================================================== */
.variant-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.variant-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.variant-hub-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.variant-hub-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.variant-hub-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.variant-hub-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.variant-hub-grid {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

/* Backward-compatible legacy fallback class */
.modal-variant-ribbon {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  overflow: visible !important;
}

.variant-chips-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  overflow: visible !important;
}

.variant-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px solid var(--border-color, #cbd5e1);
  background: #ffffff;
  color: var(--text-main, #1e293b);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.variant-chip:hover {
  border-color: #6366f1;
  background: #f5f7ff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.12);
}

.variant-chip.active {
  border-color: #4f46e5;
  background: #eff6ff;
  color: #312e81;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.18);
  position: relative;
}

.variant-chip-badge {
  font-size: 0.72rem;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--text-muted, #64748b);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.variant-chip.active .variant-chip-badge {
  background: #e0e7ff;
  color: #4338ca;
  font-weight: 700;
}

/* Scientific matrix micro styling when 6+ variants are loaded */
.variant-hub-grid.matrix-mode .variant-chip {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

.dual-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.upload-field-card {
  border-radius: var(--radius-md, 8px);
  padding: 1rem;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upload-field-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.exam-empty-tab-state {
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #ffffff;
  border-radius: var(--radius-md, 8px);
  border: 1px dashed var(--border-color, #cbd5e1);
  margin: 1rem 0;
}

@media (max-width: 640px) {
  .dual-upload-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .modal-variant-ribbon {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
}

/* ==========================================================================
   AI MODEL SELECTOR CAPSULE (Hidden from UI as configured)
   ========================================================================== */
.ai-model-capsule,
#ai-model-selector-container,
.sg-model-indicator {
  display: none !important;
}

.ai-model-capsule:hover {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.ai-model-icon-pulse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #ffffff;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.35);
  animation: subtlePulse 3s infinite ease-in-out;
}

@keyframes subtlePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.92; }
}

.ai-model-select {
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  padding-right: 0.25rem;
}

.ai-model-badge-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: #e0e7ff;
  color: #4338ca;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.ai-model-badge-chip.thinking {
  background: #fae8ff;
  color: #86198f;
}

.ai-model-badge-chip.vision {
  background: #e0f2fe;
  color: #0369a1;
}

.ai-model-badge-chip.speed {
  background: #dcfce7;
  color: #15803d;
}

.sg-model-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

/* ==========================================================================
   RBAC & USER AUTHENTICATION STYLES
   ========================================================================== */

/* User Auth Capsule & Profile Trigger */
.user-auth-capsule {
  display: flex;
  align-items: center;
  position: relative;
}

.user-profile-menu-container {
  position: relative;
}

.user-profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-subtle, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 9999px;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-main, #0f172a);
}

.user-profile-trigger:hover {
  background: #ffffff;
  border-color: var(--primary, #00c5df);
  box-shadow: 0 2px 8px rgba(0, 197, 223, 0.25);
}

.user-avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #082850, #0099b8);
  border: 1px solid rgba(0, 197, 223, 0.4);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
}

.user-name-display {
  font-size: 0.82rem;
  font-weight: 700;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-role {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-role.role-admin {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge-role.role-teacher {
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
}

.badge-role.role-student {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* User Profile Dropdown Menu */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  animation: dropdownSlide 0.15s ease-out;
}

.user-profile-dropdown.open {
  display: flex !important;
}

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

.dropdown-header {
  padding: 0.5rem 0.65rem;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color, #e2e8f0);
  margin: 0.35rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #1e293b);
  border-radius: var(--radius-sm, 6px);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.dropdown-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.dropdown-item.text-danger {
  color: #dc2626;
}

.dropdown-item.text-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

/* Quick Demo Login Pills */
.btn-demo-login {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-demo-login:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  transform: translateY(-1px);
}

/* Data Table Styling for Admin and Class Accounts */
.data-table th, .data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  font-size: 0.82rem;
}

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

.badge-status-active {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-status-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Print Roster & Credentials Card Media Query (Scoped to prevent blank print across app) */
@media print {
  body.printing-student-accounts * {
    visibility: hidden;
  }
  body.printing-student-accounts #modal-student-accounts,
  body.printing-student-accounts #modal-student-accounts * {
    visibility: visible;
  }
  body.printing-student-accounts #modal-student-accounts {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #ffffff;
  }

  /* Universal print hygiene: hide non-printable navigation, buttons and backdrops */
  .no-print,
  .app-header,
  .sidebar,
  .modal-backdrop:not(.active-print),
  .mobile-bottom-dock,
  .speedgrader-cockpit-toolbar,
  .studio-tabs-nav,
  .btn:not(.printable-btn) {
    display: none !important;
  }

  /* Assessment Studio Audit & Rubric Report Print Optimization */
  #studio-audit-report-container,
  #studio-rubric-content-container {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #studio-audit-report-container *,
  #studio-rubric-content-container * {
    visibility: visible !important;
  }

  #studio-audit-defects-list,
  #studio-rubric-questions-list {
    max-height: none !important;
    overflow: visible !important;
  }

  .audit-defect-item {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1px solid #cbd5e1 !important;
    margin-bottom: 14px !important;
    box-shadow: none !important;
  }
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .user-name-display,
  .badge-role {
    display: none;
  }
  .user-profile-trigger {
    padding: 0.25rem;
  }
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ==========================================================================
   SUBMISSION VIEWER MODAL & SMART TABLE PAGE CHIPS
   ========================================================================== */

/* Page Count & Quick View Chips in Submissions Table */
.page-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.page-chip-btn:hover {
  background: #e0e7ff;
  border-color: #818cf8;
  color: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.12);
}

.page-chip-btn .view-hint {
  font-size: 0.7rem;
  color: #4f46e5;
  font-weight: 800;
  padding-left: 0.15rem;
}

.page-chip-empty {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: #fffbeb;
  border: 1px dashed #f59e0b;
  color: #b45309;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.page-chip-empty:hover {
  background: #fef3c7;
  border-color: #d97706;
}

/* Submission Viewer Modal Container */
.submission-viewer-modal-content {
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background: #ffffff;
  max-width: 1200px;
  width: 95vw;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}

.mvs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mvs-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mvs-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #082850, #00c5df);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.mvs-meta-content {
  display: flex;
  flex-direction: column;
}

.mvs-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mvs-student-name {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main, #0f172a);
}

.mvs-meta-info {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  margin-top: 0.2rem;
}

.mvs-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mvs-disclaimer {
  margin-bottom: 0.65rem;
}

.disclaimer-short,
.btn-text-short {
  display: none;
}

.disclaimer-full,
.btn-text-full {
  display: inline;
}

.mvs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mvs-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mvs-page-indicator {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0 0.5rem;
  min-width: 90px;
  text-align: center;
}

.mvs-layer-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #475569);
}

.mvs-layer-select {
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  height: auto;
}

.mvs-zoom-level {
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 45px;
  text-align: center;
}

.mvs-main-workspace {
  flex: 1 1 auto;
  display: flex;
  position: relative;
  overflow: hidden;
  min-height: 0;
  gap: 0.75rem;
}

.mvs-rubric-drawer {
  width: 380px;
  max-width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  overflow-y: auto;
  padding: 1rem;
  flex-shrink: 0;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

.mvs-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.mvs-drawer-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main, #0f172a);
}

.mvs-drawer-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mvs-bottom-tray {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
  padding-top: 0.5rem;
  flex-shrink: 0;
}

.mvs-thumbnails-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0;
}

.mvs-score-summary {
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.mvs-toolbar .btn {
  font-weight: 600;
  white-space: nowrap;
}

/* Thumbnail Chips in Modal Tray */
.mvs-thumb-item {
  position: relative;
  width: 54px;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  background: #f1f5f9;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.mvs-thumb-item:hover {
  border-color: #818cf8;
  transform: scale(1.05);
}

.mvs-thumb-item.active {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
  transform: scale(1.06);
}

.mvs-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mvs-thumb-item .thumb-label {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
}

/* Interactive Canvas Viewer inside Modal (Unified with AnnotationViewer) */
#mvs-canvas-viewport {
  user-select: none;
  touch-action: pan-y pinch-zoom;
  background: #f1f5f9;
  background-image: radial-gradient(#e2e8f0 1.2px, transparent 1.2px);
  background-size: 24px 24px;
}

#mvs-canvas-viewport .viewer-canvas-area {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 1.25rem;
  box-sizing: border-box;
}

#mvs-canvas-viewport .document-page-wrapper {
  position: relative;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  transition: transform 0.15s ease-out;
}

#mvs-canvas-viewport .document-page-image {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
}

/* Student Portal Submissions Cards */
.my-submission-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.my-submission-card:hover {
  border-color: #818cf8;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
  transform: translateY(-2px);
}

/* Responsive Table Submissions */
.submissions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.submissions-table th,
.submissions-table td {
  padding: 0.85rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.submissions-table tbody tr:hover {
  background: #f8fafc;
}/* ====================================================================
   AM-GRADING ENTERPRISE AUTH GATE & UNAUTHENTICATED SECURITY SHIELD
   ==================================================================== */

/* Unauthenticated State: Hide All Sensitive Internal Cockpit Views & Mobile Dock */
body.unauthenticated .cockpit-sidebar,
body.unauthenticated .studio-topbar,
body.unauthenticated #teacher-dashboard-view,
body.unauthenticated .mobile-bottom-dock,
body.unauthenticated #mobile-fab-camera {
  display: none !important;
}

body.unauthenticated .workspace-container {
  padding: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  background: transparent !important;
  min-height: 100vh;
}

body.unauthenticated .app-cockpit-layout {
  display: block !important;
  min-height: 100vh;
  background: linear-gradient(135deg, #0b132b 0%, #1c2541 50%, #0f172a 100%);
}

/* Auth Gate Wrapper */
.auth-gate-wrapper {
  display: none;
  width: 100%;
  min-height: 100vh;
  padding: 1.25rem 1.5rem 2.5rem;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.15) 0%, transparent 40%),
              radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
              linear-gradient(135deg, #0b132b 0%, #131c38 60%, #0f172a 100%);
  animation: authFadeIn 0.35s ease-out;
}

/* Auth Gate Header Bar & Actions */
.auth-gate-header-bar {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto 1.5rem;
  padding: 0 0.5rem;
  z-index: 20;
}

.auth-header-brand-mini {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.auth-header-brand-title {
  display: flex;
  flex-direction: column;
}

.auth-brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main, #ffffff);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth-brand-badge-mini {
  font-size: 0.62rem;
  font-weight: 800;
  color: #818cf8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.btn-guest-pricing-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.15) 0%, rgba(99, 102, 241, 0.2) 100%);
  color: #818cf8;
  border: 1px solid rgba(129, 140, 248, 0.4);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-guest-pricing-trigger:hover {
  background: #4f46e5;
  color: #ffffff;
  border-color: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.pricing-label-mobile {
  display: none;
}

/* Auth Gate B2B Legal Trust Footer */
.auth-gate-footer {
  width: 100%;
  max-width: 1240px;
  margin: 3.5rem auto 1.5rem;
  padding: 2.25rem 2rem 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  box-shadow: 0 10px 30px -4px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  text-align: left;
  box-sizing: border-box;
  color: #334155;
}

[data-theme="dark"] .auth-gate-footer {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.4);
  color: #94a3b8;
}

.auth-footer-top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="dark"] .auth-footer-top-strip {
  border-color: rgba(255, 255, 255, 0.08);
}

.auth-footer-brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-footer-brand-title {
  font-size: 1.22rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
}

[data-theme="dark"] .auth-footer-brand-title {
  color: #f8fafc;
}

.auth-footer-brand-sub {
  font-size: 0.76rem;
  color: #64748b;
  font-weight: 600;
}

[data-theme="dark"] .auth-footer-brand-sub {
  color: #94a3b8;
}

.auth-footer-trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}

[data-theme="dark"] .auth-footer-trust-badge {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* 4-column B2B Enterprise Grid */
.auth-footer-grid {
  display: grid;
  grid-template-columns: 2.1fr 1.15fr 1.25fr 1.35fr;
  gap: 2rem;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

@media (max-width: 1024px) {
  .auth-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
  }
}

@media (max-width: 640px) {
  .auth-footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .auth-gate-footer {
    padding: 1.5rem 1rem 1rem;
    border-radius: 16px;
  }
}

.auth-footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
}

.footer-company-name {
  font-size: 0.88rem;
  font-weight: 850;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

[data-theme="dark"] .footer-company-name {
  color: #38bdf8;
}

.footer-meta-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.5;
}

[data-theme="dark"] .footer-meta-list {
  color: #94a3b8;
}

.footer-meta-list li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.footer-meta-list .meta-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
  margin-top: 1px;
}

.footer-meta-list .meta-label {
  font-weight: 700;
  color: #1e293b;
}

[data-theme="dark"] .footer-meta-list .meta-label {
  color: #e2e8f0;
}

.footer-link-highlight {
  color: #0284c7;
  text-decoration: none;
  font-weight: 700;
}

.footer-link-highlight:hover {
  text-decoration: underline;
  color: #0369a1;
}

[data-theme="dark"] .footer-link-highlight {
  color: #38bdf8;
}

.footer-link-plain {
  color: #475569;
  text-decoration: none;
}

.footer-link-plain:hover {
  text-decoration: underline;
  color: #0284c7;
}

[data-theme="dark"] .footer-link-plain {
  color: #cbd5e1;
}

.auth-footer-heading {
  font-size: 0.82rem;
  font-weight: 850;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.45rem 0;
  padding-bottom: 0.4rem;
  border-bottom: 1.5px solid #e2e8f0;
}

[data-theme="dark"] .auth-footer-heading {
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.1);
}

.auth-footer-nav-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-footer-nav-list li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.auth-legal-link {
  color: #475569;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.auth-legal-link:hover {
  color: #0284c7;
  transform: translateX(2px);
}

[data-theme="dark"] .auth-legal-link {
  color: #cbd5e1;
}

[data-theme="dark"] .auth-legal-link:hover {
  color: #38bdf8;
}

.auth-footer-bank-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .auth-footer-bank-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
}

.bct-badge-box {
  margin-top: 0.75rem;
  background: #ffffff;
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
  transition: all 0.2s ease;
}

.bct-badge-box:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

[data-theme="dark"] .bct-badge-box {
  background: #1e293b;
  border-color: rgba(59, 130, 246, 0.4);
}

.bct-badge-emblem {
  font-size: 1.35rem;
  line-height: 1;
}

.bct-badge-text-group {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.bct-badge-status {
  font-size: 0.68rem;
  color: #0284c7;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.bct-badge-ministry {
  font-size: 0.84rem;
  color: #1e293b;
  font-weight: 900;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .bct-badge-ministry {
  color: #f8fafc;
}

.auth-footer-copyright-row {
  border-top: 1px solid #e2e8f0;
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: #64748b;
}

[data-theme="dark"] .auth-footer-copyright-row {
  border-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

body.unauthenticated .auth-gate-wrapper {
  display: flex !important;
}
/* Zero FOUC & Display rules for Digitization & Assessment Rubric Studio & Math Visual 3D */
html.utility-mode #auth-gate-view,
html.utility-mode .auth-gate-wrapper,
body.utility-mode #auth-gate-view,
body.utility-mode .auth-gate-wrapper,
body.unauthenticated.utility-mode .auth-gate-wrapper,
html.studio-mode #auth-gate-view,
html.studio-mode .auth-gate-wrapper,
body.studio-mode #auth-gate-view,
body.studio-mode .auth-gate-wrapper,
body.unauthenticated.studio-mode .auth-gate-wrapper,
html.math-visual-mode #auth-gate-view,
html.math-visual-mode .auth-gate-wrapper,
body.math-visual-mode #auth-gate-view,
body.math-visual-mode .auth-gate-wrapper,
body.unauthenticated.math-visual-mode .auth-gate-wrapper {
  display: none !important;
}

html.utility-mode #student-portal-view,
body.utility-mode #student-portal-view,
body.unauthenticated.utility-mode #student-portal-view,
html.studio-mode #student-portal-view,
body.studio-mode #student-portal-view,
body.unauthenticated.studio-mode #student-portal-view,
html.math-visual-mode #student-portal-view,
body.math-visual-mode #student-portal-view,
body.unauthenticated.math-visual-mode #student-portal-view {
  display: none !important;
}

html.utility-mode #teacher-dashboard-view,
body.utility-mode #teacher-dashboard-view,
body.unauthenticated.utility-mode #teacher-dashboard-view,
body.unauthenticated.studio-mode #teacher-dashboard-view,
html.math-visual-mode #teacher-dashboard-view,
body.math-visual-mode #teacher-dashboard-view,
body.unauthenticated.math-visual-mode #teacher-dashboard-view {
  display: none !important;
}

html.math-ocr-mode #math-ocr-view,
body.math-ocr-mode #math-ocr-view,
html.utility-mode #math-ocr-view,
body.utility-mode #math-ocr-view,
body.unauthenticated.math-ocr-mode #math-ocr-view {
  display: flex !important;
  flex-direction: column !important;
  gap: 1.25rem !important;
  width: 100% !important;
  max-width: 1360px !important;
  margin: 0 auto !important;
}

html.studio-mode #assessment-studio-view,
body.studio-mode #assessment-studio-view,
body.unauthenticated.studio-mode #assessment-studio-view {
  display: block !important;
  width: 100% !important;
  max-width: 1360px !important;
  margin: 0 auto !important;
}

html.studio-mode #math-ocr-view,
body.studio-mode #math-ocr-view,
html.studio-mode.utility-mode #math-ocr-view,
body.studio-mode.utility-mode #math-ocr-view {
  display: none !important;
}

html.math-ocr-mode #assessment-studio-view,
body.math-ocr-mode #assessment-studio-view {
  display: none !important;
}

html.math-visual-mode #math-visual-studio-view,
body.math-visual-mode #math-visual-studio-view,
body.unauthenticated.math-visual-mode #math-visual-studio-view {
  display: flex !important;
  flex-direction: column !important;
}

html.math-visual-mode #math-ocr-view,
body.math-visual-mode #math-ocr-view,
body.unauthenticated.math-visual-mode #math-ocr-view {
  display: none !important;
}

html.math-ocr-mode #math-visual-studio-view,
body.math-ocr-mode #math-visual-studio-view,
body.unauthenticated.math-ocr-mode #math-visual-studio-view {
  display: none !important;
}

html.utility-mode .cockpit-sidebar,
body.utility-mode .cockpit-sidebar,
html.utility-mode .studio-topbar,
body.utility-mode .studio-topbar,
body.unauthenticated.utility-mode .cockpit-sidebar,
body.unauthenticated.utility-mode .studio-topbar,
body.unauthenticated.utility-mode .mobile-bottom-dock,
body.unauthenticated.studio-mode .cockpit-sidebar,
body.unauthenticated.studio-mode .studio-topbar,
body.unauthenticated.studio-mode .mobile-bottom-dock,
body.unauthenticated.studio-mode #mobile-fab-camera,
html.math-visual-mode .cockpit-sidebar,
body.math-visual-mode .cockpit-sidebar,
html.math-visual-mode .studio-topbar,
body.math-visual-mode .studio-topbar,
body.unauthenticated.math-visual-mode .cockpit-sidebar,
body.unauthenticated.math-visual-mode .studio-topbar,
body.unauthenticated.math-visual-mode .mobile-bottom-dock {
  display: none !important;
}

body.utility-mode .workspace-container,
body.unauthenticated.utility-mode .workspace-container,
body.studio-mode .workspace-container,
body.unauthenticated.studio-mode .workspace-container {
  padding: 1rem 1.5rem !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
  background: #f8fafc !important;
  min-height: 100vh;
}

[data-theme="dark"] body.studio-mode .workspace-container,
[data-theme="dark"] body.unauthenticated.studio-mode .workspace-container {
  background: var(--bg-canvas, #090d16) !important;
}

/* Allow switching to student portal while unauthenticated / on portal routes */
html.portal-mode #auth-gate-view,
html.portal-mode .auth-gate-wrapper,
body.portal-mode #auth-gate-view,
body.portal-mode .auth-gate-wrapper,
body.unauthenticated.portal-mode .auth-gate-wrapper {
  display: none !important;
}

/* Hide teacher desktop and mobile navigation in portal mode */
html.portal-mode .mobile-bottom-dock,
body.portal-mode .mobile-bottom-dock,
html.portal-mode .cockpit-sidebar,
body.portal-mode .cockpit-sidebar,
html.portal-mode .studio-topbar,
body.portal-mode .studio-topbar {
  display: none !important;
}

body.unauthenticated.portal-mode #student-portal-view,
body.portal-mode #student-portal-view,
html.portal-mode #student-portal-view {
  display: block !important;
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  animation: authFadeIn 0.3s ease-out;
}

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

/* Auth Gate Container: 2 Columns on Desktop */
.auth-gate-container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 3.5rem;
  align-items: center;
}

/* Left Hero Branding */
.auth-gate-hero {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  color: #ffffff;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #1d4ed8;
  text-transform: uppercase;
  width: fit-content;
  transition: all 0.2s ease;
}

.auth-brand-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

.auth-hero-title {
  font-family: var(--font-heading);
  font-size: 2.85rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin: 0;
}

.text-gradient {
  background: linear-gradient(135deg, #818cf8 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #94a3b8;
  margin: 0;
}

/* Feature List */
.auth-features-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.auth-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.auth-feature-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(129, 140, 248, 0.25);
  transform: translateX(4px);
}

.auth-feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.25) 0%, rgba(6, 182, 212, 0.25) 100%);
  color: #38bdf8;
  flex-shrink: 0;
}

.auth-feature-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-feature-text strong {
  font-size: 0.95rem;
  color: #f1f5f9;
  font-weight: 700;
}

.auth-feature-text span {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.45;
}

/* Direct Student Link in Hero */
.auth-student-cta-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  color: #cbd5e1;
}

.btn-link-student-portal {
  background: none;
  border: none;
  color: #34d399;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link-student-portal:hover {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.15);
}

/* Right Login Card */
.auth-gate-card-wrapper {
  display: flex;
  justify-content: center;
}

.auth-gate-card {
  width: 100%;
  max-width: 460px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(79, 70, 229, 0.15);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-card-header {
  text-align: center;
}

.auth-card-icon-lock {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.85rem auto;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.35);
}

.auth-card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.35rem 0;
}

.auth-card-header p {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0;
}

/* Auth Gate Form */
.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.auth-gate-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  animation: authFadeIn 0.2s ease-out;
}

.form-group-gate {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group-gate label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #cbd5e1;
}

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

.btn-toggle-pass-text {
  background: none;
  border: none;
  color: #818cf8;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.btn-toggle-pass-text:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

.input-gate-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-gate-icon {
  position: absolute;
  left: 0.95rem;
  color: #64748b;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input-gate {
  width: 100%;
  padding: 0.75rem 0.95rem 0.75rem 2.65rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.input-gate:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.input-gate::placeholder {
  color: #475569;
}

.form-row-gate-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-gate-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}

.btn-gate-primary {
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: var(--primary-gradient, linear-gradient(135deg, #0284c7 0%, #00b4d8 50%, #00c5df 100%));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 4px 16px rgba(0, 197, 223, 0.38);
  transition: all 0.2s ease;
  margin-top: 0.35rem;
}

.btn-gate-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 50%, #00b4d8 100%);
  box-shadow: 0 6px 22px rgba(0, 197, 223, 0.52);
  transform: translateY(-1px);
}

.btn-gate-primary:active {
  transform: translateY(0);
}

/* Fast Demo Login Section */
.auth-demo-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.25rem;
}

.auth-demo-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.auth-demo-divider::before,
.auth-demo-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-demo-divider span {
  padding: 0 0.75rem;
}

.auth-demo-pills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.btn-gate-demo-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.35rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-gate-demo-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #818cf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.demo-pill-role {
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 1px 4px;
}

.demo-pill-role.role-gv { color: #60a5fa; }
.demo-pill-role.role-adm { color: #f472b6; }
.demo-pill-role.role-hs { color: #34d399; }

.btn-gate-demo-pill strong {
  font-size: 0.8rem;
  font-family: monospace;
  color: #f1f5f9;
}

.auth-card-footer {
  text-align: center;
  margin-top: -0.25rem;
}

.auth-card-footer p {
  font-size: 0.72rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .auth-gate-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    max-width: 580px;
  }
  .auth-hero-title {
    font-size: 2.25rem;
  }
  .auth-gate-card {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .desktop-only-tool-pill {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .auth-gate-wrapper {
    padding: 0.5rem 0.25rem 2rem;
  }
  .auth-gate-header-bar {
    margin-bottom: 0.85rem;
    padding: 0;
  }
  .pricing-label-desktop {
    display: none !important;
  }
  .pricing-label-mobile {
    display: inline !important;
  }
  .btn-guest-pricing-trigger {
    padding: 0.32rem 0.65rem;
    font-size: 0.76rem;
  }
  .auth-theme-toggle {
    padding: 0.32rem 0.55rem;
  }
  .auth-theme-toggle .theme-toggle-label {
    display: none !important;
  }
  .auth-hero-title {
    font-size: 1.85rem;
  }
  .auth-hero-subtitle {
    font-size: 0.92rem;
  }
  .auth-gate-card {
    padding: 1.5rem 1.15rem;
  }
  .auth-demo-pills-grid {
    grid-template-columns: 1fr;
  }
  .btn-gate-demo-pill {
    flex-direction: row;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
  }
  .auth-student-cta-box {
    flex-direction: column;
    align-items: flex-start;
  }
  .auth-footer-links {
    gap: 0.4rem;
    font-size: 0.75rem;
  }
  html.portal-mode #student-portal-view,
  body.portal-mode #student-portal-view,
  body.unauthenticated.portal-mode #student-portal-view {
    margin: 0.5rem auto !important;
    padding: 0 0.75rem !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: none !important;
  }
  .portal-mode .mobile-bottom-dock,
  html.portal-mode .mobile-bottom-dock,
  body.portal-mode .mobile-bottom-dock {
    display: none !important;
  }
}

/* ==========================================================================
   SCIENTIFIC SCORE BREAKDOWN & SUBJECT STRATEGY STYLES
   ========================================================================== */
.subject-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.score-pill-table {
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  display: inline-flex;
  align-items: baseline;
  user-select: none;
}

.score-pill-table:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  filter: brightness(0.96);
}

.score-breakdown-table th {
  font-weight: 700;
  border-bottom: 2px solid var(--border-color, #e2e8f0);
}

.score-breakdown-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  vertical-align: top;
}

.score-breakdown-table tr:hover {
  background: #f8fafc;
}

.q-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.q-status-correct {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.q-status-partial {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.q-status-incorrect {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.q-status-unattempted {
  background: #f4f4f5;
  color: #71717a;
  border: 1px solid #e4e4e7;
}

@media (max-width: 768px) {
  .score-breakdown-modal-header {
    flex-direction: column;
    gap: 0.75rem;
  }
  .score-breakdown-modal-content {
    padding: 1rem;
    max-height: 95vh;
  }
  .score-breakdown-table th,
  .score-breakdown-table td {
    padding: 0.5rem 0.4rem;
    font-size: 0.82rem;
  }
}

/* ==========================================================================
   ENHANCED RUBRIC ACCORDION & DETAILED GUIDANCE (SPEEDGRADER & MODAL VIEWER)
   ========================================================================== */
.sg-rubric-card {
  flex-shrink: 0;
  min-height: 44px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  margin-bottom: 0.65rem;
  overflow: hidden;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.sg-rubric-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.sg-rubric-header {
  flex-shrink: 0;
  min-height: 42px;
  box-sizing: border-box;
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: #fafafa;
  transition: background 0.15s ease;
}

.sg-rubric-header:hover {
  background: #f1f5f9;
}

.sg-rubric-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: #1e293b;
}

.sg-rubric-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sg-rubric-score-badge {
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.sg-rubric-toggle-icon {
  font-size: 0.75rem;
  color: #64748b;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sg-rubric-card.open .sg-rubric-toggle-icon {
  transform: rotate(180deg);
}

.sg-rubric-body {
  display: none;
  padding: 0.85rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
  background: #ffffff;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #334155;
}

.sg-rubric-card.open .sg-rubric-body {
  display: block;
  animation: fadeInAccordion 0.2s ease;
}

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

.rubric-section-block {
  margin-bottom: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
}

.rubric-section-block:last-child {
  margin-bottom: 0;
}

.rubric-block-header {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.rubric-section-criteria {
  background: #f8fafc;
  border-left: 3px solid #6366f1;
}
.rubric-section-criteria .rubric-block-header {
  color: #4f46e5;
}

.rubric-section-feedback {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}
.rubric-section-feedback .rubric-block-header {
  color: #b45309;
}

.rubric-section-correction {
  background: #f0fdf4;
  border-left: 3px solid #10b981;
}
.rubric-section-correction .rubric-block-header {
  color: #047857;
}

/* Submission Viewer Rubric Drawer */
.mvs-rubric-drawer {
  transition: width 0.3s ease, opacity 0.3s ease;
  z-index: 20;
}

@media (max-width: 900px) {
  .mvs-rubric-drawer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 60vh !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25) !important;
    z-index: 250 !important;
  }
}

/* Pre-bound Exam Banner in Student Portal */
.portal-exam-banner {
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-md, 8px);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
  color: #3730a3;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.08);
}

.portal-exam-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #4f46e5;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* =====================================================================
   PORTAL DEADLINE & UPLOAD LIMIT DESIGN SYSTEM (v1.9.8)
   ===================================================================== */
.portal-deadline-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md, 10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.portal-deadline-card.active {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #86efac;
  color: #166534;
}

.portal-deadline-card.urgent {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  color: #92400e;
  animation: deadlinePulseRing 2s infinite ease-in-out;
}

.portal-deadline-card.expired {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border: 1.5px solid #fecdd3;
  color: #9f1239;
}

@keyframes deadlinePulseRing {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.deadline-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.deadline-text-group {
  flex: 1;
  min-width: 0;
}

.deadline-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
}

.deadline-subtitle {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.15rem;
}

.countdown-digits {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.deadline-status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.deadline-status-pill.active-pill {
  background: #15803d;
  color: #ffffff;
}

.deadline-status-pill.urgent-pill {
  background: #d97706;
  color: #ffffff;
}

.deadline-status-pill.expired-pill {
  background: #be123c;
  color: #ffffff;
}

/* Upload Counter Badge */
.upload-counter-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

.upload-counter-badge.counter-normal {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.upload-counter-badge.counter-warn {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.upload-counter-badge.counter-max {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 800;
}

/* Preset Chips for Teacher QR Modal */
.qr-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-qr-chip,
.btn-quota-chip {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-qr-chip:hover,
.btn-quota-chip:hover {
  border-color: #6366f1;
  color: #4f46e5;
  background: #f5f3ff;
}

.btn-qr-chip.active,
.btn-quota-chip.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.badge-status-neutral {
  background: #e2e8f0;
  color: #475569;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.badge-status-urgent {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.portal-zone-locked {
  pointer-events: none;
  opacity: 0.6;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

/* Mobile Responsive Camera Scanner & Student Portal Styles */
@media (max-width: 640px) {
  .portal-deadline-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .portal-deadline-card .deadline-status-pill {
    align-self: flex-start;
  }
  .qr-preset-chips {
    justify-content: flex-start;
  }
  .btn-qr-chip {
    padding: 0.35rem 0.6rem;
    font-size: 0.76rem;
  }

  #modal-camera-scanner {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #000000 !important;
    z-index: 99999 !important;
  }

  #modal-camera-scanner .camera-modal-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;
    max-height: 100dvh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    background: #000000 !important;
    padding: max(0.5rem, env(safe-area-inset-top, 10px)) 0.75rem max(1.2rem, env(safe-area-inset-bottom, 24px)) 0.75rem !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  #modal-camera-scanner .camera-viewfinder-box video#camera-video-stream {
    height: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
  }

  .portal-flow-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .portal-action-btn-group {
    flex-direction: column !important;
    width: 100% !important;
  }

  .portal-action-btn-group button {
    width: 100% !important;
    min-height: 48px !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
  }

  .portal-thumbnails-tray {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0.5rem 0 !important;
    gap: 0.5rem !important;
  }

  .portal-thumb-item {
    width: 75px !important;
    height: 95px !important;
    flex-shrink: 0 !important;
  }

  #btn-portal-confirm-submit {
    min-height: 50px !important;
    font-size: 1.05rem !important;
  }
}

/* ==========================================================================
   RUBRIC & GRADING GUIDE MANAGEMENT (4 MODES & RUBRIC STUDIO)
   ========================================================================== */
.rubric-management-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.rubric-mode-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--surface-hover);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.rubric-tab-btn {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.rubric-tab-btn:hover {
  color: var(--text-main);
  background: var(--surface-active);
}

.rubric-tab-btn.active {
  background: var(--card-bg);
  color: var(--primary);
  border-color: var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .rubric-tab-btn {
  color: #94a3b8;
}

[data-theme="dark"] .rubric-tab-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .rubric-tab-btn.active {
  background: #1e293b;
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.rubric-badge-neutral {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-score-valid {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

[data-theme="dark"] .badge-score-valid {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-score-invalid {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

[data-theme="dark"] .badge-score-invalid {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.rubric-ai-assistant-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 0.6rem;
}

.rubric-ai-assistant-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: #166534;
}

.rubric-ai-assistant-badge {
  font-size: 0.75rem;
  color: #15803d;
}

[data-theme="dark"] .rubric-ai-assistant-box {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .rubric-ai-assistant-title {
  color: #6ee7b7;
}

[data-theme="dark"] .rubric-ai-assistant-badge {
  color: #34d399;
}

.rubric-panel-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--card-bg);
  color: var(--text-main);
}

.rubric-dropzone {
  border: 2px dashed #818cf8;
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  background: #f5f3ff;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rubric-dropzone:hover {
  border-color: #6366f1;
  background: #eef2ff;
}

.rubric-dropzone-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #4338ca;
  margin-bottom: 0.25rem;
}

[data-theme="dark"] .rubric-dropzone {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(129, 140, 248, 0.4);
}

[data-theme="dark"] .rubric-dropzone:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #818cf8;
}

[data-theme="dark"] .rubric-dropzone-title {
  color: #a5b4fc !important;
}

.rubric-question-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s ease;
}

.rubric-question-card:hover {
  border-color: #93c5fd;
}

.rubric-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.rubric-q-meta-grid {
  display: grid;
  grid-template-columns: 120px 1fr 90px auto;
  gap: 0.4rem;
  align-items: center;
}

.rubric-q-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.rubric-methods-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 0.4rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed var(--border-color, #e2e8f0);
}

.rubric-methods-tabs {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.rubric-methods-tabs::-webkit-scrollbar {
  display: none;
}

.rubric-method-tab {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .rubric-methods-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
  .rubric-methods-tabs {
    width: 100%;
    padding-bottom: 2px;
  }
  .rubric-q-detail {
    grid-template-columns: 1fr;
  }
}

.btn-add-rubric-question {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-weight: 700;
  transition: all 0.15s ease;
}
.btn-add-rubric-question:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}
[data-theme="dark"] .btn-add-rubric-question {
  background: rgba(59, 130, 246, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  color: #93c5fd !important;
}
[data-theme="dark"] .btn-add-rubric-question:hover {
  background: rgba(59, 130, 246, 0.3) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

.rubric-criteria-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.2rem;
}
[data-theme="dark"] .rubric-criteria-label {
  color: #4ade80 !important;
}

.rubric-solution-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 0.2rem;
}
[data-theme="dark"] .rubric-solution-label {
  color: #60a5fa !important;
}

.rubric-textarea,
.rubric-q-detail textarea {
  width: 100% !important;
  font-size: 0.78rem !important;
  padding: 0.4rem 0.6rem !important;
  border: 1px solid var(--border-color, #cbd5e1) !important;
  border-radius: var(--radius-xs, 6px) !important;
  resize: vertical !important;
  min-height: 52px !important;
  background: var(--input-bg, #ffffff) !important;
  color: var(--input-text, #0f172a) !important;
  font-family: inherit !important;
  line-height: 1.45 !important;
}

.rubric-deduction-field {
  background: #fff1f2 !important;
  color: #991b1b !important;
  border: 1px solid #fecdd3 !important;
}
.rubric-deduction-field::placeholder {
  color: #f87171 !important;
}
[data-theme="dark"] .rubric-deduction-field {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
[data-theme="dark"] .rubric-deduction-field::placeholder {
  color: #f87171 !important;
}
/* ==========================================================================
   RUBRIC STUDIO MATHEMATICAL FORMULA RENDERING & LIVE PREVIEW
   ========================================================================== */
.rubric-math-box {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  border-radius: var(--radius-xs, 6px);
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.6;
  min-height: 52px;
  cursor: pointer;
  transition: all 0.18s ease;
  word-break: break-word;
  user-select: text;
}

.rubric-math-box.criteria {
  background: rgba(240, 253, 244, 0.75);
  border: 1px solid #86efac;
  color: #14532d;
}
.rubric-math-box.criteria:hover {
  background: #f0fdf4;
  border-color: #4ade80;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.12);
}

.rubric-math-box.solution {
  background: rgba(239, 246, 255, 0.75);
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}
.rubric-math-box.solution:hover {
  background: #eff6ff;
  border-color: #60a5fa;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.12);
}

.rubric-math-box.empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
  font-style: italic;
}

.rubric-math-box .katex-display {
  margin: 0.4rem 0 !important;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.rubric-math-deduction-box {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #991b1b;
  border-radius: var(--radius-xs, 6px);
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
  cursor: pointer;
  transition: all 0.18s ease;
}
.rubric-math-deduction-box:hover {
  border-color: #f87171;
}

.rubric-live-math-preview-container {
  margin-top: 0.35rem;
}

.rubric-live-math-preview {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-main);
  max-height: 160px;
  overflow-y: auto;
}

.rubric-live-math-preview-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.rubric-view-mode-tabs .btn {
  transition: all 0.15s ease;
}
.rubric-view-mode-tabs .btn.btn-primary {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

[data-theme="dark"] .rubric-math-box.criteria {
  background: rgba(34, 197, 94, 0.1) !important;
  border-color: rgba(74, 222, 128, 0.35) !important;
  color: #86efac !important;
}

[data-theme="dark"] .rubric-math-box.solution {
  background: rgba(59, 130, 246, 0.1) !important;
  border-color: rgba(96, 165, 250, 0.35) !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .rubric-math-box.empty {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: #334155 !important;
  color: #64748b !important;
}

[data-theme="dark"] .rubric-math-deduction-box {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
}

[data-theme="dark"] .rubric-live-math-preview {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

.rubric-delete-btn {
  color: #ef4444 !important;
  border: 1px solid #fca5a5 !important;
  background: transparent !important;
}
.rubric-delete-btn:hover {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
[data-theme="dark"] .rubric-delete-btn {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
}
[data-theme="dark"] .rubric-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

/* Universal Dark Form Controls and Inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color-scheme: dark;
}

[data-theme="dark"] .rubric-textarea,
[data-theme="dark"] .rubric-q-detail textarea,
[data-theme="dark"] .q-criteria-input,
[data-theme="dark"] .q-solution-input,
[data-theme="dark"] textarea,
[data-theme="dark"] input.form-control,
[data-theme="dark"] input.input-form,
[data-theme="dark"] input.input-gate,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] select.form-control,
[data-theme="dark"] select {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] input::placeholder {
  color: #64748b !important;
}

[data-theme="dark"] select option,
[data-theme="dark"] optgroup {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
  accent-color: #4f46e5;
}

[data-theme="dark"] input[type="file"]::file-selector-button,
[data-theme="dark"] input[type="file"]::-webkit-file-upload-button {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #475569 !important;
  border-radius: 6px !important;
  padding: 0.35rem 0.75rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}
[data-theme="dark"] input[type="file"]::file-selector-button:hover,
[data-theme="dark"] input[type="file"]::-webkit-file-upload-button:hover {
  background: #334155 !important;
  border-color: #64748b !important;
}

/* Modal Sub-Containers and Specialized Cards in Dark Mode */
[data-theme="dark"] .rubric-export-icon {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

[data-theme="dark"] #modal-reset-student-password div[style*="background: #fef3c7"] {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

[data-theme="dark"] #card-export-zip {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
[data-theme="dark"] #card-export-zip strong {
  color: #4ade80 !important;
}

[data-theme="dark"] #payment-live-status-container {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
  color: #4ade80 !important;
}
[data-theme="dark"] #payment-live-status-text {
  color: #4ade80 !important;
}

[data-theme="dark"] #modal-student-accounts div[style*="background: #f0fdf4"] {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}
[data-theme="dark"] #modal-student-accounts div[style*="background: #fffbeb"] {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.25) !important;
}
[data-theme="dark"] #stat-class-active-accounts {
  color: #4ade80 !important;
}
[data-theme="dark"] #stat-class-pending-accounts {
  color: #fbbf24 !important;
}

[data-theme="dark"] .data-table thead tr {
  background: #1e293b !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .data-table thead th {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] #qr-direct-link {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}
[data-theme="dark"] #qr-modal-exam-badge {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #a5b4fc !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

[data-theme="dark"] .upload-field-card {
  background: rgba(15, 23, 42, 0.75) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
[data-theme="dark"] #edit-sub-dropzone {
  background: rgba(59, 130, 246, 0.1) !important;
  border-color: rgba(96, 165, 250, 0.3) !important;
}
[data-theme="dark"] #edit-sub-dropzone div {
  color: #93c5fd !important;
}
[data-theme="dark"] #edit-sub-existing-gallery {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] #edit-sub-graded-alert {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fbbf24 !important;
}

[data-theme="dark"] #form-batch-import-students div[style*="background: #eef2ff"],
[data-theme="dark"] #modal-batch-import-students div[style*="background: #eef2ff"] {
  background: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}
[data-theme="dark"] #form-batch-import-students label,
[data-theme="dark"] #modal-batch-import-students label {
  color: #c7d2fe !important;
}

[data-theme="dark"] .plan-workload-badge {
  background: rgba(99, 102, 241, 0.18) !important;
  color: #a5b4fc !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
}

[data-theme="dark"] #modal-teacher-subscription div[style*="background: linear-gradient(135deg, #f8fafc"] {
  background: linear-gradient(135deg, #151e32 0%, #1e293b 100%) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
[data-theme="dark"] #sub-plan-title {
  color: #93c5fd !important;
}
[data-theme="dark"] .cycle-switcher-wrapper {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .cycle-switch-btn:not(.active) {
  color: #94a3b8 !important;
}
[data-theme="dark"] #modal-teacher-subscription div[style*="background: #eff6ff"] {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.25) !important;
}
[data-theme="dark"] #modal-teacher-subscription div[style*="background: #eff6ff"] h3 {
  color: #93c5fd !important;
}
[data-theme="dark"] #modal-teacher-subscription div[style*="background: #eff6ff"] p {
  color: #cbd5e1 !important;
}

[data-theme="dark"] #portal-exam-selector {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #6366f1 !important;
}
[data-theme="dark"] #portal-live-submitted-card {
  background: #151e32 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
[data-theme="dark"] #portal-live-exam-title {
  color: #f8fafc !important;
}
[data-theme="dark"] #portal-live-submitted-card div {
  color: #cbd5e1 !important;
}
[data-theme="dark"] #portal-success-receipt {
  background: rgba(5, 150, 105, 0.15) !important;
  border-color: rgba(5, 150, 105, 0.35) !important;
}
[data-theme="dark"] #portal-success-receipt h4 {
  color: #34d399 !important;
}
[data-theme="dark"] #portal-success-receipt div {
  color: #a7f3d0 !important;
}
[data-theme="dark"] #portal-routing-info {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
[data-theme="dark"] .portal-manual-entry-box {
  background: #151e32 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .portal-manual-entry-box label {
  color: #f8fafc !important;
}
[data-theme="dark"] .upload-dropzone-box {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] #portal-ocr-loading {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #4ade80 !important;
}
[data-theme="dark"] .segmented-button-group {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .segmented-btn:not(.active) {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .segmented-btn:not(.active):hover {
  background: #334155 !important;
  color: #ffffff !important;
}

/* Rubric Studio Modal & Pro Layout */
#modal-rubric-studio .rubric-studio-modal-content,
#modal-rubric-studio .modal-content,
.rubric-studio-modal-content {
  max-width: min(96vw, 1380px) !important;
  width: min(96vw, 1380px) !important;
  height: min(92vh, 920px) !important;
  max-height: min(92vh, 920px) !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 1.25rem 1.5rem !important;
  border-radius: 20px !important;
  margin: auto !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.rubric-studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  flex-shrink: 0;
}

.rubric-studio-title-group {
  min-width: 0;
  flex: 1 1 auto;
}

.rubric-studio-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.rubric-studio-title {
  font-size: 1.22rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.rubric-studio-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 650px;
}

.rubric-studio-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.rubric-studio-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.rubric-studio-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.rubric-studio-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.rubric-studio-toolbar-right #studio-ai-instructions {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 260px;
  font-size: 0.78rem;
}

.rubric-studio-disclaimer {
  margin-top: 0.65rem;
  flex-shrink: 0;
}

.rubric-studio-body {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-top: 0.75rem;
}

.rubric-studio-left {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}
[data-theme="dark"] .rubric-studio-left {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(255, 255, 255, 0.1);
}

.rubric-studio-right {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  overflow-y: auto;
  min-height: 0;
}
[data-theme="dark"] .rubric-studio-right {
  background: #151e32;
  border-color: rgba(255, 255, 255, 0.1);
}

/* Print Friendly Styles */
@media print {
  /* Let the dedicated print iframe handle standard printing.
     If printed directly from window, hide app UI modals cleanly. */
  .modal-backdrop, .app-header, .sidebar, .speedgrader-cockpit-toolbar {
    display: none !important;
  }
}

/* Rubric Export Modal & Action Cards */
.rubric-export-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.rubric-export-card:hover, .rubric-export-card:focus-visible {
  border-color: #3b82f6;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.rubric-export-card:active {
  transform: translateY(0);
}

[data-theme="dark"] .rubric-export-card {
  background: #151e32;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .rubric-export-card:hover,
[data-theme="dark"] .rubric-export-card:focus-visible {
  background: #1e293b;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.rubric-export-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

/* AI Progress Tracker Modal Styles */
.ai-progress-modal-content {
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.ai-sparkle-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #eff6ff 0%, #ede9fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.ai-progress-bar-container {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin: 0.75rem 0 1rem;
}

.ai-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #10b981 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.ai-progress-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.ai-stepper-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ai-step-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

.ai-step-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.ai-step-item.completed {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.ai-step-item.pending {
  opacity: 0.55;
}

.ai-step-icon {
  font-size: 1.15rem;
  width: 28px;
  text-align: center;
}

.ai-step-info {
  flex: 1;
  min-width: 0;
}

.ai-step-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
}

.ai-step-status {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 1px;
}

.ai-step-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.ai-step-item.active .ai-step-badge {
  background: #dbeafe;
  color: #1d4ed8;
  animation: pulse-badge 1.5s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.ai-step-item.completed .ai-step-badge {
  background: #dcfce7;
  color: #15803d;
}

.ai-step-item.pending .ai-step-badge {
  background: #f1f5f9;
  color: #94a3b8;
}

.ai-step-item.failed {
  background: #fef2f2;
  border-color: #fecaca;
}

.ai-step-item.failed .ai-step-badge {
  background: #fee2e2;
  color: #b91c1c;
}

@media (max-width: 480px) {
  #ai-progress-error-box > div:last-child {
    flex-direction: column-reverse;
  }
  #ai-progress-error-box button {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }
}

/* Mobile & Tablet Responsive Queries */
@media (max-width: 1024px) {
  .rubric-q-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
  .rubric-q-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .rubric-mode-tabs {
    flex-wrap: wrap;
  }
  .rubric-tab-btn {
    flex: 1 1 45%;
    font-size: 0.74rem;
    padding: 0.4rem;
  }
  .rubric-q-meta-grid {
    grid-template-columns: 1fr;
  }
  #modal-rubric-studio .rubric-studio-modal-content,
  #modal-rubric-studio .modal-content,
  .rubric-studio-modal-content {
    width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    padding: 0.75rem !important;
    margin: 0 !important;
  }
  .rubric-studio-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .rubric-studio-actions {
    justify-content: flex-end;
  }
  .rubric-studio-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .rubric-studio-toolbar-right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
}

/* ==========================================================================
   SEGMENTED QUICK SELECT & LIVE SUBMISSION CARD STYLES
   High-contrast, Accessible & Touch-friendly
   ========================================================================== */
.segmented-button-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #e2e8f0;
  padding: 6px;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.segmented-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1rem;
  min-height: 48px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative;
  outline: none;
}

.segmented-btn:hover:not(.active) {
  color: #0f172a;
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

.segmented-btn:focus-visible {
  outline: 3px solid #818cf8;
  outline-offset: 2px;
}

.segmented-btn.active {
  background: linear-gradient(135deg, #4338ca 0%, #312e81 100%) !important;
  color: #ffffff !important;
  font-weight: 800;
  border-color: #312e81 !important;
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  transform: scale(1.02);
  z-index: 2;
}

.segmented-btn .seg-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.segmented-btn .seg-label {
  letter-spacing: -0.01em;
}

.segmented-btn .seg-status-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.segmented-btn.active .seg-status-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.segmented-btn:not(.active) .seg-status-badge {
  display: none;
}

@media (max-width: 480px) {
  .segmented-button-group {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 6px;
  }

  .segmented-btn {
    width: 100%;
    min-height: 50px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
  }
}

/* Submitted Live Card Instant View */
.submitted-live-card {
  animation: slideDownFade 0.3s ease-out;
  border: 1px solid #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

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

.submitted-live-thumbs {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.submitted-live-thumb-item {
  position: relative;
  flex: 0 0 85px;
  height: 110px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.submitted-live-thumb-item:hover {
  transform: scale(1.05);
  border-color: #10b981;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.submitted-live-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.submitted-live-thumb-item .thumb-page-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
}

/* --- PDF & IMAGE THUMBNAIL CARDS (RESPONSIVE & SOPHISTICATED) --- */
.pdf-thumbnail-card {
  position: relative;
  width: 76px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid #fca5a5;
  background: linear-gradient(145deg, #fff5f5 0%, #fef2f2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.08);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.pdf-thumbnail-card:hover {
  transform: translateY(-2px);
  border-color: #ef4444;
  box-shadow: 0 6px 14px rgba(239, 68, 68, 0.18);
}

.pdf-thumbnail-card .pdf-icon-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: -6px;
}

.pdf-thumbnail-card .pdf-svg-icon {
  width: 28px;
  height: 28px;
  color: #dc2626;
}

.pdf-thumbnail-card .pdf-type-label {
  font-size: 0.65rem;
  font-weight: 900;
  color: #b91c1c;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

.pdf-thumbnail-card .pdf-filename-label {
  font-size: 0.58rem;
  color: #64748b;
  max-width: 66px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  padding: 0 3px;
  margin-top: 2px;
}

.pdf-thumbnail-card .pdf-page-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(185, 28, 28, 0.9);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  line-height: 1.2;
}

/* --- WORD (.DOCX) THUMBNAIL CARDS --- */
.word-thumbnail-card {
  position: relative;
  width: 76px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid #93c5fd;
  background: linear-gradient(145deg, #f0f7ff 0%, #e0effe 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.word-thumbnail-card:hover {
  transform: translateY(-2px);
  border-color: #2563eb;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
}

.word-thumbnail-card .word-icon-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: -6px;
}

.word-thumbnail-card .word-svg-icon {
  width: 28px;
  height: 28px;
  color: #1d4ed8;
}

.word-thumbnail-card .word-type-label {
  font-size: 0.65rem;
  font-weight: 900;
  color: #1e40af;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

.word-thumbnail-card .word-filename-label {
  font-size: 0.58rem;
  color: #3b82f6;
  max-width: 66px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  padding: 0 3px;
  margin-top: 2px;
}

.word-thumbnail-card .word-page-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(29, 78, 216, 0.9);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  line-height: 1.2;
}

/* --- WORD DOCUMENT CARD & DIGITIZED EXAM VIEWER --- */
.word-document-viewer-card {
  width: 100%;
  max-width: 780px;
  border-radius: var(--radius-md, 8px);
  border: 1.5px solid #bfdbfe;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: left;
}

.word-document-viewer-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.word-document-header {
  padding: 0.85rem 1.1rem;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-bottom: 1px solid #bfdbfe;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.word-document-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.word-document-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #1d4ed8;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3);
  flex-shrink: 0;
}

.word-document-title {
  font-weight: 800;
  font-size: 0.92rem;
  color: #1e3a8a;
  word-break: break-all;
}

.word-document-subtitle {
  font-size: 0.75rem;
  color: #3b82f6;
  margin-top: 0.1rem;
}

.word-document-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.digitized-paper-sheet {
  width: 100%;
  max-width: 780px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md, 8px);
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.7;
  color: #1e293b;
  text-align: left;
}

.digitized-paper-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1.5px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.digitized-paper-content {
  white-space: pre-wrap;
  font-size: 0.92rem;
  color: #0f172a;
  word-break: break-word;
}

.digitized-paper-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.digitized-paper-content th,
.digitized-paper-content td {
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.75rem;
}

.digitized-paper-content th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
}

.rubric-comprehensive-solution-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md, 8px);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  text-align: left;
}

.image-thumbnail-card {
  position: relative;
  width: 76px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.image-thumbnail-card:hover {
  transform: translateY(-2px);
  border-color: #6366f1;
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.18);
}

.image-thumbnail-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-thumbnail-card .image-fallback-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.68rem;
  text-align: center;
  padding: 4px;
}

.image-thumbnail-card .thumbnail-page-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  line-height: 1.2;
}

.thumbnail-remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
  border: none;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 3;
  transition: transform 0.15s, background-color 0.15s;
}

.thumbnail-remove-btn:hover {
  transform: scale(1.15);
  background: #dc2626;
}

/* ==========================================================================
   ENHANCED PEDAGOGICAL RUBRIC & GEMINI 3.8 FLASH DISPLAY SYSTEM
   Responsive across mobile, tablet, and high-res desktop screens
   ========================================================================== */

.rubric-viewer-card {
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  padding: 1rem;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.rubric-viewer-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
  border-color: #cbd5e1;
}

.rubric-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.5rem;
  margin-bottom: 0.65rem;
}

.rubric-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem;
}

@media (max-width: 768px) {
  .rubric-card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
  }
}

.rubric-box-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.rubric-box-header {
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.rubric-box-header.criteria-header {
  color: #166534;
}

.rubric-box-header.solution-header {
  color: #1d4ed8;
}

.rubric-box-content {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.pedagogical-ai-badge,
.gemini-38-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #eff6ff 0%, #ede9fe 100%);
  color: #4338ca;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid #c7d2fe;
  letter-spacing: 0.02em;
}

.solution-step-item {
  background: #ffffff;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: #1e293b;
  line-height: 1.45;
}

.criteria-step-item {
  background: #ffffff;
  border-left: 3px solid #22c55e;
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: #1e293b;
  line-height: 1.45;
}

/* ====================================================================
   JOB LOCK MANAGER & ACTIVE GRADING PROGRESS UI/UX
   ==================================================================== */

@keyframes spinMicro {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes shimmerEffect {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes pulseBorder {
  0%, 100% { border-color: #c7d2fe; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.2); }
  50% { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25); }
}

.spinner-micro {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spinMicro 0.75s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn-job-locked,
.btn:disabled.btn-job-locked {
  opacity: 0.8 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
  transform: none !important;
  touch-action: manipulation;
}

.action-locked-dim {
  opacity: 0.4 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  filter: grayscale(30%);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.row-grading-active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.07) 0%, rgba(245, 243, 255, 0.5) 100%) !important;
  box-shadow: inset 3.5px 0 0 #6366f1 !important;
  transition: background 0.3s ease;
}

.row-grading-active td {
  border-color: #e0e7ff !important;
}

/* REAL-TIME BATCH GRADING PROGRESS BANNER (HIGH-CONTRAST LIGHT & DARK MODES) */
.grading-progress-banner,
#progress-banner.grading-progress-banner {
  margin-bottom: 1rem !important;
  border-radius: 14px !important;
  background: #f0f6ff !important;
  color: #0f172a !important;
  padding: 12px 18px !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08) !important;
  border: 1px solid #bfdbfe !important;
  display: flex;
  align-items: center !important;
  gap: 14px !important;
  animation: fadeIn 0.25s ease-out;
  transition: background 0.2s ease, border-color 0.2s ease;
}

#progress-banner[style*="display: none"],
.grading-progress-banner[style*="display: none"],
.grading-progress-banner.hidden {
  display: none !important;
}

[data-theme="dark"] .grading-progress-banner,
[data-theme="dark"] #progress-banner.grading-progress-banner,
body.dark-mode .grading-progress-banner,
body.dark-mode #progress-banner.grading-progress-banner {
  background: #0f2547 !important;
  color: #f8fafc !important;
  border-color: #1e3a8a !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

.grading-progress-banner .spinner-micro,
#progress-banner .spinner-micro {
  width: 18px !important;
  height: 18px !important;
  border: 2.5px solid rgba(37, 99, 235, 0.2) !important;
  border-top-color: #2563eb !important;
  border-radius: 50% !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

[data-theme="dark"] .grading-progress-banner .spinner-micro,
[data-theme="dark"] #progress-banner .spinner-micro,
body.dark-mode .grading-progress-banner .spinner-micro,
body.dark-mode #progress-banner .spinner-micro {
  border-color: rgba(96, 165, 250, 0.25) !important;
  border-top-color: #60a5fa !important;
}

.grading-progress-banner .a-b,
#progress-banner .a-b {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.grading-progress-banner #progress-text,
#progress-banner #progress-text {
  color: #0f172a !important;
  font-size: 13.5px !important;
  font-weight: 650 !important;
  line-height: 1.4 !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

[data-theme="dark"] .grading-progress-banner #progress-text,
[data-theme="dark"] #progress-banner #progress-text,
body.dark-mode .grading-progress-banner #progress-text,
body.dark-mode #progress-banner #progress-text {
  color: #f8fafc !important;
}

.grading-progress-banner .btn-batch-reset,
.grading-progress-banner #btn-batch-reset-stuck-inline,
#progress-banner .btn-batch-reset,
#progress-banner #btn-batch-reset-stuck-inline {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin-left: 6px !important;
  padding: 3px 10px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.grading-progress-banner .btn-batch-reset:hover,
.grading-progress-banner #btn-batch-reset-stuck-inline:hover,
#progress-banner .btn-batch-reset:hover,
#progress-banner #btn-batch-reset-stuck-inline:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

[data-theme="dark"] .grading-progress-banner .btn-batch-reset,
[data-theme="dark"] .grading-progress-banner #btn-batch-reset-stuck-inline,
[data-theme="dark"] #progress-banner .btn-batch-reset,
[data-theme="dark"] #progress-banner #btn-batch-reset-stuck-inline,
body.dark-mode .grading-progress-banner .btn-batch-reset,
body.dark-mode .grading-progress-banner #btn-batch-reset-stuck-inline,
body.dark-mode #progress-banner .btn-batch-reset,
body.dark-mode #progress-banner #btn-batch-reset-stuck-inline {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

[data-theme="dark"] .grading-progress-banner .btn-batch-reset:hover,
[data-theme="dark"] .grading-progress-banner #btn-batch-reset-stuck-inline:hover,
[data-theme="dark"] #progress-banner .btn-batch-reset:hover,
[data-theme="dark"] #progress-banner #btn-batch-reset-stuck-inline:hover,
body.dark-mode .grading-progress-banner .btn-batch-reset:hover,
body.dark-mode .grading-progress-banner #btn-batch-reset-stuck-inline:hover,
body.dark-mode #progress-banner .btn-batch-reset:hover,
body.dark-mode #progress-banner #btn-batch-reset-stuck-inline:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.grading-progress-banner .btn-batch-retry,
.grading-progress-banner #btn-batch-retry-failed-inline,
#progress-banner .btn-batch-retry,
#progress-banner #btn-batch-retry-failed-inline {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin-left: 8px !important;
  padding: 3px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.grading-progress-banner .btn-batch-retry:hover,
.grading-progress-banner #btn-batch-retry-failed-inline:hover,
#progress-banner .btn-batch-retry:hover,
#progress-banner #btn-batch-retry-failed-inline:hover {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.grading-progress-banner .mini-bar,
.grading-progress-banner .progress-bar-track,
#progress-banner .mini-bar,
#progress-banner .progress-bar-track {
  width: 100% !important;
  max-width: 100% !important;
  height: 7px !important;
  margin-top: 0 !important;
  border-radius: 99px !important;
  background: #dbeafe !important;
  border: 1px solid rgba(191, 219, 254, 0.8) !important;
  overflow: hidden !important;
  position: relative !important;
}

[data-theme="dark"] .grading-progress-banner .mini-bar,
[data-theme="dark"] .grading-progress-banner .progress-bar-track,
[data-theme="dark"] #progress-banner .mini-bar,
[data-theme="dark"] #progress-banner .progress-bar-track,
body.dark-mode .grading-progress-banner .mini-bar,
body.dark-mode .grading-progress-banner .progress-bar-track,
body.dark-mode #progress-banner .mini-bar,
body.dark-mode #progress-banner .progress-bar-track {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.grading-progress-banner .progress-bar-fill,
#progress-banner .progress-bar-fill,
#progress-banner #progress-bar-fill {
  display: block !important;
  height: 100% !important;
  border-radius: 99px !important;
  background: linear-gradient(90deg, #2563eb 0%, #0284c7 60%, #10b981 100%) !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3) !important;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

[data-theme="dark"] .grading-progress-banner .progress-bar-fill,
[data-theme="dark"] #progress-banner .progress-bar-fill,
[data-theme="dark"] #progress-banner #progress-bar-fill,
body.dark-mode .grading-progress-banner .progress-bar-fill,
body.dark-mode #progress-banner .progress-bar-fill,
body.dark-mode #progress-banner #progress-bar-fill {
  background: linear-gradient(90deg, #38bdf8 0%, #818cf8 60%, #34d399 100%) !important;
}

.grading-progress-banner #progress-count-badge,
#progress-banner #progress-count-badge {
  display: inline-flex !important;
  align-items: center !important;
  padding: 4px 10px !important;
  border-radius: 99px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
}

[data-theme="dark"] .grading-progress-banner #progress-count-badge,
[data-theme="dark"] #progress-banner #progress-count-badge,
body.dark-mode .grading-progress-banner #progress-count-badge,
body.dark-mode #progress-banner #progress-count-badge {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #93c5fd !important;
  border-color: rgba(147, 197, 253, 0.35) !important;
}

.grading-progress-banner #progress-percent-badge,
#progress-banner #progress-percent-badge {
  display: inline-flex !important;
  align-items: center !important;
  padding: 4px 10px !important;
  border-radius: 99px !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  white-space: nowrap !important;
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
}

[data-theme="dark"] .grading-progress-banner #progress-percent-badge,
[data-theme="dark"] #progress-banner #progress-percent-badge,
body.dark-mode .grading-progress-banner #progress-percent-badge,
body.dark-mode #progress-banner #progress-percent-badge {
  background: rgba(34, 197, 94, 0.22) !important;
  color: #4ade80 !important;
  border-color: rgba(74, 222, 128, 0.35) !important;
}

@media (max-width: 640px) {
  .grading-progress-banner,
  #progress-banner.grading-progress-banner {
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 10px 12px !important;
  }
  .grading-progress-banner .a-b,
  #progress-banner .a-b {
    order: 2 !important;
    width: 100% !important;
  }
  .grading-progress-banner #progress-count-badge,
  .grading-progress-banner #progress-percent-badge,
  #progress-banner #progress-count-badge,
  #progress-banner #progress-percent-badge {
    order: 3 !important;
  }
}

/* SPEEDGRADER AI GRADING PROGRESS WIDGET */
.sg-grading-progress-widget {
  animation: pulseBorder 2s infinite ease-in-out;
}

/* ====================================================================
   DEDICATED EXAM MANAGEMENT HUB & EXAM DETAIL VIEW STYLES (v1.7.0)
   ==================================================================== */

.view-exam-hub,
.view-exam-detail {
  animation: fadeInView 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.exam-detail-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding: 0.65rem 1rem;
  background: var(--surface-card, #ffffff);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-back-to-exams {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  color: #4338ca;
  background: #f5f3ff;
  border: 1px solid #c7d2fe;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  min-height: 36px;
}

.btn-back-to-exams svg {
  stroke: #4338ca;
  transition: stroke 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.btn-back-to-exams span {
  color: inherit;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-back-to-exams:hover {
  background: #4338ca !important;
  color: #ffffff !important;
  border-color: #4338ca !important;
  transform: translateX(-3px);
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.28);
}

.btn-back-to-exams:hover svg {
  stroke: #ffffff !important;
  transform: translateX(-2px);
}

.btn-back-to-exams:hover span {
  color: #ffffff !important;
}

.btn-back-to-exams:active {
  transform: translateX(-1px) scale(0.98);
}

/* --- SEMANTIC OUTLINE & THEMED BUTTONS (B2B EDTECH DESIGN SYSTEM) --- */
.btn-outline-indigo {
  color: var(--brand-navy, #082850);
  border-color: rgba(0, 197, 223, 0.35);
  background: var(--primary-light, #ecfeff);
}
.btn-outline-indigo:hover {
  background: var(--primary, #00c5df) !important;
  color: var(--brand-navy, #082850) !important;
  border-color: var(--primary, #00c5df) !important;
  box-shadow: 0 2px 8px rgba(0, 197, 223, 0.32);
}

.btn-outline-emerald {
  color: #059669;
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.btn-outline-emerald:hover {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.btn-outline-rose {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff1f2;
}
.btn-outline-rose:hover {
  background: #e11d48 !important;
  color: #ffffff !important;
  border-color: #e11d48 !important;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.25);
}

.btn-outline-sky {
  color: #0284c7;
  border-color: #bae6fd;
  background: #f0f9ff;
}
.btn-outline-sky:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.btn-outline-danger {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fff1f2;
}
.btn-outline-danger:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

/* Dark Mode Support for Back to Exams and Semantic Buttons */
[data-theme="dark"] .btn-back-to-exams {
  background: rgba(99, 102, 241, 0.18) !important;
  color: #c7d2fe !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
}
[data-theme="dark"] .btn-back-to-exams svg {
  stroke: #c7d2fe !important;
}
[data-theme="dark"] .btn-back-to-exams:hover {
  background: #4f46e5 !important;
  color: #ffffff !important;
  border-color: #6366f1 !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45) !important;
}
[data-theme="dark"] .btn-back-to-exams:hover svg,
[data-theme="dark"] .btn-back-to-exams:hover span {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

[data-theme="dark"] .btn-outline-indigo {
  background: rgba(0, 197, 223, 0.12) !important;
  color: #67e8f9 !important;
  border-color: rgba(0, 197, 223, 0.35) !important;
}
[data-theme="dark"] .btn-outline-indigo:hover {
  background: #00c5df !important;
  color: #082850 !important;
  border-color: #00c5df !important;
}

[data-theme="dark"] .btn-outline-emerald {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #a7f3d0 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
[data-theme="dark"] .btn-outline-emerald:hover {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}

[data-theme="dark"] .btn-outline-rose,
[data-theme="dark"] .btn-outline-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
[data-theme="dark"] .btn-outline-rose:hover,
[data-theme="dark"] .btn-outline-danger:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

[data-theme="dark"] .btn-outline-sky {
  background: rgba(14, 165, 233, 0.15) !important;
  color: #bae6fd !important;
  border-color: rgba(14, 165, 233, 0.35) !important;
}
[data-theme="dark"] .btn-outline-sky:hover {
  background: #0ea5e9 !important;
  color: #ffffff !important;
  border-color: #0ea5e9 !important;
}

.btn-hub-create {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: var(--apple-blue, #00c5df) !important;
  color: #082850 !important;
  border-radius: 980px !important;
  font-weight: 750 !important;
  font-size: 0.82rem !important;
  border: 1px solid rgba(8, 40, 80, 0.15) !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(0, 197, 223, 0.3) !important;
  transition: all 0.2s ease !important;
}

.btn-hub-create:hover {
  transform: translateY(-1px) !important;
  background: var(--apple-blue-hover, #00d5ee) !important;
  color: #082850 !important;
  box-shadow: 0 4px 14px rgba(0, 197, 223, 0.45) !important;
}

.btn-sidebar-class-tool {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--surface-card, #ffffff);
  color: var(--text-secondary, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sidebar-class-tool:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.btn-sidebar-class-tool.text-danger {
  color: #e11d48;
  border-color: #fecaca;
  background: #fff1f2;
}

.btn-sidebar-class-tool.text-danger:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #be123c;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
  .exam-detail-nav-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .exam-hero-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
  
  .exam-hero-action-buttons {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .exam-hero-action-buttons .btn {
    min-height: 40px;
    font-size: 0.8rem;
    flex: 1 1 calc(50% - 0.4rem);
    justify-content: center;
  }

  .exam-hub-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .exam-hub-search-box {
    max-width: 100%;
    width: 100%;
  }

  .exam-hub-view-modes {
    justify-content: center;
  }

  .btn-hub-create {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* ==========================================================================
   Smart Batch Grade Modal Styles
   ========================================================================== */
.smart-batch-option-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1.5px solid var(--border-color, #e2e8f0);
}
.smart-batch-option-card:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.smart-batch-option-card.active {
  border-color: var(--primary, #4f46e5) !important;
  background: #f5f3ff !important;
  box-shadow: 0 0 0 1px var(--primary, #4f46e5);
}

/* ==========================================================================
   Class Management Modal Styles
   ========================================================================== */
.class-mgmt-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}
.class-mgmt-table th {
  background: #f8fafc;
  color: var(--text-secondary, #475569);
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.class-mgmt-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color, #f1f5f9);
  vertical-align: middle;
}
.class-mgmt-row {
  transition: background 0.15s ease;
}
.class-mgmt-row:hover {
  background: #f8fafc;
}
.class-mgmt-row.is-active-class {
  background: #f0fdf4;
}
.class-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 700;
}
.class-mgmt-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}
.btn-class-action {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color, #cbd5e1);
  background: #fff;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.btn-class-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.btn-class-action.action-delete {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff5f5;
}
.btn-class-action.action-delete:hover {
  background: #fee2e2;
  border-color: #f87171;
}
.btn-class-action.action-select {
  color: var(--primary, #4f46e5);
  border-color: #c7d2fe;
  background: #eef2ff;
}
.btn-class-action.action-select:hover {
  background: #e0e7ff;
}

/* ==========================================================================
   CUSTOM CONFIRM MODAL (Professional Commercial-Grade B2B Dialog)
   ========================================================================== */
#modal-custom-confirm {
  z-index: 100100 !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, 0.65) !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#modal-custom-confirm.active {
  display: flex !important;
  animation: customConfirmFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes customConfirmFadeIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

#modal-custom-confirm .modal-content,
#modal-custom-confirm .custom-confirm-content {
  max-width: 460px !important;
  width: 92vw;
  background: #ffffff !important;
  border-radius: 20px !important;
  padding: 2rem 1.75rem 1.6rem !important;
  text-align: center;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  position: relative;
  overflow: hidden;
}

#modal-custom-confirm .custom-confirm-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  background: #eff6ff;
  border: 4px solid #dbeafe;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.12);
  transition: transform 0.2s ease;
}

#modal-custom-confirm.is-danger .custom-confirm-icon-wrap {
  background: #fef2f2 !important;
  border: 4px solid #fee2e2 !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.15) !important;
}

#modal-custom-confirm #custom-confirm-title {
  font-size: 1.2rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin-bottom: 0.65rem !important;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

#modal-custom-confirm #custom-confirm-message {
  font-size: 0.925rem !important;
  color: #475569 !important;
  line-height: 1.6 !important;
  margin-bottom: 1.75rem !important;
  white-space: pre-line !important;
  text-align: center;
  word-break: break-word;
}

#modal-custom-confirm .custom-confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

#modal-custom-confirm #btn-custom-confirm-cancel {
  flex: 1;
  min-height: 44px;
  border-radius: 12px !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  color: #334155 !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
}

#modal-custom-confirm #btn-custom-confirm-cancel:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

#modal-custom-confirm #btn-custom-confirm-ok {
  flex: 1.2;
  min-height: 44px;
  border-radius: 12px !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
  justify-content: center;
  border: none !important;
  transition: all 0.15s ease;
  cursor: pointer;
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3) !important;
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.42) !important;
  transform: translateY(-1px);
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3) !important;
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.42) !important;
  transform: translateY(-1px);
}

/* Inplace Auto-OCR Scanning Indicator */
@keyframes pulseScan {
  0% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0.6; transform: scale(0.98); }
}
.ocr-scanning {
  animation: pulseScan 1.2s infinite ease-in-out;
}

/* ==========================================================================
   IMAGE FIT-TO-SCREEN & LIGHTBOX
   ========================================================================== */
.image-thumbnail-card img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  background: #0f172a;
}

#modal-image-lightbox.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}

.mvs-page-wrapper img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

/* ==========================================================================
   MULTI-VIEWPORT RESPONSIVE WORKSPACE STUDIO
   ========================================================================== */
@media (min-width: 1025px) {
  .workspace-modal {
    max-width: 1300px;
    width: 95vw;
    height: 90vh;
  }
  .workspace-body {
    display: grid;
    grid-template-columns: 60% 40%;
    height: calc(100% - 60px);
    overflow: hidden;
  }
  .viewer-pane {
    height: 100%;
    overflow: auto;
  }
  .grading-pane {
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
  }
}

@media (max-width: 1024px) {
  .workspace-modal {
    width: 98vw;
    height: 95vh;
    max-height: 95vh;
  }
  .workspace-body {
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px);
    overflow: hidden;
  }
  .viewer-pane {
    flex: 1;
    min-height: 40vh;
    max-height: 50vh;
  }
  .grading-pane {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
  }
}

@media (max-width: 768px) {
  .workspace-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    padding: 0.75rem !important;
  }
}

/* ==========================================================================
   PRINT ENGINE OPTIMIZATIONS
   ========================================================================== */
@media print {
  .no-print,
  .sidebar,
  .app-header,
  .topbar-right,
  .modal-backdrop:not(.active-print) {
    display: none !important;
  }
}

/* ==========================================================================
   TEACHER SUBSCRIPTION & AI PAGE QUOTA DESIGN SYSTEM
   ========================================================================== */

/* --- Topbar Quota Pill --- */
.user-quota-capsule {
  display: inline-flex;
  align-items: center;
}

.btn-quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-quota-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.btn-quota-pill.quota-ok {
  background: #f0fdf4;
  color: #166534;
  border: 1.5px solid #bbf7d0;
}

.btn-quota-pill.quota-ok:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.btn-quota-pill.quota-low {
  background: #fffbeb;
  color: #b45309;
  border: 1.5px solid #fde68a;
  animation: quota-pulse-warn 2s infinite ease-in-out;
}

.btn-quota-pill.quota-low:hover {
  background: #fef3c7;
}

.btn-quota-pill.quota-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1.5px solid #fecaca;
  animation: quota-pulse-danger 1.5s infinite ease-in-out;
}

.btn-quota-pill.quota-danger:hover {
  background: #fee2e2;
}

@keyframes quota-pulse-warn {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
  }
}

@keyframes quota-pulse-danger {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.2);
  }
}

/* --- Segmented Cycle Switcher --- */
.cycle-switcher-wrapper {
  display: inline-flex;
  background: #f1f5f9;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  gap: 0.25rem;
  max-width: 100%;
}

.cycle-switch-btn {
  border: none;
  background: transparent;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cycle-switch-btn:hover:not(.active) {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.6);
}

.cycle-switch-btn.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

/* --- Pricing Cards Grid --- */
.pricing-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.pricing-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.1);
}

.pricing-card.popular-glow {
  border-color: #6366f1 !important;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.25);
}

.pricing-card.popular-glow:hover {
  box-shadow: 0 16px 32px -4px rgba(99, 102, 241, 0.35);
}

.popular-badge {
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

/* --- Subscription Responsive Layout --- */
@media (max-width: 768px) {
  .cycle-switcher-wrapper {
    flex-direction: column;
    border-radius: var(--radius-md);
    width: 100%;
  }

  .cycle-switch-btn {
    width: 100%;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
  }

  .pricing-cards-grid {
    grid-template-columns: 1fr;
  }

  #modal-teacher-subscription .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .btn-quota-pill .quota-text {
    font-size: 0.75rem;
  }
}

/* --- School & Academic Year Management Responsive Layout --- */
.school-form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.school-form-grid-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.school-form-grid-school-top {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.school-form-grid-school-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.school-table-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.school-table-container table {
  min-width: 580px;
}

@media (max-width: 768px) {
  #modal-school-year-management .modal-content {
    padding: 1rem !important;
    width: 96vw !important;
    max-height: 94vh !important;
  }

  .school-form-grid-2col,
  .school-form-grid-3col,
  .school-form-grid-school-top,
  .school-form-grid-school-bottom {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  .school-form-grid-3col > div {
    padding-top: 0 !important;
  }

  .btn-edit-school-year,
  .btn-delete-school-year {
    min-height: 36px;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* --- Admin Management Center Styling (Tone Sáng SaaS) --- */
#modal-admin-management .modal-content {
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.admin-tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.admin-tab-btn {
  font-weight: 700;
  transition: all var(--fast-transition, 0.2s ease);
  border-radius: var(--radius-sm, 6px);
  padding: 0.4rem 0.85rem;
}

.admin-tab-btn.btn-primary {
  background-color: var(--primary, #2563eb);
  color: #ffffff !important;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 1px 2px 0 rgba(37, 99, 235, 0.2);
}

.admin-tab-btn.btn-outline {
  color: #475569 !important;
  border-color: #cbd5e1;
  background-color: #ffffff;
}

.admin-tab-btn.btn-outline:hover {
  background-color: #f1f5f9;
  color: #0f172a !important;
  border-color: #94a3b8;
}

@media (max-width: 768px) {
  #modal-admin-management .modal-content {
    width: 96vw !important;
    height: 94vh !important;
    max-height: 94vh !important;
    padding: 1rem !important;
  }

  .admin-tab-nav {
    gap: 0.35rem;
  }

  .admin-tab-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
    flex: 1 1 auto;
    text-align: center;
  }
}

/* ==========================================================================
   EDIT SUBMISSION MODAL & PAGE MANAGEMENT STYLES
   ========================================================================== */
.submission-edit-gallery {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.sub-edit-thumb-card {
  position: relative;
  width: 90px;
  height: 120px;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.sub-edit-thumb-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
}

.sub-edit-thumb-img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  background: #f1f5f9;
  cursor: pointer;
}

.sub-edit-thumb-footer {
  height: 30px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
}

.sub-edit-thumb-del {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
  transition: background 0.15s ease;
}

.sub-edit-thumb-del:hover {
  background: #ef4444;
  color: #ffffff;
}

.sub-new-file-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.sub-new-file-tag-remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0 0.15rem;
}

.btn-edit-submission {
  color: #2563eb;
  border-color: #bfdbfe;
  font-weight: 600;
}

.btn-edit-submission:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.btn-delete-submission {
  color: #ef4444;
  border-color: #fca5a5;
  font-weight: 600;
}

.btn-delete-submission:hover {
  background: #fef2f2;
  border-color: #f87171;
  color: #dc2626;
}

/* ==========================================================================
   AUTO-DETECT LOADING OVERLAY & INTERACTION LOCKING (EDTECH PREMIUM)
   ========================================================================== */

.auto-detect-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1050;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all !important;
  user-select: none;
}

.auto-detect-loading-overlay.active {
  display: flex !important;
  opacity: 1 !important;
}

.auto-detect-loading-card {
  background: #ffffff;
  border: 1.5px solid #bfdbfe;
  border-radius: 18px;
  padding: 1.75rem 1.5rem;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px -15px rgba(37, 99, 235, 0.22), 0 0 0 1px rgba(37, 99, 235, 0.08);
  transform: scale(0.95);
  animation: autoDetectCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  z-index: 1051;
}

.auto-detect-spinner-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 0 auto 1.15rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auto-detect-spinner {
  position: absolute;
  inset: 0;
  border: 3.5px solid #e0e7ff;
  border-top-color: #2563eb;
  border-right-color: #7c3aed;
  border-radius: 50%;
  animation: spinAutoDetect 0.9s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

.auto-detect-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.35);
  animation: pulseAutoDetect 1.8s ease-out infinite;
}

.auto-detect-icon {
  font-size: 1.5rem;
  line-height: 1;
  animation: floatAutoDetect 2s ease-in-out infinite alternate;
}

.auto-detect-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e3a8a;
  margin: 0 0 0.35rem 0;
  letter-spacing: -0.01em;
}

.auto-detect-desc {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.45;
  margin: 0 0 1rem 0;
}

.auto-detect-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #4338ca;
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.auto-detect-locked {
  pointer-events: none !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
  filter: grayscale(15%);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

@keyframes spinAutoDetect {
  to { transform: rotate(360deg); }
}

@keyframes pulseAutoDetect {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0.18; }
  100% { transform: scale(1.3); opacity: 0; }
}

@keyframes floatAutoDetect {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-3px) scale(1.1); }
}

@keyframes autoDetectCardIn {
  to { transform: scale(1); }
}

@media (max-width: 640px) {
  .auto-detect-loading-card {
    padding: 1.25rem 1rem;
    width: 94%;
  }
  .auto-detect-title {
    font-size: 0.95rem;
  }
  .auto-detect-desc {
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
  }

  /* Responsive styles for Edit Exam Modal */
  #modal-edit-exam .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    padding: 1rem !important;
    margin: 1rem auto !important;
    border-radius: var(--radius-md) !important;
  }
  #form-edit-exam div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  #form-edit-exam .form-control {
    font-size: 0.9rem !important;
    min-height: 40px !important;
  }
}

/* --- VIETQR PAYMENT MODAL RESPONSIVE & COPY BUTTONS --- */
.btn-copy-inline {
  transition: all 0.2s ease-in-out;
  user-select: none;
}
.btn-copy-inline:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.btn-copy-inline:active {
  transform: translateY(0);
}

@media (max-width: 480px) {
  #modal-subscription-payment .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
  #payment-qr-img {
    width: 180px !important;
    height: 180px !important;
  }
  .vietqr-transfer-info-card {
    font-size: 0.8rem !important;
    padding: 0.75rem !important;
  }
  .vietqr-transfer-info-card strong {
    font-size: 0.85rem !important;
  }
  #payment-transfer-content {
    font-size: 0.82rem !important;
    padding: 0.1rem 0.35rem !important;
  }
}

/* --- CHANGE PASSWORD MODAL & PASS TOGGLES --- */
#modal-change-password .modal-content {
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: var(--radius-xl);
}

.btn-toggle-pass-inline {
  font-size: 0.75rem;
  color: var(--iris-600);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-toggle-pass-inline:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--iris-700);
}

.btn-toggle-pass-inline:active {
  transform: scale(0.97);
}

#chg-pass-error {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

@media (max-width: 480px) {
  #modal-change-password .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    padding: 1.25rem 1rem !important;
    margin: 1rem auto !important;
  }
  #modal-change-password .form-control {
    font-size: 0.95rem;
    padding: 0.75rem 0.85rem;
    min-height: 44px;
  }
  #modal-change-password .btn {
    min-height: 42px;
  }
}@media (max-width: 480px) {
  #modal-admin-assign-subscription .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    padding: 1.25rem 1rem !important;
    margin: 1rem auto !important;
  }
  #modal-admin-assign-subscription .form-control {
    font-size: 0.95rem;
    min-height: 44px;
  }
  #modal-admin-assign-subscription div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #modal-admin-assign-subscription .btn {
    min-height: 42px;
  }
}

/* ==========================================================================
   Export Options Modal & Responsive Cards
   ========================================================================== */
.export-option-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.export-option-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}
#card-export-zip:hover {
  border-color: #16a34a !important;
}
#card-export-merged:hover {
  border-color: #3b82f6 !important;
}
#card-export-xlsx:hover {
  border-color: #2563eb !important;
}

@media (max-width: 640px) {
  #modal-export-options .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    padding: 1.25rem 1rem !important;
    margin: 1rem auto !important;
  }
  .export-option-card {
    padding: 1rem 0.85rem !important;
  }
  .export-option-card button {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* ==========================================================================
   Sortable Table Headers
   ========================================================================== */
.submissions-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.submissions-table th.sortable-th:hover {
  background-color: #f1f5f9;
  color: var(--primary, #2563eb);
}

.submissions-table th.sortable-th .th-content {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.submissions-table th.sortable-th .sort-icon {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1;
  color: #94a3b8;
  transition: transform 0.15s ease, color 0.15s ease;
}

.submissions-table th.sortable-th:hover .sort-icon {
  color: #64748b;
}

.submissions-table th.sortable-th.th-sorted-active {
  background-color: #eff6ff;
  color: #1d4ed8;
  border-bottom: 2px solid #2563eb;
}

.submissions-table th.sortable-th.th-sorted-active .sort-icon {
  color: #2563eb;
  font-weight: 800;
  transform: scale(1.15);
}

@media (max-width: 768px) {
  .submissions-table th.sortable-th {
    padding: 0.75rem 0.5rem;
    min-height: 44px;
  }
}

/* ==========================================================================
   STUDENT PORTAL PROGRESSIVE STEPPER & MOBILE FLOW
   ========================================================================== */
.portal-stepper-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-surface, #ffffff);
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stepper-step {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  opacity: 0.5;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  cursor: pointer;
}

.stepper-step:hover {
  opacity: 0.85;
}

.stepper-step.active {
  opacity: 1;
}

.stepper-step.completed {
  opacity: 0.9;
}

.step-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stepper-step.active .step-icon-circle {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
  transform: scale(1.05);
}

.stepper-step.completed .step-icon-circle {
  background: #10b981;
  color: #ffffff;
}

.step-meta {
  display: flex;
  flex-direction: column;
}

.step-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stepper-step.active .step-name {
  color: #4f46e5;
}

.step-desc {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #1e293b);
}

.stepper-line {
  flex: 1;
  max-width: 60px;
  height: 2px;
  background: #e2e8f0;
  transition: background 0.3s ease;
}

.stepper-line.completed {
  background: #10b981;
}

/* Animations for progressive card transitions */
@keyframes portalCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portal-card-entering {
  animation: portalCardFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mobile responsive progressive flow */
@media (max-width: 768px) {
  .portal-stepper-container {
    padding: 0.65rem 0.85rem;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    border-radius: var(--radius-md, 10px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
  }
  .step-desc {
    display: none;
  }
  .step-name {
    font-size: 0.68rem;
  }
  .step-icon-circle {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }
  .stepper-line {
    max-width: 28px;
    height: 2px;
  }
  .portal-card {
    padding: 1.15rem 0.9rem !important;
  }
}

@media (max-width: 375px) {
  .portal-stepper-container {
    padding: 0.5rem 0.65rem;
    gap: 0.25rem;
  }
  .stepper-step {
    gap: 0.35rem;
  }
  .step-name {
    font-size: 0.62rem;
  }
  .stepper-line {
    max-width: 16px;
  }
}

@media (max-width: 480px) {
  .portal-manual-entry-box div {
    flex-direction: column;
  }
  .portal-manual-entry-box button {
    width: 100%;
    min-height: 44px;
  }
  #btn-portal-scan-qr {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
}

/* ==========================================================================
   PORTAL ACCESS REQUIRED CARD & QR SCANNER (UI/UX Rich Aesthetics)
   ========================================================================== */
.portal-access-required-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: var(--radius-lg, 16px) !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04) !important;
  animation: portalCardFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.portal-access-required-card .access-required-icon-wrap {
  transition: transform 0.25s ease;
}

.portal-access-required-card .access-required-icon-wrap:hover {
  transform: scale(1.06);
}

.portal-manual-entry-box {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-manual-entry-box:focus-within {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

@media (max-width: 480px) {
  .portal-access-required-card {
    padding: 1.5rem 1rem !important;
  }
  .portal-manual-entry-box div {
    flex-direction: column;
  }
  .portal-manual-entry-box button {
    width: 100%;
  }
}


/* ==========================================================================
   EXPORT PROGRESS MODAL (UI/UX Rich Aesthetics & Responsive Matrix)
   ========================================================================== */
.export-progress-modal-content {
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: exportModalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.export-progress-sparkle {
  animation: pulseSparkle 2s infinite ease-in-out;
}

@keyframes pulseSparkle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5)); }
}

.export-progress-card {
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.export-progress-card:hover {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

/* Mobile & Foldable Responsive Breakpoints */
@media (max-width: 480px) {
  .export-progress-modal-content {
    padding: 1.15rem 1rem !important;
    width: 95vw !important;
    max-width: 95vw !important;
    border-radius: 14px !important;
  }
  #export-progress-title {
    font-size: 1rem !important;
  }
  #export-progress-subtitle {
    font-size: 0.72rem !important;
  }
  .export-progress-card {
    padding: 0.65rem 0.75rem !important;
    margin-bottom: 0.85rem !important;
  }
  #export-progress-student-name {
    font-size: 0.82rem !important;
    max-width: 160px;
  }
  #export-progress-detail-label {
    font-size: 0.7rem !important;
  }
  #export-progress-counter {
    font-size: 0.72rem !important;
    padding: 0.2rem 0.4rem !important;
  }
}

@media (max-width: 360px) {
  #export-progress-subtitle {
    display: none;
  }
  #export-progress-speed {
    display: none !important;
  }
}

/* ==========================================================================
   COLLUSION & REMEDIATION RESPONSIVE DESIGN SYSTEM (v1.9.9)
   Desktop, Tablet, Foldable & Mobile Ultra-Smooth Responsiveness
   ========================================================================== */

.collusion-modal-content,
.remediation-modal-content {
  animation: modalFadeInUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
}

@keyframes modalFadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.collusion-pair-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.collusion-pair-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08);
}

.gap-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.gap-card:hover {
  border-color: #94a3b8 !important;
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.06);
}

.worksheet-preview-container {
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
  border: 1.5px solid #cbd5e1;
}

/* Touch scrolling optimization */
#collusion-modal-content,
#remediation-modal-content {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Remediation Class Badge & Grade Selector Styling */
.modal-content select.remediation-target-grade-select,
.remediation-modal-content select.remediation-target-grade-select,
#remediation-target-grade {
  width: auto !important;
  min-width: 170px !important;
  max-width: 240px !important;
  height: 36px !important;
  min-height: 36px !important;
  line-height: 1.4 !important;
  padding: 4px 28px 4px 10px !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  background-color: var(--bg-main, #f8fafc) !important;
  color: #0284c7 !important;
  border: 1.5px solid var(--border-color, #cbd5e1) !important;
  display: inline-block !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] .remediation-modal-content select.remediation-target-grade-select,
[data-theme="dark"] #remediation-target-grade {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #38bdf8 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.remediation-selected-class-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  padding: 5px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.86rem;
  border: 1px solid rgba(14, 165, 233, 0.25);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .remediation-selected-class-badge {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

/* --- Tablet Breakpoint (max-width: 768px) --- */
@media (max-width: 768px) {
  .collusion-modal-content,
  .remediation-modal-content {
    width: 96vw !important;
    max-height: 94vh !important;
    padding: 1.15rem 1rem !important;
    border-radius: 14px !important;
  }
  
  .worksheet-preview-container {
    padding: 14px !important;
  }
  
  .collusion-pair-card {
    padding: 12px !important;
  }

  #btn-topbar-collusion,
  #btn-topbar-remediation {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.78rem !important;
  }
}

/* --- Mobile Standard Breakpoint (max-width: 640px) --- */
@media (max-width: 640px) {
  /* Prevent topbar horizontal clutter on mobile; features remain accessible via sidebar */
  #btn-topbar-collusion,
  #btn-topbar-remediation {
    display: none !important;
  }

  .topbar-utilities-wrapper {
    display: none !important;
  }

  .collusion-modal-header,
  .remediation-modal-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .collusion-modal-icon,
  .remediation-modal-icon {
    width: 34px !important;
    height: 34px !important;
    font-size: 1.15rem !important;
  }

  #collusion-modal-title,
  #remediation-modal-title {
    font-size: 1.05rem !important;
    line-height: 1.35;
  }

  .collusion-modal-subtitle,
  .remediation-modal-subtitle {
    font-size: 0.75rem !important;
    line-height: 1.35;
  }

  /* Full-width touch-friendly action buttons in modal footers */
  .collusion-modal-footer,
  .remediation-modal-footer {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }

  .collusion-footer-btns {
    display: flex;
    flex-direction: column-reverse;
    width: 100%;
    gap: 0.5rem;
  }

  .collusion-footer-btns button,
  .remediation-modal-footer button {
    width: 100% !important;
    min-height: 42px !important;
    font-size: 0.9rem !important;
    justify-content: center !important;
  }

  .collusion-footer-note {
    text-align: center;
    font-size: 0.75rem !important;
  }
}

/* --- Foldable & Small Phone Breakpoint (max-width: 480px) --- */
@media (max-width: 480px) {
  .collusion-modal-content,
  .remediation-modal-content {
    width: 98vw !important;
    max-height: 96vh !important;
    padding: 0.9rem 0.75rem !important;
    border-radius: 12px !important;
  }

  #collusion-modal-title,
  #remediation-modal-title {
    font-size: 0.98rem !important;
  }

  .collusion-summary-card {
    padding: 10px !important;
    margin-bottom: 14px !important;
  }

  .collusion-summary-card > div:first-child {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .stat-pill {
    font-size: 0.72rem !important;
    padding: 3px 8px !important;
  }

  .gap-card {
    padding: 10px !important;
  }

  .exercise-preview-item {
    padding-bottom: 10px !important;
    margin-bottom: 12px !important;
  }
}

/* ==========================================================================
   Global KaTeX Math Rendering & Step-Item Typography
   ========================================================================== */
.katex {
  font-size: 1.05em;
  text-rendering: auto;
}

.katex-display {
  display: block;
  margin: 0.5rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.math-fallback {
  background: rgba(241, 245, 249, 0.9);
  color: #1e293b;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: 'KaTeX_Math', 'Cambria Math', 'Times New Roman', serif;
  font-size: 0.95em;
}

.math-display.math-fallback {
  display: block;
  padding: 0.4rem 0.65rem;
  margin: 0.4rem 0;
  border-left: 3px solid var(--primary-color, #2563eb);
  overflow-x: auto;
}

.rubric-step-item {
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: break-word;
}

.rubric-box-content {
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Exam Audit & Flawed Question Warning Styles */
.pedagogical-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

#modal-exam-audit-report {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 10080 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#modal-exam-audit-report.active {
  display: flex !important;
}

/* Modal Exam Audit Header Action Buttons (High contrast on dark gradient) */
#modal-exam-audit-report .modal-exam-audit-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#modal-exam-audit-report .modal-exam-audit-badges-wrap {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.45rem !important;
  align-items: center !important;
  margin-top: 0.25rem !important;
}

#modal-exam-audit-report .modal-exam-audit-badges-wrap .badge {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  border-radius: 6px !important;
  padding: 0.2rem 0.5rem !important;
  font-size: 0.75rem !important;
}

#modal-exam-audit-report .modal-exam-audit-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  flex-shrink: 0 !important;
}

#modal-exam-audit-report .modal-exam-audit-header-actions button,
#modal-exam-audit-report #btn-header-exam-audit-rerun,
#modal-exam-audit-report #btn-header-exam-audit-print,
#modal-exam-audit-report #btn-close-exam-audit-modal {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  border-radius: 8px !important;
  padding: 0.38rem 0.72rem !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#modal-exam-audit-report #btn-header-exam-audit-rerun {
  background: rgba(14, 165, 233, 0.25) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.6) !important;
}
#modal-exam-audit-report #btn-header-exam-audit-rerun:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  transform: translateY(-1px) !important;
}

#modal-exam-audit-report #btn-header-exam-audit-print {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}
#modal-exam-audit-report #btn-header-exam-audit-print:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
  transform: translateY(-1px) !important;
}

#modal-exam-audit-report #btn-close-exam-audit-modal {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
}
#modal-exam-audit-report #btn-close-exam-audit-modal:hover {
  background: rgba(239, 68, 68, 0.8) !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  transform: translateY(-1px) !important;
}

@media (max-width: 640px) {
  #modal-exam-audit-report .modal-content {
    width: 96% !important;
    margin: 0.5rem auto !important;
    max-height: 94vh !important;
  }
  #modal-exam-audit-report .modal-exam-audit-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    padding: 0.75rem 1rem !important;
  }
  #modal-exam-audit-report .modal-exam-audit-btn-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }
  #modal-exam-audit-report .modal-exam-audit-btn-group .btn {
    min-height: 42px !important;
    font-size: 0.78rem !important;
    padding: 0.4rem 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: normal !important;
    line-height: 1.25 !important;
  }
  #modal-exam-audit-report .modal-exam-audit-btn-group #btn-audit-print-pdf {
    grid-column: span 2 !important;
  }
}

@media (max-width: 380px) {
  #modal-exam-audit-report .modal-exam-audit-btn-group {
    grid-template-columns: 1fr !important;
  }
  #modal-exam-audit-report .modal-exam-audit-btn-group #btn-audit-print-pdf {
    grid-column: span 1 !important;
  }
}

/* ==========================================================================
   TEACHER PRESENTATION MODE (SMART BOARD & PROJECTOR CINEMATIC UX)
   ========================================================================== */
.teacher-presentation-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #090d16 !important;
  color: #f8fafc;
  z-index: 10080;
  overflow: hidden;
}

.teacher-presentation-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.teacher-presentation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.presentation-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.presentation-live-badge {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.presentation-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: #f1f5f9;
}

.presentation-header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.presentation-theme-selector {
  display: flex;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px;
  border-radius: 6px;
}

.presentation-theme-selector .theme-btn {
  color: #94a3b8;
  border-color: transparent;
  padding: 0.25rem 0.5rem;
}

.presentation-theme-selector .theme-btn.active {
  background: #3b82f6;
  color: #ffffff;
}

.teacher-presentation-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 58% 42%;
  height: calc(100vh - 125px);
  overflow: hidden;
  position: relative;
}

.presentation-canvas-pane {
  position: relative;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.3s ease;
}

/* Theme variants */
.presentation-canvas-pane.theme-chalkboard {
  background: #064e3b !important;
}

.presentation-canvas-pane.theme-grid {
  background: #ffffff !important;
  background-image: linear-gradient(#e2e8f0 1px, transparent 1px), linear-gradient(90deg, #e2e8f0 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
}

.presentation-viewport-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.presentation-hint-banner {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(234, 88, 12, 0.92);
  color: #ffffff;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.35);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 20;
  animation: pulseHint 2s infinite ease-in-out;
}

@keyframes pulseHint {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.03); }
}

.presentation-blank-curtain {
  position: absolute;
  inset: 0;
  background: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  cursor: pointer;
}

.blank-curtain-content {
  text-align: center;
  color: #e2e8f0;
}

.presentation-proof-pane {
  background: #111827;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.proof-pane-header {
  padding: 0.75rem 1rem;
  background: rgba(31, 41, 55, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.proof-header-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: #60a5fa;
  letter-spacing: 0.5px;
}

.proof-step-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
}

.presentation-proof-steps-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.presentation-step-item {
  padding: 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid transparent;
  transition: all 0.3s ease;
  opacity: 0.4;
}

.presentation-step-item.step-active {
  opacity: 1;
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

.presentation-step-item.step-passed {
  opacity: 0.75;
}

.presentation-step-item.step-future {
  opacity: 0.15;
}

.presentation-step-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #93c5fd;
  margin-bottom: 0.35rem;
}

.presentation-step-body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #e2e8f0;
}

/* Floating Dock */
.teacher-floating-dock {
  height: 65px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  backdrop-filter: blur(12px);
  z-index: 40;
}

.dock-left-info .dock-step-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #94a3b8;
}

.dock-center-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dock-btn {
  min-height: 42px;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.4rem 1rem;
  border-radius: 8px;
}

.dock-btn-play {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  border: none;
  min-width: 120px;
}

.dock-btn-hint {
  color: #fb923c;
  border-color: #ea580c;
}

.dock-right-shortcuts {
  display: flex;
  gap: 0.75rem;
}

.hotkey-tip {
  font-size: 0.75rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.hotkey-tip kbd {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.72rem;
}

@media (max-width: 1024px) {
  .teacher-presentation-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 55% 45%;
  }
  .dock-right-shortcuts {
    display: none;
  }
}

/* v1.64.9: AI Processing Status Pill outside Ribbon */
.variant-ai-processing-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  animation: pulse-soft 2s infinite ease-in-out;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.variant-ai-processing-pill.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
  animation: none;
}

.variant-ai-processing-pill.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
  animation: none;
}

[data-theme="dark"] .variant-ai-processing-pill {
  background: rgba(30, 58, 138, 0.35);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}

[data-theme="dark"] .variant-ai-processing-pill.success {
  background: rgba(20, 83, 45, 0.35);
  border-color: rgba(74, 222, 128, 0.4);
  color: #86efac;
}

[data-theme="dark"] .variant-ai-processing-pill.error {
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.variant-ai-processing-pill .spinner-micro {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.75s linear infinite;
}

.variant-ai-processing-pill.success .spinner-micro,
.variant-ai-processing-pill.error .spinner-micro {
  display: none;
}

/* v1.64.9: Modal Stacking Context - Child Modals of modal-student-accounts */
#modal-add-or-edit-student,
#modal-batch-import-students,
#modal-reset-student-password {
  z-index: 10060 !important;
}

/* AI Responsibility & Pedagogical Review Disclaimer */
.ai-pedagogical-disclaimer {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md, 8px);
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.8rem;
  line-height: 1.45;
  box-sizing: border-box;
}

.ai-pedagogical-disclaimer.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.ai-pedagogical-disclaimer.info {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.ai-pedagogical-disclaimer.neutral {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

.ai-pedagogical-disclaimer .disclaimer-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
}

.ai-pedagogical-disclaimer .disclaimer-text {
  flex: 1;
}

.ai-pedagogical-disclaimer .disclaimer-text strong {
  font-weight: 700;
}

[data-theme="dark"] .ai-pedagogical-disclaimer {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(71, 85, 105, 0.6);
  color: #cbd5e1;
}

[data-theme="dark"] .ai-pedagogical-disclaimer.warning {
  background: rgba(120, 53, 15, 0.25);
  border-color: rgba(217, 119, 6, 0.4);
  color: #fde68a;
}

[data-theme="dark"] .ai-pedagogical-disclaimer.info {
  background: rgba(20, 83, 45, 0.25);
  border-color: rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
}

.ii-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ii-actions .btn {
  margin-top: 0 !important;
}



