
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --dark: #0f172a;
  --secondary: #64748b;
  --secondary-text: #64748b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  --primary-soft: #eef2ff;
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --danger: #f43f5e;
  --danger-glow: rgba(244, 63, 94, 0.2);
  --radius: 24px;
  --glass: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

/* ==========================================================================
   Premium Glass Cards Design System
   ========================================================================== */
.dashboard-canvas {
  padding: 1.5rem;
  padding-bottom: 0;
  max-width: 1440px;
  margin: 0 auto;
}

.glass-card {
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.04);
}

.premium-card {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.25s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.premium-card:hover {
  box-shadow: 0 12px 20px -3px rgba(79, 70, 229, 0.08);
  transform: translateY(-2px);
  border-color: rgba(79, 70, 229, 0.2);
}

/* Фоновый водяной знак */
.card-bg-number {
  position: absolute;
  right: -0.5rem;
  bottom: -1.5rem;
  font-size: 110px;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
  opacity: 0.04;
  user-select: none;
  z-index: 1;
  font-style: italic;
}

.card-bg-icon {
  position: absolute;
  right: -0.5rem;
  bottom: -1rem;
  font-size: 80px;
  color: var(--primary);
  opacity: 0.05;
  user-select: none;
  z-index: 1;
}

.bg-primary-soft {
  background-color: #eef2ff !important;
}

.btn-primary-soft {
  background-color: #eef2ff;
  color: #4f46e5;
  border: 1px solid #e0e7ff;
  transition: all 0.2s ease;
}

.btn-primary-soft:hover {
  background-color: #4f46e5;
  color: #ffffff !important;
}

.card-content-wrapper {
  position: relative;
  z-index: 2;
}

.lesson-badge-v2 {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 2px;
}

.class-badge-v2 {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 6px;
  text-transform: uppercase;
}

.lesson-title-v2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.teacher-name-v2 {
  font-size: 0.85rem;
  color: var(--secondary-text);
  font-weight: 500;
}

.lesson-header-v2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
}

.card-footer-v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.footer-item-v2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dark);
  opacity: 0.8;
}

.footer-item-v2 i {
  font-size: 15px;
  color: var(--primary);
}

/* Полный запрет кривых моноширинных шрифтов для бейджей и дат */
.font-monospace, font-monospace, code {
  font-family: 'Outfit', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

/* PWA и Мобильная адаптивность */
@media (max-width: 768px) {
  .dashboard-canvas {
    padding: 0.75rem 0.75rem 6rem 0.75rem !important; /* Увеличенный отступ под нижний таббар */
  }
  
  h2 {
    font-size: 1.4rem !important;
  }
  
  .glass-card {
    padding: 1rem !important;
    border-radius: 16px !important;
    margin-bottom: 0.75rem !important;
  }
  
  .premium-card {
    padding: 0.875rem !important;
    border-radius: 14px !important;
  }
  
  .lesson-title-v2 {
    font-size: 1.1rem !important;
  }
  
  .card-bg-number {
    font-size: 65px !important;
    right: -0.2rem !important;
    bottom: -0.8rem !important;
  }
  
  /* Компактный подвал карточки урока для мобилок */
  .card-footer-v2 {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }
}

.ls-wide {
  letter-spacing: 0.05em;
}

.bg-primary-soft {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}

.flex-1 {
  flex: 1 1 0%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', 'Montserrat', -apple-system, sans-serif;
  letter-spacing: -0.02em;
}

.container-app {
  width: 100%;
  padding: 16px;
  padding-bottom: 0;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .container-app {
    padding: 24px;
    padding-bottom: 0;
  }
}

@media (min-width: 1024px) {
  .container-app {
    max-width: 1440px;
    padding: 32px;
    padding-bottom: 0;
    margin: 0 auto;
  }
}

/* Универсальная адаптивная сетка карточек для десктопа и мобилок */
.desktop-grid {
  display: grid;
  grid-template-columns: 1fr; /* Для мобилок 1 колонка */
  gap: 16px;
}

@media (min-width: 768px) {
  .desktop-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); /* На ПК карточки встанут в 3-4 колонки */
    align-items: start;
  }
}

