/* ═══════════════════════════════════════════════════════════════════════════
   SchoolNet — Головний CSS (без CDN, офлайн-сумісний)
   Підтримка: CSS-змінні, темна/світла тема, адаптивний mobile-first
   ═══════════════════════════════════════════════════════════════════════════ */

/* Шрифти: системний стек (офлайн, без CDN, менше навантаження на ПК) */

/* ─── CSS Змінні — Світла тема (default) ───────────────────────────────────── */
:root {
  /* Основні кольори */
  --color-bg: #f4f5f8;
  --color-bg-secondary: #eceef4;
  --color-surface: #ffffff;
  --color-surface-hover: #f7f8fc;
  --color-border: #e2e5ee;
  --color-border-light: #eef0f6;

  /* Текст */
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #59677c;
  --color-text-inverse: #ffffff;

  /* Бренд / акцент */
  --color-primary: #4f46e5;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #e0e7ff;
  --color-primary-text: #4338ca;

  /* Статуси */
  --color-success: #047857;
  --color-success-light: #d1fae5;
  --color-warning: #92400e;
  --color-warning-light: #fef3c7;
  --color-danger: #b91c1c;
  --color-danger-light: #fee2e2;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;

  /* Картки та тіні (легкі, без дорогих розмивань) */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 0 3px rgba(99,102,241,0.14);

  /* Заокруглення */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Навбар */
  --navbar-bg: rgba(255, 255, 255, 0.92);
  --navbar-border: rgba(225, 228, 237, 0.8);

  /* Анімації */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Сайдбар */
  --sidebar-width: 240px;

  /* Блок опису завдання вчителя (Світла тема) */
  --desc-card-bg: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  --desc-card-border: #cbd5e1;
  --desc-card-accent: #4f46e5;
  --desc-header-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.14) 0%, rgba(139, 92, 246, 0.08) 100%);
  --desc-header-border: rgba(99, 102, 241, 0.25);
  --desc-header-text: #312e81;
  --desc-header-badge-bg: rgba(99, 102, 241, 0.16);
  --desc-header-badge-text: #312e81;
  --desc-body-text: #0f172a;
  --desc-shadow: 0 4px 20px rgba(99, 102, 241, 0.1), 0 1px 4px rgba(15, 23, 42, 0.06);
}

/* ─── CSS Змінні — Темна тема ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg: #0d1117;
  --color-bg-secondary: #161b22;
  --color-surface: #1c2333;
  --color-surface-hover: #242d3d;
  --color-border: #2d3748;
  --color-border-light: #252f40;

  --color-text-primary: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #0f172a;

  --color-primary: #818cf8;
  --color-primary-hover: #6366f1;
  --color-primary-light: #1e1b4b;
  --color-primary-text: #a5b4fc;

  --color-success: #34d399;
  --color-success-light: #064e3b;
  --color-warning: #fbbf24;
  --color-warning-light: #451a03;
  --color-danger: #f87171;
  --color-danger-light: #450a0a;
  --color-info: #60a5fa;
  --color-info-light: #172554;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6), 0 8px 20px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 0 3px rgba(129,140,248,0.2);

  --navbar-bg: rgba(28, 35, 51, 0.95);
  --navbar-border: rgba(45, 55, 72, 0.8);

  /* Блок опису завдання вчителя (Темна тема) */
  --desc-card-bg: linear-gradient(180deg, #161e2e 0%, #111827 100%);
  --desc-card-border: rgba(129, 140, 248, 0.4);
  --desc-card-accent: #818cf8;
  --desc-header-bg: linear-gradient(135deg, rgba(129, 140, 248, 0.25) 0%, rgba(168, 85, 247, 0.15) 100%);
  --desc-header-border: rgba(129, 140, 248, 0.32);
  --desc-header-text: #e0e7ff;
  --desc-header-badge-bg: rgba(129, 140, 248, 0.28);
  --desc-header-badge-text: #ffffff;
  --desc-body-text: #f8fafc;
  --desc-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(129, 140, 248, 0.25);
}

/* ─── Ресет та базові стилі ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
  overflow-x: clip;
  max-width: 100%;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  text-rendering: optimizeSpeed;
  overflow-x: clip;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.site-footer {
  margin-top: auto;
  text-align: center;
  padding: 22px 16px;
  font-size: 12px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

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

img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

p, span, h1, h2, h3, h4, h5, h6, li, td, th {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

pre, code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* ─── Навбар ─────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  height: 56px;
}

/* ─── Навбар у Режимі Супер-Адміністратора (Привертає увагу та захищає від помилок) ─── */
.navbar.navbar-superadmin {
  background: linear-gradient(135deg, #1e1b4b 0%, #3b0764 45%, #7f1d1d 100%) !important;
  border-bottom: 2px solid #f59e0b !important;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.25), 0 0 15px rgba(245, 158, 11, 0.2) !important;
}

.navbar.navbar-superadmin .navbar-brand,
.navbar.navbar-superadmin .navbar-brand span {
  color: #fef08a !important;
}

.navbar.navbar-superadmin .navbar-brand .brand-icon {
  background: linear-gradient(135deg, #f59e0b, #ef4444) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.superadmin-top-banner {
  background: #7f1d1d;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  color: #ffffff;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-brand span {
  color: #ffffff;
}

.navbar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.navbar-search {
  flex: 0 1 240px;
  max-width: 280px;
  position: relative;
  transition: flex 0.25s ease, max-width 0.25s ease;
}

.navbar-search input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13.5px;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.navbar-search input::placeholder {
  color: rgba(226, 232, 240, 0.55);
}

.navbar-search:focus-within {
  flex: 0 1 340px;
  max-width: 360px;
}

.navbar-search input:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
  background: rgba(255, 255, 255, 0.14);
}

.navbar-search .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(226, 232, 240, 0.6);
  font-size: 13px;
  pointer-events: none;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

/* ─── Перемикач теми ────────────────────────────────────────────────────────── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px;
  flex: 1 0 auto;
}

.feed-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* ─── Сайдбар ────────────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

@media (max-width: 880px) {
  .feed-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    display: none;
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    z-index: 90 !important;
    width: min(300px, 88vw) !important;
    max-height: calc(100vh - 56px) !important;
    padding: 12px;
    background: var(--color-bg);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  .sidebar.mobile-open {
    display: block !important;
  }
  body.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(15, 23, 42, 0.28);
    z-index: 80;
  }
}

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

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

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

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.sidebar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.sidebar-header {
  padding: 10px 14px;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-list {
  list-style: none;
}

.sidebar-list li a,
.sidebar-list li button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.sidebar-list li a:hover,
.sidebar-list li button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.sidebar-list li.active a,
.sidebar-list li.active button {
  background: var(--color-primary-light);
  color: var(--color-primary-text);
  font-weight: 600;
}

.class-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ГУГЛ КАЛЕНДАР — ВІДЖЕТ
   ═══════════════════════════════════════════════════════════════════════════════ */
.calendar-card {
  padding: 14px 12px;
}

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

.cal-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cal-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1;
  padding: 0;
}

.cal-nav-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.cal-today-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.2;
}

.cal-today-btn:hover {
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  user-select: none;
}

.cal-weekdays span {
  padding: 3px 0;
}

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

.cal-day {
  min-height: 38px;
  height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 1px;
  margin: 0;
}

.cal-day-number {
  font-size: 12.5px;
  line-height: 1.1;
  font-weight: 600;
  display: block;
}

.cal-task-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  background: var(--color-primary);
  color: #fff;
  min-width: 14px;
  height: 13px;
  line-height: 13px;
  text-align: center;
  border-radius: var(--radius-full);
  padding: 0 3px;
}

.cal-task-spacer {
  height: 13px;
  display: block;
}

.cal-day:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-border);
}

.cal-day.cal-other-month {
  color: var(--color-text-muted);
  opacity: 0.35;
}

.cal-day.cal-today {
  font-weight: 800;
  color: var(--color-primary);
}

.cal-day.cal-today .cal-day-number {
  font-weight: 800;
}

.cal-day.cal-today::before {
  content: '';
  position: absolute;
  inset: 1px;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  pointer-events: none;
}

.cal-day.cal-selected {
  background: var(--color-primary) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  border-color: var(--color-primary) !important;
}

.cal-day.cal-selected .cal-day-number {
  color: #ffffff !important;
}

.cal-day.cal-selected::before {
  border-color: #ffffff !important;
}

.cal-day.cal-selected .cal-task-badge {
  background: #ffffff;
  color: var(--color-primary);
}

.cal-day.cal-has-tasks {
  font-weight: 700;
}

