/* =============================================
   TRASH_MATH — Page-specific styles
   ============================================= */

/* ===== HOME PAGE ===== */

/* Hero two-column layout */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
}

.hero-content { max-width: 700px; }

/* Hero photo */
.hero-photo-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.hero-photo {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  height: 540px;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--radius-xl);
  box-shadow:
    0 20px 60px rgba(168, 200, 232, 0.4),
    0 0 0 6px rgba(255, 255, 255, 0.7);
  transition: transform 0.5s ease, border-radius 0.8s ease;
}
.hero-photo:hover {
  transform: scale(1.02) translateY(-5px);
  border-radius: var(--radius-2xl);
}

/* Decorative blobs behind photo */
.hero-photo-blob {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  opacity: 0.25;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  animation: float 6s ease-in-out infinite;
}
.hero-photo-blob-2 {
  width: 280px;
  height: 280px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  opacity: 0.3;
  transform: translate(-40%, -60%);
  animation-delay: -3s;
  animation-duration: 7s;
}
.hero-title {
  font-size: var(--font-size-hero);
  font-weight: var(--font-weight-extrabold);
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-deeper) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}
.hero-subtitle strong {
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}
.hero-actions { display: flex; gap: var(--space-md); flex-wrap: wrap; }

/* Old service-card / review styles removed — see V2 styles below */


/* Counter stats */
.counter-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  padding: var(--space-2xl) 0;
  color: white;
}
.counter-value {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
  line-height: 1;
}
.counter-label {
  font-size: var(--font-size-sm);
  opacity: 0.8;
  margin-top: var(--space-xs);
}

/* ===== TASK BANK ===== */
.task-bank-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--space-lg);
}
.task-filter-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-lg));
  align-self: start;
  max-height: calc(100vh - var(--nav-height) - var(--space-lg) * 2);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.task-filter-sidebar:hover {
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.task-filter-sidebar::-webkit-scrollbar { width: 4px; }
.task-filter-sidebar::-webkit-scrollbar-track { background: transparent; }
.task-filter-sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}
.task-filter-sidebar:hover::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
}
.filter-group {
  margin-bottom: var(--space-lg);
}
.filter-group-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}
.filter-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary-color);
}
.filter-checkbox .filter-label-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.filter-checkbox .badge {
  flex-shrink: 0;
  margin-top: 1px;
}
.task-number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-xs);
  justify-items: center;
}
.task-number-btn {
  width: 100%;
  max-width: 40px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
}
.task-number-btn:hover { border-color: var(--primary-color); color: var(--primary-dark); }
.task-number-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Task card */
.task-card {
  padding: var(--space-lg);
  overflow: hidden;
  word-break: break-word;
}
#tasks-grid .task-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}
.task-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.task-card-number {
  background: var(--accent-color);
  color: var(--text-primary);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
}
.task-card-content {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}
.task-card-answer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.task-card-answer input {
  flex: 1;
  max-width: 280px; width: 100%;
}

/* Part 2: the solution uses the card width; Theory is a separate action below. */
.task-card-answer--solution {
  flex-direction: column;
  align-items: stretch;
}
.task-card-answer--solution > .accordion {
  min-width: 0;
}

.answer-feedback {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  animation: scaleIn var(--transition-fast);
}
.answer-correct {
  background: var(--success-light);
  color: #2D7A54;
}
.answer-incorrect {
  background: var(--error-light);
  color: #A03030;
}

/* ===== GENERATOR ===== */
.generator-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.generator-mode-card {
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
}

.generator-mode-card.selected {
  border: 2px solid var(--primary-color);
  background: var(--primary-light);
}
.generator-mode-icon { font-size: 48px; margin-bottom: var(--space-md); }
.generator-timer {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-extrabold);
  text-align: center;
  color: var(--primary-dark);
  padding: var(--space-lg);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  font-variant-numeric: tabular-nums;
}

/* ===== ARCHIVE ===== */
.archive-year-group {
  margin-bottom: var(--space-xl);
}
.archive-year-title {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 3px solid var(--primary-color);
  display: inline-block;
}

/* ===== MEDIA ===== */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
}
.media-card-thumb {
  aspect-ratio: 16/9;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  position: relative;
  overflow: hidden;
}
.media-card-thumb iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.media-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  font-size: 48px;
  color: white;
  cursor: pointer;
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
}
.media-card-play:hover { background: rgba(0, 0, 0, 0.5); }

.media-viewer {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-lg);
  min-height: 60vh;
}
.media-player {
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
}
.media-player iframe { width: 100%; height: 100%; border: none; }

.comments-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}
.comment-item {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.comment-item .avatar { flex-shrink: 0; }
.comment-bubble {
  background: var(--bg-secondary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border-top-left-radius: var(--radius-xs);
}
.comment-author {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--primary-dark);
}
.comment-text { font-size: var(--font-size-sm); color: var(--text-primary); }
.comment-time { font-size: var(--font-size-xs); color: var(--text-muted); margin-top: 2px; }
.comment-input-area {
  padding: var(--space-md);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--space-sm);
}
.comment-input-area input { flex: 1; }

/* ===== LOGIN/REGISTER ===== */
.auth-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}
.auth-bg-circle {
  position: absolute;
  border-radius: var(--radius-circle);
  opacity: 0.15;
  z-index: 0;
}
.auth-bg-circle-1 { width: 400px; height: 400px; background: var(--accent-color); top: -100px; right: -100px; }
.auth-bg-circle-2 { width: 250px; height: 250px; background: var(--primary-color); bottom: -50px; left: -50px; }
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.auth-title {
  text-align: center;
  margin-bottom: var(--space-xl);
}
.auth-toggle {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}
.auth-toggle a { font-weight: var(--font-weight-semibold); }

/* ===== DASHBOARD ===== */
.dashboard-welcome {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}
.dashboard-welcome h2 { margin-bottom: var(--space-xs); }

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.chart-card canvas { max-height: 300px; }

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
}
.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  text-decoration: none;
  color: var(--text-primary);
}
.quick-link-icon {
  font-size: 32px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
}

/* ===== HOMEWORK ===== */
.hw-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  cursor: pointer;
}
.hw-card-status {
  width: 4px;
  height: 50px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.hw-card-status.active { background: var(--info); }
.hw-card-status.submitted { background: var(--warning); }
.hw-card-status.reviewed { background: var(--success); }
.hw-card-status.overdue { background: var(--error); }
.hw-card-status.revision { background: var(--accent-color); }
.hw-card-info { flex: 1; }
.hw-card-title { font-weight: var(--font-weight-semibold); margin-bottom: var(--space-xs); }
.hw-card-meta { font-size: var(--font-size-xs); color: var(--text-muted); }
.hw-card-score {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary-dark);
}