.app-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 2.25rem;
  letter-spacing: -0.04em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 1.25rem;
  overflow: visible;
}

.glass-card {
  background: var(--glass) !important;
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--shadow-lg);
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}

.badge {
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-chip-free {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.1);
}

.status-chip-busy {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid rgba(244, 63, 94, 0.1);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.dot-free { background: var(--success); box-shadow: 0 0 10px var(--success-glow); }
.dot-busy { background: var(--danger); box-shadow: 0 0 10px var(--danger-glow); }

.pulse {
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pulse-busy {
  animation: pulse-busy-animation 2s infinite;
}

@keyframes pulse-busy-animation {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.btn {
  border-radius: 12px;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s;
}

.btn-dark {
  background: #1e293b;
  border: none;
  color: white;
}

.btn-primary-app {
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary-app:hover {
  color: white;
  transform: scale(1.02);
}

/* --- Desktop Navbar and Wide Layout --- */
.desktop-nav-link {
  text-decoration: none;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.desktop-nav-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}
.desktop-nav-link.active {
  background: rgba(79, 70, 229, 0.12);
  color: #4f46e5 !important;
  font-weight: 700;
}

.wide-container {
  max-width: 1440px !important;
  width: 100% !important;
  padding-left: 32px !important;
  padding-right: 32px !important;
  padding-bottom: 0 !important;
}
@media (max-width: 768px) {
  .wide-container {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-bottom: 0 !important;
  }
}

/* ==========================================================================
   School Analytics Table & Ribbon Utilities
   ========================================================================== */
.table-classes-container {
  max-height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.table-classes-container::-webkit-scrollbar {
  width: 5px;
}
.table-classes-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-classes {
  width: 100%;
  margin-bottom: 0;
}
.table-classes th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 700;
  border-bottom: 2px solid rgba(0,0,0,0.06) !important;
  background: #ffffff;
  padding: 12px 14px;
  white-space: nowrap;
}
.table-classes td {
  padding: 12px 14px;
  vertical-align: middle;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.filter-ribbon-grades {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}
.filter-ribbon-grades::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   Teachers Grid & Cards (.teachers-grid, .teacher-card)
   ========================================================================== */
.teachers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
  gap: 16px;
  align-items: stretch; /* Одинаковая высота всех карточек в ряду */
}

.teacher-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 145px;
  height: 100%;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.teacher-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  border-color: #cbd5e1;
}
.teacher-card.busy {
  background: #ffffff;
  border-color: #e2e8f0;
}

.teacher-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.teacher-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
}

.teacher-info-block {
  flex: 1;
  min-width: 0;
  margin-right: 8px;
}

.teacher-name {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
  word-break: normal;
}

.teacher-card-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed #f1f5f9;
}

.filter-status, .filter-gender, .sort-btn {
  font-size: 0.8rem !important;
  border-radius: 99px !important;
  white-space: nowrap !important;
  padding: 4px 14px !important;
  font-weight: 600;
  transition: all 0.2s ease;
}
.filter-status.btn-primary, .filter-gender.btn-primary, .sort-btn.btn-primary {
  background: #4f46e5 !important;
  border-color: #4f46e5 !important;
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.25);
}
.filter-status.btn-light, .filter-gender.btn-light, .sort-btn.btn-light {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
}
.filter-status.btn-light:hover, .filter-gender.btn-light:hover, .sort-btn.btn-light:hover {
  background: #f1f5f9 !important;
  color: #1e293b !important;
}

/* ==========================================================================
   Page Header Card (Unified Premium Style)
   ========================================================================== */