.cal-day.cal-has-tasks:not(.cal-selected) {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
}

.cal-day.cal-has-tasks:not(.cal-selected):hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: var(--color-primary);
}

.cal-selected-bar {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-primary);
  font-weight: 600;
}

.cal-clear-btn {
  font-size: 11px;
  color: var(--color-danger);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  padding: 2px 4px;
}
.cal-clear-btn:hover {
  text-decoration: underline;
}

/* ─── Картки завдань (стрічка) ───────────────────────────────────────────────── */
.assignments-feed {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.assignment-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal), opacity var(--transition-normal), filter var(--transition-normal);
  cursor: pointer;
}

.assignment-card:hover {
  box-shadow: var(--shadow-md);
  transform: none;
  border-color: var(--color-primary);
}

.card-accent {
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), #8b5cf6);
  flex-shrink: 0;
}

.card-body {
  padding: 12px 14px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

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

.subject-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-primary-light);
  color: var(--color-primary-text);
}

/* ─── Виразні бейджі класів з актуальністю до уроків ─── */
.class-prominent-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  background: var(--color-primary-light);
  color: var(--color-primary-text);
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  letter-spacing: 0.02em;
  transition: all 0.25s ease;
}

/* Актуальний клас: урок триває ЗАРАЗ — світиться яскравим зеленим і пульсує */
.class-prominent-badge.class-status-now {
  background: rgba(16, 185, 129, 0.18);
  color: #065f46;
  border: 1.5px solid #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4), inset 0 0 4px rgba(16, 185, 129, 0.15);
  animation: pulse-badge-green 2.2s infinite ease-in-out;
}

/* Урок СЬОГОДНІ — насичений зелений бейдж */
.class-prominent-badge.class-status-today {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1.5px solid rgba(16, 185, 129, 0.45);
}

/* Майбутній урок — синій/індиго */
.class-prominent-badge.class-status-upcoming {
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
  border: 1.5px solid rgba(59, 130, 246, 0.35);
}

/* Пройдений урок — сірий згаслий */
.class-prominent-badge.class-status-past {
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  opacity: 0.82;
}

/* Темна тема для бейджів класів */
[data-theme="dark"] .class-prominent-badge.class-status-now {
  background: rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
  border-color: #34d399;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.5);
}

[data-theme="dark"] .class-prominent-badge.class-status-today {
  background: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.45);
}

[data-theme="dark"] .class-prominent-badge.class-status-upcoming {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .class-prominent-badge.class-status-past {
  background: rgba(255, 255, 255, 0.05);
  color: #9ca3af;
  border-color: rgba(255, 255, 255, 0.12);
}

.class-time-hint {
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.92;
  margin-left: 2px;
}

.class-dot-today {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

@keyframes pulse-badge-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.class-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.individual-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  background: rgba(147, 51, 234, 0.12);
  color: #7e22ce;
  border: 1px solid rgba(147, 51, 234, 0.32);
  box-shadow: 0 1px 3px rgba(147, 51, 234, 0.06);
  letter-spacing: 0.01em;
}

[data-theme="dark"] .individual-tag {
  background: rgba(168, 85, 247, 0.18);
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.4);
}

.views-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  user-select: none;
}

.views-badge:hover {
  color: var(--color-primary);
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
}

.views-badge .views-icon {
  font-size: 12px;
}

[data-theme="dark"] .views-badge {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--color-text-muted);
}

[data-theme="dark"] .views-badge:hover {
  color: #a5b4fc;
  border-color: rgba(165, 180, 252, 0.4);
  background: rgba(165, 180, 252, 0.12);
}

.unarchive-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: #0f766e;
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.3);
  letter-spacing: 0.01em;
}

[data-theme="dark"] .unarchive-badge {
  color: #5eead4;
  background: rgba(94, 234, 212, 0.14);
  border-color: rgba(94, 234, 212, 0.35);
}

/* ─── Візуальне старіння/затемнення завдань ─── */
.assignment-card {
  transition: box-shadow 0.22s ease, filter 0.25s ease, opacity 0.25s ease, border-color 0.25s ease;
}

.assignment-card.card-age-today {
  opacity: 1;
  filter: none;
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.08);
}

.assignment-card.card-age-yesterday {
  opacity: 0.93;
  filter: saturate(0.85) contrast(0.97);
  background: var(--color-surface);
}

.assignment-card.card-age-2days {
  opacity: 0.86;
  filter: grayscale(0.35) saturate(0.65) contrast(0.95);
}

.assignment-card.card-age-3days {
  opacity: 0.79;
  filter: grayscale(0.60) saturate(0.45) contrast(0.92);
}

.assignment-card.card-age-older {
  opacity: 0.72;
  filter: grayscale(0.90) contrast(0.88);
}

.assignment-card:hover {
  opacity: 1 !important;
  filter: none !important;
  box-shadow: var(--shadow-md) !important;
  transform: none !important;
  border-color: var(--color-primary) !important;
}

/* ─── Розумні бейджі дати ─── */
.publish-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}

.publish-date-badge.badge-today {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.32);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 12px;
}

.publish-date-badge.badge-yesterday {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.32);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 12px;
}

.publish-date-badge.badge-earlier {
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
}

.publish-date-badge.badge-relevance-now {
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.45);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.publish-date-badge.badge-relevance-today {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.32);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 12px;
}

.publish-date-badge.badge-relevance-upcoming {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.32);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 12px;
}

.publish-date-badge.badge-relevance-past {
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
}

.live-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot 1.8s infinite ease-in-out;
}

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

/* Темна тема для бейджів актуальності */
[data-theme="dark"] .publish-date-badge.badge-relevance-now {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.35);
}

[data-theme="dark"] .publish-date-badge.badge-relevance-today {
  background: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.4);
}

[data-theme="dark"] .publish-date-badge.badge-relevance-upcoming {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .publish-date-badge.badge-relevance-past {
  background: rgba(255, 255, 255, 0.05);
  color: #9ca3af;
  border-color: rgba(255, 255, 255, 0.12);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 4px;
  line-height: 1.35;
}

.card-description {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  background: var(--desc-card-bg);
  border: 1px solid var(--desc-card-border);
  border-left: 3px solid var(--desc-card-accent);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  margin-top: 5px;
  margin-bottom: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.card-description b,
.card-description strong {
  font-weight: 700;
  color: var(--color-text-primary);
}

.card-description code {
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  background: rgba(99, 102, 241, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  border-top: 1px solid var(--color-border-light);
  gap: 8px;
  flex-wrap: wrap;
}

.card-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.teacher-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.avatar-mini {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-mini-img {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.teacher-avatar-img {
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border: 2px solid var(--color-border);
}

.attachment-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.due-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.btn-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-primary);
  color: white;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}
.btn-open:hover {
  background: var(--color-primary-hover);
  transform: scale(1.03);
}

/* ─── Модальне вікно ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition-normal);
  border: 1px solid var(--color-border);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  z-index: 1;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  line-height: 1;
}
.modal-close:hover {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

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

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-description {
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  margin-bottom: 20px;
}

/* ─── Файли ──────────────────────────────────────────────────────────────────── */
.files-section {
  margin-top: 16px;
}

.files-section h4 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  transition: all var(--transition-fast);
}
.file-item:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
}

.file-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-view, .btn-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
}

.btn-view {
  background: var(--color-info-light);
  color: var(--color-info);
}
.btn-view:hover { filter: brightness(0.9); }

.btn-download {
  background: var(--color-success-light);
  color: var(--color-success);
}
.btn-download:hover { filter: brightness(0.9); }

.link-section {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.link-section a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.link-section a:hover {
  background: var(--color-primary-hover);
  transform: scale(1.02);
}

/* ─── Кнопки ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.btn-ai-explain {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(99, 102, 241, 0.12) 100%) !important;
  border: 2px solid #f59e0b !important;
  color: #b45309 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.22) !important;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-ai-explain:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.38) !important;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(99, 102, 241, 0.2) 100%) !important;
  color: #92400e !important;
}
[data-theme="dark"] .btn-ai-explain {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(99, 102, 241, 0.25) 100%) !important;
  border-color: #fbbf24 !important;
  color: #fef08a !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3) !important;
}
[data-theme="dark"] .btn-ai-explain:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3) 0%, rgba(99, 102, 241, 0.35) 100%) !important;
  color: #ffffff !important;
}

.btn-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

.btn-success {
  background: var(--color-success-light);
  color: var(--color-success);
}
.btn-success:hover {
  background: var(--color-success);
  color: white;
}

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

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Форми ──────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition-fast);
  line-height: 1.5;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--color-danger);
  margin-top: 4px;
}

/* Чекбокс-група */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.checkbox-group label:hover {
  background: var(--color-surface-hover);
}

/* Вибір класів у формі завдання — гарні кнопки-мітки з автоматом перенесення */
.class-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  padding: 4px 0;
}