/* ===== ADMIN ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}
.admin-table th {
  text-align: left;
  padding: var(--space-md);
  border-bottom: 2px solid var(--border-color);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.admin-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.admin-table tr:hover td { background: var(--bg-elevated); }

/* ===== RESPONSIVE PAGE OVERRIDES ===== */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; gap: var(--space-xl); }
  .hero-content { margin: 0 auto; }
  .hero-actions { justify-content: center; }
  .task-bank-layout { grid-template-columns: minmax(0, 1fr); }
  .task-filter-sidebar { position: static; }
  .media-viewer { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .task-filter-sidebar { padding: var(--space-md); }
  .hero-title { font-size: var(--font-size-3xl); }
  .hero-subtitle { font-size: var(--font-size-md); }
  .hero-photo { width: 280px; height: 320px; }
  .hero-photo-blob { width: 300px; height: 300px; }
  .hero-photo-blob-2 { width: 240px; height: 240px; }
  .generator-modes { grid-template-columns: 1fr; }
  .review-card { min-width: 280px; }
  .auth-card { padding: var(--space-lg); }
  .media-grid { grid-template-columns: 1fr; }
}

/* =============================================
   HW SOLVE PAGE (ученик)
   ============================================= */

.hw-solve-page {
  min-height: 100vh;
  padding-bottom: 80px;
}

/* A transformed SPA ancestor makes fixed submit bars follow the full page
   instead of the viewport. Homework keeps its opacity transition only. */
#app:has(.hw-solve-page) {
  transform: none !important;
}

/* Sticky шапка */
.hw-solve-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 12px var(--space-lg);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.hw-solve-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hw-solve-header-center {
  flex: 1;
  text-align: center;
  overflow: hidden;
}

/* Прогресс */
.hw-progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Разделитель частей */
.hw-section-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: var(--space-md);
}

/* Карточка задачи */
.hw-task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: box-shadow 0.2s ease;
}
.hw-task-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.hw-task-card-header {
  margin-bottom: var(--space-sm);
}

.hw-task-card-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  
}

.hw-task-img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  display: block;
}

.hw-task-img-small {
  max-width: 280px; width: 100%;
}
.hw-task-img-8 {
  max-width: 450px; width: 100%;
}
.hw-task-img-medium {
  max-width: 450px; width: 100%;
}
.hw-task-img-large {
  min-height: 240px;
  min-width: 240px;
  object-fit: contain;
  object-position: left top;
}

/* Поле ответа */
.hw-answer-wrap {
  background: var(--bg-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--border-color);
}

/* Загрузка файла */
.hw-file-upload {
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hw-file-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--primary-color);
  color: var(--primary-color);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.hw-file-label:hover { background: var(--primary-bg); }

/* Просмотр сданного ответа */
.hw-answer-submitted {
  background: var(--bg-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--border-color);
}
.hw-answer-submitted-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.hw-answer-submitted-value {
  font-size: 1rem;
  font-weight: 600;
}
.hw-teacher-comment {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--primary-bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-color);
}

/* Sticky кнопка сдачи */
.hw-submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 12px 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.10);
  backdrop-filter: blur(12px);
}

/* Карточка из списка ДЗ */
.hw-list-card {
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
}

/* =============================================
   HW CREATE PAGE (учитель)
   ============================================= */

.hw-create-page {
  min-height: 100vh;
}

.hw-create-page .container {
  max-width: 1720px;
  width: 96%;
  padding-left: clamp(16px, 2.5vw, 36px);
  padding-right: clamp(16px, 2.5vw, 36px);
}

/* Двухколоночная сетка: левая колонка широкая для банка задач, правая фиксированная 390px */
.hw-create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: var(--space-lg);
  align-items: start;
}

.hw-create-left {
  position: sticky;
  top: 76px;
  height: calc(100vh - 215px);
  max-height: calc(100vh - 215px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.hw-create-right {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 215px);
  overflow-y: auto;
  padding-right: 4px;
}

/* Левая карточка: на всю высоту, без внешних отступов */
.hc-left-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Шапка левой карточки (фильтры и действия) */
.hc-left-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hc-left-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.hc-template-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.hc-filters-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.hc-filter-num {
  width: 145px;
  flex-shrink: 0;
  font-size: 13px;
}

.hc-search-wrap {
  flex: 1 1 200px;
  min-width: 180px;
}

.hc-search-wrap input {
  font-size: 13px;
}

.hc-filter-year {
  width: 95px;
  flex-shrink: 0;
  font-size: 13px;
}

.hc-filter-wave {
  width: 140px;
  flex-shrink: 0;
  font-size: 13px;
}

.hc-filter-source {
  width: 135px;
  flex-shrink: 0;
  font-size: 13px;
}

/* Список задач: растянут на всю доступную высоту, внутренний скролл */
.hc-tasks-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Строка задачи в браузере */
.hc-task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  margin-bottom: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-card);
}
.hc-task-item:hover {
  background: var(--primary-bg);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.hc-task-item.selected {
  background: var(--primary-bg);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px var(--primary-color);
}
.hc-task-item-info { flex: 1; min-width: 0; }

.hc-toggle-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 50%;
}

/* Закрепленная снизу пагинация */
.hc-tasks-pagination {
  flex-shrink: 0;
  padding: 10px 18px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
  z-index: 5;
}

.hc-pagination-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.hc-pagination-info {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.hc-pagination-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.hc-tasks-pagination .hc-page-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hc-page-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Responsive — мобильные и планшеты */
@media (max-width: 1024px) {
  .hw-create-grid {
    grid-template-columns: 1fr;
  }
  .hw-create-left {
    position: static;
    height: auto;
    max-height: none;
  }
  .hc-left-card {
    height: 600px;
    max-height: 70vh;
  }
  .hw-create-right {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .hc-filters-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .hc-search-wrap {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .hw-solve-header {
    padding: 10px var(--space-md);
  }
  .hw-solve-title {
    font-size: 0.95rem;
  }
  .hc-filters-bar {
    grid-template-columns: 1fr;
  }
  .hc-search-wrap {
    grid-column: span 1;
  }
  .hc-pagination-inner {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .hw-task-card {
    padding: var(--space-md);
  }
  .hw-submit-bar .container {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .hw-submit-bar .container button {
    width: 100%;
  }
}

/* =============================================
   LANDING PAGE V2 — Reviews Carousel
   ============================================= */
.reviews-carousel {
  position: relative;
  padding: 0 48px;
}
.carousel-track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-md) 0;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.carousel-arrow:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.carousel-arrow--left { left: 0; }
.carousel-arrow--right { right: 0; }

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-md);
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color, #e2e8f0);
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-dot:hover {
  background: var(--text-muted);
}

.carousel-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--primary-color);
}

.review-card {
  min-width: 340px;
  max-width: 380px;
  scroll-snap-align: start;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.review-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.review-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.review-card-stars { color: var(--warning); letter-spacing: 2px; }
.review-card-result {
  display: inline-block;
  margin-top: var(--space-md);
  padding: 4px 12px;
  background: var(--success-light);
  color: #2D7A54;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}
.review-card-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}
.review-card-readmore {
  margin-top: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--primary-dark);
  transition: color 0.15s;
}
.review-card:hover .review-card-readmore { color: var(--primary-color); }

/* =============================================
   LANDING PAGE V2 — Service Cards (EdTech)
   ============================================= */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 420px));
  justify-content: center;
  gap: 28px;
  align-items: stretch;
}