.page-header-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.page-icon-box {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Цветовые вариации иконок */
.icon-box-primary { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.icon-box-success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.icon-box-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.icon-box-info { background: rgba(14, 165, 233, 0.1); color: #0ea5e9; }
.icon-box-purple { background: rgba(168, 85, 247, 0.1); color: #a855f7; }

.page-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2px 0;
}

.page-header-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .page-header-card {
        padding: 14px 16px;
        gap: 12px;
    }
    .page-header-info {
        width: 100%;
        gap: 12px;
    }
    .page-icon-box {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
        border-radius: 12px;
    }
    .page-header-title {
        font-size: 1.15rem;
    }
    .page-header-actions {
        width: 100% !important;
        justify-content: flex-start !important;
        margin-left: 0 !important;
    }
    .page-header-actions form {
        width: 100% !important;
        margin-left: 0 !important;
        justify-content: flex-start !important;
    }
    .page-header-actions .input-group,
    .page-header-actions .form-control,
    .page-header-actions .form-select {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Улучшение поисковой строки внутри шапки */
.page-header-actions .form-control, 
.page-header-actions .form-select {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 14px;
    box-shadow: none;
    font-size: 0.875rem;
}
.page-header-actions .form-control:focus, 
.page-header-actions .form-select:focus {
    background-color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Выравнивание шапки слева направо без пустого пространства по центру */
.page-header-card.page-header-start {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 28px;
    width: 100%;
}
@media (max-width: 767.98px) {
    .page-header-card.page-header-start {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
}

/* Поисковая строка на всю оставшуюся ширину карточки */
.search-box-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-box-wrapper .form-control {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 42px 10px 42px;
    font-size: 0.875rem;
    box-shadow: none;
    transition: all 0.2s ease;
    width: 100%;
}

.search-box-wrapper .form-control:focus {
    background-color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon-left {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    pointer-events: none;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}
.search-clear-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* ==========================================================================
   Rooms Grid Dashboard (Floor & Status Matrix)
   ========================================================================== */
.lesson-ribbon {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.lesson-ribbon::-webkit-scrollbar {
    height: 4px;
}
.lesson-ribbon::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.lesson-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 130px;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.02);
}
.lesson-tab-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    transform: translateY(-1px);
}
.lesson-tab-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.lesson-tab-btn .lesson-time {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.85;
}
.lesson-tab-btn.active .lesson-time {
    color: rgba(255, 255, 255, 0.9);
}
.lesson-tab-btn .live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    margin-right: 4px;
    box-shadow: 0 0 8px #10b981;
    animation: livePulse 1.8s infinite;
}
@keyframes livePulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.floor-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 7px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.floor-pill:hover {
    background: #f8fafc;
    color: #1e293b;
    border-color: #cbd5e1;
}
.floor-pill.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.rooms-dashboard-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
    margin-bottom: 24px;
}
.rooms-dashboard-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

/* Свободные кабинеты (Quick Badge Cloud) */
.free-rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}
.free-room-badge {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    padding: 10px 8px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.free-room-badge:hover {
    background: #dcfce7;
    border-color: #86efac;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}
.free-room-number {
    font-size: 1.15rem;
    font-weight: 800;
    color: #15803d;
    line-height: 1.1;
}
.free-room-sub {
    font-size: 0.65rem;
    font-weight: 600;
    color: #16a34a;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Занятые кабинеты (Rich Cards Grid) */
.busy-rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.busy-room-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
    position: relative;
    overflow: hidden;
}
.busy-room-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #6366f1, #a855f7);
}
.busy-room-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    border-color: #cbd5e1;
}
.busy-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.busy-room-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
}
.busy-class-badge {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 8px;
}
.busy-subject-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    line-height: 1.3;
}
.busy-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}
.busy-teacher-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Gemini-Style Collapsible Sidebar & Desktop Layout (Light Glassmorphism Theme)
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f8fafc;
}

/* Основной контент занимает оставшееся место */
.app-main {
    flex-grow: 1;
    overflow-x: hidden;
    height: 100vh;
    overflow-y: auto;
}

@media (max-width: 991.98px) {
    .app-layout {
        display: block;
    }
    .app-main {
        height: auto;
        overflow-y: visible;
    }
}

/* Стили Сайдбара (Светлая тема SchoolKeys) */
.gemini-sidebar {
    width: 260px;
    background: #ffffff;
    color: #475569;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.2, 0, 0, 1);
    border-right: 1px solid #e2e8f0;
    overflow: hidden;
    white-space: nowrap;
    z-index: 1040;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    box-shadow: 2px 0 12px rgba(15, 23, 42, 0.02);
}

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 64px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    transition: padding 0.3s ease;
}