.class-checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-sizing: border-box;
}

.class-checkbox-group label:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary-text);
}

.class-checkbox-group label input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
  margin: 0;
}

.btn-remove-chip {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 0 4px;
  margin-left: 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-remove-chip:hover {
  background: var(--color-danger-light);
  transform: scale(1.2);
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Завантаження файлів */
.file-upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--color-bg-secondary);
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.file-upload-area .upload-icon { font-size: 32px; margin-bottom: 8px; }
.file-upload-area .upload-text { font-size: 14px; color: var(--color-text-secondary); }
.file-upload-area .upload-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.form-file-input { display: none; }

/* Вибір публікації */
.publish-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.publish-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.publish-option:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
}
.publish-option input[type="radio"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}
.publish-option.selected {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}
.publish-option-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
}

/* ─── Панель вчителя ─────────────────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--color-bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.tab-btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  color: var(--color-text-secondary);
  background: none;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--color-text-primary);
  background: rgba(99, 102, 241, 0.08);
}

.tab-btn:active {
  transform: scale(0.96);
}

.tab-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transform: scale(1.02);
}

.tab-count {
  background: var(--color-bg);
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.tab-btn.active .tab-count {
  background: var(--color-primary-light);
  color: var(--color-primary-text);
}

/* ─── Анімація перемикання вкладок панелі ─── */
.dashboard-list-animated {
  animation: dashboardFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dashboardFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Картки в панелі */
.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition-normal);
}
.dashboard-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.dashboard-card-content {
  flex: 1;
  min-width: 0;
}

.dashboard-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-card-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.dashboard-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Статус-мітки */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.status-published { background: var(--color-success-light); color: var(--color-success); }
.status-draft { background: var(--color-bg-secondary); color: var(--color-text-muted); }
.status-scheduled { background: var(--color-warning-light); color: var(--color-warning); }
.status-archived { background: var(--color-info-light); color: var(--color-info); }

/* ─── Профіль вчителя (авватар) ─────────────────────────────────────────────── */
.teacher-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ─── Повідомлення (Django messages) ─────────────────────────────────────────── */
.messages-container {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  width: calc(100vw - 32px);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid transparent;
  animation: slideInRight 0.3s ease;
  position: relative;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.alert-success { background: var(--color-success-light); color: var(--color-success); border-color: var(--color-success); }
.alert-error { background: var(--color-danger-light); color: var(--color-danger); border-color: var(--color-danger); }
.alert-warning { background: var(--color-warning-light); color: var(--color-warning); border-color: var(--color-warning); }
.alert-info { background: var(--color-info-light); color: var(--color-info); border-color: var(--color-info); }

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 16px;
  opacity: 0.6;
  padding: 0;
  line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ─── Порожній стан ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--color-text-primary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--color-text-muted); margin-bottom: 20px; }

/* ─── Форма входу ────────────────────────────────────────────────────────────── */
.login-page {
  min-height: calc(100vh - 140px);
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 32px 16px;
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  border-radius: var(--radius-lg);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: var(--shadow-md);
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text-primary);
}
.login-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ─── Форма завдання ─────────────────────────────────────────────────────────── */
.form-page {
  width: 100%;
  max-width: 100%;
}

.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}


.form-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.form-card-body {
  padding: 24px;
}

.form-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--color-border-light);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}

.form-row > * {
  min-width: 0;
}

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

/* Існуючі файли при редагуванні */
.existing-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.existing-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}

.delete-file-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-danger);
  cursor: pointer;
  margin-left: auto;
}

/* Попередній перегляд завантажених файлів */
.upload-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.upload-preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

/* ─── Мобільний фільтр-бар ───────────────────────────────────────────────────── */
.mobile-filter-bar {
  display: none;
  overflow-x: auto;
  gap: 8px;
  padding: 0 4px 8px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-filter-bar::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
  .mobile-filter-bar { display: flex; }
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--transition-fast);
  font-family: inherit;
}
.filter-chip:hover, .filter-chip.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary-text);
}

/* ─── Загальні утиліти ───────────────────────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 13px; }
.fw-bold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* Divider */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 16px 0;
}

/* Завантаження (спінер) */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Скролбар (chromium) ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ─── Медіазапити (адаптивність) ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nav-btn-text { display: none; }
}

@media (max-width: 480px) {
  .navbar-search { display: none; }
  .login-card { padding: 28px 20px; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-height: 85vh; }
  .page-wrapper { padding: 16px 12px; }
}

/* Анімація появи карток */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.assignment-card {
  animation: none;
}

/* ─── Підсвітка синтаксису коду ────────────────────────────────────────────── */
.code-comment {
  color: #727e96;
  font-style: italic;
}
.code-string {
  color: #22c55e; /* Зелений */
}
.code-keyword {
  color: var(--color-primary);
  font-weight: bold;
}
.code-builtin {
  color: #f59e0b; /* Помаранчевий */
}
.code-number {
  color: #ec4899; /* Рожевий */
}

/* ─── Плавні переходи між сторінками (View Transitions API) ───────────────── */
/* Opt-in is declared early in base.html; external CSS can arrive after pagereveal. */
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: .14s;
  animation-timing-function: ease-out;
}

/* М'яка поява сторінки при переході без блимання */
@keyframes pageSmoothIn {
  0% { opacity: 0.92; }
  100% { opacity: 1; }
}
body {
  animation: pageSmoothIn 0.12s ease-out;
}

/* ─── Глобальний індикатор завантаження (Top Progress Bar) ──────────────────── */
#global-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3.5px;
  background: linear-gradient(90deg, var(--color-primary), #818cf8, #c084fc);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.75), 0 0 4px var(--color-primary);
  z-index: 9999999;
  transition: width 0.22s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.2s ease;
  pointer-events: none;
  opacity: 0;
}
#global-progress-bar.active {
  opacity: 1;
}

/* Плаваюча плашка очікування завантаження (зрозумілий статус без блимань) */
.global-loading-indicator {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px) scale(0.95);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0,0,0,0.06);
  border-radius: 24px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999998;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}
.global-loading-indicator.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.loading-spinner-ring {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(99, 102, 241, 0.25);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spinRing 0.6s linear infinite;
  display: inline-block;
}
@keyframes spinRing {
  to { transform: rotate(360deg); }
}
.global-loading-indicator:not(.active) .loading-spinner-ring { animation: none; }

/* Легка поява карток без блимання всієї сторінки */
@keyframes cardGlideIn {
  from { opacity: 0.75; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .assignments-feed .assignment-card:nth-child(-n+6) {
    animation: cardGlideIn 0.16s ease both;
  }
}

/* ─── Тактильні мікро-інтеракції кнопок і фільтрів ─────────────────────────── */
.btn {
  transition: transform 0.14s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.14s ease, background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.97);
}

.filter-chip {
  transition: transform 0.16s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.filter-chip:hover {
  background: var(--color-surface-hover);
}

.filter-chip:active {
  transform: scale(0.94);
}

.sidebar-list a {
  transition: background-color 0.12s ease, color 0.12s ease;
}

/* ─── Skeleton Loading Shimmer при повільному зв'язку ──────────────────────── */
.feed-skeleton-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.feed-skeleton-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.18) 25%,
    rgba(255, 255, 255, 0.38) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmerAnim 1.2s infinite;
}

[data-theme="dark"] .feed-skeleton-card::after {
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0) 100%
  );
}