.svc-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}
.svc-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}

/* Cover */
.svc-card__cover {
  position: relative;
  height: 280px;
  background-size: cover;
  background-position: top center;
  background-color: var(--primary-light);
}
.svc-card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Body */
.svc-card__body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Subtitle */
.svc-card__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Title */
.svc-card__title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 14px;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

/* Tags */
.svc-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.svc-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
  letter-spacing: 0.01em;
}
.svc-tag:nth-child(2) { background: #FFF3E0; color: #E65100; }
.svc-tag:nth-child(3) { background: #E8F5E9; color: #2E7D32; }

/* Meta */
.svc-card__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.svc-card__meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.svc-card__meta-icon {
  font-size: 15px;
  flex-shrink: 0;
}

/* Price */
.svc-card__price {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  margin-top: auto;
}
.svc-card__price strong {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
}
.svc-card__price span {
  font-size: 13px;
  color: var(--text-muted);
}

/* Buttons */
.svc-card__buttons {
  display: flex;
  gap: 10px;
}
.svc-card__btn-primary,
.svc-card__btn-secondary {
  flex: 1;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  text-align: center;
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
}
.svc-card__btn-primary {
  text-decoration: none;
}
.svc-card__btn-secondary {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
}
.svc-card__btn-secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Description */
.svc-card__desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 20px;
  white-space: pre-wrap;
}
.svc-card__toggle {
  display: none;
}

/* =============================================
   LANDING PAGE V2 — Social Pills
   ============================================= */
.social-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.social-pill:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
  background: var(--primary-light);
}
.social-pill__icon {
  font-size: 22px;
}

/* =============================================
   LANDING PAGE V2 — Responsive
   ============================================= */
@media (max-width: 1024px) {
  .reviews-carousel { padding: 0 40px; }
}
@media (max-width: 768px) {
  .svc-grid { grid-template-columns: 1fr; gap: 20px; max-width: 420px; margin-left: auto; margin-right: auto; }
  .review-card { min-width: 280px; max-width: 320px; }
  .reviews-carousel { padding: 0; }
  .carousel-arrow { display: none; }
  .svc-card__cover { height: 220px; }
  .svc-card__title { font-size: 15px; }
  .svc-card__price strong { font-size: 22px; }
  .social-pill { padding: 10px 20px; font-size: 14px; }

  /* Mobile: collapse description */
  .svc-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .svc-card__desc.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  .svc-card__toggle {
    display: inline-block;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 12px;
  }
  .svc-card__toggle:hover {
    text-decoration: underline;
  }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
  /* Скрыть интерфейс: шапка, меню, сайдбар, футер */
  .header, .nav-links, .sidebar, #nav-hamburger, #nav-mobile, footer, #auth-section, #auth-section-mobile {
    display: none !important;
  }
  
  /* Скрыть интерактивные элементы в самом варианте */
  .btn, input, textarea, .timer, #confetti-canvas, .notifications-wrapper, .dropdown, .accordion, .print-hide {
    display: none !important;
  }

  /* Развернуть контент */
  body {
    background: #fff !important;
    color: #000 !important;
  }
  
  .container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: none !important;
    border-bottom: 1px solid #ccc !important;
    border-radius: 0 !important;
    background: #fff !important;
    margin-bottom: 20px !important;
    page-break-inside: avoid;
  }

  /* Сброс цветов для экономии краски */
  .badge {
    border: 1px solid #000 !important;
    background: transparent !important;
    color: #000 !important;
  }
}

/* =============================================
   ADMIN CHECK PAGE
   ============================================= */
.ac-task-card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border-light);
  margin-bottom: var(--space-lg);
}
.ac-task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ac-task-card.ac-reviewed { border-color: var(--success); border-left-width: 4px; }
.ac-task-card.ac-pending { border-color: var(--warning); border-left-width: 4px; }
.ac-task-card.ac-failed { border-color: var(--error); border-left-width: 4px; }

.chw-filter-tab.active {
  background: var(--primary-color) !important;
  color: white !important;
  border-color: var(--primary-color) !important;
}

.ac-task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

.ac-task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}
@media (max-width: 900px) {
  .ac-task-grid { grid-template-columns: 1fr; }
}

.ac-task-col { min-width: 0; }

.ac-student-col {
  padding: var(--space-md);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.ac-solution-wrap {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--primary-color);
  display: none;
}
.ac-solution-wrap.open { display: block; }

.ac-toggle-btn {
  margin-top: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--primary-color);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  text-decoration: underline;
}

.ac-score-group { margin-top: var(--space-md); }
.ac-score-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-md);
}
.ac-score-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
}
.ac-score-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.ac-score-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }

.ac-auto-task {
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  border: 1px solid var(--border-light);
  border-left-width: 4px;
  margin-bottom: var(--space-sm);
}
.ac-auto-correct { border-left-color: var(--success); }
.ac-auto-error { border-left-color: var(--error); }

.ac-sticky-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
  position: sticky;
  top: var(--nav-height, 60px);
  background: var(--bg-card);
  z-index: 100;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.ac-batch-save-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

/* UI Enhancements for Teacher Check */
.ac-textarea-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ac-textarea-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.ac-auto-resize {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 4px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  min-height: 24px;
  max-height: 300px;
  overflow-y: auto !important;
  color: var(--text-color);
}

.ac-file-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: 8px;
  transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
  font-size: 16px;
}

.ac-file-upload-btn:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.ac-auto-task-wrap {
  margin-bottom: 5px;
}

.ac-auto-task {
  transition: transform 0.2s, box-shadow 0.2s;
}

.ac-auto-task:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* ===== GRADING CRITERIA ===== */
.grading-criteria-block {
  margin-top: 32px;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.grading-criteria-header {
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8ecf8 100%);
  color: #2d3748;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.grading-criteria-content {
  padding: 0;
}

.grading-criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.55;
}

