:root {
  /* Акцент */
  --color-accent: #c7b3f0;
  --color-accent-hover: #b380e6;
  --color-accent-bg: #e6e6fa;
  --color-accent-bg-hover: #d7cdf5;
  --color-accent-2: #e6809d;
  --color-accent-wash: rgba(199, 179, 240, 0.08);
  --color-subject-green-bg: #E1F5EE;
  --color-subject-green: #085041;
  --color-subject-neutral-bg: #F1EFE8;
  --color-subject-neutral: #444;

  /* Поверхности */
  --color-bg: #f5f4f0;
  --color-surface: #fff;
  --color-surface-muted: #f0ede6;
  --color-border: #e8e5de;
  --color-border-input: #ddd;

  /* Текст */
  --color-text: #1a1a1a;
  --color-text-secondary: #888;

  /* Статусы */
  --color-success: #27500A;
  --color-success-bg: #EAF3DE;
  --color-warning: #633806;
  --color-warning-bg: #FAEEDA;
  --color-danger: #791F1F;
  --color-danger-bg: #FCEBEB;
  --color-info: #185FA5;
  --color-info-dark: #0C447C;
  --color-info-bg: #E6F1FB;

  /* Шкала отступов */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Радиусы */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-pill: 20px;

  /* Тени */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 20px rgba(179,128,230,0.14);

  /* Шкала текста */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;

  /* Яркая палитра (только для детской страницы student-cabinet.html) */
  --color-bright-pink: #FF5FA2;
  --color-bright-blue: #3B9EFF;
  --color-bright-green: #3DBE6C;
  --color-bright-orange: #FF9F40;
  --color-bright-red: #FF5C5C;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-md);
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--color-surface);
  border-right: 0.5px solid var(--color-border);
  display: flex;
  flex-direction:column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  padding: 18px 16px 14px;
  border-bottom: 0.5px solid var(--color-border);
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
  font-size: var(--text-xl);
  color: var(--color-surface);
}

.logo-text {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.2px;
}

.logo-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 1px;
}

.nav { padding: var(--space-2); flex: 1; overflow-y: auto; }

.nav-section {
  font-size: var(--text-xs);
  color: #aaa;
  padding: var(--space-3) var(--space-2) var(--space-1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: #666;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background 0.1s;
}

.nav-item:hover { background: var(--color-bg); color: var(--color-text); }
.nav-item.active { background: var(--color-accent-bg); color: var(--color-accent-hover); font-weight: 500; }
.nav-item.active .nav-icon { color: var(--color-accent); }

.nav-icon { font-size: var(--text-xl); color: #bbb; flex-shrink: 0; }
.nav-item.active .nav-icon { color: var(--color-accent); }

.nav-badge {
  margin-left: auto;
  font-size: var(--text-xs);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-hover);
  color: var(--color-surface);
  font-weight: 500;
}

.sidebar-bottom {
  padding: var(--space-3) var(--space-4);
  border-top: 0.5px solid var(--color-border);
}

.user-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.user-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent-bg);
  color: var(--color-accent-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 500;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: var(--text-sm); font-weight: 500; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 10px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-logout-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  font-size: var(--text-lg);
  padding: 2px;
  flex-shrink: 0;
}
.btn-logout-icon:hover { color: #666; }

/* Topbar */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 52px;
  padding: 0 var(--space-6);
  background: var(--color-surface);
  border-bottom: 0.5px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title { font-size: var(--text-lg); font-weight: 500; color: var(--color-text); }

.topbar-right { display: flex; align-items: center; gap: var(--space-2); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
  border: 0.5px solid var(--color-border-input);
  background: var(--color-surface);
  color: #444;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.1s, box-shadow 0.1s;
}
.btn:hover { background: var(--color-bg); }
.btn i, .btn-primary i { font-size: var(--text-lg); }

.btn-primary {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-surface);
  box-shadow: 0 2px 8px rgba(179,128,230,0.25);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: 0 4px 14px rgba(179,128,230,0.32);
}

.btn-logout {
  width: 100%;
  padding: var(--space-2);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  font-size: var(--text-base);
  color: #666;
  cursor: pointer;
  transition: background 0.1s;
}
.btn-logout:hover { background: var(--color-bg); }