@keyframes shimmerAnim {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-bar {
  height: 14px;
  background: var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  opacity: 0.6;
}
.skeleton-bar.badge { width: 90px; height: 22px; border-radius: 20px; }
.skeleton-bar.title { width: 60%; height: 20px; }
.skeleton-bar.text-line { width: 95%; }
.skeleton-bar.text-short { width: 45%; }

/* ─── Стилізація DOCX прев'ю ─────────────────────────────────────────────────── */
.docx-preview-content h1,
.docx-preview-content h2,
.docx-preview-content h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--color-text-primary);
  font-weight: 700;
}
.docx-preview-content p {
  margin-bottom: 12px;
}
.docx-preview-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.docx-preview-content th,
.docx-preview-content td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
}
.docx-preview-content th {
  background: var(--color-bg-secondary);
  font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   СИСТЕМА ЗДАЧІ РОБІТ — SchoolNet+
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Кнопка "Здати роботу" для учня */
.btn-submit-work {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-submit-work:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  color: #fff;
}

/* Кнопка "Здачі" для вчителя */
.btn-submissions {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-submissions:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  color: #fff;
}

/* Значок кількості здач */
.submissions-count-badge {
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.submissions-count-badge.badge-ungraded {
  background: rgba(239, 68, 68, 0.45);
}

/* ── Загальний значок "неоціненого" в панелі вчителя ─────────────────────── */
.ungraded-alert-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Форма здачі ──────────────────────────────────────────────────────────── */
.submit-page-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

.submit-assignment-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.submit-assignment-header {
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  padding: 20px 24px;
  color: #fff;
}

.submit-assignment-header h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
}

.submit-assignment-header p {
  margin: 0;
  opacity: 0.85;
  font-size: 14px;
}

.submit-form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.submit-form-card h3 {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.submit-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--color-text-muted);
  font-size: 13px;
}
.submit-divider::before,
.submit-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ── Сторінка здач по завданню ────────────────────────────────────────────── */
.submissions-page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.submissions-header {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.submissions-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
}

.stat-card.total .stat-number { color: var(--color-primary); }
.stat-card.graded .stat-number { color: var(--color-success); }
.stat-card.ungraded .stat-number { color: var(--color-warning); }

/* Рядок здачі у таблиці */
.submission-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  transition: all 0.2s ease;
}
.submission-row:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px rgba(99,102,241,0.1);
}
.submission-row.is-graded {
  border-left: 3px solid var(--color-success);
}
.submission-row.is-ungraded {
  border-left: 3px solid var(--color-warning);
}

.submission-student-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.submission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.submission-grade-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grade-input-inline {
  width: 80px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  transition: border-color 0.2s;
}
.grade-input-inline:focus {
  border-color: var(--color-primary);
  outline: none;
}

.grade-badge {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-weight: 700;
  font-size: 14px;
  min-width: 36px;
  text-align: center;
  display: inline-block;
}

.grade-badge.no-grade {
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  font-weight: 400;
}

/* Успішна здача */
.submit-success-wrapper {
  max-width: 520px;
  margin: 60px auto;
  text-align: center;
  padding: 24px 16px;
}

.submit-success-icon {
  font-size: 72px;
  margin-bottom: 16px;
  animation: bounceIn 0.6s cubic-bezier(.36,.07,.19,.97);
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  80% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* Фільтри на сторінці здач */
.submissions-filters {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Коментарі до здачі */
.submission-comments {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.submission-comment-item {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.submission-comment-author {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 2px;
}

.submission-comment-time {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Кнопка "Всі здачі" в панелі вчителя */
.btn-all-submissions {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}
.btn-all-submissions:hover {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
  color: #fff;
}

/* Форматування компактної таблиці загального дашборду */
.submissions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.submissions-table th {
  background: var(--color-bg-secondary);
  padding: 9px 8px;
  font-weight: 700;
  text-align: left;
  color: var(--color-text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.submissions-table th a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.submissions-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  box-sizing: border-box;
}

.submissions-table tr:last-child td {
  border-bottom: none;
}

.submissions-table tr:hover td {
  background: rgba(99, 102, 241, 0.04);
}

.submissions-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  scrollbar-width: thin;
}


/* ─── Студентські картки та макет завдань ─────────────────────────────────── */
.student-sub-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.student-sub-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.feed-main-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.feed-main-content > * {
  max-width: 100%;
}

.assignment-detail-card {
  transition: box-shadow 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Виділений блок опису завдання вчителя (ергономічний для світлої та темної тем)
   ═══════════════════════════════════════════════════════════════════════════ */
.assignment-description-card {
  margin-bottom: 26px;
  background: var(--desc-card-bg);
  border: 1.5px solid var(--desc-card-border);
  border-left: 6px solid var(--desc-card-accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--desc-shadow);
  position: relative;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.assignment-description-card:hover {
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.16), 0 2px 8px rgba(15, 23, 42, 0.08);
}
[data-theme="dark"] .assignment-description-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(129, 140, 248, 0.35);
}

.assignment-description-header {
  padding: 12px 20px;
  background: var(--desc-header-bg);
  border-bottom: 1px solid var(--desc-header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.assignment-description-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.assignment-description-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--desc-header-text);
  letter-spacing: 0.04em;
}

.assignment-description-title .desc-icon {
  font-size: 19px;
  line-height: 1;
}

.assignment-desc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 750;
  background: var(--desc-header-badge-bg);
  color: var(--desc-header-badge-text);
  border: 1px solid var(--desc-header-border);
  letter-spacing: 0.02em;
}

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

.btn-copy-desc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-copy-desc:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-copy-desc.copied {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #059669;
}

/* Основне тіло опису завдання */
.assignment-full-description {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--desc-body-text);
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
  padding: 20px 24px;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.assignment-full-description p {
  margin: 0 0 0.85em;
}
.assignment-full-description p:last-child {
  margin-bottom: 0;
}

/* Заголовки всередині опису */
.assignment-full-description h1,
.assignment-full-description h2,
.assignment-full-description h3,
.assignment-full-description h4,
.assignment-full-description h5,
.assignment-full-description h6 {
  color: var(--color-text-primary);
  font-weight: 800;
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  line-height: 1.35;
}
.assignment-full-description h1:first-child,
.assignment-full-description h2:first-child,
.assignment-full-description h3:first-child,
.assignment-full-description h4:first-child {
  margin-top: 0;
}
.assignment-full-description h2,
.assignment-full-description h3 {
  font-size: 1.16rem;
  border-bottom: 1.5px solid var(--desc-header-border);
  padding-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.assignment-full-description h4 {
  font-size: 1.05rem;
  color: var(--color-primary);
}

/* Списки всередині опису */
.assignment-full-description ul,
.assignment-full-description ol {
  margin: 0.6em 0 1em 1.25em;
  padding-left: 0.5em;
}
.assignment-full-description li {
  margin-bottom: 0.45em;
  line-height: 1.6;
  color: var(--desc-body-text);
}
.assignment-full-description li:last-child {
  margin-bottom: 0;
}
.assignment-full-description li::marker {
  color: var(--desc-card-accent);
  font-weight: 800;
}

/* Виділення важливого тексту */
.assignment-full-description strong,
.assignment-full-description b {
  font-weight: 750;
  color: var(--color-text-primary);
}

.assignment-full-description u {
  text-decoration-color: var(--desc-card-accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

/* Код всередині опису */
.assignment-full-description code {
  font-family: var(--font-mono, monospace);
  font-size: 0.9em;
  background: rgba(99, 102, 241, 0.12);
  color: #3730a3;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  font-weight: 600;
}
[data-theme="dark"] .assignment-full-description code {
  background: rgba(129, 140, 248, 0.2);
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.35);
}

.assignment-full-description pre {
  margin: 0.8em 0;
  padding: 12px 16px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.assignment-full-description blockquote {
  margin: 1em 0;
  padding: 10px 16px;
  background: rgba(99, 102, 241, 0.06);
  border-left: 4px solid var(--desc-card-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--color-text-secondary);
}

/* ── Гарантія читабельності тексту опису завдання та візуального редактора в темній темі ── */
[data-theme="dark"] #rich-editor,
[data-theme="dark"] #rich-editor *:not(mark):not(code):not(pre):not(a):not(.badge):not(.tag),
[data-theme="dark"] .assignment-full-description,
[data-theme="dark"] .assignment-full-description *:not(mark):not(code):not(pre):not(a):not(.badge):not(.tag),
[data-theme="dark"] .rich-text-content,
[data-theme="dark"] .rich-text-content *:not(mark):not(code):not(pre):not(a):not(.badge):not(.tag) {
  color: var(--color-text-primary) !important;
}

[data-theme="dark"] #rich-editor span,
[data-theme="dark"] #rich-editor p,
[data-theme="dark"] #rich-editor div,
[data-theme="dark"] .assignment-full-description span,
[data-theme="dark"] .assignment-full-description p,
[data-theme="dark"] .assignment-full-description div,
[data-theme="dark"] .rich-text-content span,
[data-theme="dark"] .rich-text-content p,
[data-theme="dark"] .rich-text-content div {
  background-color: transparent !important;
}

[data-theme="dark"] #rich-editor {
  background: var(--color-surface);
  caret-color: var(--color-primary);
  border-color: var(--color-border);
}

[data-theme="dark"] #rich-editor:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .editor-btn {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

[data-theme="dark"] .editor-btn:hover {
  background: var(--color-bg-secondary);
}

/* Порожній опис (підказка) */
.assignment-description-card.is-empty-notice {
  border-left-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.04);
}
.assignment-description-card.is-empty-notice .assignment-description-header {
  background: rgba(14, 165, 233, 0.1);
  border-bottom-color: rgba(14, 165, 233, 0.2);
}
.assignment-description-card.is-empty-notice .assignment-description-title {
  color: #0369a1;
}
[data-theme="dark"] .assignment-description-card.is-empty-notice .assignment-description-title {
  color: #7dd3fc;
}

/* Панель швидких дій учня вгорі завдання */
.assignment-student-top-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.12) 100%);
  border: 1.5px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.assignment-student-top-banner .top-banner-title {
  font-size: 14px;
  font-weight: 750;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.assignment-student-top-banner .top-banner-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Компактний варіант для модалок або бічних панелей */
.assignment-description-card.is-compact {
  margin-bottom: 14px;
  border-left-width: 4px;
}
.assignment-description-card.is-compact .assignment-description-header {
  padding: 8px 12px;
}
.assignment-description-card.is-compact .assignment-full-description {
  font-size: 13.5px;
  line-height: 1.6;
  padding: 12px 14px;
}

/* ─── Панель ергономічного читання умови завдання (на сторінці здачі) ── */
.assignment-reading-pane {
  white-space: normal !important;
  word-break: break-word;
}
.assignment-reading-pane p {
  margin: 0 0 0.7em;
}
.assignment-reading-pane p:last-child {
  margin-bottom: 0;
}
.assignment-reading-pane ul,
.assignment-reading-pane ol {
  margin: 0.5em 0 0.75em 1.2em;
  padding-left: 0.4em;
}
.assignment-reading-pane li {
  margin-bottom: 0.35em;
  line-height: 1.55;
  color: var(--desc-body-text);
}
.assignment-reading-pane li:last-child {
  margin-bottom: 0;
}
.assignment-reading-pane li::marker {
  color: var(--desc-card-accent);
  font-weight: 800;
}
.assignment-reading-pane h1,
.assignment-reading-pane h2,
.assignment-reading-pane h3,
.assignment-reading-pane h4 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0.8em 0 0.35em;
  color: var(--color-text-primary);
}
.assignment-reading-pane h1:first-child,
.assignment-reading-pane h2:first-child,
.assignment-reading-pane h3:first-child,
.assignment-reading-pane h4:first-child {
  margin-top: 0;
}
.assignment-reading-pane code {
  font-family: var(--font-mono, monospace);
  font-size: 0.9em;
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-primary);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.assignment-reading-pane strong,
.assignment-reading-pane b {
  font-weight: 750;
  color: var(--color-text-primary);
}


/* ─── Єдиний блок посилань на одному рівні ─────────────────────────────────── */
.assignment-links-card {
  margin-bottom: 26px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.assignment-links-header {
  padding: 11px 18px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-primary);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.assignment-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 16px 18px;
}

.assignment-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s ease;
  min-width: 0;
}

.assignment-link-item:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.12);
  text-decoration: none;
}