.sidebar-btn {
    background: transparent;
    border: none;
    color: #475569;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.sidebar-btn:hover { 
    background-color: #f1f5f9; 
    color: #1e293b; 
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    transition: opacity 0.2s ease;
}
.brand-text {
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: #0f172a;
    transition: opacity 0.2s ease;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    color: #64748b;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
}

.sidebar-link i { 
    font-size: 1.25rem; 
    min-width: 24px; 
    text-align: center; 
    flex-shrink: 0;
    color: #6366f1;
    transition: color 0.2s ease;
}

.sidebar-link:hover { 
    background-color: #f1f5f9; 
    color: #1e293b; 
}
.sidebar-link:hover i {
    color: #4f46e5;
}

.sidebar-link.active { 
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%); 
    color: #ffffff !important; 
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.sidebar-link.active i {
    color: #ffffff !important;
}

.link-text {
    transition: opacity 0.2s ease;
    font-weight: 500;
}

.sidebar-link.text-danger {
    color: #ef4444 !important;
}
.sidebar-link.text-danger i {
    color: #ef4444 !important;
}
.sidebar-link.text-danger:hover {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
}
.sidebar-link.text-danger:hover i {
    color: #dc2626 !important;
}

/* Футер сайдбара */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    background: #ffffff;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    overflow: hidden;
    padding: 6px 8px;
    border-radius: 12px;
}

.avatar {
    width: 36px; 
    height: 36px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 10px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-weight: 700; 
    color: #ffffff;
    flex-shrink: 0;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    display: block;
}

.user-role {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.1;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ==========================================================================
   Свернутое состояние (Collapsed State - 72px)
   ========================================================================== */
.gemini-sidebar.collapsed {
    width: 72px;
}

.gemini-sidebar.collapsed .link-text,
.gemini-sidebar.collapsed .brand-text,
.gemini-sidebar.collapsed .user-info,
.gemini-sidebar.collapsed .sidebar-text,
.sidebar-collapsed .sidebar-text,
.collapsed .sidebar-text,
.sidebar-mini .sidebar-text {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.gemini-sidebar.collapsed .brand-logo {
    display: none !important;
}

.gemini-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 16px 0;
}

.gemini-sidebar.collapsed .sidebar-btn {
    margin: 0 auto;
}

.gemini-sidebar.collapsed .sidebar-nav {
    padding: 14px 0;
    align-items: center;
}

.gemini-sidebar.collapsed .sidebar-link,
.gemini-sidebar.collapsed .nav-link,
.sidebar-collapsed .nav-link,
.collapsed .nav-link,
.sidebar-mini .nav-link {
    justify-content: center !important;
    padding: 0 !important;
    width: 44px !important;
    height: 44px !important;
    margin: 0 auto !important;
    border-radius: 12px !important;
    gap: 0 !important;
}

.gemini-sidebar.collapsed .sidebar-link i,
.gemini-sidebar.collapsed .nav-link i {
    margin: 0 !important;
    min-width: unset !important;
    font-size: 1.25rem !important;
}

.gemini-sidebar.collapsed .sidebar-nav .nav-item {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.gemini-sidebar.collapsed .sidebar-link #sidebar-return-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    padding: 2px 4px;
}

.gemini-sidebar.collapsed .sidebar-footer {
    padding: 12px 0;
    align-items: center;
}

.gemini-sidebar.collapsed .user-profile {
    justify-content: center;
    padding: 4px 0;
    width: 44px;
    margin: 0 auto;
}

.gemini-sidebar.collapsed .avatar {
    margin: 0 auto;
}

.gemini-sidebar.collapsed .sidebar-link.text-danger {
    justify-content: center;
    padding: 0;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 12px;
}

/* По умолчанию на десктопе нижний навбар полностью скрыт */
.bottom-nav,
.nav-bottom {
    display: none !important;
}

/* Используем нижнюю навигацию, пока ширины недостаточно для боковой панели (< 992px) */
@media (max-width: 991.98px) {
    .bottom-nav,
    .nav-bottom {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-height: 64px !important;
        padding-top: 8px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        background: #ffffff !important;
        border-top: 1px solid #e2e8f0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05) !important;
        z-index: 1050 !important;
        align-items: center !important;
        justify-content: space-around !important;
    }

    .bottom-nav .nav-wrap,
    .nav-bottom .nav-wrap {
        display: flex !important;
        align-items: center !important;
        justify-content: space-around !important;
        width: 100% !important;
        max-width: 540px !important;
        margin: 0 auto !important;
    }

    .bottom-nav .nav-link,
    .bottom-nav .nav-item,
    .bottom-nav .nav-link-app,
    .nav-bottom .nav-link,
    .nav-bottom .nav-item,
    .nav-bottom .nav-link-app {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        text-decoration: none !important;
        color: #64748b !important;
        padding: 2px 0 !important;
        position: relative !important;
    }

    .bottom-nav .nav-link.active,
    .bottom-nav .nav-item.active,
    .bottom-nav .nav-link-app.active,
    .nav-bottom .nav-link.active,
    .nav-bottom .nav-item.active,
    .nav-bottom .nav-link-app.active {
        color: #4338ca !important;
    }

    .bottom-nav .nav-icon,
    .bottom-nav i,
    .bottom-nav svg,
    .nav-bottom .nav-icon,
    .nav-bottom i,
    .nav-bottom svg {
        font-size: 1.35rem !important;
        margin-bottom: 3px !important;
        display: block !important;
    }

    .bottom-nav .nav-label,
    .bottom-nav span:not(.badge),
    .nav-bottom .nav-label,
    .nav-bottom span:not(.badge) {
        font-size: 0.72rem !important;
        line-height: 1.1 !important;
        font-weight: 500 !important;
        text-align: center !important;
        display: block !important;
    }

    .bottom-nav .badge,
    .nav-bottom .badge {
        position: absolute !important;
        top: 0 !important;
        right: calc(50% - 20px) !important;
        font-size: 0.6rem !important;
        padding: 2px 5px !important;
    }

    /* Отступ страницы снизу сбрасываем, так как он задан ровно 80px на main */
    body {
        padding-bottom: 0 !important;
    }
}

/* На ПК и широких экранах (>= 768px) убираем отступ снизу */
@media (min-width: 768px) {
    body {
        padding-bottom: 0 !important;
    }
}

/* Dashboard and List visuals */
.stat-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  color: white;
  margin-bottom: 2rem;
}