.grading-criteria-table thead th {
  padding: 12px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.grading-criteria-table thead th:last-child {
  text-align: center;
  width: 80px;
}

.grading-criteria-table tbody td {
  padding: 14px 20px;
  vertical-align: top;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.grading-criteria-table tbody td:last-child {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: #3b82f6;
  vertical-align: middle;
  width: 80px;
}

.grading-criteria-table tbody td.score {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: #3b82f6;
  vertical-align: middle;
}

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

.grading-criteria-table tbody td em {
  font-style: italic;
}

.grading-criteria-table tbody td strong {
  color: #1e293b;
}

.grading-criteria-table tfoot td {
  padding: 12px 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-top: 2px solid #c7d2fe;
  color: #1e293b;
}

.grading-criteria-table tfoot td:last-child {
  text-align: center;
  font-size: 20px;
  color: #4f46e5;
}

.grading-criteria-table tfoot td.score {
  text-align: center;
  font-size: 20px;
  color: #4f46e5;
}

/* CRIT-09: Protect KaTeX from global line-height and box-sizing overrides */
.katex {
  line-height: 1.2;
}
.katex * {
  box-sizing: content-box;
}

/* ===== NEWS & ANNOUNCEMENTS SECTION ===== */
.news-section {
  position: relative;
  overflow: hidden;
}

.news-featured-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 4vw, 36px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.news-featured-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-color);
}

.news-featured-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  opacity: 0.25;
  border-radius: 50%;
  pointer-events: none;
}

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

.news-tags-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.news-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.news-title {
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  font-weight: 800;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0 0 14px 0;
  letter-spacing: -0.01em;
}

.news-preview {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 24px;
}

.news-preview p {
  margin-bottom: 8px;
}

.news-preview ul {
  padding-left: 20px;
  margin: 8px 0;
}

.news-preview li {
  margin-bottom: 4px;
}

.news-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.news-read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--primary-color);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: gap 0.2s ease, color 0.2s ease;
}

.news-featured-card:hover .news-read-more-btn {
  gap: 12px;
  color: var(--primary-dark);
}

/* Grid of multiple news */
.news-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
}

.news-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}

.news-card-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.news-card-item:hover .news-read-more-btn {
  gap: 10px;
}

/* =============================================
   STUDENT DASHBOARD RESPONSIVENESS & TOUCH TARGETS
   ============================================= */
.dashboard-widgets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.analytics-showcase-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-light, #F0EBE6);
  border-radius: var(--radius-md, 16px);
  padding: var(--space-lg, 24px);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(168,200,232,0.1));
  position: relative;
  overflow: hidden;
}

.analytics-showcase-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary-color, #A8C8E8), #10b981);
  border-radius: 4px 0 0 4px;
}

.analytics-showcase-grid {
  display: grid;
  grid-template-columns: 190px 1fr 1.2fr;
  gap: var(--space-lg, 24px);
  align-items: center;
}

.analytics-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.analytics-metric-box {
  background: var(--bg-secondary, #F9F7F5);
  border-radius: var(--radius-sm, 12px);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border-light, #F0EBE6);
  min-width: 0;
}

@media (max-width: 960px) {
  .analytics-showcase-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-md) !important;
  }
}

@media (max-width: 768px) {
  .analytics-showcase-card {
    padding: var(--space-md, 16px) !important;
  }
  .dashboard-widgets-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-md) !important;
  }
  .dashboard-welcome {
    flex-direction: column !important;
    text-align: center !important;
    gap: var(--space-md) !important;
  }
  .hw-task-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
}

@media (max-width: 420px) {
  .analytics-showcase-card {
    padding: 14px 12px !important;
  }
  .analytics-metrics-grid {
    gap: 8px !important;
  }
  .analytics-metric-box {
    padding: 8px 10px !important;
  }
  .analytics-metric-box strong {
    font-size: 1.05rem !important;
  }
}

/* Responsive tables inside task cards & markdown content */
.task-card-content table,
.render-md table,
.grading-criteria-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-sm, 8px) 0;
}

#pagination,
.pagination {
  flex-wrap: wrap !important;
}

/* ===== MARATHON ENHANCEMENTS ===== */
.marathon-nav-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 6px);
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg, 12px);
  margin-bottom: var(--space-lg, 16px);
  position: sticky;
  top: calc(var(--nav-height, 72px) + 8px);
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.marathon-nav-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
}

.marathon-nav-pill {
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.marathon-nav-pill:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.marathon-nav-pill.filled {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--primary-color, #2563eb);
  color: var(--primary-color, #2563eb);
  font-weight: 800;
}

[data-theme="dark"] .marathon-nav-pill.filled {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: #3b82f6;
}

.marathon-task-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.marathon-task-card.highlight-pulse {
  animation: taskPulse 1.2s ease;
}

@keyframes taskPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { transform: scale(1.01); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
  100% { transform: scale(1); box-shadow: none; }
}

/* Floating Bottom Action Bar */
.marathon-bottom-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: fit-content;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill, 9999px);
  padding: 8px 14px 8px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: slideUp 0.3s ease;
}



.marathon-bottom-bar.hidden {
  transform: translateX(-50%) translateY(100px);
  opacity: 0;
  pointer-events: none;
}

.marathon-bottom-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
}

.marathon-bottom-counter {
  font-weight: 800;
  font-size: 14px;
  color: var(--text-primary);
}

.marathon-bottom-label {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  #pagination,
  .pagination {
    gap: 4px !important;
  }
  #pagination button,
  .pagination button {
    padding: 4px 8px !important;
    font-size: 13px !important;
    min-width: 32px !important;
  }
}

/* Preserve the 3:1 desktop grid without its tables imposing intrinsic column widths. */
#app .students-groups-grid {
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) !important;
}
#app .students-groups-grid > div { min-width: 0; }

/* Keep authenticated mobile grids within the viewport; scroll wide tables locally. */
@media (max-width: 768px) {
  #app .students-groups-grid { grid-template-columns: minmax(0, 1fr) !important; }
  #app .students-groups-grid > div,
  #app .dashboard-widgets-grid > *,
  #app .an-row > *,
  #app .hw-create-grid > * { min-width: 0; }

  #app .dashboard-widgets-grid,
  #app .an-row,
  #app .hw-create-grid { grid-template-columns: minmax(0, 1fr); }

  #app .students-groups-grid .form-input,
  #app .hw-create-grid .form-input { min-width: 0; max-width: 100%; }

  #hw-widget .card > div > div:first-child,
  #app .hw-solve-header,
  #app .hc-left-header-top,
  #app .hc-header-actions { flex-wrap: wrap; }

  #app .hw-solve-header .hw-solve-title { flex-basis: 100%; white-space: normal; }
  #app .hc-left-header-top > * { min-width: 0; max-width: 100%; }
  #variants-pagination { flex-wrap: wrap; }
}