.link-item-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-item-content {
  flex: 1;
  min-width: 0;
}

.link-item-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--color-text-primary);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assignment-link-item:hover .link-item-title {
  color: var(--color-primary);
}

.link-item-url {
  font-size: 11.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.link-item-arrow {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* ─── Сайдбар: фільтр класів компактною сіткою (HD Ready оптимізація) ──────── */
.sidebar-classes-container {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.class-grid-all-btn a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.class-grid-all-btn:hover a {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-surface-hover);
}

.class-grid-all-btn.active a {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.sidebar-class-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.class-grid-item a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 4px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.class-grid-item:hover a {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-surface-hover);
  transform: translateY(-1px);
}

.class-grid-item.active a {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

/* ─── Канвас переглядача файлів з реалістичними тінями (Paper Stage) ────────── */
.file-preview-stage {
  margin-top: 14px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.32s ease, padding 0.38s ease, margin 0.38s ease;
  transform-origin: top center;
}

.file-preview-stage.collapsing,
.file-preview-stage.expanding {
  overflow: hidden !important;
  pointer-events: none;
}

[data-theme="dark"] .file-preview-stage {
  background: #090d16;
  border-color: #1e293b;
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.6);
}

.file-preview-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ─── Стилі презентацій PowerPoint (.pptx) ─────────────────────────────────── */
.pptx-viewer {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
}

.pptx-slide-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16), 0 3px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease;
}

[data-theme="dark"] .pptx-slide-card {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pptx-slide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.pptx-slide-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pptx-slide-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.pptx-slide-body {
  padding: 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pptx-slide-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
}

.pptx-img-box {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.03);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  max-width: 100%;
}

[data-theme="dark"] .pptx-img-box {
  background: rgba(255, 255, 255, 0.03);
}

.pptx-img-box.is-icon {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.pptx-slide-img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
}

.pptx-slide-img.is-icon {
  max-width: 140px !important;
  max-height: 140px !important;
}

.pptx-slide-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: 8px;
  line-height: 1.35;
}

.pptx-slide-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text-primary);
}

.pptx-bullet {
  padding-left: 12px;
  margin-bottom: 6px;
  font-weight: 500;
}

.pptx-slide-table-wrapper {
  overflow-x: auto;
  margin: 10px 0;
}

.pptx-slide-table {
  width: 100%;
  border-collapse: collapse;
}

/* ─── Стилі аркуша документів (.docx, .odt, .xlsx тощо) ───────────────────── */
.document-page {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 44px;
  max-width: 960px;
  margin: 16px auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14), 0 3px 12px rgba(0, 0, 0, 0.07);
  line-height: 1.7;
  font-size: 15px;
  position: relative;
}

[data-theme="dark"] .document-page {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.document-page h1,
.document-page h2,
.document-page h3,
.document-page h4 {
  color: var(--color-text-primary);
  font-weight: 700;
  margin-top: 1.2em;
  margin-bottom: 0.6em;
}

.document-page p {
  margin-bottom: 0.85em;
  line-height: 1.7;
}

.document-page table {
  margin: 16px 0;
  background: var(--color-surface);
  border-collapse: collapse;
  width: 100%;
}

.btn-submit-work {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 700;
  border: none;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.btn-submit-work:hover {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

/* ─── Стилі перегляду документів (Word, ODT, Text Paper) ─────────────────────── */
.document-page {
  background: var(--color-surface);
  color: var(--color-text-primary);
  max-width: 920px;
  margin: 20px auto;
  padding: 40px 48px;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16), 0 3px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
  font-size: 15.5px;
  line-height: 1.75;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

[data-theme="dark"] .document-page {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.document-page p {
  margin-bottom: 1em;
  color: var(--color-text-primary);
}
.document-page h1, .document-page h2, .document-page h3, .document-page h4 {
  color: var(--color-text-primary);
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  font-weight: 800;
}
/* Table scroll wrapper — обгортка для прокрутки широких таблиць */
.docx-table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

.document-page table,
.docx-table,
.pptx-slide-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--color-surface);
}

.document-page table th, .document-page table td,
.docx-table th, .docx-table td,
.pptx-slide-table th, .pptx-slide-table td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  color: var(--color-text-primary);
  word-break: normal;
  overflow-wrap: break-word;
}

.document-page table th,
.docx-table th,
.pptx-slide-table th {
  background: var(--color-bg-secondary);
  font-weight: 700;
  color: var(--color-text-primary);
}

.document-page table td p,
.docx-table td p,
.document-page table th p,
.docx-table th p {
  margin: 0 0 4px 0;
  line-height: 1.45;
}

.document-page table td p:last-child,
.docx-table td p:last-child,
.document-page table th p:last-child,
.docx-table th p:last-child {
  margin-bottom: 0;
}

[data-theme="dark"] .document-page table,
[data-theme="dark"] .docx-table,
[data-theme="dark"] .pptx-slide-table {
  background: var(--color-surface);
}

[data-theme="dark"] .document-page table th,
[data-theme="dark"] .docx-table th,
[data-theme="dark"] .pptx-slide-table th {
  background: rgba(255,255,255,0.08);
}

[data-theme="dark"] .document-page table th,
[data-theme="dark"] .document-page table td,
[data-theme="dark"] .docx-table th,
[data-theme="dark"] .docx-table td,
[data-theme="dark"] .pptx-slide-table th,
[data-theme="dark"] .pptx-slide-table td {
  border-color: rgba(255,255,255,0.14);
}

/* Images inside docx */
.document-page img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

/* Document heading classes generated by mammoth style_map */
.document-page .doc-h1,
.document-page h1.doc-h1 {
  font-size: 1.7em;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 4px;
}
.document-page .doc-h2,
.document-page h2.doc-h2 {
  font-size: 1.35em;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}
.document-page .doc-h3,
.document-page h3.doc-h3 {
  font-size: 1.15em;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-top: 1em;
  margin-bottom: 0.4em;
}

/* Текстовий паперовий режим для .txt та нотаток */
.fv-text-paper {
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 32px 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--color-border);
  max-width: 960px;
  margin: 20px auto;
}