.alert {
  border-radius: 12px;
  border: none;
  font-weight: 500;
}

/* --- Stitch AI Dashboard Styles --- */
.stitch-bg {
  background-color: #f6f8f6;
  font-family: 'Montserrat', sans-serif;
  color: #0f172a;
  /* slate-900 */
}

.stitch-header {
  background-color: rgba(246, 248, 246, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  /* slate-200 */
}

.stitch-primary {
  color: #5854ea;
}

.stitch-bg-primary {
  background-color: #5854ea;
}

.stitch-bg-primary-soft {
  background-color: rgba(88, 84, 234, 0.2);
}

.stitch-card {
  background-color: #ffffff;
  border: 1px solid #f1f5f9;
  /* slate-100 */
  border-radius: 0.75rem;
  /* xl */
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.filled-icon {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.aspect-video {
  aspect-ratio: 16 / 9;
}

.bg-cover {
  background-size: cover;
}

.bg-center {
  background-position: center;
}

.stitch-btn {
  background-color: #5854ea;
  color: #0f172a;
  font-weight: 700;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 4px 6px -1px rgba(88, 84, 234, 0.2);
  transition: all 0.2s;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.stitch-btn:hover {
  background-color: rgba(88, 84, 234, 0.9);
}

.stitch-input {
  width: 100%;
  background-color: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  outline: none;
  font-weight: 500;
  transition: all 0.3s;
  box-shadow: var(--shadow-sm);
}

.stitch-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  transform: translateY(-1px);
}

/* Analytics Dashboard Styles */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-item {
  background: var(--card);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-up {
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* History Specific */
.hist-card {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #eef2f6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    margin-bottom: 0.75rem;
}

.hist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f8fafc;
    padding-bottom: 0.5rem;
}

.hist-room {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.hist-time {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted);
}

.hist-user {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: #1e293b;
}

.hist-action-label {
    font-size: 0.75rem;
    font-weight: 600;
}

.hist-comment {
    font-size: 0.8rem;
    color: #475569;
    padding: 0.5rem 0.75rem;
    background: #f1f5f9;
    border-radius: 8px;
    margin-top: 0.5rem;
    border-left: 3px solid #64748b;
}

.text-issue { color: var(--primary); }
.text-return { color: var(--success); }
.bg-issue-soft { background: #eef2ff; color: #4338ca; }
.bg-return-soft { background: #ecfdf5; color: #047857; }

/* Premium V2 Card Styles */
.premium-card {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.premium-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.card-bg-number {
    position: absolute;
    right: -1rem;
    bottom: -2rem;
    font-size: 130px;
    font-weight: 900;
    line-height: 1;
    color: var(--primary);
    opacity: 0.05;
    user-select: none;
    z-index: 1;
    font-style: italic;
}

.card-content-wrapper {
    position: relative;
    z-index: 2;
}

.lesson-header-v2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.lesson-badge-v2 {
    font-size: 10px;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    border-bottom: 2px solid var(--primary);
}

.class-badge-v2 {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 6px;
    text-transform: uppercase;
}

.lesson-title-v2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.teacher-name-v2 {
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 500;
}

.card-footer-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.04);
}

.footer-item-v2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dark);
    opacity: 0.8;
}

.footer-item-v2 i {
    font-size: 16px;
    color: var(--primary);
    opacity: 0.6;
}

/* ==========================================================================
   CURATOR & ATTENDANCE MODULE
   ========================================================================== */

/* Карточка прогресса посещаемости */
.curator-progress-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 18px 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    margin-bottom: 16px;
}

.attendance-progress-track {
    height: 10px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.attendance-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #5854ea 100%);
    border-radius: 99px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Карточка ученика */
.student-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    padding: 16px 18px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}

.student-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.96);
}