/* Course execution/list only. Shared homework components retain their rules. */
.chw-course [hidden], .chw-courses [hidden] { display:none !important; }
.chw-course .hw-solve-header { gap:8px; padding:12px; }
.chw-course .hw-solve-title { white-space:normal; overflow-wrap:anywhere; font-size:1rem; }
.chw-course .hw-solve-header-center { min-width:0; }
.chw-course .hw-solve-header > .btn { flex-shrink:0; padding:6px 8px; font-size:12px; }
.chw-course .chw-course-body { padding-top:16px; padding-bottom:180px; }
.chw-course .chw-course-progress { display:flex; flex-wrap:wrap; gap:6px 14px; align-items:center; }
.chw-course .chw-course-progress progress { flex-basis:100%; }
.chw-course progress, .chw-courses progress { width:100%; height:8px; accent-color:var(--primary-color); }
.chw-course .chw-course-tabs, .chw-courses .tabs { display:flex; margin:16px 0; }
.chw-course .chw-course-tabs .tab, .chw-courses .tab { flex:1; white-space:normal; }
.chw-course .hw-task-card { min-width:0; overflow-wrap:anywhere; }
.chw-course .hw-task-card-header { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:8px; margin-bottom:16px; }
.chw-course .hw-task-card-header > div { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.chw-course .hw-answer-wrap { margin-top:16px; display:flex; flex-direction:column; gap:8px; }
.chw-course .chw-answer-input { width:100%; min-width:0; }
.chw-course .chw-answer-input[readonly] { opacity:.8; }
.chw-course .chw-task-result, .chw-course .chw-teacher-comment { margin-top:10px; white-space:pre-wrap; }
.chw-course .chw-teacher-comment:not(:empty), .chw-course .chw-operation-note { padding:12px; background:var(--bg-secondary); border-radius:var(--radius-md,8px); border-left:3px solid var(--primary-color); margin:12px 0; }
.chw-course .chw-selected-files, .chw-course .chw-server-files { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.chw-course .chw-file-upload-block { display:flex; flex-direction:column; gap:8px; }
.chw-course .chw-answer-file { max-width:100%; font-size:12px; }
.chw-course small, .chw-courses small { display:block; color:var(--text-muted); }
.chw-course .chw-official-solution { margin-top:16px; border-top:1px solid var(--border-color); padding-top:12px; }
.chw-course .chw-official-solution summary { cursor:pointer; font-weight:600; }
.chw-course .hw-submit-bar .container { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; }
.chw-course .hw-submit-bar .container > div { min-width:0; flex:1 1 180px; }
.chw-course .hw-submit-bar .btn { flex:1 1 160px; }
.chw-course .chw-save-error { color:var(--error-color,var(--error)); }
.chw-courses { margin:0 0 24px; padding-bottom:20px; border-bottom:1px solid var(--border-color); }
.chw-courses #course-hw-pinned-list { display:flex; flex-direction:column; gap:12px; }
.chw-courses .chw-pinned-card { display:flex; align-items:center; gap:12px; color:inherit; text-decoration:none; border-left:4px solid var(--primary-color); }
.chw-courses .chw-pinned-card > div { flex:1; min-width:0; overflow-wrap:anywhere; }
.chw-courses h4 { margin:8px 0; }
.chw-courses .chw-pinned-card p { margin:8px 0 0; font-size:13px; }
.student-homework { max-width:1040px; }
.student-homework.container.section { padding:28px 20px 40px; }
.student-homework .section-title { font-size:28px; letter-spacing:-.5px; }
.student-homework .section-subtitle { font-size:14px; }
.student-homework .chw-courses { border:0; padding:0; margin-bottom:28px; }
.student-homework .chw-list-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; margin-bottom:18px; }
.student-homework .chw-list-header h3 { margin:0; font-size:18px; }
.student-homework #chw-list-tabs { display:grid; grid-template-columns:1fr 1fr; width:320px; max-width:100%; padding:4px; gap:4px; margin:0; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-secondary); overflow:visible; }
.student-homework #chw-list-tabs .tab { min-width:0; padding:10px 12px; margin:0; border:0; border-radius:8px; font-size:13px; white-space:normal; transition:background-color .12s,color .12s; }
.student-homework #chw-list-tabs .tab.active { background:var(--bg-card); color:var(--text-primary); box-shadow:0 1px 3px #00000008; }
.student-homework #course-hw-pinned-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.student-homework .chw-pinned-card { display:flex; flex-direction:column; align-items:stretch; gap:20px; padding:22px; border:1px solid var(--border-color); border-radius:16px; box-shadow:none; transition:border-color .12s; min-width:0; }
.student-homework .chw-pinned-card:hover { transform:none; box-shadow:none; border-color:var(--primary-deeper); }
.student-homework .chw-list-topic { color:var(--text-secondary); font-size:12px; }
.student-homework .chw-pinned-card h4 { margin:8px 0 18px; font-size:19px; line-height:1.35; overflow-wrap:anywhere; }
.student-homework .chw-list-progress-label { font-size:14px; margin-bottom:9px; }
.student-homework .chw-pinned-card progress { display:block; height:5px; border:0; border-radius:5px; overflow:hidden; accent-color:var(--primary-deeper); }
.student-homework .chw-pinned-card progress::-webkit-progress-bar { background:var(--border-light); }
.student-homework .chw-pinned-card progress::-webkit-progress-value { background:var(--primary-deeper); border-radius:5px; }
.student-homework .chw-pinned-card small { margin-top:10px; color:var(--text-secondary); font-size:12px; }
.student-homework .chw-list-hint { color:var(--text-secondary); line-height:1.5; }
.student-homework .chw-list-action { color:var(--primary-deeper); font-size:14px; font-weight:600; display:flex; align-items:center; justify-content:space-between; }
.student-homework .chw-list-empty { grid-column:1/-1; padding:32px 20px; text-align:center; color:var(--text-secondary); border:1px dashed var(--border-color); border-radius:14px; line-height:1.5; }
.student-homework .hw-ordinary-section { border-top:1px solid var(--border-color); padding-top:20px; }
.student-homework .hw-ordinary-section > summary { cursor:pointer; font-weight:600; font-size:15px; padding:4px 0; }
.student-homework .hw-ordinary-section > summary span { display:inline-block; margin-left:8px; font-size:12px; font-weight:400; color:var(--text-secondary); }
.student-homework .hw-ordinary-content { padding-top:20px; }
.student-homework #hw-tabs { flex-wrap:wrap; overflow:visible; border:0; gap:6px; }
.student-homework #hw-tabs .tab { margin:0; padding:8px 12px; border:1px solid var(--border-color); border-radius:8px; font-size:12px; }
@media(max-width:600px) {
  .student-homework.container.section { padding:24px 16px 32px; }
  .student-homework #course-hw-pinned-list { grid-template-columns:minmax(0,1fr); }
  .student-homework .chw-list-header { align-items:stretch; }
  .student-homework #chw-list-tabs { width:100%; }
  .student-homework .chw-pinned-card { padding:18px; }
  .student-homework .hw-ordinary-section > summary span { display:block; margin:6px 0 0 16px; }
}

/* Scoped overrides: shared mobile flex rules must not stretch the fixed submit bar. */
.chw-course .chw-course-body { padding-bottom:120px; }
.chw-course .chw-course-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; padding:4px; border:1px solid var(--border-color); border-radius:11px; background:var(--bg-secondary); overflow:visible; }
.chw-course .chw-course-tabs .tab { margin:0; padding:10px 8px; min-width:0; border:0; border-radius:7px; white-space:normal; }
.chw-course .chw-course-tabs .tab.active { background:var(--bg-card); color:var(--text-primary); }
.chw-course .hw-task-card-header { margin-bottom:18px; }
.chw-course .render-svg { margin:16px auto; }
.chw-course .chw-answer-heading { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:6px 12px; }
.chw-course .chw-task-status { color:var(--text-secondary); font-size:12px; font-weight:400; line-height:1.5; }
.chw-course .chw-status-success { color:var(--success-color,var(--success)); }
.chw-course .chw-status-error { color:var(--error-color,var(--error)); }
.chw-course .chw-answer-tools { display:flex; align-items:center; }
.chw-course .chw-theory-btn { color:var(--primary-deeper); background:var(--info-light); border:1px solid transparent; padding:7px 11px; min-height:34px; border-radius:8px; }
.chw-course #chw-submit-bar { padding:10px 0 calc(10px + env(safe-area-inset-bottom,0px)); }
.chw-course #chw-submit-bar > .container { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; padding:0 16px; text-align:left; }
.chw-course #chw-submit-bar > .container > div { flex:none; min-width:0; font-size:12px; line-height:1.45; }
.chw-course #chw-submit-btn { flex:none; width:auto; min-width:140px; min-height:44px; height:auto; margin:0; padding:10px 16px; border-radius:10px; font-size:13px; line-height:1.4; }
.chw-course #chw-submit-hint { font-size:11px; margin-top:2px; }
.chw-course #chw-submit-bar.chw-submit-recovery #chw-submit-hint { display:block; }
@media(max-width:600px) {
  .chw-course #chw-submit-hint { display:none; }
  .chw-course #chw-submit-btn { padding:10px 12px; font-size:12px; }
  .chw-course .chw-course-body { padding-inline:16px; }
}