/* ─── Стилі класичного класного журналу (Journal Matrix) ─────────────────────── */
.journal-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.journal-scroll-area {
  overflow-x: auto;
  max-width: 100%;
}

.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.journal-table thead th {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  padding: 8px 6px;
  font-weight: 700;
  border: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
  min-width: 48px;
}

.journal-table thead th.journal-th-student {
  position: sticky;
  left: 0;
  z-index: 12;
  background: var(--color-bg-secondary);
  text-align: left;
  min-width: 180px;
  max-width: 220px;
  padding: 8px 12px;
  border-right: 2px solid var(--color-border);
}

.journal-table tbody td {
  padding: 5px 6px;
  border: 1px solid var(--color-border);
  vertical-align: middle;
}

.journal-table tbody tr:hover td {
  background: rgba(99, 102, 241, 0.04);
}

.journal-table tbody td.journal-td-student {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--color-surface);
  text-align: left;
  font-weight: 700;
  padding: 5px 12px;
  border-right: 2px solid var(--color-border);
  min-width: 180px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.journal-table tbody tr:hover td.journal-td-student {
  background: var(--color-surface);
}

.journal-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 25px;
  padding: 0 4px;
  font-weight: 800;
  font-size: 12px;
  border-radius: 4px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.journal-grade-badge:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  background: var(--color-primary);
  color: #fff;
}
.journal-grade-badge.high {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.4);
}
.journal-grade-badge.high:hover {
  background: #10b981;
  color: #fff;
}
.journal-grade-badge.rework {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
  font-weight: 800;
}
.journal-grade-badge.rework:hover {
  background: #f59e0b;
  color: #fff;
}
.journal-grade-badge.pending {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.35);
  font-size: 11px;
}

.journal-avg-badge {
  font-weight: 800;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ЄДИНА СИСТЕМА ІНТЕРФЕЙСУ (легка, офлайн, без блимань)
   ═══════════════════════════════════════════════════════════════════════════════ */

.page-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.page-hero-kicker {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.04em;
}
.page-hero h1 {
  font-size: 1.28rem;
  font-weight: 750;
  margin: 2px 0 0;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}
.page-hero-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.nav-link-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
}
.nav-link-quiet:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.navbar .nav-link-quiet {
  color: #e2e8f0;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 11px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all var(--transition-fast);
}
.navbar .nav-link-quiet:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(-1px);
}

.nav-badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ─── Користувацьке меню та оптимізована навігація вчителя ────────────────────── */
.user-menu {
  position: relative;
}
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: inherit;
  color: var(--color-text-primary);
  max-width: 180px;
  transition: all var(--transition-fast);
}
.user-menu-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
}

.navbar .user-menu-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 3px 8px 3px 3px;
  transition: all var(--transition-fast);
}
.navbar .user-menu-btn:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.navbar .user-menu-name {
  color: #ffffff;
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.user-menu-chevron {
  font-size: 10px;
  opacity: 0.7;
  color: #ffffff;
  transition: transform 0.2s ease;
}
.user-menu.open .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.2);
  padding: 8px;
  z-index: 1050;
  animation: rescheduleModalIn 0.15s ease-out;
}
.user-menu.open .user-menu-panel { display: block; }

/* Шапка меню користувача */
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}
.user-menu-header-avatar {
  flex-shrink: 0;
}
.user-menu-header-meta {
  overflow: hidden;
  flex: 1;
}
.user-menu-header-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-header-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.user-menu-divider {
  height: 1px;
  background: var(--color-border);
  margin: 6px 0;
}

.user-menu-section-label {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 4px 8px 2px;
}

.user-menu-link,
.user-menu-panel a,
.user-menu-panel button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.user-menu-link:hover,
.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}
.user-menu-panel .danger {
  color: var(--color-danger);
}
.user-menu-panel .danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

/* Блок масштабування шрифту всередині меню користувача */
.user-menu-font-control {
  padding: 6px 8px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin: 4px 0;
}
.user-menu-font-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.font-scale-val-badge {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-primary);
  background: var(--color-surface);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}
.user-menu-font-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}
.user-menu-font-grid .font-scale-choice-btn {
  font-size: 10.5px;
  padding: 4px 2px;
  font-weight: 700;
  border-radius: 4px;
  text-align: center;
  justify-content: center;
}

.user-menu-version-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  background: rgba(99, 102, 241, 0.15);
  color: var(--color-primary);
  padding: 1px 6px;
  border-radius: 8px;
}

/* ─── Компактний статус-піл розкладу вчителя ─────────────────────────────────── */
.nav-schedule-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1;
  max-width: 175px;
}
.nav-schedule-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(-1px);
}
.nav-schedule-pill.status-in-lesson {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.4);
}
.nav-schedule-pill.status-in-break {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}
.schedule-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.schedule-pill-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2.5px;
  transition: width 0.4s ease;
}

.live-dot-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.live-dot-pulse.green {
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}
.live-dot-pulse.amber {
  background: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulseAmber 2s infinite;
}
@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes pulseAmber {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes liveBarShimmer {
  0% { filter: brightness(0.96); }
  50% { filter: brightness(1.24); }
  100% { filter: brightness(0.96); }
}

#mobile-menu-btn { display: none; }
#mobile-menu-btn.sidebar-not-found { display: none !important; }

@media (max-width: 1180px) {
  .navbar-search { flex: 0 1 180px; }
  .navbar-search:focus-within { flex: 0 1 260px; }
  .nav-btn-create .nav-btn-text-full { display: none; }
}

@media (max-width: 992px) {
  .nav-schedule-pill { max-width: 140px; }
  .user-menu-name { display: none; }
}

@media (max-width: 880px) {
  #mobile-menu-btn { display: flex; }
}

@media (max-width: 768px) {
  .navbar-search { display: none; }
  .nav-btn-text { display: none; }
  .user-menu-name { display: none; }
  .nav-schedule-pill { padding: 5px 8px; }
}

.page-auth .navbar-search { display: none; }

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

/* ─── Глобальна оптимізація переповнення та таблиць (Anti-overflow system) ── */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  margin-bottom: 16px;
}

/* Таблиці учнів та реєстрів */
.student-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.student-table th {
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}
.student-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  font-size: 13.5px;
  box-sizing: border-box;
}
.student-table tr:hover td {
  background: rgba(99, 102, 241, 0.03);
}

/* Підсвітка цільового рядка при кліку по якорю (#log-entry-3 тощо) */
:target td, tr:target td {
  background: rgba(99, 102, 241, 0.15) !important;
  animation: targetHighlightAnim 2.5s ease-out;
}
@keyframes targetHighlightAnim {
  0% { background: rgba(99, 102, 241, 0.45) !important; }
  100% { background: rgba(99, 102, 241, 0.15) !important; }
}

/* Стилі пігулок вибору класів */
.class-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-text-primary);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.class-check-pill:hover {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.05);
}
.class-check-pill input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}
.class-check-pill:has(input[type="checkbox"]:checked) {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-primary-text);
  box-shadow: 0 0 0 1px var(--color-primary);
}

/* ── Віджет масштабування шрифтів (доступність) ── */
.font-scale-dropdown {
  animation: fadeIn 0.15s ease-out;
}
.font-scale-choice-btn {
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 36px;
  text-align: center;
}
.font-scale-choice-btn:hover {
  border-color: var(--color-primary) !important;
}

/* ── Кнопка оновлень сайту в навігаційній панелі ── */
.nav-btn-changelog {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  width: auto;
  min-width: fit-content;
  padding: 0 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  text-decoration: none;
  box-sizing: border-box;
}
.nav-btn-changelog:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(-1px);
}
.nav-btn-changelog:active {
  transform: translateY(0);
}
.nav-btn-changelog .changelog-sparkle {
  font-size: 13px;
  line-height: 1;
  display: inline-block;
}
.nav-btn-changelog .changelog-version-tag {
  font-weight: 750;
  letter-spacing: 0.02em;
  color: #ffffff;
  line-height: 1;
}
.changelog-version-card {
  transition: box-shadow 0.2s ease;
}
.changelog-version-card:hover {
  box-shadow: var(--shadow-sm);
}