/* Аватарка с инициалом */
.avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(88, 84, 234, 0.12) 0%, rgba(124, 58, 237, 0.2) 100%);
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(88, 84, 234, 0.15);
}

/* Идеальный iOS-стиль тумблера с идеальным центрированием */
.attendance-switch {
    position: relative;
    display: inline-block;
    width: 48px !important;
    height: 28px !important;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.attendance-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.attendance-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    border-radius: 99px !important;
    transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
    box-sizing: border-box !important;
}

/* Ползунок (круг): диаметр 22px при высоте капсулы 28px -> ровный отступ 3px со всех сторон */
.attendance-slider:before {
    position: absolute;
    content: "";
    height: 22px !important;
    width: 22px !important;
    left: 3px !important;
    top: 3px !important;
    bottom: 3px !important;
    background-color: #ffffff !important;
    border-radius: 50% !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
    box-sizing: border-box !important;
}

/* Активное состояние (Включен / Зеленый) */
.attendance-switch input:checked + .attendance-slider {
    background: #10b981 !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* Смещение круга вправо на ровно 20px */
.attendance-switch input:checked + .attendance-slider:before {
    transform: translateX(20px) !important;
}

/* Бейджи статусов */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.badge-present {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-absent {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid rgba(225, 29, 72, 0.2);
}

.badge-ill {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.badge-late {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.badge-excused {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

/* Раскрывающийся аккордеон причин */
.reason-accordion {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    padding-top: 0;
    border-top: 1px dashed transparent;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.25s ease, 
                margin-top 0.3s ease, 
                padding-top 0.3s ease,
                border-color 0.25s ease;
    pointer-events: none;
}

.reason-accordion.open {
    max-height: 180px;
    opacity: 1;
    margin-top: 14px;
    padding-top: 12px;
    border-top-color: #e2e8f0;
    pointer-events: auto;
}

.reason-chips-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.reason-chip {
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: white;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reason-chip:hover {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.reason-chip:active {
    transform: scale(0.97);
}

.reason-chip i {
    font-size: 0.95rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.reason-chip:hover i {
    transform: scale(1.12);
}

/* Кастомные цветовые состояния для активных кнопок причин */
.reason-chip[data-reason="ABSENT"].active {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}
.reason-chip[data-reason="ABSENT"].active i {
    color: #dc2626;
}

.reason-chip[data-reason="ILL"].active {
    background: #fef3c7;
    color: #d97706;
    border-color: #fcd34d;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}
.reason-chip[data-reason="ILL"].active i {
    color: #d97706;
}

.reason-chip[data-reason="LATE"].active {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #7dd3fc;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15);
}
.reason-chip[data-reason="LATE"].active i {
    color: #0284c7;
}

.reason-chip[data-reason="EXCUSED"].active {
    background: #f3e8ff;
    color: #7c3aed;
    border-color: #d8b4fe;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}
.reason-chip[data-reason="EXCUSED"].active i {
    color: #7c3aed;
}


/* Анимация ошибки карточки при сбое сети */
.student-card.card-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.25) !important;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Кастомный тонкий скроллбар для модальных окон */
#modal-students-list,
.custom-modal-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

#modal-students-list::-webkit-scrollbar,
.custom-modal-scroll::-webkit-scrollbar {
    width: 6px;
}

#modal-students-list::-webkit-scrollbar-track,
.custom-modal-scroll::-webkit-scrollbar-track {
    background: transparent;
}

#modal-students-list::-webkit-scrollbar-thumb,
.custom-modal-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 99px;
    transition: background-color 0.2s ease;
}

#modal-students-list::-webkit-scrollbar-thumb:hover,
.custom-modal-scroll::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.35);
}


/* ═══════════════════════════════════════════════════════════════════════
   Schedule Matrix Table — Modal Width & Grade-level color-coded cells
   ═══════════════════════════════════════════════════════════════════ */

@media (min-width: 1200px) {
    .modal-schedule-wide {
        max-width: 1180px !important;
        width: 92% !important;
    }
}
@media (min-width: 1400px) {
    .modal-schedule-wide {
        max-width: 1280px !important;
    }
}

/* Убрать overflow-x у таблицы и выровнять распределение колонок */
#teacherProfileModal .table-responsive {
    overflow-x: hidden !important;
}

.schedule-matrix-table {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 0.82rem;
    border-collapse: separate;
    border-spacing: 0;
}

.schedule-matrix-table th, 
.schedule-matrix-table td {
    padding: 8px 4px !important;
    font-size: 0.82rem !important;
    vertical-align: middle !important;
}

.schedule-matrix-table thead th {
    background: #4f46e5 !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-color: #4338ca !important;
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
}

.schedule-matrix-table tbody td {
    border-color: #e2e8f0 !important;
    transition: background 0.15s ease;
}

.schedule-matrix-table tbody tr:hover td {
    filter: brightness(0.97);
}

/* Колонки со временем */
.schedule-col-time {
    width: 95px !important;
    font-size: 0.78rem !important;
    font-weight: 600;
}
.schedule-col-num {
    width: 36px !important;
}

/* Time columns (left & right) */
.schedule-matrix-table .td-time {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
    font-size: 0.72rem;
    white-space: nowrap;
    text-align: center;
}

/* Empty slot */
.schedule-matrix-table .td-empty {
    color: #cbd5e1;
    font-size: 0.82rem;
}

/* Lesson cell with data */
.schedule-cell {
    border-radius: 8px;
    padding: 4px 6px;
    line-height: 1.2;
    text-align: center;
    font-size: 0.76rem;
}

.schedule-cell .cell-subject {
    font-weight: 700;
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.schedule-cell .cell-meta {
    font-size: 0.68rem;
    opacity: 0.85;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Grade color classes */
.grade-primary { background: #fee2e2; color: #991b1b; }
.grade-middle  { background: #dbeafe; color: #1e40af; }
.grade-7       { background: #f3e8ff; color: #6b21a8; }
.grade-89      { background: #fef3c7; color: #92400e; }
.grade-senior  { background: #dcfce7; color: #166534; }
.grade-default { background: #eef2ff; color: #1e293b; }

/* Legend pills */
.schedule-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.schedule-legend .legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    border: 1px solid rgba(0,0,0,0.06);
}

/* Centered empty state full width */
#no-teachers-found, #no-results-msg {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

