/* Rubik — вариативный шрифт, встроен локально (кириллица+латиница) */
@font-face{font-family:'Rubik';src:url('/fonts/rubik-400-cyrillic.woff2') format('woff2');font-weight:300 900;font-style:normal;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:'Rubik';src:url('/fonts/rubik-400-latin.woff2') format('woff2');font-weight:300 900;font-style:normal;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Rubik';src:url('/fonts/rubik-400-italic-cyrillic.woff2') format('woff2');font-weight:300 900;font-style:italic;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:'Rubik';src:url('/fonts/rubik-400-italic-latin.woff2') format('woff2');font-weight:300 900;font-style:italic;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root,
[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-sidebar: #0e1422;
  --bg-surface: #131b2e;
  --bg-surface-hover: #19233b;
  --bg-elevated: #1c2742;
  --bg-input: #0d1322;
  --border-subtle: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.16);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.16);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.65);
}

[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f8fafc;
  --bg-elevated: #f1f5f9;
  --bg-input: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --cyan: #0891b2;
  --cyan-soft: rgba(8, 145, 178, 0.12);
  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 20px 50px rgba(15, 23, 42, 0.22);
}

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

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: 'Rubik', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', monospace;
}

.hidden {
  display: none !important;
}

/* Основная сетка приложения */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Боковая панель */
.sidebar {
  width: 276px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-weight:600;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Карточка переключателя Числитель / Знаменатель */
.week-switcher-card {
  margin-top: 14px;
  padding: 11px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.week-switcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.week-label-caption {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.week-date-chip {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 6px;
}

.week-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.week-toggle-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  padding: 7px 6px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.18s ease;
}

.week-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.week-toggle-btn.active {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.odd-dot { background: #6366f1; }
.even-dot { background: #10b981; }

/* Навигация */
.sidebar-nav {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.35);
}

.nav-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
}

.nav-label {
  flex: 1;
}

.nav-counter {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.nav-counter.warn {
  background: var(--warning-soft);
  color: var(--warning);
}

/* Футер сайдбара */
.sidebar-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.semester-progress-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: 10px;
}

.sp-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.sp-row strong {
  color: var(--text-primary);
}

.progress-bar-track {
  height: 7px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.sidebar-user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  border-radius: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-meta-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.user-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  width: 100%;
}

.user-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Основная правая колонка */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* Верхняя панель */
.topbar {
  height: 66px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 580px;
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
  font-size: 0.9rem;
  margin-right: 8px;
  opacity: 0.7;
}

.search-box input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 9px 0;
  font-size: 0.86rem;
  outline: none;
}

.search-kbd {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  margin-left: 8px;
  white-space: nowrap;
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  margin-left: 4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Мини-таймер в шапке */
.topbar-pomodoro {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.pomo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.pomo-dot.running {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.pomo-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
}

.pomo-mini-btn {
  background: var(--bg-elevated);
  border: none;
  color: var(--text-primary);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Выпадающий поиск */
.global-search-dropdown {
  position: absolute;
  top: 62px;
  left: 24px;
  width: min(620px, calc(100vw - 48px));
  max-height: 440px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  padding: 12px;
  z-index: 60;
}

.search-result-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 8px 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-surface-hover);
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 0.74rem;
  border-radius: 7px;
}

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  background: var(--success);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

/* Контент страницы */
.main-content {
  padding: 24px 28px 48px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.55rem;
  font-weight:600;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Сетки и карточки */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.35rem;
  font-weight:600;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Бейджи и чипы */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-lecture { background: rgba(99, 102, 241, 0.16); color: #818cf8; }
.badge-practice { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.badge-lab { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.badge-high { background: var(--danger-soft); color: var(--danger); }
.badge-medium { background: var(--warning-soft); color: var(--warning); }
.badge-low { background: var(--cyan-soft); color: var(--cyan); }
.badge-done { background: var(--success-soft); color: var(--success); }

/* Панель фильтров и табов */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: 14px;
}

.pill-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-tab {
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-tab:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.pill-tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Расписание: карточки пар */
.schedule-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent);
  margin-bottom: 10px;
  transition: transform 0.15s, border-color 0.15s;
}

.schedule-item:hover {
  border-color: var(--border-strong);
}

.schedule-time-col {
  min-width: 82px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-right: 1px solid var(--border-subtle);
  padding-right: 12px;
}

.pair-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pair-time-start {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.pair-time-end {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.schedule-main-col {
  flex: 1;
  min-width: 0;
}

.schedule-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.schedule-subj-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.schedule-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.schedule-note {
  margin-top: 6px;
  font-size: 0.79rem;
  color: var(--text-muted);
}

/* Сетка расписания на всю неделю */
.week-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

/* Доска объявлений */
.announcement-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}

.announcement-card.pinned {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.07), transparent);
}

/* ДЗ и Канбан-доска */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.92rem;
}

.hw-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}

.hw-card:hover {
  border-color: var(--border-strong);
}

.hw-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
}

.hw-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.subtask-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.subtask-item.done span {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Файловое хранилище и Drag & Drop зона */
.upload-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--accent-soft), transparent);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 20px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.22);
  transform: translateY(-1px);
}

.dropzone-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dropzone-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.file-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 15px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, transform 0.15s;
}

.file-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.file-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.file-ext-box {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.file-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
  word-break: break-word;
}

.file-desc {
  font-size: 0.81rem;
  color: var(--text-secondary);
}

.file-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-chip {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

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

/* Конспекты / Wiki */
.notes-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.note-list-item {
  padding: 13px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.15s;
}

.note-list-item:hover,
.note-list-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.markdown-body {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-primary);
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 14px 0 8px;
  font-weight: 700;
}
.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
  margin: 8px 0;
}
.markdown-body pre {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 0.82rem;
}
.markdown-body code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.83em;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.84rem;
}
.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  text-align: left;
}
.markdown-body th {
  background: var(--bg-elevated);
}

/* БРС и Зачётка */
.grades-table-wrap {
  overflow-x: auto;
}

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

.grades-table th,
.grades-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  font-size: 0.86rem;
}

.grades-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.lab-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.lab-dot-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.lab-dot-btn.completed {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

/* Таймер Pomodoro */
.pomodoro-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
}

.pomodoro-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.8rem;
  font-weight:600;
  letter-spacing: -0.03em;
  margin: 16px 0;
  color: var(--text-primary);
}

/* Формы и Модальное окно */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.modal-window.modal-lg {
  max-width: 880px;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}

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

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

/* Всплывающие уведомления */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
}

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