/* ── Кнопка інструкції в навігаційній панелі ── */
.nav-btn-guide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  width: auto;
  min-width: fit-content;
  padding: 0 13px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  text-decoration: none;
  box-sizing: border-box;
}
.nav-btn-guide:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(-1px);
}
.nav-btn-guide:active {
  transform: translateY(0);
}
.nav-btn-guide .guide-nav-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-block;
}

/* ── Стилі інтерактивної інструкції (Guide Modal) ── */
.environment-storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 12px;
  margin-top: 12px;
}
.environment-storage-card {
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.environment-storage-card strong { font-size: 22px; font-weight: 900; }
.environment-storage-card span { font-size: 12px; font-weight: 700; }
.environment-storage-card small { font-size: 11px; color: var(--color-text-muted); }
.environment-storage-total { border-color: var(--color-primary); }
.environment-storage-total strong { color: var(--color-primary); }
.guide-modal-dialog {
  height: min(85dvh, 900px) !important;
  max-height: calc(100dvh - 32px) !important;
  width: 100%;
  max-width: 780px;
}
.guide-modal-dialog > :not(#guide-accordion-container) { flex-shrink: 0; }
.guide-modal-dialog button { white-space: normal; }
#guide-current-context-banner { flex-wrap: wrap; }
@media (max-width: 640px) {
  .guide-modal-dialog {
    height: calc(100dvh - 32px) !important;
    max-height: calc(100dvh - 32px) !important;
    max-width: 96vw;
  }
  .guide-header-title { min-width: 0; }
  .guide-header-text { min-width: 0; overflow-wrap: anywhere; }
  .guide-header-meta { flex-shrink: 0; }
  .guide-active-page-badge { display: none !important; }
  .guide-modal-dialog .guide-card-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .guide-modal-dialog .guide-header-meta { width: auto; }
}
.guide-card {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: fit-content;
}
.guide-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.guide-card.guide-card-active {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 1px var(--color-primary), 0 4px 16px rgba(99, 102, 241, 0.12) !important;
}
#guide-accordion-container {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
#guide-accordion-container::-webkit-scrollbar {
  width: 8px;
}
#guide-accordion-container::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
  border-radius: 4px;
}
#guide-accordion-container::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}
#guide-accordion-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}
.guide-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-surface);
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.guide-card:hover .guide-card-header {
  background: var(--color-bg-secondary);
}
.guide-card.guide-card-active .guide-card-header {
  background: rgba(99, 102, 241, 0.05);
}
.guide-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.guide-cat-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.guide-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.guide-header-text strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.3;
}
.guide-cat-sub {
  font-size: 11.5px;
  color: var(--color-text-muted);
  line-height: 1.25;
}
.guide-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.guide-chevron {
  font-size: 14px;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}
.guide-card.guide-card-open .guide-chevron,
.guide-card.guide-card-active .guide-chevron {
  transform: rotate(180deg);
}
.guide-active-page-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
  animation: guidePulseBadge 2s infinite ease-in-out;
}
@keyframes guidePulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
.guide-pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  display: inline-block;
  animation: guideDotPulse 1.5s infinite ease-in-out;
}
@keyframes guideDotPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}
.guide-card-body {
  border-top: 1px solid var(--color-border);
  padding: 16px 18px;
  background: var(--color-bg-secondary);
  overflow: visible;
}
.guide-content-inner {
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-primary);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.guide-content-inner p {
  margin: 0;
}
.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  flex-shrink: 0;
}
.guide-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.guide-step strong {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.guide-step p {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.45;
}
.guide-tip-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.45;
}
.guide-tip-box.info {
  background: rgba(99, 102, 241, 0.07);
  border-left: 3.5px solid var(--color-primary);
  color: var(--color-text-primary);
}
.guide-tip-box.warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1.5px solid #f59e0b;
  color: #92400e;
}
[data-theme="dark"] .guide-tip-box.warning {
  color: #fbbf24;
}
.guide-close-btn:hover {
  background: var(--color-border);
  color: var(--color-text-primary);
}




/* Читабельний підсумок, статус черги та прогрес великих завантажень. */
.submission-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:20px; }
.submission-summary > div { display:flex; flex-direction:column; gap:6px; padding:18px; border:1px solid var(--color-border); border-radius:var(--radius-md); background:var(--color-surface); }
.submission-summary strong { font-size:28px; line-height:1.2; color:var(--color-text-primary); }
.submission-summary span { font-size:14px; color:var(--color-text-secondary); }
.submission-summary p { grid-column:1/-1; margin:0; font-size:14px; line-height:1.5; color:var(--color-text-secondary); }
.ai-job-status { padding:16px; margin:16px 0; border:1px solid var(--color-border); border-left:4px solid var(--color-primary); border-radius:var(--radius-md); background:var(--color-surface); color:var(--color-text-primary); font-size:14px; line-height:1.5; }
.ai-event-panel, .ai-event-history { min-width:0; margin:8px 0; padding:8px 10px; border:1px solid var(--color-border); border-radius:var(--radius-md); background:var(--color-surface); color:var(--color-text-primary); font-size:12px; line-height:1.4; overflow-wrap:anywhere; }
.ai-event-panel p { margin:3px 0 5px; font-size:12px; }
.ai-event-panel summary, .ai-event-history summary { cursor:pointer; color:var(--color-text-secondary); }
.ai-event-panel ol, .ai-event-history ol { margin:5px 0 0; padding-left:22px; max-height:132px; overflow:auto; }
.ai-event-panel li, .ai-event-history li { padding:2px 0; }
.ai-event-panel [data-kind="model_error"], .ai-event-history [data-kind="model_error"] { color:var(--color-danger); }
.ai-event-bar { height:3px; margin:5px 0; background:var(--color-bg-secondary); overflow:hidden; border-radius:3px; }
.ai-event-bar::after { content:""; display:block; width:30%; height:100%; background:var(--color-primary); animation:ai-event-wait 1.8s ease-in-out infinite alternate; }
.ai-event-panel[data-state="success"] .ai-event-bar::after { width:100%; background:var(--color-success); animation:none; }
.ai-event-panel[data-state="failed"] .ai-event-bar::after, .ai-event-panel[data-state="disconnected"] .ai-event-bar::after { width:100%; background:var(--color-danger); animation:none; }
@keyframes ai-event-wait { to { transform:translateX(233%); } }
@media(prefers-reduced-motion:reduce) { .ai-event-bar::after { animation:none; } }
.upload-progress { padding:16px; margin-top:16px; border:1px solid var(--color-border); border-radius:var(--radius-md); background:var(--color-surface); color:var(--color-text-primary); }
.upload-progress progress { display:block; width:100%; height:14px; margin-bottom:10px; accent-color:var(--color-primary); }
.upload-progress p { margin:0; font-size:14px; line-height:1.5; }
:where(a,button,input,select,textarea,summary):focus-visible { outline:3px solid var(--color-primary); outline-offset:3px; }
@media(max-width:480px) { .submission-summary { gap:8px; } .submission-summary > div { padding:12px 8px; } .submission-summary strong { font-size:24px; } .submission-summary span { font-size:13px; } }