/* Teacher course cabinet only; shared homework/review components keep their rules. */
.chw-teacher [hidden] { display:none !important; }
.chw-teacher { --ct-panel-height:clamp(440px,calc(100dvh - 260px),720px); padding-top:12px; }
.chw-teacher .card, .chw-teacher .card:hover, .chw-teacher .btn:hover, .chw-teacher .btn:active { transform:none; box-shadow:none; }
.chw-teacher .card, .chw-teacher .btn, .chw-teacher .tab { transition:background-color .12s, border-color .12s, color .12s; }
.chw-teacher .card { border-radius:18px; padding:0; }
.chw-teacher .btn { padding:11px 16px; min-height:40px; border-radius:10px; }
.chw-teacher .ct-header { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; }
.chw-teacher .ct-header h2, .chw-teacher .ct-header h3 { margin:0; overflow-wrap:anywhere; }
.chw-teacher .ct-page-header h2 { font-size:22px; }
.chw-teacher .ct-page-header p { margin:4px 0 0; color:var(--text-muted); font-size:13px; }
.chw-teacher .ct-layout { display:grid; grid-template-columns:240px minmax(0,1fr); gap:18px; align-items:start; overflow-anchor:none; }
.chw-teacher .ct-main { min-width:0; display:flex; flex-direction:column; height:var(--ct-panel-height); overflow:hidden; }
.chw-teacher .ct-recipients { display:flex; flex-direction:column; height:var(--ct-panel-height); min-width:0; overflow:hidden; }
.chw-teacher .ct-sidebar-head { padding:18px 16px 12px; flex-shrink:0; }
.chw-teacher .ct-sidebar-title-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 12px; }
.chw-teacher .ct-sidebar-title-row h3 { margin:0; font-size:15px; }
.chw-teacher .ct-sidebar-head > h3 { margin:0 0 12px; font-size:15px; }
.chw-teacher .ct-recipient-header-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.chw-teacher .ct-mobile-only { display:none; }
.chw-teacher .ct-recipients .tabs { display:flex; gap:4px; margin:0 0 12px; padding:3px; background:var(--bg-secondary); border:0; border-radius:10px; overflow:visible; }
.chw-teacher .ct-recipients .tab { flex:1; padding:8px; margin:0; border:0; border-radius:7px; font-size:13px; }
.chw-teacher .ct-recipients .tab.active { background:var(--bg-card); color:var(--text-primary); }
.chw-teacher #ct-recipients { overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; flex:1; min-height:0; padding:0 8px 8px; }
.chw-teacher .ct-recipient { width:100%; display:flex; flex-direction:column; align-items:flex-start; text-align:left; white-space:normal; overflow-wrap:anywhere; gap:3px; padding:11px 12px; border:1px solid transparent; border-radius:9px; }
.chw-teacher .ct-recipient strong { font-size:14px; font-weight:600; }
.chw-teacher .ct-recipient[aria-pressed="true"] { border-color:var(--primary-color); background:var(--primary-light); }
.chw-teacher .ct-recipient-header { display:flex; align-items:center; justify-content:space-between; flex-shrink:0; min-height:70px; gap:12px; padding:16px 22px; }
.chw-teacher .ct-recipient-header h3 { margin:0; font-size:18px; overflow-wrap:anywhere; }
.chw-teacher #ct-assignments { display:flex; gap:8px; padding:0 22px 12px; overflow-x:auto; flex-shrink:0; min-height:76px; scrollbar-gutter:stable; }
.chw-teacher .ct-assignment { display:flex; flex-direction:column; flex:0 0 172px; gap:5px; align-items:flex-start; justify-content:center; padding:10px 12px; border:1px solid var(--border-color); border-radius:10px; background:transparent; color:var(--text-primary); text-align:left; font:inherit; cursor:pointer; }
.chw-teacher .ct-assignment strong { font-size:13px; font-weight:600; line-height:1.35; }
.chw-teacher .ct-assignment:hover { background:var(--bg-secondary); }
.chw-teacher .ct-assignment[aria-pressed="true"] { border-color:var(--primary-dark); background:var(--bg-secondary); }
.chw-teacher #ct-course { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:4px 22px 20px; }
.chw-teacher #ct-workspace[aria-busy="true"] #ct-course { opacity:.6; }
.chw-teacher .ct-course-header { margin-bottom:8px; align-items:flex-start; }
.chw-teacher .ct-course-header h3 { font-size:22px; line-height:1.3; }
.chw-teacher .ct-course-header small { margin-top:6px; }
.chw-teacher .ct-empty { color:var(--text-muted); font-size:14px; margin:8px 0; }
.chw-teacher .ct-course-placeholder { display:grid; place-items:center; min-height:230px; text-align:center; }
.chw-teacher small { display:block; color:var(--text-muted); font-size:12px; white-space:normal; }
.chw-teacher input.form-input { width:100%; min-width:0; min-height:42px; padding:10px 12px; border-radius:10px; font-size:14px; }
.chw-teacher label { display:block; margin:14px 0 8px; font-size:14px; }
.chw-teacher .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.chw-teacher .ct-range-line { display:flex; align-items:center; gap:8px; max-width:370px; }
.chw-teacher .ct-range-line input { flex:0 1 100px; width:100px; font-weight:600; }
.chw-teacher .ct-range-line button { flex-shrink:0; }
.chw-teacher .ct-range-line small { flex:1; white-space:nowrap; }
.chw-teacher .ct-actions, .chw-teacher .ct-pages { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; }
.chw-teacher .ct-pages:empty { display:none; }
.chw-teacher .ct-recipients .ct-pages { padding:8px 16px; border-top:1px solid var(--border-color); margin:0; flex-shrink:0; }
.chw-teacher #ct-assignment-pages { padding:0 22px 8px; margin:0; }
.chw-teacher #ct-save { min-width:170px; }
.chw-teacher #ct-server-range { margin:0 0 12px; font-size:13px; color:var(--text-muted); }
.chw-teacher #ct-review-primary { float:right; margin:12px 0 12px 12px; }
.chw-teacher #ct-storage { min-height:20px; margin:8px 0 14px; font-size:12px; color:var(--text-muted); }
.chw-teacher .ct-advanced { margin-top:18px; padding-top:10px; border-top:1px solid var(--border-color); }
.chw-teacher .ct-advanced input { max-width:100px; }
.chw-teacher #ct-personal { clear:both; border-top:1px solid var(--border-color); padding-top:8px; }
.chw-teacher #ct-source:empty, .chw-teacher #ct-outcome:empty { display:none; }
.chw-teacher .ct-check { display:flex; align-items:flex-start; gap:10px; line-height:1.5; }
.chw-teacher .ct-check input { margin-top:5px; flex-shrink:0; }
.chw-teacher .ct-catalog-row, .chw-teacher .ct-personal-row { display:flex; flex-wrap:wrap; align-items:center; gap:10px; border-top:1px solid var(--border-color); padding:12px 0; }
.chw-teacher .ct-catalog-row > div { flex:1 1 170px; min-width:0; overflow-wrap:anywhere; }
.chw-teacher .ct-catalog-row a { font-size:13px; }
.chw-teacher .ct-personal-row strong { flex-basis:100%; }
.chw-teacher details summary { cursor:pointer; font-weight:500; margin:6px 0; font-size:13px; }
.chw-teacher #ct-status { flex-shrink:0; min-height:24px; padding:0 22px 4px; color:var(--text-muted); font-size:12px; line-height:20px; overflow-wrap:anywhere; }
.chw-teacher #ct-outcome:not(:empty), .chw-teacher .ct-warning { padding:12px; margin:12px 0; border-left:3px solid var(--primary-color); background:var(--bg-secondary); overflow-wrap:anywhere; }
.chw-teacher .card { min-width:0; overflow-wrap:anywhere; }
.chw-teacher .ct-menu { position:relative; flex-shrink:0; }
.chw-teacher .ct-menu summary { list-style:none; padding:4px 10px; border-radius:8px; font-size:18px; color:var(--text-muted); }
.chw-teacher .ct-menu summary::-webkit-details-marker { display:none; }
.chw-teacher .ct-menu > div { position:absolute; right:0; top:100%; z-index:5; display:flex; flex-direction:column; gap:8px; width:210px; padding:12px; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-card); box-shadow:var(--shadow-md); }
.chw-teacher .ct-menu a { font-size:13px; padding:8px; }
.chw-teacher .ct-catalog-dialog { width:min(640px,calc(100vw - 32px)); max-height:80dvh; margin:auto; padding:24px; border:1px solid var(--border-color); border-radius:18px; background:var(--bg-card); color:var(--text-primary); overflow-y:auto; }
.chw-teacher .ct-catalog-dialog::backdrop { background:rgba(0,0,0,.3); }
.chw-teacher .ct-catalog-dialog h3 { font-size:20px; }
@media(max-width:768px) {
  .chw-teacher .ct-layout { grid-template-columns:minmax(0,1fr); gap:12px; }
  .chw-teacher .ct-mobile-only { display:inline-flex; }
  .chw-teacher .ct-recipients { height:auto; max-height:none; overflow:visible; }
  .chw-teacher #ct-recipients { min-height:200px; max-height:min(340px, 46dvh); padding:4px 10px 10px; }
  .chw-teacher .ct-recipients.is-collapsed #ct-recipients,
  .chw-teacher .ct-recipients.is-collapsed #ct-recipient-pages { display:none; }
  .chw-teacher .ct-recipients .tab { min-height:42px; padding:9px 10px; }
  .chw-teacher .ct-recipient { min-height:48px; padding:11px 14px; }
  .chw-teacher .ct-main { height:clamp(600px, 84dvh, 760px); }
  .chw-teacher .ct-sidebar-head { padding:12px; }
  .chw-teacher .ct-sidebar-title-row { margin-bottom:8px; }
  .chw-teacher .ct-recipients .tabs { margin-bottom:8px; }
  .chw-teacher .ct-recipient-header { padding:14px; flex-wrap:wrap; }
  .chw-teacher #ct-assignments { padding-left:14px; padding-right:14px; scroll-snap-type:inline proximity; }
  .chw-teacher .ct-assignment { flex:0 0 min(210px, 72vw); scroll-snap-align:start; }
  .chw-teacher #ct-course { padding:4px 14px 16px; }
  .chw-teacher #ct-status { padding-left:14px; padding-right:14px; }
  .chw-teacher .ct-page-header { align-items:flex-start; }
  .chw-teacher .ct-page-header h2 { font-size:20px; }
  .chw-teacher .ct-page-header p { display:none; }
  .chw-teacher #ct-review-primary { float:none; margin:0 0 12px; }
  .chw-teacher .ct-actions .btn { padding-left:12px; padding-right:12px; }
  .chw-teacher .ct-course-header h3 { font-size:20px; }
  .chw-teacher .ct-catalog-dialog { padding:18px; }
}