/* Адаптивность */
@media (max-width: 1080px) {
  .dashboard-grid,
  .kanban-board,
  .notes-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .main-content {
    padding: 18px 16px 40px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Календарь расписания --- */
.calendar-card{margin-bottom:20px}
.calendar-top{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:12px}
.calendar-selected{text-align:center;flex:1;min-width:260px}
.calendar-selected-date{font-size:1.45rem;font-weight:600;letter-spacing:-.02em;text-transform:capitalize}
.calendar-selected-week{display:flex;align-items:center;justify-content:center;gap:10px;margin-top:7px;flex-wrap:wrap}
.calendar-range{color:var(--text-secondary);font-size:.88rem}
.calendar-month-title{text-align:center;font-weight:700;text-transform:capitalize;margin:8px 0 10px;color:var(--text-secondary)}
.cal-weekdays,.cal-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;max-width:720px;margin:0 auto}
.cal-weekdays span{text-align:center;font-size:.75rem;font-weight:700;color:var(--text-muted);padding:4px}
.cal-day{position:relative;border:1px solid var(--border-subtle);background:var(--bg-input);color:var(--text-primary);border-radius:10px;min-height:44px;font-weight:600;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}
.cal-day:hover{border-color:var(--accent)}
.cal-day i{width:6px;height:6px;border-radius:50%;background:var(--accent);display:block}
.cal-day.other-month{opacity:.35}
.cal-day.today{border-color:var(--success);box-shadow:0 0 0 2px var(--success-soft)}
.cal-day.selected{background:var(--accent);color:#fff;border-color:var(--accent)}
.cal-day.selected i{background:#fff}
.calendar-actions{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;margin-top:14px}
.calendar-date-input{font-size:.85rem;color:var(--text-secondary)}
.calendar-hint{text-align:center;font-size:.8rem;color:var(--text-muted);margin-top:10px}
body.readonly .subtask-item input{cursor:not-allowed}
@media(max-width:640px){.calendar-selected-date{font-size:1.15rem}.cal-day{min-height:38px}}


/* --- Современный закруглённый шрифт --- */
button, input, select, textarea { font-family: inherit; }
body { font-weight: 600; }
h1, h2, h3, .brand-title, .page-title, .card-title, .stat-value,
.calendar-selected-date, .file-title, .hw-title, .schedule-subj-title,
.kanban-col-header, .modal-title, .dropzone-title {
  font-family: 'Rubik', 'Segoe UI', sans-serif;
  font-weight:700;
  letter-spacing: -0.01em;
}
.btn, .nav-item, .pill-tab, .badge { font-weight:600; }
input, select, textarea { font-weight: 600; }

/* --- Страница входа --- */
.login-gate{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background:radial-gradient(1000px 500px at 20% 0%,rgba(99,102,241,.25),transparent),var(--bg-app)}
.login-card{background:var(--bg-surface);border:1px solid var(--border-subtle);border-radius:20px;box-shadow:var(--shadow-modal);padding:34px 30px;max-width:400px;width:100%;text-align:center}
.login-title{font-size:1.35rem;margin-bottom:6px}
.login-subtitle{color:var(--text-secondary);font-size:.9rem;margin-bottom:20px}
.login-hint{color:var(--text-muted);font-size:.8rem;margin-top:14px}

/* --- Редактор расписания --- */
.sched-editor-wrap{overflow-x:auto}
table.sched-editor th,table.sched-editor td{padding:7px 6px}
table.sched-editor .form-input,table.sched-editor .form-select{padding:6px 8px;font-size:.8rem;min-width:90px}
table.sched-editor input[type="time"]{min-width:96px;width:96px}

/* --- Контрольные мероприятия --- */
.cal-day i.ctrl-dot{background:var(--danger)}
.ctrl-event{display:flex;justify-content:space-between;gap:12px;padding:13px 14px;border:1px solid var(--border-subtle);background:var(--bg-input);border-radius:12px;margin-bottom:9px;align-items:flex-start}
.ctrl-event-title{font-weight:700;margin-top:7px;font-size:.98rem}
.ctrl-event-meta{font-size:.82rem;color:var(--text-secondary);margin-top:3px}

/* --- Метки контрольных на парах --- */
.pair-events{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.pair-event-badge{font-size:.8rem;font-weight:700;padding:4px 10px;border-radius:8px;border:1px solid}
.pe-РК,.pe-КР{background:var(--danger-soft);color:var(--danger);border-color:var(--danger)}
.pe-ДЗ{background:var(--warning-soft);color:var(--warning);border-color:var(--warning)}
.pe-М{background:var(--accent-soft);color:var(--accent);border-color:var(--accent)}

/* --- Компактное расписание --- */
.sched-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;background:var(--bg-surface);border:1px solid var(--border-subtle);border-radius:14px;padding:10px 14px;margin-bottom:14px}
.sched-nav{display:flex;align-items:center;gap:7px}
.sched-date{width:auto;padding:7px 10px}
.sched-week-badge{font-size:.85rem;padding:6px 13px}
.sched-range{color:var(--text-secondary);font-size:.86rem;margin-left:auto}
.day-strip{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-bottom:16px}
.day-chip{background:var(--bg-surface);border:1px solid var(--border-subtle);color:var(--text-primary);border-radius:12px;padding:8px 6px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:1px}
.day-chip:hover{border-color:var(--accent)}
.day-chip-name{font-size:.72rem;font-weight:600;color:var(--text-muted);text-transform:uppercase}
.day-chip-num{font-size:1.15rem;font-weight:700;line-height:1.1}
.day-chip-cnt{font-size:.7rem;color:var(--text-secondary);min-height:.85rem}
.day-chip.today{border-color:var(--success)}
.day-chip.selected{background:var(--accent);border-color:var(--accent);color:#fff}
.day-chip.selected .day-chip-name,.day-chip.selected .day-chip-cnt{color:rgba(255,255,255,.85)}
.day-card{padding:16px}
.day-title{margin-bottom:12px;font-size:1rem}
.day-date{color:var(--text-muted);font-weight:700;font-size:.85rem}
.day-selected{border-color:var(--accent)!important;box-shadow:0 0 0 2px var(--accent-soft)}
.no-pairs{color:var(--text-muted);font-size:.85rem}
.pair-admin-btns{display:flex;gap:6px;margin:-4px 0 10px}
.week-schedule-grid .schedule-item{padding:11px 12px;margin-bottom:8px}
@media(max-width:640px){.day-strip{grid-template-columns:repeat(3,1fr)}.sched-range{margin-left:0}}

/* --- Современное подробное расписание --- */
.sched-hero{background:linear-gradient(135deg,rgba(99,102,241,.20),rgba(16,185,129,.10) 55%,transparent),var(--bg-surface);border:1px solid var(--border-subtle);border-radius:18px;padding:20px 22px;margin-bottom:14px;box-shadow:var(--shadow-card)}
.sched-hero-top{display:flex;justify-content:space-between;gap:18px;flex-wrap:wrap;align-items:flex-start}
.sched-hero-eyebrow{font-size:.78rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--text-secondary)}
.sched-hero-date{font-size:1.75rem;line-height:1.15;margin:6px 0 8px;text-transform:capitalize}
.sched-hero-sub{display:flex;gap:10px;align-items:center;flex-wrap:wrap;color:var(--text-secondary);font-size:.9rem}
.sched-hero-stats{display:flex;gap:10px}
.hero-stat{background:var(--bg-input);border:1px solid var(--border-subtle);border-radius:14px;padding:10px 14px;text-align:center;min-width:92px;display:flex;flex-direction:column}
.hero-stat strong{font-size:1.35rem;line-height:1.1}
.hero-stat span{font-size:.72rem;color:var(--text-secondary)}
.hero-stat-warn{border-color:var(--danger);background:var(--danger-soft)}
.sched-hero-controls{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:center;margin-top:16px;padding-top:14px;border-top:1px solid var(--border-subtle)}
.sched-admin{display:flex;gap:8px}
.sched-week-events{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:14px}
.swe-label{font-size:.84rem;font-weight:600;color:var(--text-secondary)}
.swe-chip{border-radius:999px;padding:6px 12px;font-size:.8rem;font-weight:700;cursor:pointer;border:1px solid;background:var(--bg-input);color:var(--text-primary)}
.swe-РК,.swe-КР{border-color:var(--danger);background:var(--danger-soft);color:var(--danger)}
.swe-ДЗ{border-color:var(--warning);background:var(--warning-soft);color:var(--warning)}
.swe-М{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.day-ev-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--danger);vertical-align:middle}
.day-count{margin-left:auto;font-size:.76rem;color:var(--text-muted);font-weight:700}
.schedule-item{border-left:4px solid var(--subj,var(--accent));background:linear-gradient(90deg,color-mix(in srgb,var(--subj) 7%,transparent),transparent 55%),var(--bg-input)}
.schedule-item.has-event{box-shadow:0 0 0 1px var(--danger) inset}
.schedule-item.is-now{box-shadow:0 0 0 2px var(--success) inset}
.subj-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:var(--subj);margin-right:7px}
.pair-dur{font-size:.7rem;color:var(--text-muted);font-weight:700;margin-top:4px}
.pair-event-alerts{margin-top:9px;display:flex;flex-direction:column;gap:6px}
.pair-event-alert{display:flex;gap:8px;align-items:center;padding:8px 11px;border-radius:10px;font-size:.84rem;border:1px solid}
.pea-РК,.pea-КР{background:var(--danger-soft);color:var(--danger);border-color:var(--danger)}
.pea-ДЗ{background:var(--warning-soft);color:var(--warning);border-color:var(--warning)}
.pea-М{background:var(--accent-soft);color:var(--accent);border-color:var(--accent)}
@media(max-width:700px){.sched-hero{padding:16px}.sched-hero-date{font-size:1.35rem}.hero-stat{min-width:76px;padding:8px 10px}}

/* --- Красивый календарь месяца --- */
.mcal-card{padding:18px 20px;margin-bottom:16px;background:linear-gradient(180deg,rgba(99,102,241,.08),transparent 45%),var(--bg-surface)}
.mcal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.mcal-title{font-size:1.15rem;font-weight:700;text-transform:capitalize}
.mcal-arrow{border-radius:50%;width:34px;height:34px;padding:0}
.mcal-weekdays,.mcal-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:7px}
.mcal-weekdays span{text-align:center;font-size:.74rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);padding:2px 0 6px}
.mcal-day{position:relative;border:1px solid var(--border-subtle);background:var(--bg-input);color:var(--text-primary);border-radius:13px;min-height:58px;padding:7px 6px 6px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:2px;transition:all .15s}
.mcal-day:hover{border-color:var(--accent);transform:translateY(-1px)}
.mcal-day.other{opacity:.38}
.mcal-day.in-week{background:var(--accent-soft)}
.mcal-day.today{border-color:var(--success);box-shadow:0 0 0 2px var(--success-soft)}
.mcal-day.selected{background:var(--accent);border-color:var(--accent);color:#fff;box-shadow:0 6px 16px rgba(99,102,241,.35)}
.mcal-num{font-size:1.05rem;font-weight:700;line-height:1.1}
.mcal-cnt{font-size:.68rem;color:var(--text-secondary);min-height:.8rem}
.mcal-day.selected .mcal-cnt{color:rgba(255,255,255,.85)}
.mcal-cnt.empty{min-height:.8rem}
.mcal-dots{display:flex;gap:4px;min-height:7px;align-items:center}
.mcal-dots i,.mcal-legend i{display:inline-block;width:7px;height:7px;border-radius:50%}
.dot-pairs{background:var(--accent)}
.dot-ctrl{background:var(--danger)}
.mcal-day.selected .dot-pairs{background:#fff}
.mcal-legend{display:flex;gap:16px;align-items:center;flex-wrap:wrap;margin-top:12px;font-size:.76rem;color:var(--text-secondary)}
.mcal-leg-sel{display:inline-block;width:14px;height:14px;border-radius:5px;background:var(--accent-soft);border:1px solid var(--accent);vertical-align:-2px;margin-right:-10px}
@media(max-width:640px){.mcal-day{min-height:50px}.mcal-cnt{display:none}}

/* --- Календарь недели (как в мобильном расписании) --- */
.week-strip{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;max-width:880px;margin:0 auto 18px}
.wst-day{position:relative;background:var(--bg-surface);border:1px solid var(--border-subtle);border-radius:20px;padding:14px 6px 11px;cursor:pointer;color:var(--text-primary);display:flex;flex-direction:column;align-items:center;gap:2px;transition:all .18s ease;box-shadow:var(--shadow-card)}
.wst-day:hover{border-color:var(--accent);transform:translateY(-2px)}
.wst-num{position:relative;font-size:1.65rem;font-weight:600;line-height:1.05;letter-spacing:-.02em}
.wst-ev-dot{position:absolute;top:1px;right:-13px;width:8px;height:8px;border-radius:50%;background:var(--danger)}
.wst-dow{font-size:.82rem;font-weight:700;color:var(--text-secondary);letter-spacing:.08em}
.wst-cnt{font-size:.7rem;font-weight:700;color:var(--text-muted);margin-top:3px}
.wst-day.today{border-color:var(--success)}
.wst-day.selected{background:linear-gradient(180deg,#38bdf8,#2563eb);border-color:#2563eb;color:#fff;box-shadow:0 10px 24px rgba(37,99,235,.35)}
.wst-day.selected .wst-dow,.wst-day.selected .wst-cnt{color:rgba(255,255,255,.88)}
.wst-day.selected .wst-ev-dot{background:#fca5a5}
@media(max-width:640px){.week-strip{gap:7px}.wst-num{font-size:1.3rem}.wst-day{border-radius:16px;padding:11px 3px 9px}.wst-cnt{display:none}}

/* --- Скрытые (архивные) вкладки у админа --- */
.nav-item.tab-archived{opacity:.55}
.tab-hidden-badge{font-size:.66rem;font-weight:700;padding:2px 7px;border-radius:999px;background:var(--warning-soft);color:var(--warning);margin-left:auto;white-space:nowrap}

/* --- Тумблер режима администратора --- */
.admin-mode-row{display:flex;align-items:center;gap:9px;background:var(--bg-surface);border:1px solid var(--border-subtle);padding:9px 11px;border-radius:10px}
.admin-mode-label{font-size:.8rem;font-weight:600;flex:1}
.admin-mode-state{font-size:.72rem;font-weight:700;color:var(--success);min-width:24px;text-align:right}
.switch{position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0}
.switch input{opacity:0;width:0;height:0}
.switch-slider{position:absolute;inset:0;background:var(--bg-input);border:1px solid var(--border-strong);border-radius:999px;cursor:pointer;transition:.2s}
.switch-slider:before{content:"";position:absolute;width:18px;height:18px;border-radius:50%;background:var(--text-secondary);top:2px;left:2px;transition:.2s}
.switch input:checked + .switch-slider{background:var(--accent);border-color:var(--accent)}
.switch input:checked + .switch-slider:before{transform:translateX(20px);background:#fff}

/* --- Корпус и кабинет покрупнее --- */
.pair-room{font-size:.93rem;font-weight:700;color:var(--text-primary);background:var(--accent-soft);border:1px solid var(--border-subtle);padding:3px 10px;border-radius:9px}

/* --- Светящиеся точки контрольных событий --- */
@keyframes evDotGlow{0%,100%{box-shadow:0 0 6px 2px rgba(239,68,68,.75),0 0 14px 5px rgba(239,68,68,.38)}50%{box-shadow:0 0 10px 4px rgba(239,68,68,.95),0 0 22px 9px rgba(239,68,68,.5)}}
.wst-ev-dot{background:#ef4444;box-shadow:none;animation:evDotGlow 1.8s ease-in-out infinite}
.wst-day.selected .wst-ev-dot{background:#fca5a5;animation:evDotGlowSel 1.8s ease-in-out infinite}
@keyframes evDotGlowSel{0%,100%{box-shadow:0 0 6px 2px rgba(254,202,202,.85),0 0 14px 5px rgba(254,202,202,.45)}50%{box-shadow:0 0 10px 4px rgba(254,202,202,1),0 0 22px 9px rgba(254,202,202,.55)}}
@media (prefers-reduced-motion: reduce){.wst-ev-dot{animation:none;box-shadow:0 0 12px 4px rgba(239,68,68,.6)}}

/* --- Светящиеся кружочки событий: полоска дней и карточки пар (мягкая пульсация) --- */
@keyframes evDotGlow{0%,100%{box-shadow:0 0 5px 1px rgba(239,68,68,.55),0 0 11px 3px rgba(239,68,68,.28)}50%{box-shadow:0 0 8px 2px rgba(239,68,68,.8),0 0 16px 5px rgba(239,68,68,.4)}}
@keyframes evDotGlowSel{0%,100%{box-shadow:0 0 5px 1px rgba(254,202,202,.65),0 0 11px 3px rgba(254,202,202,.32)}50%{box-shadow:0 0 8px 2px rgba(254,202,202,.9),0 0 16px 5px rgba(254,202,202,.45)}}
.wst-ev-dot,.pair-ev-dot{animation-duration:2.8s}
.wst-ev-dot.ev-dz,.pair-ev-dot.ev-dz{background:#f59e0b;animation-name:evDotDz}
.wst-ev-dot.ev-kr,.pair-ev-dot.ev-kr{background:#a855f7;animation-name:evDotKr}
.wst-ev-dot.ev-m,.pair-ev-dot.ev-m{background:#3b82f6;animation-name:evDotM}
@keyframes evDotDz{0%,100%{box-shadow:0 0 5px 1px rgba(245,158,11,.55),0 0 11px 3px rgba(245,158,11,.28)}50%{box-shadow:0 0 8px 2px rgba(245,158,11,.85),0 0 16px 5px rgba(245,158,11,.42)}}
@keyframes evDotKr{0%,100%{box-shadow:0 0 5px 1px rgba(168,85,247,.55),0 0 11px 3px rgba(168,85,247,.28)}50%{box-shadow:0 0 8px 2px rgba(168,85,247,.85),0 0 16px 5px rgba(168,85,247,.42)}}
@keyframes evDotM{0%,100%{box-shadow:0 0 5px 1px rgba(59,130,246,.55),0 0 11px 3px rgba(59,130,246,.28)}50%{box-shadow:0 0 8px 2px rgba(59,130,246,.85),0 0 16px 5px rgba(59,130,246,.42)}}
.wst-day.selected .wst-ev-dot.ev-dz{background:#fcd34d}
.wst-day.selected .wst-ev-dot.ev-kr{background:#d8b4fe}
.wst-day.selected .wst-ev-dot.ev-m{background:#93c5fd}
.pair-ev-dot{display:inline-block;width:10px;height:10px;border-radius:50%;background:#ef4444;margin-left:8px;vertical-align:middle;flex-shrink:0;animation:evDotGlow 2.8s ease-in-out infinite}

/* --- Векторные иконки и точка внутри плашки события --- */
.svg-ic{flex-shrink:0;vertical-align:-2px}
.pair-room .svg-ic,.schedule-meta-row .svg-ic{vertical-align:-2px}
.pair-event-alert{gap:10px}
.pea-dot-plate{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;background:rgba(255,255,255,.92);border:1px solid rgba(255,255,255,.95);box-shadow:0 1px 5px rgba(2,6,23,.35);flex-shrink:0}
.pea-dot-plate .pair-ev-dot{margin-left:0;width:11px;height:11px}
.pea-text{flex:1}
.pea-svg{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:8px;background:rgba(255,255,255,.16);flex-shrink:0}
.schedule-note .svg-ic{vertical-align:-3px;margin-right:4px}
.pair-event-alert .pair-ev-dot{margin-left:0;width:11px;height:11px}

/* --- Иконки вместо эмодзи: выравнивание + точки --- */
.emoji-dot{display:inline-block;width:9px;height:9px;border-radius:50%;vertical-align:0;margin-right:2px}
button .svg-ic,.btn .svg-ic,.badge .svg-ic,.nav-item .svg-ic,.stat-icon .svg-ic{vertical-align:-3px}
.nav-item .svg-ic{width:19px;height:19px}
.stat-icon .svg-ic{width:24px;height:24px}
/* --- Контрольные блоки: шрифт легче --- */
.pair-event-alert{font-weight:500}
.pair-event-alert strong{font-weight:600}
.ctrl-event-title{font-weight:600 !important}
.ctrl-event .badge{font-weight:600}

/* --- Точка на выбранном (синем) дне: белая окантовка, без размытия --- */
.wst-day.selected .wst-ev-dot{width:9px;height:9px;border:2px solid #fff;animation:evDotSelCrisp 2.8s ease-in-out infinite}
.wst-day.selected .wst-ev-dot.ev-rk{background:#ef4444}
.wst-day.selected .wst-ev-dot.ev-dz{background:#f59e0b}
.wst-day.selected .wst-ev-dot.ev-kr{background:#a855f7}
.wst-day.selected .wst-ev-dot.ev-m{background:#3b82f6}
@keyframes evDotSelCrisp{0%,100%{box-shadow:0 0 4px 1px rgba(255,255,255,.55)}50%{box-shadow:0 0 7px 2px rgba(255,255,255,.8)}}

/* --- Выбранный день: кружок белый (цветной на синем всё равно сливается) --- */
.wst-day.selected .wst-num .wst-ev-dot{background:#fff;border:none;width:10px;height:10px;box-shadow:0 1px 4px rgba(30,58,138,.55);animation:evDotSelWhite 2.8s ease-in-out infinite}
@keyframes evDotSelWhite{0%,100%{box-shadow:0 1px 4px rgba(30,58,138,.55),0 0 4px 1px rgba(255,255,255,.5)}50%{box-shadow:0 1px 4px rgba(30,58,138,.55),0 0 8px 3px rgba(255,255,255,.75)}}

/* --- Выбранный день: цветной кружок с тёмной обводкой, без свечения --- */
.wst-day.selected .wst-num .wst-ev-dot{border:2px solid #172554;width:10px;height:10px;animation:none;box-shadow:0 1px 3px rgba(23,37,84,.5)}
.wst-day.selected .wst-num .wst-ev-dot.ev-rk{background:#ef4444}
.wst-day.selected .wst-num .wst-ev-dot.ev-dz{background:#f59e0b}
.wst-day.selected .wst-num .wst-ev-dot.ev-kr{background:#a855f7}
.wst-day.selected .wst-num .wst-ev-dot.ev-m{background:#60a5fa}

/* --- ДЗ: статус сегментом и личный приоритет --- */
.hw-status-seg{display:flex;gap:3px;background:var(--bg-input);border:1px solid var(--border-subtle);border-radius:11px;padding:3px;margin-top:4px}
.hw-status-btn{flex:1;border:none;background:transparent;color:var(--text-secondary);font-weight:600;font-size:.78rem;padding:7px 4px;border-radius:8px;cursor:pointer;transition:all .15s}
.hw-status-btn:hover{color:var(--text-primary)}
.hw-status-btn.active.st-todo{background:var(--bg-elevated);color:var(--text-primary);box-shadow:var(--shadow-card)}
.hw-status-btn.active.st-in_progress{background:var(--warning-soft);color:var(--warning)}
.hw-status-btn.active.st-done{background:var(--success-soft);color:var(--success)}
.hw-pr-row{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.hw-pr-label{font-size:.74rem;color:var(--text-muted);font-weight:600;margin-right:2px}
.hw-pr-btn{border:1px solid var(--border-subtle);background:transparent;color:var(--text-muted);font-size:.72rem;font-weight:600;padding:4px 9px;border-radius:999px;cursor:pointer;transition:all .15s}
.hw-pr-btn.active.pr-high{background:var(--danger-soft);color:var(--danger);border-color:var(--danger)}
.hw-pr-btn.active.pr-medium{background:var(--warning-soft);color:var(--warning);border-color:var(--warning)}
.hw-pr-btn.active.pr-low{background:var(--success-soft);color:var(--success);border-color:var(--success)}

/* --- Предпросмотр Office: DOCX и PPTX --- */
.office-doc{background:var(--bg-input);border:1px solid var(--border-subtle);border-radius:12px;padding:20px 22px;max-height:62vh;overflow:auto;line-height:1.65}
.office-p{margin:0 0 9px;font-size:.92rem}
.office-li{padding-left:16px;position:relative}
.office-li:before{content:"•";position:absolute;left:2px;color:var(--accent)}
.office-h{margin:14px 0 8px;font-size:1.05rem}
.slides-list{display:flex;flex-direction:column;gap:12px;max-height:62vh;overflow:auto}
.slide-card{background:var(--bg-input);border:1px solid var(--border-subtle);border-radius:12px;padding:16px 18px}
.slide-num{font-size:.7rem;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.07em;margin-bottom:7px}
.slide-title{font-size:1.02rem;font-weight:700;margin-bottom:6px}
.slide-line{font-size:.88rem;color:var(--text-secondary);margin-bottom:3px}

/* --- Индикатор резервной копии состояния --- */
.backup-status{font-size:.72rem;font-weight:600;line-height:1.45;color:var(--success);background:var(--success-soft);border:1px solid var(--border-subtle);border-radius:10px;padding:8px 11px}
.backup-status.backup-bad{color:var(--danger);background:var(--danger-soft)}

/* --- Успеваемость из ЭУ --- */
.eu-card{margin-bottom:20px}
.eu-student{font-size:.92rem;color:var(--text-secondary);margin-bottom:14px}
.eu-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px}
.eu-subj{background:var(--bg-input);border:1px solid var(--border-subtle);border-radius:12px;padding:13px 14px}
.eu-subj-head{display:flex;justify-content:space-between;gap:8px;font-weight:600;font-size:.9rem;margin-bottom:8px}
.eu-pct{color:var(--accent)}
.eu-weeks{display:flex;flex-wrap:wrap;gap:5px;margin-top:9px}
.eu-week-chip{font-size:.7rem;background:var(--bg-surface);border:1px solid var(--border-subtle);border-radius:999px;padding:3px 8px;color:var(--text-secondary)}
.eu-note{font-size:.78rem;color:var(--text-muted);margin-top:12px}
.eu-error{background:var(--danger-soft);color:var(--danger);border-radius:10px;padding:9px 12px;font-size:.86rem;margin-bottom:10px}
.eu-login-row{display:flex;gap:8px;flex-wrap:wrap}
.eu-login-row .form-input{flex:1;min-width:180px}

/* ============ МОБИЛЬНАЯ ОПТИМИЗАЦИЯ ============ */
@media (max-width: 760px){
  html{ -webkit-text-size-adjust:100%; }
  body{ font-size:15px; }
  .main-content{ padding:14px 12px 90px; }
  /* Шапка страницы и верхняя панель */
  .page-header{ flex-direction:column; align-items:stretch; gap:10px; margin-bottom:14px; }
  .page-title{ font-size:1.35rem; line-height:1.25; }
  .page-subtitle{ font-size:.85rem; }
  .page-actions{ display:flex; flex-wrap:wrap; gap:8px; }
  .page-actions .btn{ flex:1 1 auto; min-height:42px; }
  .topbar{ flex-wrap:wrap; gap:8px; padding:10px 12px; }
  .topbar-left{ flex:1 1 100%; }
  .search-box{ flex:1; }
  .search-kbd{ display:none; }
  .topbar-right{ flex:1 1 100%; justify-content:space-between; }
  #quickUploadTopBtn{ flex:1; min-height:40px; }
  /* Сенсорные цели */
  .btn{ min-height:40px; padding:9px 14px; }
  .btn-sm{ min-height:36px; }
  .btn-xs{ min-height:32px; padding:6px 10px; }
  .nav-item{ padding:13px 14px; }
  .pill-tab{ padding:9px 13px; flex-shrink:0; }
  /* Фильтры — горизонтальная прокрутка в одну строку */
  .filter-bar{ flex-direction:column; align-items:stretch; gap:10px; }
  .pill-tabs{ display:flex; flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; padding-bottom:2px; }
  .pill-tabs::-webkit-scrollbar{ display:none; }
  /* Сетки — в одну колонку */
  .stats-grid{ grid-template-columns:1fr 1fr; gap:10px; }
  .files-grid,.dashboard-grid,.kanban-board,.notes-layout,.eu-grid{ grid-template-columns:1fr !important; }
  .stat-card{ padding:13px; }
  .stat-value{ font-size:1.3rem; }
  /* Расписание */
  .sched-hero{ padding:14px; border-radius:16px; }
  .sched-hero-stats{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .hero-stat{ min-width:0; }
  .schedule-item{ padding:12px; gap:10px; border-radius:14px; }
  .schedule-time-col{ min-width:58px; }
  .pair-time-start{ font-size:1rem; }
  .schedule-subj-title{ font-size:.98rem; }
  .schedule-meta-row{ gap:6px 10px; font-size:.8rem; }
  .pair-room{ font-size:.85rem; padding:3px 8px; }
  .schedule-note{ font-size:.8rem; }
  /* Карточки и формы */
  .card{ padding:15px; border-radius:16px; }
  .hw-card,.file-card{ padding:14px; }
  .hw-status-btn{ padding:10px 4px; font-size:.8rem; }
  .hw-pr-btn{ padding:7px 11px; }
  .form-input,.form-select,.form-textarea{ font-size:16px; min-height:44px; } /* 16px — без автозума iOS */
  .subtask-item{ padding:9px 0; }
  .subtask-item input[type="checkbox"]{ width:20px; height:20px; }
  /* Таблицы — горизонтальная прокрутка */
  .grades-table-wrap{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .grades-table{ min-width:600px; }
  /* Модалки — почти на весь экран, снизу */
  .modal-backdrop{ align-items:flex-end; padding:0; }
  .modal-window,.modal-window.modal-lg{ width:100vw; max-width:100vw; max-height:92dvh; border-radius:20px 20px 0 0; }
  .modal-body{ max-height:calc(92dvh - 60px); overflow-y:auto; -webkit-overflow-scrolling:touch; }
  /* Вход */
  .login-card{ padding:26px 20px; border-radius:18px; }
  /* Pomodoro и прочее */
  .pomodoro-clock{ font-size:3rem; }
  .eu-login-row{ flex-direction:column; }
  .eu-login-row .btn{ width:100%; }
  .search-dropdown{ left:8px; right:8px; width:auto; }
}
@media (max-width: 420px){
  .stats-grid{ grid-template-columns:1fr 1fr; }
  .wst-num{ font-size:1.15rem; }
  .topbar-pomodoro{ display:none; } /* таймер есть в разделе «Инструменты» */
  .brand-subtitle{ display:none; }
}

/* Затемнение под выдвижным меню на мобильных */
@media (max-width: 820px){
  .sidebar{ z-index:60; width:min(300px,86vw); box-shadow:var(--shadow-modal); }
  .sidebar.open::after{ content:""; position:fixed; inset:0; left:min(300px,86vw); background:rgba(2,6,23,.45); }
  .main-wrapper{ min-width:0; }
}

/* --- Закрытие боковой панели на мобильных + без закреплённой шапки --- */
.sidebar-close-btn{ display:none; margin-left:auto; flex-shrink:0; width:38px; height:38px; border-radius:10px; border:1px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); cursor:pointer; align-items:center; justify-content:center; }
.topbar{ position:static !important; }
@media (max-width: 820px){
  .sidebar-close-btn{ display:inline-flex; }
}

/* ============ РЕЖИМ ПРИЛОЖЕНИЯ (мобильные) ============ */
.bottom-nav{ display:none; }
html,body{ overflow-x:hidden; max-width:100%; }
body{ touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
img,svg,video,iframe{ max-width:100%; }
*{ -webkit-tap-highlight-color:transparent; }

@media (max-width: 760px){
  /* Шапка: авто-высота (была фикс. 66px — кнопки налезали на контент) */
  .topbar{ height:auto !important; min-height:0; flex-direction:column; align-items:stretch; gap:8px; padding:calc(8px + env(safe-area-inset-top)) 12px 10px; overflow:visible; }
  .topbar-left{ flex:none; max-width:none; width:100%; gap:8px; }
  .mobile-menu-btn{ flex:0 0 42px; width:42px; height:42px; display:inline-flex; align-items:center; justify-content:center; padding:0; }
  .search-box{ height:42px; border-radius:12px; }
  .search-box input{ font-size:16px; padding:0; } /* 16px = нет автозума */
  .topbar-right{ flex:none; width:100%; display:flex; flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; gap:8px; padding-bottom:2px; justify-content:flex-start; }
  .topbar-right::-webkit-scrollbar{ display:none; }
  .topbar-right .btn,.topbar-right .icon-btn{ flex:0 0 auto; white-space:nowrap; min-height:38px; }
  .topbar-pomodoro{ display:none !important; }
  .main-content{ padding:14px 12px calc(86px + env(safe-area-inset-bottom)); width:100%; box-sizing:border-box; }
  /* Нижняя навигация как в приложении */
  .bottom-nav{ display:flex; position:fixed; left:0; right:0; bottom:0; z-index:55; background:var(--bg-sidebar); border-top:1px solid var(--border-subtle); padding:6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow:0 -6px 24px rgba(0,0,0,.18); }
  .bnav-item{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; padding:7px 2px 5px; border:none; background:transparent; color:var(--text-muted); font:inherit; font-size:.66rem; font-weight:600; border-radius:12px; cursor:pointer; min-height:52px; }
  .bnav-item.active{ color:var(--accent); background:var(--accent-soft); }
  .bnav-item:active{ transform:scale(.96); }
  /* конец страницы не уезжает под нижнюю навигацию */
  .modal-backdrop{ padding-bottom:calc(70px + env(safe-area-inset-bottom)); box-sizing:border-box; }
}

/* Крупная кнопка меню на мобильных */
@media (max-width: 760px){
  .mobile-menu-btn{ flex:0 0 52px !important; width:52px !important; height:46px !important; font-size:1.5rem !important; border-radius:14px !important; background:var(--accent-soft) !important; border-color:var(--accent) !important; color:var(--accent) !important; font-weight:700; }
}

/* Оценки по баллам: 60+ = 3, 71–84 = 4, 85+ = 5 */
.grade-badge{ white-space:nowrap; margin-left:6px; }
.grade-badge.g5{ background:rgba(34,197,94,.18); color:#22c55e; }
.grade-badge.g4{ background:rgba(59,130,246,.18); color:#3b82f6; }
.grade-badge.g3{ background:rgba(245,158,11,.18); color:#f59e0b; }
.grade-badge.glow{ background:rgba(239,68,68,.14); color:#ef4444; }
.eu-subj-head{ gap:8px; flex-wrap:wrap; }

/* Шапка на мобильных — одна линия: меню, поиск, Выйти, тема */
@media (max-width: 760px){
  .topbar{ flex-direction:row !important; flex-wrap:nowrap !important; align-items:center; gap:8px; }
  .topbar-left{ flex:1 1 auto !important; min-width:0; width:auto !important; }
  .topbar-right{ flex:0 0 auto !important; width:auto !important; overflow:visible !important; gap:6px; }
  #quickUploadTopBtn,#openSettingsBtn{ display:none !important; }
  #adminAuthBtn{ min-height:42px; padding:8px 12px; white-space:nowrap; }
  #themeToggleBtn{ width:42px; height:42px; flex:0 0 42px; display:inline-flex; align-items:center; justify-content:center; }
  .bnav-item span{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
}

/* Оценки по баллам: 60+ = 3, 71–84 = 4, 85+ = 5 */
.grade-badge{ white-space:nowrap; margin-left:6px; }
.grade-badge.g5{ background:rgba(34,197,94,.18); color:#22c55e; }
.grade-badge.g4{ background:rgba(59,130,246,.18); color:#3b82f6; }
.grade-badge.g3{ background:rgba(245,158,11,.18); color:#f59e0b; }
.grade-badge.glow{ background:rgba(239,68,68,.14); color:#ef4444; }
.eu-subj-head{ gap:8px; flex-wrap:wrap; }

/* Шапка на мобильных — одна линия: меню, поиск, Выйти, тема */
@media (max-width: 760px){
  .topbar{ flex-direction:row !important; flex-wrap:nowrap !important; align-items:center; gap:8px; }
  .topbar-left{ flex:1 1 auto !important; min-width:0; width:auto !important; }
  .topbar-right{ flex:0 0 auto !important; width:auto !important; overflow:visible !important; gap:6px; }
  #quickUploadTopBtn,#openSettingsBtn{ display:none !important; }
  #adminAuthBtn{ min-height:42px; padding:8px 12px; white-space:nowrap; }
  #themeToggleBtn{ width:42px; height:42px; flex:0 0 42px; display:inline-flex; align-items:center; justify-content:center; }
  .bnav-item span{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
}

/* --- Кнопка «Выйти» внизу боковой панели + панель не уезжает под строку браузера --- */
.sidebar{ height:100vh; height:100dvh; }
.sidebar-logout-btn{ display:flex; align-items:center; justify-content:center; gap:9px; width:100%; min-height:46px; padding:11px 14px; border-radius:12px; border:1px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); font:inherit; font-weight:600; cursor:pointer; }
.sidebar-logout-btn:hover{ border-color:var(--danger); color:var(--danger); }
.sidebar-logout-btn:active{ transform:scale(.98); }
@media (max-width: 820px){
  .sidebar{ padding-bottom:calc(14px + env(safe-area-inset-bottom)); }
  .sidebar-footer{ padding-bottom:env(safe-area-inset-bottom); }
  .sidebar-logout-btn{ position:sticky; bottom:calc(8px + env(safe-area-inset-bottom)); z-index:5; box-shadow:0 8px 24px rgba(0,0,0,.28); background:var(--bg-surface); }
}

/* --- Файлы: компактная строка категорий --- */
.files-filter{ align-items:flex-start; }
.files-filter .pill-tabs{ flex:1 1 auto; min-width:0; flex-wrap:wrap; }
.files-filter .pill-tab{ max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.files-subject-select{ flex:0 1 220px; max-width:100%; }
@media (max-width: 760px){
  .files-filter{ flex-direction:column; align-items:stretch; padding:10px 12px; }
  .files-filter .pill-tabs{ display:flex; flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; width:100%; }
  .files-filter .pill-tabs::-webkit-scrollbar{ display:none; }
  .files-filter .pill-tab{ flex:0 0 auto; max-width:170px; }
  .files-subject-select{ flex:none; width:100%; min-height:44px; font-size:16px; }
}

/* --- Прокрутка только внутри своих окошек, не из краёв окна --- */
.main-wrapper,#mainContent{ min-width:0; overflow-x:clip; }
.filter-bar{ width:100%; max-width:100%; box-sizing:border-box; overflow:hidden; }
.filter-bar .pill-tabs{ min-width:0; max-width:100%; }
.kanban-board{ max-width:100%; }
.kanban-col{ min-width:0; overflow:hidden; }
.hw-card{ min-width:0; max-width:100%; box-sizing:border-box; overflow-wrap:break-word; }
.hw-title,.hw-desc{ overflow-wrap:anywhere; }
@media (max-width: 760px){
  .hw-filter{ padding:10px 12px; }
  .hw-filter .pill-tabs{ display:flex; flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden; width:100%; -webkit-overflow-scrolling:touch; scrollbar-width:none; overscroll-behavior-x:contain; border-radius:10px; }
  .hw-filter .pill-tabs::-webkit-scrollbar{ display:none; }
  .hw-filter .pill-tab{ flex:0 0 auto; }
  .kanban-col{ padding:13px; border-radius:14px; }
}

/* --- Выйти: только в боковой панели, закреплена внизу; панель выше докбара --- */
#adminAuthBtn{ display:none !important; }
.sidebar{ overflow:hidden; z-index:90; }
.sidebar-brand,.week-switcher-card,.sidebar-footer{ flex-shrink:0; }
.sidebar-nav{ flex:1 1 auto; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.sidebar-footer{ margin-top:0; }
@media (max-width: 820px){
  .sidebar{ z-index:90; }
  .sidebar-logout-btn{ position:static; box-shadow:none; }
}

/* Основная область не листается при открытой боковой панели */
.sidebar{ touch-action:pan-y; }
.main-wrapper{ overscroll-behavior:contain; }

/* --- Докбара нет на странице входа --- */
.bottom-nav.hidden{ display:none !important; }
body.at-gate .bottom-nav{ display:none !important; }

/* --- Мобильное расписание: день таймлайном, как в референсе --- */
.m-sched{ display:none; }
@media (max-width: 760px){
  .sched-hero{ display:none !important; }
  .week-schedule-grid{ display:none !important; }
  .m-sched{ display:block; }
  .m-sched-head{ display:flex; align-items:flex-start; gap:6px; margin:2px 0 14px; }
  .m-week-nav{ flex:0 0 42px; width:42px; height:42px; margin-top:34px; border-radius:12px; border:1px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); font-size:1.5rem; line-height:1; cursor:pointer; }
  .m-sched-titlebox{ flex:1; text-align:center; min-width:0; }
  .m-sched-title{ font-size:1.55rem; font-weight:700; letter-spacing:-.01em; }
  .m-sched-group{ margin-top:8px; color:var(--accent); font-weight:700; font-size:1.02rem; }
  .m-sched-chev{ font-size:.75rem; }
  .m-sched-week{ margin-top:6px; font-weight:600; font-size:.98rem; }
  .m-sched-daylabel{ margin-top:3px; color:var(--text-muted); font-size:.82rem; text-transform:capitalize; }
  .m-day-list{ display:flex; flex-direction:column; gap:14px; }
  .m-day-empty{ text-align:center; color:var(--text-secondary); padding:28px 0; }
  .m-pair{ display:grid; grid-template-columns:56px 1fr; gap:12px; align-items:stretch; }
  .m-pair-times{ display:flex; flex-direction:column; justify-content:space-between; padding:14px 0; text-align:left; }
  .m-t-start,.m-t-end{ font-weight:700; font-size:1.02rem; }
  .m-pair-card{ background:var(--bg-surface); border:1px solid var(--border-subtle); border-radius:18px; padding:14px 16px; min-width:0; }
  .m-pair-room{ color:var(--accent); font-weight:700; font-size:1.05rem; }
  .m-pair-type{ margin-top:5px; color:var(--text-secondary); font-weight:600; font-size:.92rem; }
  .m-pair-teacher{ margin-top:3px; color:var(--text-secondary); font-size:.92rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .m-pair-event{ margin-top:9px; display:flex; align-items:center; gap:8px; font-weight:600; font-size:.88rem; color:var(--warning); }
  .m-pair-subj{ margin-top:10px; font-weight:700; font-size:1.08rem; }
  .m-sched-admin{ display:flex; gap:8px; margin-top:16px; }
  .m-sched-admin .btn{ flex:1; min-height:44px; }
  /* Полоска дней под референс: число сверху, день недели под ним */
  .week-strip{ gap:6px; margin-bottom:16px; }
  .wst-day{ border:none; background:transparent; box-shadow:none; border-radius:16px; padding:10px 2px 8px; }
  .wst-num{ font-size:1.45rem; font-weight:700; }
  .wst-dow{ text-transform:lowercase; letter-spacing:0; font-size:.85rem; }
  .wst-day.selected{ background:var(--accent); }
  .wst-day.selected .wst-num{ color:#fff; }
}

/* --- Возврат старого дизайна расписания (один выбранный день) --- */
@media (max-width: 760px){
  .sched-hero{ display:block !important; }
  .week-schedule-grid{ display:grid !important; grid-template-columns:1fr; }
  .m-sched{ display:none !important; }
  /* полоска дней — снова карточки, как раньше */
  .week-strip{ gap:7px; margin-bottom:18px; }
  .wst-day{ background:var(--bg-surface); border:1px solid var(--border-subtle); box-shadow:var(--shadow-card); border-radius:16px; padding:11px 3px 9px; }
  .wst-num{ font-size:1.3rem; font-weight:600; }
  .wst-dow{ text-transform:uppercase; letter-spacing:.08em; font-size:.82rem; }
  .wst-day.selected{ background:var(--accent); border-color:var(--accent); }
}

/* --- Приложение не залезает под чёлку/статус-бар iPhone --- */
.main-wrapper{ padding-top:env(safe-area-inset-top); }
.topbar{ padding-top:env(safe-area-inset-top); }
.login-gate{ padding-top:calc(20px + env(safe-area-inset-top)); padding-bottom:calc(20px + env(safe-area-inset-bottom)); }
.sidebar{ padding-top:calc(18px + env(safe-area-inset-top)); }
@media (max-width: 760px){
  .topbar{ padding-top:calc(8px + env(safe-area-inset-top)); }
}

/* --- Боковая панель листается всегда (фикс залипания на главной) --- */
.sidebar-nav{ overscroll-behavior:contain; }

/* --- Боковая панель: листается целиком, низ приклеен (фикс залипания) --- */
.main-wrapper{ padding-top:0; }
.sidebar{ overflow-y:auto !important; overflow-x:hidden; -webkit-overflow-scrolling:touch; touch-action:pan-y; overscroll-behavior:contain; }
.sidebar-nav{ flex:none; overflow:visible; }
.sidebar-footer{ position:sticky; bottom:0; z-index:6; background:var(--bg-sidebar); padding-bottom:calc(10px + env(safe-area-inset-bottom)); }

/* --- Мобильная герой-плашка расписания: как на десктопе, компактно --- */
@media (max-width: 760px){
  .sched-hero{ padding:14px; border-radius:18px; margin-bottom:14px; }
  .sched-hero-top{ flex-direction:column; gap:11px; }
  .sched-hero-eyebrow{ font-size:.7rem; }
  .sched-hero-date{ font-size:1.42rem; margin:4px 0 7px; }
  .sched-hero-sub{ font-size:.8rem; gap:7px; }
  .sched-hero-stats{ display:grid !important; grid-template-columns:repeat(4,1fr); gap:6px; width:100%; }
  .hero-stat{ min-width:0; padding:8px 2px 7px; border-radius:12px; }
  .hero-stat strong{ font-size:1.08rem; line-height:1.1; }
  .hero-stat span{ font-size:.56rem; line-height:1.15; margin-top:3px; }
  .sched-hero-controls{ margin-top:12px; padding-top:11px; gap:9px; }
  .sched-nav{ gap:5px; flex:1 1 auto; min-width:0; }
  .sched-nav .btn{ min-height:38px; padding:7px 10px; }
  .sched-date{ flex:1 1 auto; min-width:0; width:auto; font-size:.85rem; padding:7px 6px; }
  .sched-admin{ display:flex; gap:6px; }
  .sched-admin .btn{ min-height:38px; padding:7px 11px; }
}
@media (max-width: 380px){
  .hero-stat span{ font-size:.52rem; }
  .sched-nav .btn:last-child{ display:none; } /* «Сегодня» прячем на совсем узких, дата остаётся */
}

/* --- Листание по дням в мобильном расписании --- */
.m-day-nav{ display:none; }
@media (max-width: 760px){
  .m-day-nav{ display:flex; align-items:center; gap:8px; margin:0 0 10px; }
  .m-day-nav-btn{ flex:1; min-height:44px; padding:9px 6px; border-radius:12px; border:1px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); font:inherit; font-weight:600; font-size:.88rem; cursor:pointer; }
  .m-day-nav-btn:active{ transform:scale(.97); border-color:var(--accent); color:var(--accent); }
  .m-day-nav-label{ flex:0 1 auto; min-width:86px; text-align:center; font-weight:600; font-size:.85rem; text-transform:capitalize; color:var(--text-secondary); }
  .wst-day{ min-height:58px; }
}

/* --- Мобильное расписание: дни вместо ряда управления, неделя «уплывает» --- */
@media (max-width: 760px){
  .sched-hero-controls{ display:none !important; } /* зелёный ряд убран, его место заняли дни */
  .m-day-nav{ margin-top:0; }
}
.week-strip.strip-from-right{ animation:stripFromRight .32s ease both; }
.week-strip.strip-from-left{ animation:stripFromLeft .32s ease both; }
@keyframes stripFromRight{ from{ transform:translateX(34px); opacity:0; } to{ transform:translateX(0); opacity:1; } }
@keyframes stripFromLeft{ from{ transform:translateX(-34px); opacity:0; } to{ transform:translateX(0); opacity:1; } }
.day-card{ animation:dayCardIn .25s ease both; }
@keyframes dayCardIn{ from{ transform:translateY(8px); opacity:.35; } to{ transform:translateY(0); opacity:1; } }
@media (prefers-reduced-motion: reduce){ .week-strip.strip-from-right,.week-strip.strip-from-left,.day-card{ animation:none; } }

/* Строка дней — внутри герой-плашки (на месте убранного ряда управления) */
@media (max-width: 760px){
  .sched-hero{ margin-bottom:0; border-bottom:none; border-radius:18px 18px 0 0; }
  .m-day-nav{ background:linear-gradient(135deg,rgba(99,102,241,.20),rgba(16,185,129,.10) 55%,transparent),var(--bg-surface); border-left:1px solid var(--border-subtle); border-right:1px solid var(--border-subtle); padding:2px 14px 8px; margin-bottom:0; }
  .m-day-nav-btn{ background:var(--bg-input); }
  .week-strip{ background:linear-gradient(135deg,rgba(99,102,241,.20),rgba(16,185,129,.10) 55%,transparent),var(--bg-surface); border:1px solid var(--border-subtle); border-top:none; border-radius:0 0 18px 18px; padding:0 14px 14px; margin-bottom:14px; }
}

/* --- Без склеивания: блок дней снова отдельный; формы не «прыгают» от недели к неделе --- */
@media (max-width: 760px){
  .sched-hero{ margin-bottom:14px; border-bottom:1px solid var(--border-subtle); border-radius:18px; }
  .m-day-nav{ background:none; border:none; padding:0; margin:0 0 10px; }
  .m-day-nav-btn{ background:var(--bg-surface); }
  .week-strip{ background:none; border:none; border-radius:0; padding:0; margin-bottom:18px; }
  /* Стабильная геометрия: кнопки недель не wrap-ятся и не становятся квадратами */
  .m-day-nav{ align-items:center; }
  .m-day-nav-btn{ flex:0 0 126px; width:126px; height:44px; min-height:44px; white-space:nowrap; display:flex; align-items:center; justify-content:center; overflow:hidden; font-size:.85rem; }
  .m-day-nav-label{ flex:1 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  /* Диапазон недели и дата не переносятся и не сдвигают плашку */
  .sched-hero-sub{ flex-wrap:nowrap; min-width:0; }
  .sched-hero-sub .badge{ flex:0 0 auto; white-space:nowrap; }
  .sched-hero-sub span:last-child{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }
  .sched-hero-date{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .hero-stat{ height:66px; justify-content:center; }
  .wst-day{ height:64px; justify-content:center; }
}
@media (max-width: 380px){
  .m-day-nav-btn{ flex-basis:106px; width:106px; font-size:.78rem; }
}

/* --- Прогресс успеваемости: видимая граница и отметки оценок --- */
.eu-progress{ position:relative; height:12px; border:1.5px solid var(--border-strong); border-radius:999px; background:var(--bg-input); overflow:hidden; }
.eu-progress .progress-bar-fill{ height:100%; border-radius:999px; }
.eu-tick{ position:absolute; top:1px; bottom:1px; width:2px; margin-left:-1px; background:var(--text-primary); opacity:.55; border-radius:2px; pointer-events:none; }

/* --- Корзина файлов --- */
.trash-card{ opacity:.92; }
.trash-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; padding:10px 12px; border:1px solid var(--border-subtle); border-radius:12px; background:var(--bg-input); margin-bottom:8px; opacity:.55; filter:grayscale(.7); }
.trash-name{ font-weight:600; min-width:0; overflow-wrap:anywhere; }

/* --- Расписание: на ПК — вся неделя, на телефоне — один день --- */
.m-day-schedule{ display:none; }
@media (max-width: 760px){
  .week-schedule-grid{ display:none !important; }
  .m-day-schedule{ display:block; }
}

/* --- ПК: боковое меню листается всегда; замок прокрутки — только мобильный --- */
@media (min-width: 821px){
  .sidebar{ overflow-y:auto !important; overflow-x:hidden; height:100vh; height:100dvh; }
  .sidebar-nav{ flex:none; overflow:visible; min-height:0; }
}

/* --- ПК: панель не сжимается, а прокручивается; колёсико не глушится --- */
.sidebar-nav{ flex:0 0 auto !important; }
@media (min-width: 821px){
  .sidebar{ overscroll-behavior:auto; }
  .sidebar-footer{ position:static; }
}

/* --- Крупные кликабельные кнопки в карточках ДЗ --- */
.hw-actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:2px; }
.hw-actions .btn{ flex:1 1 auto; min-height:42px; padding:10px 14px; font-size:.86rem; font-weight:600; display:inline-flex; align-items:center; justify-content:center; gap:6px; border-radius:11px; }
.hw-actions .btn:active{ transform:scale(.97); }
.hw-status-btn{ min-height:42px; }

/* --- Папки файлов --- */
.folder-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; padding:10px 12px; border:1px solid var(--border-subtle); border-radius:12px; background:var(--bg-input); }

/* --- Красивая форма создания ДЗ --- */
.hw-form{ display:flex; flex-direction:column; gap:14px; }
.hw-form-sub{ color:var(--text-secondary); font-size:.9rem; margin:0; }
.hw-form-block{ background:var(--bg-input); border:1px solid var(--border-subtle); border-radius:14px; padding:14px; }
.hw-form-block-title{ font-weight:700; font-size:.95rem; margin-bottom:10px; }
.hw-form-hint{ font-size:.78rem; color:var(--text-muted); margin-top:7px; }
.hw-file-input{ padding:9px 10px; }
.hw-form-submit{ width:100%; min-height:48px; font-size:1rem; border-radius:13px; }

/* --- Рамка ДЗ по срочности: красный / оранжевый / зелёный --- */
.hw-card.prio-high{ border:2px solid var(--danger); box-shadow:0 0 0 3px var(--danger-soft), 0 10px 24px rgba(239,68,68,.14); }
.hw-card.prio-medium{ border:2px solid var(--warning); box-shadow:0 0 0 3px var(--warning-soft), 0 10px 24px rgba(245,158,11,.14); }
.hw-card.prio-low{ border:2px solid var(--success); box-shadow:0 0 0 3px var(--success-soft), 0 10px 24px rgba(34,197,94,.12); }

/* --- Красивые крупные подзадачи --- */
.subtask-list{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.subtask-list .subtask-item{ display:flex; align-items:center; gap:13px; min-height:52px; padding:12px 14px; background:var(--bg-surface); border:1.5px solid var(--border-subtle); border-radius:14px; cursor:pointer; transition:border-color .15s, background .15s, transform .1s; -webkit-tap-highlight-color:transparent; }
.subtask-list .subtask-item:hover{ border-color:var(--border-strong); }
.subtask-list .subtask-item:active{ transform:scale(.99); }
.subtask-list .subtask-item span{ font-size:.97rem; line-height:1.4; font-weight:500; }
.subtask-list .subtask-item input[type="checkbox"]{ appearance:none; -webkit-appearance:none; flex:0 0 28px; width:28px; height:28px; margin:0; border:2.5px solid var(--border-strong); border-radius:9px; background:var(--bg-input); cursor:pointer; position:relative; transition:background .15s, border-color .15s, transform .1s; }
.subtask-list .subtask-item input[type="checkbox"]:active{ transform:scale(.88); }
.subtask-list .subtask-item input[type="checkbox"]:checked{ background:var(--success); border-color:var(--success); }
.subtask-list .subtask-item input[type="checkbox"]:checked::after{ content:""; position:absolute; left:8px; top:4px; width:7px; height:13px; border:solid #fff; border-width:0 3.5px 3.5px 0; border-radius:1px; transform:rotate(45deg); }
.subtask-list .subtask-item.done{ background:var(--success-soft); border-color:var(--success); }
.subtask-list .subtask-item.done span{ color:var(--text-muted); text-decoration:line-through; text-decoration-thickness:2px; text-decoration-color:var(--success); }
@media (max-width: 760px){
  .subtask-list .subtask-item{ min-height:56px; padding:13px 15px; }
  .subtask-list .subtask-item span{ font-size:1rem; }
  .subtask-list .subtask-item input[type="checkbox"]{ flex-basis:30px; width:30px; height:30px; border-radius:10px; }
  .subtask-list .subtask-item input[type="checkbox"]:checked::after{ left:9px; top:5px; }
}

/* --- Файлы: названия не вылезают, папки плитками, избранное --- */
.file-card{ min-width:0; overflow:hidden; }
.file-card-top{ min-width:0; }
.file-card-top > div:last-child{ min-width:0; flex:1; }
.file-title{ overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.file-orig-name{ font-size:.78rem; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.file-desc{ overflow-wrap:anywhere; }
.folders-strip{ display:flex; gap:10px; overflow-x:auto; padding:2px 2px 12px; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
.folders-strip::-webkit-scrollbar{ display:none; }
.folder-tile{ flex:0 0 auto; display:flex; align-items:center; gap:9px; padding:11px 14px; border-radius:14px; border:1.5px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); font:inherit; font-weight:600; font-size:.9rem; cursor:pointer; max-width:230px; }
.folder-tile:active{ transform:scale(.97); }
.folder-tile.active{ border-color:var(--accent); background:var(--accent-soft); color:var(--accent); }
.folder-tile-name{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.folder-tile-cnt{ background:var(--bg-input); border-radius:999px; padding:2px 8px; font-size:.75rem; color:var(--text-secondary); }
.folder-tile.active .folder-tile-cnt{ background:var(--bg-surface); color:var(--accent); }
.fav-btn{ min-width:40px; }

/* --- Объявления: действия администратора --- */
.ann-actions{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.ann-actions .btn{ min-height:38px; }

/* --- ДЗ: компактный список, разворот по нажатию --- */
.hw-card.compact{ padding:10px 14px; }
.hw-head{ display:flex; align-items:center; gap:10px; min-height:40px; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.hw-head:active{ opacity:.75; }
.hw-deadline{ margin-left:auto; font-size:.85rem; font-weight:600; color:var(--text-secondary); white-space:nowrap; }
.hw-deadline.today{ color:var(--warning); }
.hw-deadline.overdue{ color:var(--danger); }
.hw-chevron{ font-size:1.05rem; color:var(--text-muted); transition:transform .18s ease; flex:0 0 auto; }
.hw-chevron.open{ transform:rotate(90deg); }
.hw-body{ margin-top:10px; }

/* --- Папки: стрелки листания (только ПК) --- */
.folders-nav{ display:flex; align-items:flex-start; gap:8px; }
.folders-nav .folders-strip{ flex:1; min-width:0; }
.folders-arrow{ display:none; }
@media (min-width:821px){
 .folders-arrow{ display:flex; align-items:center; justify-content:center; flex:0 0 auto; width:40px; height:44px; margin-top:2px; border-radius:12px; border:1.5px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); font-size:1.5rem; line-height:1; cursor:pointer; font-family:inherit; }
 .folders-arrow:hover{ border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
 .folders-arrow:active{ transform:scale(.94); }
}

/* --- Сердечко лайка: пустое / залитое --- */
.fav-btn .heart-ic{ display:block; fill:none; stroke:var(--text-muted); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:fill .15s ease, stroke .15s ease, transform .12s ease; }
.fav-btn:hover .heart-ic{ stroke:#ef4444; }
.fav-btn:active .heart-ic{ transform:scale(1.25); }
.fav-btn.liked{ background:rgba(239,68,68,.13) !important; border-color:rgba(239,68,68,.5) !important; }
.fav-btn.liked .heart-ic{ fill:#ef4444; stroke:#ef4444; }

/* --- Файлы: вкладки режимов вместо папок --- */
.files-view-tabs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.files-view-tabs button{ display:inline-flex; align-items:center; gap:8px; padding:10px 16px; min-height:44px; border-radius:999px; border:1.5px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); font:inherit; font-weight:600; font-size:.9rem; cursor:pointer; }
.files-view-tabs button.active{ border-color:var(--accent); background:var(--accent-soft); color:var(--accent); }
.fvt-cnt{ background:var(--bg-input); border-radius:999px; padding:2px 8px; font-size:.75rem; color:var(--text-secondary); }
.files-view-tabs button.active .fvt-cnt{ background:var(--bg-surface); color:var(--accent); }

/* --- Вкладка «Избранное»: векторное сердечко --- */
.files-view-tabs .fav-tab-heart{ fill:#ef4444; stroke:#ef4444; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex:0 0 auto; }
.files-view-tabs button.active .fav-tab-heart{ fill:#ef4444; stroke:#ef4444; }

/* --- Прогресс-бар: ровный однотонный, без делений --- */
.eu-tick{ display:none !important; }

/* --- Успеваемость: баллы не жирные --- */
.eu-pct{ font-weight:500; }
.eu-subj-head strong{ font-weight:500; }

/* --- Успеваемость: баллы по неделям/модулям не жирные --- */
.eu-week-chip strong{ font-weight:500; }

/* --- Телефон: стабильная боковая панель, ширина, главная --- */
@media (max-width: 820px){
  /* Панель: приклеена к краям экрана, высота не зависит от строки браузера */
  .sidebar{ top:0 !important; bottom:0 !important; left:0 !important; height:auto !important; max-height:none !important; overflow:hidden !important; overscroll-behavior:contain; }
  .sidebar-nav{ overscroll-behavior:contain; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .sidebar-nav::-webkit-scrollbar{ display:none; }
  .sidebar-footer{ margin-top:auto; }
  /* Ширина: ничего не вылезает за экран */
  html, body{ overflow-x:clip; }
  .main-wrapper, #mainContent{ width:100%; max-width:100%; min-width:0; }
  .dashboard-grid, .stats-grid, .kanban-board, .notes-layout, .files-grid{ grid-template-columns:minmax(0,1fr) !important; width:100%; max-width:100%; }
  .dashboard-grid > div{ display:contents; }
  .card, .stat-card, .hw-card, .file-card, .eu-card, .announcement-card, section.card{ min-width:0; max-width:100%; box-sizing:border-box; }
  /* Объявления — первым блоком перед расписанием (только телефон) */
  .dash-announce{ order:-1; }
  .dashboard-grid{ display:flex; flex-direction:column; }
  /* Кнопки «Добавить ДЗ» на главной на телефоне нет */
  .dash-add-hw{ display:none !important; }
}

/* --- Телефон: меню листается внутри панели, объявления первым блоком --- */
@media (max-width: 820px){
  .sidebar-nav{ flex:1 1 auto !important; min-height:0 !important; overflow-y:auto !important; touch-action:pan-y; }
  .dashboard-grid > div{ display:contents !important; }
}

/* --- Телефон: 2 стат-блока в ряд + низ боковой панели у докбара --- */
@media (max-width: 820px){
  .stats-grid{ display:grid !important; grid-template-columns:1fr 1fr !important; gap:10px; }
  .stat-card{ flex-direction:column; align-items:flex-start; gap:9px; padding:16px 14px; border-radius:18px; box-shadow:0 6px 18px rgba(2,6,23,.08); }
  .stat-card .stat-icon{ width:40px; height:40px; border-radius:12px; display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
  .stat-info{ display:flex; flex-direction:column; gap:2px; min-width:0; }
  .stat-value{ font-size:1.55rem; line-height:1.1; }
  .stat-label{ font-size:.72rem; line-height:1.3; }
  .sidebar{ padding-bottom:calc(8px + env(safe-area-inset-bottom)); }
  .sidebar-footer{ margin-top:auto !important; padding-bottom:0; }
  .sidebar-logout-btn{ min-height:48px; margin-bottom:4px; }
}

/* --- ПК: боковая панель закреплена на всю высоту экрана --- */
@media (min-width: 821px){
  .sidebar{ position:fixed; top:0; bottom:0; left:0; height:auto; box-sizing:border-box; }
  .app-shell{ padding-left:276px; box-sizing:border-box; }
}

/* --- Телефон: компактная строка ДЗ не вылезает за карточку --- */
@media (max-width: 820px){
  .hw-card.compact{ padding:10px 12px; }
  .hw-head{ gap:8px; }
  .hw-head .badge{ flex:0 1 auto; min-width:0; max-width:40%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .hw-deadline{ flex:1 1 auto; min-width:0; margin-left:0; text-align:right; white-space:normal; overflow-wrap:anywhere; font-size:.8rem; line-height:1.3; }
  .hw-chevron{ flex:0 0 auto; }
  .card-header{ flex-wrap:wrap; row-gap:8px; }
}

/* --- Телефон: стат-блоки компактнее, ближайший контроль — цветной --- */
@media (max-width: 820px){
  .stats-grid .stat-card{ flex-direction:row; align-items:center; gap:10px; padding:10px 12px; border-radius:14px; min-height:62px; }
  .stats-grid .stat-card .stat-icon{ width:32px; height:32px; border-radius:10px; }
  .stats-grid .stat-value{ font-size:1.25rem; }
  .stats-grid .stat-label{ font-size:.68rem; }
  .stat-next .stat-value{ font-size:1.45rem; font-weight:700; letter-spacing:.01em; }
  .stat-next .nc-week{ font-size:.78rem; font-weight:500; color:var(--text-secondary); }
  .stat-next.nc-рк{ border:1.5px solid var(--danger); background:var(--danger-soft); box-shadow:0 0 0 3px var(--danger-soft); }
  .stat-next.nc-рк .stat-value{ color:var(--danger); }
  .stat-next.nc-дз{ border:1.5px solid var(--success); background:var(--success-soft); box-shadow:0 0 0 3px var(--success-soft); }
  .stat-next.nc-дз .stat-value{ color:var(--success); }
  .stat-next.nc-кр{ border:1.5px solid #a855f7; background:rgba(168,85,247,.12); box-shadow:0 0 0 3px rgba(168,85,247,.10); }
  .stat-next.nc-кр .stat-value{ color:#a855f7; }
}

/* --- Ближайший контроль: выделение и на ПК, огонёк, дата --- */
.flame-ic{ vertical-align:-4px; margin-right:5px; filter:drop-shadow(0 2px 6px rgba(255,61,104,.45)); animation:flamePulse 1.6s ease-in-out infinite; }
@keyframes flamePulse{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.12); } }
.stat-next .stat-value{ font-weight:700; }
.stat-next .nc-week{ font-size:.62em; font-weight:500; color:var(--text-secondary); }
.stat-next.nc-рк{ border:1.5px solid var(--danger); background:var(--danger-soft); box-shadow:0 0 0 3px var(--danger-soft); }
.stat-next.nc-рк .stat-value{ color:var(--danger); }
.stat-next.nc-дз{ border:1.5px solid var(--success); background:var(--success-soft); box-shadow:0 0 0 3px var(--success-soft); }
.stat-next.nc-дз .stat-value{ color:var(--success); }
.stat-next.nc-кр{ border:1.5px solid #a855f7; background:rgba(168,85,247,.12); box-shadow:0 0 0 3px rgba(168,85,247,.10); }
.stat-next.nc-кр .stat-value{ color:#a855f7; }
@media (min-width: 821px){
  .stat-next{ border-radius:16px; }
  .flame-ic{ width:26px; height:26px; }
}

/* --- Огонёк: без анимации, строго по центру плашки --- */
.flame-ic{ animation:none !important; }
.stat-icon{ display:flex; align-items:center; justify-content:center; }
.stat-icon .flame-ic{ margin:0; display:block; }

/* --- Загрузка файла: несколько предметов --- */
.up-subj-row{ display:flex; gap:8px; align-items:center; margin-bottom:8px; }
.up-subj-row .up-subj{ flex:1; min-width:0; }
.up-subj-del{ flex:0 0 auto; min-width:38px; min-height:38px; }

/* --- Карточка файла: все кнопки влезают и переносятся --- */
.file-card-footer{ flex-wrap:wrap; }

/* --- Просмотрщик документов: на весь экран, ПК и телефон --- */
.doc-viewer{ position:fixed; inset:0; z-index:200; background:var(--bg-body,#0b0f1a); display:none; flex-direction:column; }
.doc-viewer.open{ display:flex; }
.dv-head{ display:flex; align-items:center; gap:10px; padding:10px 12px; padding-top:calc(10px + env(safe-area-inset-top)); background:var(--bg-surface); border-bottom:1px solid var(--border-subtle); }
.dv-close{ flex:0 0 auto; width:40px; height:40px; border-radius:11px; border:1px solid var(--border-subtle); background:var(--bg-input); color:var(--text-primary); font-size:1rem; cursor:pointer; }
.dv-title{ flex:1; min-width:0; font-weight:600; font-size:.95rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dv-actions{ display:flex; gap:8px; flex:0 0 auto; }
.dv-body{ flex:1; min-height:0; display:flex; flex-direction:column; }
.dv-pdf{ flex:1; width:100%; border:0; background:#fff; }
.dv-hint{ padding:8px 12px; font-size:.78rem; color:var(--text-secondary); text-align:center; }
.dv-status{ margin:auto; text-align:center; color:var(--text-secondary); padding:24px; font-size:.95rem; }
.dv-scroll{ flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:18px 12px calc(18px + env(safe-area-inset-bottom)); }
.dv-page{ max-width:820px; margin:0 auto; background:#ffffff; color:#1a1a1a; border-radius:10px; padding:34px 30px; box-shadow:0 12px 40px rgba(0,0,0,.35); line-height:1.55; font-size:.98rem; }
.dv-page h2,.dv-page h3,.dv-page h4{ margin:16px 0 8px; line-height:1.3; }
.dv-page p{ margin:0 0 10px; }
.dv-page .dv-li{ padding-left:16px; text-indent:-10px; }
.dv-slide-wrap{ flex:1; min-height:0; display:flex; align-items:center; gap:10px; padding:16px 12px 6px; }
.dv-nav{ flex:0 0 auto; width:46px; height:64px; border-radius:12px; border:1px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-primary); font-size:1.7rem; cursor:pointer; }
.dv-nav:active{ transform:scale(.95); }
.dv-slide{ flex:1; min-width:0; align-self:stretch; max-height:66vh; overflow-y:auto; background:#ffffff; color:#1a1a1a; border-radius:14px; box-shadow:0 12px 40px rgba(0,0,0,.35); padding:30px 28px; display:flex; flex-direction:column; gap:10px; }
.dv-slide-title{ font-size:1.45rem; font-weight:700; line-height:1.25; margin-bottom:8px; }
.dv-slide-line{ font-size:1.02rem; line-height:1.45; }
.dv-counter{ text-align:center; color:var(--text-secondary); font-size:.85rem; padding:8px 0 4px; }
.dv-thumbs{ display:flex; gap:6px; flex-wrap:wrap; justify-content:center; padding:6px 12px calc(14px + env(safe-area-inset-bottom)); }
.dv-thumb{ min-width:38px; height:34px; padding:0 8px; border-radius:9px; border:1px solid var(--border-subtle); background:var(--bg-surface); color:var(--text-secondary); font:inherit; font-size:.82rem; cursor:pointer; }
.dv-thumb.active{ border-color:var(--accent); color:var(--accent); background:var(--accent-soft); font-weight:700; }
@media (max-width: 820px){
  .dv-page{ padding:22px 16px; font-size:.95rem; }
  .dv-slide{ padding:20px 16px; max-height:60vh; }
  .dv-slide-title{ font-size:1.2rem; }
  .dv-nav{ width:40px; height:56px; }
  .dv-actions .btn{ padding:8px 10px; font-size:.8rem; }
}

/* --- Просмотрщик на телефоне: компактно и без вылезаний --- */
.dv-pdf-wrap{ flex:1; min-height:0; overflow:auto; -webkit-overflow-scrolling:touch; background:#fff; }
.dv-pdf-wrap .dv-pdf{ height:100%; display:block; }
@media (max-width: 820px){
  .doc-viewer{ height:100dvh; }
  .dv-head{ gap:8px; padding:8px 10px; padding-top:calc(8px + env(safe-area-inset-top)); }
  .dv-close{ width:38px; height:38px; }
  .dv-title{ font-size:.88rem; }
  .dv-actions{ gap:6px; }
  .dv-actions .btn{ min-height:38px; padding:7px 10px; font-size:.8rem; white-space:nowrap; }
  .dv-scroll{ padding:12px 8px calc(14px + env(safe-area-inset-bottom)); }
  .dv-page{ border-radius:8px; padding:20px 15px; box-shadow:none; }
  .dv-slide-wrap{ padding:10px 8px 4px; gap:6px; align-items:stretch; }
  .dv-slide{ max-height:none; height:100%; padding:18px 15px; border-radius:10px; box-shadow:none; }
  .dv-nav{ width:37px; height:auto; min-height:120px; align-self:center; font-size:1.35rem; border-radius:10px; }
  .dv-thumbs{ flex-wrap:nowrap; justify-content:flex-start; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; padding:6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .dv-thumbs::-webkit-scrollbar{ display:none; }
  .dv-thumb{ flex:0 0 auto; }
}

/* --- PDF через PDF.js: все страницы лентой --- */
.dv-pdf-scroll{ flex:1; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:14px 10px calc(18px + env(safe-area-inset-bottom)); display:flex; flex-direction:column; align-items:center; gap:14px; }
.dv-pdf-page{ width:100%; max-width:900px; display:flex; flex-direction:column; align-items:center; gap:6px; }
.dv-pdf-page canvas{ max-width:100%; height:auto; background:#fff; border-radius:6px; box-shadow:0 8px 28px rgba(0,0,0,.3); }
.dv-pdf-num{ font-size:.72rem; color:var(--text-muted); }

/* --- Родной просмотр PDF + плавающий выход --- */
.dv-native{ flex:1; min-height:0; display:flex; background:#fff; }
.dv-native .dv-pdf{ flex:1; width:100%; height:100%; border:0; }
.doc-viewer{ position:fixed; }
.dv-float-close{ position:absolute; right:14px; bottom:calc(18px + env(safe-area-inset-bottom)); z-index:20; width:54px; height:54px; border-radius:50%; border:1px solid rgba(255,255,255,.35); background:rgba(10,14,24,.82); color:#fff; font-size:1.35rem; line-height:1; cursor:pointer; box-shadow:0 10px 26px rgba(0,0,0,.4); backdrop-filter:blur(4px); }
.dv-float-close:active{ transform:scale(.93); }
@media (max-width: 820px){
  .dv-close{ width:44px; height:44px; }
}

/* --- Просмотрщик: выход поверх всего --- */
.dv-float-close{ z-index:999; }
.dv-pdf-loading{ color:var(--text-muted); font-size:.8rem; padding:18px 0; }