/* ── Дитяча анімація перевірки ШІ для учнів ── */
.ai-kid-panel {
  background: linear-gradient(145deg, rgba(240, 253, 244, 0.9) 0%, rgba(239, 246, 255, 0.9) 50%, rgba(250, 245, 255, 0.9) 100%) !important;
  border: 2px dashed #818cf8 !important;
  border-radius: var(--radius-lg) !important;
  padding: 18px 16px !important;
  text-align: center !important;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12) !important;
  margin: 14px 0 !important;
}
[data-theme="dark"] .ai-kid-panel {
  background: linear-gradient(145deg, #131d2e 0%, #1e1b4b 100%) !important;
  border-color: #6366f1 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}
.ai-kid-robot-anim {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}
.ai-kid-robot-svg {
  animation: ai-robot-bob 2.4s ease-in-out infinite alternate;
}
@keyframes ai-robot-bob {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-1.5deg); }
  100% { transform: translateY(0px) rotate(1.5deg); }
}
.ai-robot-antenna-bulb {
  animation: ai-antenna-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes ai-antenna-pulse {
  0% { fill: #f59e0b; filter: drop-shadow(0 0 2px #f59e0b); }
  100% { fill: #ef4444; filter: drop-shadow(0 0 7px #ef4444); }
}
.ai-robot-eyes {
  animation: ai-eyes-read 2.8s ease-in-out infinite;
}
@keyframes ai-eyes-read {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.ai-scanner-beam {
  animation: ai-scanner-flicker 1.6s ease-in-out infinite alternate;
}
@keyframes ai-scanner-flicker {
  0% { opacity: 0.15; transform: scaleX(0.85); transform-origin: 80px 88px; }
  100% { opacity: 0.55; transform: scaleX(1.15); transform-origin: 80px 88px; }
}
.ai-kid-title {
  font-size: 15.5px !important;
  font-weight: 800 !important;
  color: var(--color-primary-text) !important;
  margin-bottom: 4px !important;
  display: block !important;
}
.ai-kid-status {
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: var(--color-text-secondary) !important;
  margin: 6px auto 12px auto !important;
  min-height: 22px;
}
.ai-kid-progress {
  height: 8px !important;
  background: rgba(99, 102, 241, 0.15) !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  max-width: 280px !important;
  margin: 0 auto 12px auto !important;
}
.ai-kid-progress-bar {
  height: 100% !important;
  width: 40% !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #3b82f6, #10b981) !important;
  background-size: 200% 100% !important;
  animation: ai-kid-bar-move 2s linear infinite !important;
}
@keyframes ai-kid-bar-move {
  0% { background-position: 0% 0%; width: 25%; }
  50% { width: 75%; }
  100% { background-position: 200% 0%; width: 25%; }
}
.ai-kid-panel[data-state="success"] .ai-kid-progress-bar {
  width: 100% !important;
  background: var(--color-success) !important;
  animation: none !important;
}
.ai-kid-panel[data-state="failed"] .ai-kid-progress-bar,
.ai-kid-panel[data-state="disconnected"] .ai-kid-progress-bar {
  width: 100% !important;
  background: var(--color-danger) !important;
  animation: none !important;
}

/* ── Зменшення панелі робота після завершення перевірки ── */
.ai-kid-panel {
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.ai-kid-panel[data-state="success"] {
  padding: 10px 16px !important;
  margin: 8px 0 16px 0 !important;
  border-style: solid !important;
  border-width: 1.5px !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(99, 102, 241, 0.05) 100%) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  text-align: left !important;
}

[data-theme="dark"] .ai-kid-panel[data-state="success"] {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.25) 0%, rgba(30, 27, 75, 0.4) 100%) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.ai-kid-panel[data-state="success"] .ai-kid-robot-anim {
  margin-bottom: 0 !important;
  flex-shrink: 0 !important;
}

.ai-kid-panel[data-state="success"] .ai-kid-robot-svg {
  width: 38px !important;
  height: 34px !important;
  animation: none !important;
}

.ai-kid-panel[data-state="success"] .ai-kid-title {
  font-size: 13.5px !important;
  margin-bottom: 1px !important;
  color: var(--color-success) !important;
  display: block !important;
}

.ai-kid-panel[data-state="success"] .ai-kid-status {
  font-size: 12.5px !important;
  margin: 0 !important;
  min-height: auto !important;
  color: var(--color-text-secondary) !important;
  display: block !important;
}

.ai-kid-panel[data-state="success"] .ai-kid-progress {
  display: none !important;
}

.ai-kid-panel[data-state="success"] details {
  margin: 0 !important;
  font-size: 11px !important;
  flex-shrink: 0 !important;
}

.ai-kid-panel[data-state="success"] details summary {
  padding: 3px 8px !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(0, 0, 0, 0.04) !important;
}

/* ── Анімація виїзду оцінки на передній план ── */
@keyframes studentCardSlideIn {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scale(1.008);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.student-ai-card-active {
  animation: studentCardSlideIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  z-index: 10;
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.16), 0 2px 10px rgba(0, 0, 0, 0.06) !important;
}

.student-ai-feedback-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

/* ── Сумний робот (анімація сліз та співчуття при помилці перевірки) ── */
.ai-robot-mouth-sad,
.ai-robot-sad-brows,
.ai-robot-tears {
  display: none !important;
}
.ai-robot-mouth-smile {
  display: inline !important;
}

.ai-kid-panel[data-state="failed"],
.ai-sad-robot-card {
  background: linear-gradient(145deg, rgba(254, 242, 242, 0.95) 0%, rgba(245, 243, 255, 0.95) 100%) !important;
  border-color: #f87171 !important;
  border-style: dashed !important;
  box-shadow: 0 8px 26px rgba(239, 68, 68, 0.12) !important;
  transition: all 0.4s ease !important;
}
[data-theme="dark"] .ai-kid-panel[data-state="failed"],
[data-theme="dark"] .ai-sad-robot-card {
  background: linear-gradient(145deg, #241417 0%, #17162e 100%) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4) !important;
}

.ai-kid-panel[data-state="failed"] .ai-robot-mouth-smile,
.ai-sad-robot-card .ai-robot-mouth-smile {
  display: none !important;
}
.ai-kid-panel[data-state="failed"] .ai-robot-mouth-sad,
.ai-sad-robot-card .ai-robot-mouth-sad {
  display: inline !important;
}
.ai-kid-panel[data-state="failed"] .ai-robot-sad-brows,
.ai-sad-robot-card .ai-robot-sad-brows {
  display: inline !important;
}
.ai-kid-panel[data-state="failed"] .ai-robot-tears,
.ai-sad-robot-card .ai-robot-tears {
  display: inline !important;
}
.ai-kid-panel[data-state="failed"] .ai-scanner-beam,
.ai-sad-robot-card .ai-scanner-beam {
  display: none !important;
}

.ai-kid-panel[data-state="failed"] .ai-kid-robot-svg,
.ai-sad-robot-card .ai-kid-robot-svg {
  animation: ai-robot-weep 2.4s ease-in-out infinite !important;
}

@keyframes ai-robot-weep {
  0% { transform: translateY(0px) rotate(0deg); }
  15% { transform: translateY(2px) rotate(-1.5deg); }
  35% { transform: translateY(4px) rotate(1.5deg); }
  55% { transform: translateY(2px) rotate(-1deg); }
  75% { transform: translateY(3px) rotate(0.8deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

.ai-kid-panel[data-state="failed"] .ai-tear-left,
.ai-sad-robot-card .ai-tear-left {
  animation: ai-tear-flow 1.9s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
}
.ai-kid-panel[data-state="failed"] .ai-tear-right,
.ai-sad-robot-card .ai-tear-right {
  animation: ai-tear-flow 1.9s cubic-bezier(0.4, 0, 0.2, 1) infinite 0.6s !important;
}
.ai-kid-panel[data-state="failed"] .ai-tear-drop-left,
.ai-sad-robot-card .ai-tear-drop-left {
  animation: ai-tear-drop 1.9s cubic-bezier(0.4, 0, 0.2, 1) infinite 0.35s !important;
}
.ai-kid-panel[data-state="failed"] .ai-tear-drop-right,
.ai-sad-robot-card .ai-tear-drop-right {
  animation: ai-tear-drop 1.9s cubic-bezier(0.4, 0, 0.2, 1) infinite 0.95s !important;
}

@keyframes ai-tear-flow {
  0% { transform: translateY(0) scaleY(0.5); opacity: 0; }
  25% { opacity: 0.95; transform: translateY(2px) scaleY(1); }
  70% { opacity: 0.85; transform: translateY(8px) scaleY(1.2); }
  100% { transform: translateY(14px) scaleY(0.4); opacity: 0; }
}

@keyframes ai-tear-drop {
  0% { transform: translateY(0) scale(0); opacity: 0; }
  35% { opacity: 0.95; transform: translateY(3px) scale(1.1); }
  75% { opacity: 0.7; transform: translateY(10px) scale(1); }
  100% { transform: translateY(18px) scale(0.2); opacity: 0; }
}

.ai-kid-panel[data-state="failed"] .ai-robot-antenna-bulb,
.ai-sad-robot-card .ai-robot-antenna-bulb {
  fill: #60a5fa !important;
  animation: ai-antenna-sad 1.8s ease-in-out infinite alternate !important;
}

@keyframes ai-antenna-sad {
  0% { fill: #60a5fa; filter: drop-shadow(0 0 2px #60a5fa); }
  100% { fill: #94a3b8; filter: drop-shadow(0 0 1px #94a3b8); }
}

/* ── Згорнуті групи текстового звіту ШІ для вчителя ── */
.teacher-ai-groups-container {
  margin-top: 8px;
}
.teacher-ai-group-card {
  transition: all 0.2s ease;
}
.teacher-ai-group-card:hover {
  border-color: rgba(99, 102, 241, 0.4) !important;
}
.teacher-ai-group-card[open] {
  border-color: var(--color-primary) !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}
.teacher-ai-group-card summary::-webkit-details-marker {
  display: inline-block;
  color: var(--color-primary);
}