/* Course homework teacher review only; shared .ac-* rules keep their defaults for ordinary check */
.chw-teacher { --ct-accent:#356f9b; max-width:1280px; margin-inline:auto; padding:16px 24px 28px; }
.chw-teacher .ct-page-header { padding:8px 0 18px; margin-bottom:0; }
.chw-teacher .ct-recipient-header { border-bottom:1px solid var(--border-light); margin-bottom:16px; }
.chw-teacher .ct-recipient small { color:var(--text-secondary); font-weight:400; }
.chw-teacher .ct-recipient[aria-pressed="true"] { border-color:transparent; background:var(--info-light); box-shadow:inset 3px 0 var(--ct-accent); }
.chw-teacher .ct-assignment[aria-pressed="true"] { border-color:var(--ct-accent); background:var(--info-light); }
.chw-teacher .ct-work-summary { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin:18px 0 22px; padding:16px; border:1px solid var(--border-light); border-radius:12px; }
.chw-teacher .ct-work-summary #ct-server-range { margin:6px 0 0; color:var(--text-primary); font-size:14px; }
.chw-teacher .ct-work-summary #ct-review-primary { float:none; margin:0; color:var(--ct-accent); background:var(--bg-card); }
.chw-teacher .ct-eyebrow { color:var(--text-secondary); font-size:12px; font-weight:600; }
.chw-teacher #ct-range-form { padding:18px; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-elevated); }
.chw-teacher .ct-form-heading h4 { margin:6px 0; font-size:17px; }
.chw-teacher .ct-form-heading p { margin:0 0 16px; color:var(--text-secondary); font-size:13px; line-height:1.5; max-width:440px; }
.chw-teacher #ct-save, .chw-teacher #ct-add-course { background:var(--ct-accent); color:white; border-color:var(--ct-accent); }
.chw-teacher #ct-add-course:disabled { opacity:.45; }
.chw-teacher .ct-catalog-row { padding:16px 0; }
.chw-teacher .ct-catalog-row strong { font-size:15px; }
.chw-teacher .ct-catalog-row small { margin-top:5px; }
.chw-teacher .ct-course-header h3 { font-size:23px; letter-spacing:-.4px; }
.chw-teacher .ct-course-progressbar { display:block; width:180px; max-width:100%; height:5px; margin-top:10px; border:0; border-radius:5px; accent-color:var(--ct-accent); overflow:hidden; }
.chw-teacher .ct-course-progressbar::-webkit-progress-bar { background:var(--border-light); }
.chw-teacher .ct-course-progressbar::-webkit-progress-value { background:var(--ct-accent); border-radius:5px; }
@media(max-width:768px) {
  .chw-teacher { padding:12px; }
  .chw-teacher #ct-range-form { padding:14px; }
  .chw-teacher .ct-work-summary { padding:14px; }
}
.chw-review .container.section { padding-top:16px; }
.chw-review .ac-task-card, .chw-review .ac-task-card:hover { transform:none; box-shadow:none; border-radius:16px; transition:none; }
.chw-review .ac-task-card { content-visibility:auto; contain-intrinsic-size:auto 560px; }
.chw-review .ac-sticky-header { box-shadow:none; border:1px solid var(--border-color); border-radius:14px; }
.chw-review .chw-solution { margin-top:16px; border-top:1px solid var(--border-color); }
.chw-review .chw-solution summary { padding:14px 0; cursor:pointer; color:var(--primary-deeper); font-size:14px; font-weight:600; }
.chw-review .chw-solution img { max-width:100%; border-radius:8px; }
.chw-review .chw-attempt-summary { margin-bottom:14px; padding:8px 10px; border-radius:8px; background:var(--info-light); color:var(--text-primary); font-size:13px; font-weight:500; }
.chw-review .chw-history-legacy-notice { color:var(--text-secondary); font-size:12px; margin-bottom:10px; }
.chw-review .chw-review-filters { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:18px; }
.chw-review .chw-review-filters button { border-radius:9px; }
.chw-review .chw-review-filters [aria-pressed="true"] { background:var(--info-light); border-color:var(--primary-deeper); color:var(--text-primary); }
html:has(.chw-review) {
  scroll-padding-top: 80px;
  scroll-padding-bottom: 110px;
}
body:has(.chw-review) #main-footer {
  display: none;
}
.chw-review [hidden] { display: none !important; }
.chw-review .ac-task-card { min-width: 0; overflow-wrap: anywhere; }
.chw-review .ac-student-col { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 768px) {
  .chw-review .ac-sticky-header {
    position: static;
    box-shadow: none;
    margin-bottom: var(--space-md);
    padding: var(--space-md);
  }
  .chw-review .container.section {
    padding-bottom: 160px !important;
  }
  .chw-review .ac-batch-save-bar {
    padding: 10px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    text-align: center;
  }
  .chw-review .ac-batch-save-bar button {
    width: 100%;
  }
}