.btn-assign {
  font-size: var(--text-sm);
  color: var(--color-accent);
  background: var(--color-accent-bg);
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.btn-assign:hover { background: var(--color-accent-bg-hover); }

.btn-delete {
  font-size: 12px;
  color: #791F1F;
  background: #FCEBEB;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.btn-delete:hover { background: #f7c1c1; }

/* Content */
.content { padding: var(--space-6); flex: 1; }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: var(--text-xs); color: var(--color-text-secondary); margin-bottom: 6px; }
.stat-val { font-size: var(--text-2xl); font-weight: 500; color: var(--color-text); line-height: 1; }
.stat-sub { font-size: var(--text-xs); color: var(--color-text-secondary); margin-top: var(--space-1); }
.stat-sub.up { color: var(--color-success); }

/* Cards */
.card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

.section-title { font-size: var(--text-base); font-weight: 500; color: var(--color-text); margin-bottom: var(--space-3); }

/* Forms */
.form-card {
  background: #fff;
  border: 0.5px solid #e8e5de;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.form-title { font-size: 14px; font-weight: 500; margin-bottom: 16px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 11px;
  color: #999;
  margin-bottom: 5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 0.5px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  transition: border-color 0.15s;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--color-accent-hover);
}

/* Rows */
.student-row {
  background: #fff;
  border: 0.5px solid #e8e5de;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.1s, box-shadow 0.1s, background 0.1s;
  cursor: pointer;
}
.student-row:hover {
  border-color: var(--color-accent-hover);
  background: var(--color-bg);
  box-shadow: var(--shadow-hover);
}

.test-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-2) 0;
  border-bottom: 0.5px solid var(--color-surface-muted);
}
.test-row:last-child { border-bottom: none; }

/* Avatar */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-accent-bg);
  color: var(--color-accent-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 500;
  flex-shrink: 0;
}

.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }

.avatar-accent  { background: var(--color-accent-bg);  color: var(--color-accent-hover); }
.avatar-success { background: var(--color-success-bg); color: var(--color-success); }
.avatar-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.avatar-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.avatar-info    { background: var(--color-info-bg);    color: var(--color-info); }

/* Profile */
.profile-header {
  background: linear-gradient(135deg, var(--color-accent-bg) 0%, var(--color-surface) 70%);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

/* Badges */
.badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 500; }
.badge-math { background: var(--color-accent-bg); color: var(--color-accent-hover); }
.badge-rus { background: var(--color-subject-green-bg); color: var(--color-subject-green); }
.badge-eng { background: var(--color-info-bg); color: var(--color-info-dark); }
.badge-multi { background: var(--color-subject-neutral-bg); color: var(--color-subject-neutral); }

.score-badge { font-size: var(--text-xs); padding: 2px 8px; border-radius: var(--radius-pill); }
.sb-good { background: var(--color-success-bg); color: var(--color-success); }
.sb-mid { background: var(--color-warning-bg); color: var(--color-warning); }
.sb-low { background: var(--color-danger-bg); color: var(--color-danger); }
.status-new { background: var(--color-accent-bg); color: var(--color-accent-hover); }

/* Topic cards */
.topic-card {
  background: #fff;
  border: 0.5px solid #e8e5de;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.1s, box-shadow 0.1s;
  position: relative;
  overflow: hidden;
}
.topic-card:hover {
  border-color: var(--color-accent-hover);
  box-shadow: var(--shadow-hover);
}

.topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.card-actions-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  font-size: 18px;
  padding: 6px;
  flex-shrink: 0;
  border-radius: 6px;
}
.card-actions-toggle:hover { background: #f0ede6; }

.topic-title { font-size: 14px; font-weight: 500; color: #1a1a1a; }
.topic-meta { font-size: 12px; color: #999; margin-top: 2px; }

.topic-desc {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid #f0ede6;
}

/* Subject dot */
.subject-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Contacts */
.student-info { flex: 1; min-width: 0; }
.student-name { font-size: 14px; font-weight: 500; color: #1a1a1a; }
.student-meta { font-size: 12px; color: #999; margin-top: 2px; }
.student-contacts { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.contact-item { font-size: 12px; color: #666; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}
.empty-state-icon {
  display: block;
  font-size: 40px;
  color: var(--color-border-input);
  margin-bottom: var(--space-3);
}
.empty-state-title {
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.empty-state-desc {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

/* Error */
.error-msg {
  background: #FCEBEB;
  color: #791F1F;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.hidden { display: none !important; }

/* Filter buttons */
.filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 0.5px solid #e0ddd5;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #666;
  transition: all 0.1s;
}
.filter-btn:hover { background: #f5f4f0; }
.filter-btn.active { background: var(--color-accent-bg); color: var(--color-accent-hover); border-color: var(--color-accent-bg-hover); }

/* Question block */
.question-block {
  background: #f9f8f5;
  border: 0.5px solid #e8e5de;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

/* Report card */
.report-card {
  background: #fff;
  border: 1.5px solid #B5D4F4;
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f4f0;
}

.login-card {
  background: #fff;
  border: 0.5px solid #e8e5de;
  border-radius: 14px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

.login-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.login-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--color-accent-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.login-logo { font-size: 20px; font-weight: 500; }
.login-sub { font-size: 13px; color: #999; margin-bottom: 28px; }

/* Улучшенные карточки заданий ученика */
.assignment-card {
  background: #fff;
  border: 0.5px solid #e8e5de;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.1s, box-shadow 0.1s;
}
.assignment-card:hover {
  border-color: var(--color-accent-hover);
  box-shadow: var(--shadow-hover);
}
.assignment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.assignment-card-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
}
.assignment-card-meta {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}
.assignment-card-desc {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 0.5px solid #f0ede6;
}
.page-content {
  max-width: 860px;
}

/* Level showcase */
.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.level-card {
  background: #fff;
  border: 0.5px solid #e8e5de;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}
.level-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.level-card-img {
  width: 112px;
  height: 112px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 8px;
}

.level-card.locked .level-card-img {
  filter: grayscale(1) brightness(0.85);
  opacity: 0.75;
}

.level-card-name { font-size: var(--text-lg); font-weight: 500; color: #1a1a1a; }
.level-card-range { font-size: var(--text-base); color: #999; margin-top: 2px; }
.level-card-hint { font-size: var(--text-base); color: #999; margin-top: 4px; }

.level-modal-img {
  width: 90px;
  height: 90px;
  border-radius: 16px;
  object-fit: cover;
}
.level-modal-img.locked { filter: grayscale(1) brightness(0.85); }

.level-modal-img-lg {
  width: min(60vw, 320px);
  height: min(60vw, 320px);
  border-radius: 20px;
  object-fit: cover;
  cursor: zoom-in;
}
.level-modal-img-lg.locked { filter: grayscale(1) brightness(0.85); }

/* Mascot */
.mascot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  cursor: pointer;
}

.mascot-img {
  width: 170px;
  height: 170px;
  object-fit: contain;
  display: block;
  animation: mascot-float 2.5s ease-in-out infinite;
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.mascot-bubble {
  position: absolute;
  right: 8px;
  bottom: 105%;
  max-width: 220px;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  animation: mascot-bubble-in 0.25s ease-out;
}
.mascot-bubble.hidden { display: none; }
.mascot-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 20px;
  width: 12px;
  height: 12px;
  background: var(--color-surface);
  border-right: 0.5px solid var(--color-border);
  border-bottom: 0.5px solid var(--color-border);
  transform: rotate(45deg);
}

@keyframes mascot-bubble-in {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Bright student-cabinet theme */
.profile-header.bright {
  background: linear-gradient(135deg, var(--color-accent-hover) 0%, var(--color-accent) 100%);
  border: none;
}
.profile-header.bright .ph-text { color: #fff; }
.profile-header.bright .ph-text-secondary { color: rgba(255,255,255,0.8); }

.stat-lg { padding: var(--space-6); }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  margin-bottom: var(--space-2);
}

/* ===== Responsive ===== */

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #1a1a1a;
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 150;
}
.sidebar-overlay.open { display: block; }

.cal-cell {
  height: 60px;
  font-size: 15px;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-top: 2px;
}

.cal-count {
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  padding: 0 3px;
  background: var(--color-accent-hover);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.stats-3col { grid-template-columns: repeat(3, 1fr); margin-bottom: 24px; }

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.week-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.lesson-panel-fixed {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 380px;
  background: #fff;
  border-left: 0.5px solid #e0ddd5;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

.article-page {
  min-height: 100vh;
  background: var(--color-bg);
}

.article-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
}

.article-container {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6) 80px;
}

.article-meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.article-title {
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-6);
  line-height: 1.3;
}

.article-body.ql-editor {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--color-text);
}
.article-body.ql-editor p,
.article-body.ql-editor ul,
.article-body.ql-editor ol,
.article-body.ql-editor blockquote,
.article-body.ql-editor img {
  margin-bottom: var(--space-4);
}
.article-body.ql-editor h1,
.article-body.ql-editor h2,
.article-body.ql-editor h3 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}
.article-body.ql-editor img { max-width: 100%; height: auto; border-radius: var(--radius-md); display: block; }

#editor .ql-editor { min-height: 400px; font-size: var(--text-lg); }
#editor.ql-container { border-bottom-left-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.ql-toolbar.ql-snow { border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md); }

@media (max-width: 1024px) {
  .stats, .stats-3col { grid-template-columns: repeat(2, 1fr); }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .achievements-grid { grid-template-columns: repeat(2, 1fr); }
  .subjects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 2px 0 20px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }

  .content { padding: 16px; }

  .stats, .stats-3col { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .grid2 { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .achievements-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-layout { grid-template-columns: 1fr; }
  .subjects-grid { grid-template-columns: repeat(2, 1fr); }
  .week-calendar { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .profile-header { flex-wrap: wrap; }

  .nav-item { padding: 12px 10px; font-size: 14px; min-height: 44px; }
  .btn, .btn-primary, .btn-logout { min-height: 44px; padding: 10px 16px; box-sizing: border-box; }
  .btn-delete, .btn-assign {
    min-height: 44px; padding: 10px 14px; box-sizing: border-box;
  }

  .cal-cell { height: 44px; font-size: 13px; }

  .mascot { right: 10px; bottom: 10px; }
  .mascot-img { width: 76px; height: 76px; }
  .mascot-bubble { max-width: 150px; padding: 8px 10px; font-size: 11px; }

  .student-row { flex-direction: column; align-items: flex-start; }
  .student-contacts { text-align: left; margin-top: 8px; }

  .topic-card { overflow: visible; }
  .card-actions-toggle { display: flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .card-actions {
    display: none;
    position: absolute;
    top: 40px;
    right: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border: 0.5px solid #e0ddd5;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    z-index: 20;
    min-width: 200px;
    padding: 6px;
  }
  .card-actions.open { display: flex; }
  .card-actions a, .card-actions button {
    width: 100%;
    text-align: left;
    background: none;
    border-radius: 8px;
    padding: 11px 12px;
    min-height: 44px;
    box-sizing: border-box;
    font-size: 14px;
    display: flex;
    align-items: center;
  }
  .card-actions a:active, .card-actions button:active { background: #f5f4f0; }

  .lesson-panel-fixed { width: 100vw; }

  .topbar {
    height: auto;
    min-height: 52px;
    padding: 8px var(--space-4);
    flex-wrap: wrap;
    gap: 8px;
  }

  .article-topbar { padding: var(--space-3) var(--space-4); }
  .article-container { padding: var(--space-3) var(--space-4) 60px; }
  .article-title { font-size: var(--text-2xl); margin-bottom: var(--space-4); }
  .article-body.ql-editor { font-size: var(--text-md); }
}

/* ===== FullCalendar theme (расписание) ===== */
#fc-calendar {
  background: var(--color-surface);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 2px solid #c7b3f0;
}

.fc {
  --fc-border-color: var(--color-border);
  --fc-page-bg-color: var(--color-surface);
  --fc-neutral-bg-color: var(--color-bg);
  --fc-today-bg-color: var(--color-accent-wash);
  --fc-now-indicator-color: #c7b3f0;
  --fc-more-link-bg-color: var(--color-accent-bg);
  --fc-more-link-text-color: var(--color-accent-hover);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.fc-timegrid-slot {
  height: 70px !important;
}

.fc-col-header-cell-cushion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  text-decoration: none;
}

.fc-daynum-weekday {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fc-daynum-date {
  font-size: var(--text-lg);
  color: var(--color-text);
  font-weight: 600;
}
.fc-day-today .fc-daynum-weekday,
.fc-day-today .fc-daynum-date {
  color: var(--color-accent-hover);
}

.fc-timegrid-slot-label-cushion,
.fc-timegrid-axis-cushion {
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: 400;
}

.fc-timegrid-slot-lane {
  border-color: var(--color-surface-muted);
}
.fc-timegrid-col {
  border-color: var(--color-border);
}

.fc-daygrid-day-number {
  color: var(--color-text);
  font-size: var(--text-sm);
  text-decoration: none;
}

.fc-day-today .fc-daygrid-day-number {
  color: var(--color-accent-hover);
  font-weight: 600;
}

.fc-col-header-cell.fc-day-today {
  position: relative;
  z-index: 2;
  border-left: 2px solid var(--color-accent);
  border-right: 2px solid var(--color-accent);
  border-top: 2px solid var(--color-accent);
}
.fc-timegrid-col.fc-day-today {
  position: relative;
  z-index: 2;
  border-left: 2px solid var(--color-accent);
  border-right: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
}

/* Higher specificity than FullCalendar's own injected `.fc .fc-timegrid-now-indicator-line`
   and `.fc-direction-ltr .fc-timegrid-now-indicator-arrow` rules, which otherwise win the
   border-width cascade over a same-or-lower-specificity override. */
#fc-calendar .fc-timegrid-now-indicator-line {
  border-top-width: 2px;
}
#fc-calendar .fc-timegrid-now-indicator-arrow {
  border-width: 6px 0 6px 7px;
}

.fc-timegrid-event {
  border-radius: 10px;
  border-width: 2px;
  border-style: solid;
  box-shadow: none;
}
.fc-timegrid-event .fc-event-main {
  padding: 6px 10px;
}
.fc-timegrid-event .fc-event-main,
.fc-daygrid-event .fc-event-time,
.fc-daygrid-event .fc-event-title {
  font-size: 13px;
  font-weight: 700;
}

.fc-daygrid-block-event {
  border-radius: 10px;
  border-width: 2px;
  border-style: solid;
}