/* ===== ADMIN TABS BAR (SINGLE-ROW SWIPEABLE ON MOBILE/TABLET) ===== */
.admin-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
}

@property --tab-fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --tab-fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@keyframes admin-tabs-fade-edges {
  0%   { --tab-fade-start: 0px;  --tab-fade-end: 28px; }
  8%   { --tab-fade-start: 28px; --tab-fade-end: 28px; }
  92%  { --tab-fade-start: 28px; --tab-fade-end: 28px; }
  100% { --tab-fade-start: 28px; --tab-fade-end: 0px; }
}

@media (max-width: 900px) {
  .admin-tabs-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: inline proximity;
    scroll-padding-inline: 24px;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 2px;
  }
  .admin-tabs-bar::-webkit-scrollbar {
    display: none;
  }
  .admin-tabs-bar .tab {
    flex: none;
    min-height: 44px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  @supports (animation-timeline: scroll()) {
    .admin-tabs-bar {
      mask-image: linear-gradient(
        to right,
        transparent 0,
        black var(--tab-fade-start),
        black calc(100% - var(--tab-fade-end)),
        transparent 100%
      );
      animation: admin-tabs-fade-edges linear both;
      animation-timeline: scroll(self inline);
    }
  }
}

/* ===== ADMIN ANALYTICS GRID ===== */
.admin-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.admin-analytics-grid > * {
  min-width: 0;
}
@media (max-width: 900px) {
  .admin-analytics-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-analytics-dashboard {
    padding: 12px 0 !important;
  }
}
