
@media (max-width: 768px) {
  .header {
    display: none;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
  }

  .stats-bar-wrap.collapsed {
    display: none !important;
    
  }

  .stats-bar-wrap:not(.collapsed) {
    display: grid !important;
  }

  .stats-container {
    margin-bottom: 4px !important;
    padding: 0 !important;
    
  }

  .stats-toggle-mobile-btn {
    margin: 0 0 4px 0 !important;
  }

  .stats-toggle-mobile-btn {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100% !important;
    height: 44px !important;
    padding: 0 16px !important;
    margin: 0 0 12px 0 !important;

    background: #FFFFFF !important;
    border: 1.5px solid rgba(183, 77, 63, 0.2) !important;
    border-radius: 12px !important;

    color: #B74D3F !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    font-family: 'Inter', sans-serif !important;

    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
    -webkit-tap-highlight-color: transparent;
  }

  .stats-toggle-mobile-btn {
    margin-bottom: 0px !important;
    
  }

  .stats-container {
    margin-bottom: 6px !important;
    
    padding-bottom: 0 !important;
    
  }

  .stats-bar-wrap {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .stats-toggle-mobile-btn svg {
    width: 18px !important;
    height: 18px !important;
    transition: transform 0.3s ease;
    flex-shrink: 0;
  }

  .stats-toggle-mobile-btn.expanded svg {
    transform: rotate(180deg);
  }

  body {
    padding-top: 0;
    font-size: 12px;
    background: rgba(var(--primary-rgb, 183, 77, 63), 0.09);
  }

  .stats-container {
    display: block !important;
    margin: 0 0 0.75rem 0;
    background: white;
    border-radius: 14px;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(183, 77, 63, 0.1);
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .stats-container.stats-collapsed {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.4rem;
  }

  .stats-toggle-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 1rem;
    background: white;
    border: 1.5px solid rgba(183, 77, 63, 0.2);
    border-radius: 12px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0.5rem;
    margin: 0 0 0.5rem 0;
    height: auto;
    width: auto;
  }

  .week-stats-divider {
    display: none;
  }

  .week-navigation {
    display: none !important;
  }

  .stats-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
  }

  .stats-toggle-btn.expanded svg {
    transform: rotate(180deg);
  }

  .stats-bar-wrap {
    display: grid;
    grid-template-rows: 1fr;
    overflow: hidden;
    transition: grid-template-rows 0.34s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .stats-bar-wrap.collapsed {
    grid-template-rows: 0fr;
  }

  .stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    padding: 0.5rem;
    overflow: hidden;
    min-height: 0;
    transition: opacity 0.26s ease;
  }

  .stats-bar.has-room-capacity {
    grid-template-columns: repeat(5, 1fr);
  }

  .stats-bar.collapsed {
    opacity: 0;
  }

  .stat-item {
    flex-direction: column;
    text-align: center;
    gap: 0.25rem;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
    margin: 0 auto;
  }

  .stat-value {
    font-size: 0.95rem;
  }

  .stat-label {
    font-size: 0.55rem;
  }

  .week-controls,
  .week-today-btn {
    display: none !important;
  }

  .mobile-settings-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(var(--primary-rgb, 183, 77, 63), 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .mobile-settings-toggle:active {
    transform: scale(0.90);
    box-shadow: 0 1px 4px rgba(var(--primary-rgb, 183, 77, 63), 0.30);
  }

  .mobile-settings-toggle svg {
    width: 24px;
    height: 24px;
  }

  .settings-card {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 0.6rem;
    right: 0.6rem;
    z-index: 998;
    padding: 1rem;
    margin: 0;
    border-radius: 20px;
    max-height: calc(100dvh - 70px);
    overflow-y: auto;
    transform: translateY(0) scale(1);
    opacity: 1;
    transition:
      transform 0.30s cubic-bezier(0.34, 1.2, 0.64, 1),
      opacity 0.22s ease;
    box-shadow: 0 14px 34px rgba(var(--primary-rgb, 49, 130, 206), 0.26), 0 8px 24px rgba(0, 0, 0, 0.16);
    background: white;
    border: 1px solid rgba(var(--primary-rgb, 49, 130, 206), 0.20);
    -webkit-overflow-scrolling: touch;
  }

  .settings-card::before {
    height: 5px;
  }

  .settings-card.hidden {
    transform: translateY(calc(-100% - 60px)) scale(0.97);
    opacity: 0;
    pointer-events: none;
  }

  .settings-card h2 {
    font-size: 0.95rem;
    margin-bottom: 0.7rem;
    text-align: center;
    color: var(--primary);
  }

  .role-selector {
    margin-bottom: 0.9rem;
    background: rgba(var(--primary-rgb, 49, 130, 206), 0.10);
    border-radius: 12px;
    padding: 0.4rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 6px 18px rgba(var(--primary-rgb, 49, 130, 206), 0.10);
  }

  .role-selector>label {
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
    color: var(--text-light);
    display: block;
    text-align: center;
    font-weight: 600;
  }

  .role-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .role-option {
    position: relative;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 12px;
    overflow: hidden;
  }

  .role-option:has(input[type="radio"]:checked) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .settings-card .role-option input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  .settings-card .role-option input[type="radio"]::before {
    display: none !important;
  }

  .role-option .role-icon-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    background: rgba(var(--primary-rgb, 183, 77, 63), 0.09);
    border-radius: 12px;
    border: 1.5px solid rgba(var(--primary-rgb, 183, 77, 63), 0.22);
    color: rgba(var(--primary-rgb, 183, 77, 63), 0.82);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    overflow: hidden;
  }

  .role-option .role-icon {
    display: block;
    width: 34px;
    height: 34px;
    background-color: currentColor;
    opacity: 0.85;
    transition: transform 0.18s ease, opacity 0.18s ease, background-color 0.2s ease;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
  }
  .role-icon-student {
    width: 39px;
    height: 39px;
    -webkit-mask-image: url("../img/icons/student/student-icon.svg");
    mask-image: url("../img/icons/student/student-icon.svg");
    -webkit-mask-position: center 52%;
    mask-position: center 52%;
  }

  .role-icon-teacher {
    -webkit-mask-image: url("../img/professor-w.png");
    mask-image: url("../img/professor-w.png");
  }

  .role-icon-room {
    -webkit-mask-image: url("../img/door.svg");
    mask-image: url("../img/door.svg");
  }

  .role-option .role-icon-text {
    display: none;
  }

  .role-option .role-icon-label:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb, 183, 77, 63), 0.08);
    color: var(--primary);
    transform: translateY(-1px);
  }

  .role-option .role-icon-label:active {
    transform: scale(0.96);
  }

  .role-option input[type="radio"]:checked+.role-icon-label {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 183, 77, 63), 0.16) 0%, rgba(var(--primary-rgb, 183, 77, 63), 0.08) 100%);
    color: var(--primary);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb, 183, 77, 63), 0.22);
  }

  .role-option input[type="radio"]:checked+.role-icon-label .role-icon {
    opacity: 1;
    transform: scale(1.08);
  }

  #results-container,
  #schedule-display {
    transition: filter 0.22s ease, opacity 0.22s ease;
  }

  body.role-swipe-blur #results-container,
  body.role-swipe-blur #schedule-display {
    filter: blur(2px) saturate(0.94);
    opacity: 0.88;
  }

  .role-icon-label.role-swipe-accent {
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb, 183, 77, 63), 0.35), 0 8px 20px rgba(var(--primary-rgb, 183, 77, 63), 0.28);
    transform: translateY(-1px) scale(1.03);
    transition: transform 0.2s ease, box-shadow 0.22s ease;
  }

  .filters-section.visible .filters-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .filter-group {
    margin-bottom: 0;
  }

  .filter-group label {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
    display: block;
  }

  .filter-group select {
    padding: 0 0.7rem 0.5rem;
    font-size: 0.8rem;
    width: 100%;
    border-radius: 10px;
    border: 1.5px solid #e0e0e0;
    background: white;
    color: var(--text);
    -webkit-text-fill-color: var(--text);
  }

  .search-box {
    margin-bottom: 0.6rem;
  }

  .search-input {
    padding: 0.5rem 0.7rem 0.5rem 2.3rem;
    font-size: 0.8rem;
    border-radius: 10px;
  }

  .search-icon {
    left: 0.7rem;
    font-size: 0.95rem;
  }

  .close-settings-btn {
    position: sticky;
    bottom: -1rem;
    width: 100%;
    padding: 0.7rem;
    margin: 0.9rem -1rem -1rem -1rem;
    width: calc(100% + 2rem);
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%);
    color: white;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0 0 20px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: block;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.02em;
  }

  .close-settings-btn:active {
    opacity: 0.85;
    transform: scale(0.99);
  }

  .week-switcher {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 990;
    background: rgba(var(--primary-rgb, 183, 77, 63), 0.09);
    padding: 0 0.7rem 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    border-bottom: 1px solid rgba(183, 77, 63, 0.1);
  }

  .week-nav-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(183, 77, 63, 0.3);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
  }

  .week-nav-btn:active {
    transform: scale(0.95);
    background: var(--primary-dark);
  }

  .week-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .week-nav-btn {
    position: relative;
  }

  .week-nav-btn::before {
    content: "";
    position: absolute;
    top: -12px;
    bottom: -12px;
    left: -14px;
    right: -14px;
    border-radius: 999px;
  }

  .week-info {
    flex: 1;
    text-align: center;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    background: none;
    border: none;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
    font-family: inherit;
  }

  .week-info:active {
    background: rgba(183, 77, 63, 0.08);
  }

  .current-week {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
  }

  .week-range {
    font-size: 0.65rem;
    color: var(--text-light);
    margin-top: 0.1rem;
  }

  .today-btn {
    display: none;
  }

  .container {
    padding: 0.4rem;
  }

  #week-navigation {
    display: none !important;
  }

  .schedule-wrapper {
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(183, 77, 63, 0.08);
    margin-top: 0;
  }

  .schedule-wrapper::-webkit-scrollbar {
    height: 3px;
  }

  .schedule-wrapper::-webkit-scrollbar-track {
    background: #F0E8E3;
  }

  .schedule-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
  }

  .schedule-grid {
    min-width: 820px;
    font-size: 0.68rem;
    border: none;
    grid-template-columns: 70px repeat(7, 1fr);
  }

  .schedule-cell {
    min-height: 80px;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
  }

  .time-header {
    padding: 0.5rem 0.2rem;
    font-size: 0.65rem;
    background: linear-gradient(135deg, #202020 0%, #202020 100%);
    color: white;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
  }

  .time-header br {
    display: none;
  }

  .time-cell {
    font-size: 0.6rem;
    padding: 0.4rem 0.2rem;
    background: #FBF6F1;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
  }

  .time-cell br {
    display: none;
  }

  .day-header {
    padding: 0.4rem 0.2rem;
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .day-name {
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    line-height: 1.2;
    font-weight: 700;
  }

  .day-date {
    font-size: 0.62rem;
    white-space: nowrap;
  }

  .today-indicator {
    width: 5px;
    height: 5px;
    margin-left: 3px;
    display: inline-block;
    vertical-align: middle;
  }

  .lesson-cell {
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
  }

  .lesson {
    padding: 0.4rem 0.35rem;
    border-left-width: 3px;
    font-size: 0.62rem;
    border-radius: 5px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    white-space: normal;
    line-height: 1.3;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .lesson:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(183, 77, 63, 0.15);
  }

  .lesson:active {
    transform: scale(0.98);
  }

  .lesson-subject {
    font-size: 0.66rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    line-height: 1.3;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    color: var(--text);
  }

  .lesson-info {
    font-size: 0.58rem;
    line-height: 1.3;
    color: var(--text-light);
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .lesson-teacher {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    margin-bottom: 0.1rem;
    font-weight: 500;
  }

  .lesson-type {
    font-size: 0.52rem;
    padding: 0.1rem 0.3rem;
    margin-bottom: 0.15rem;
    display: inline-block;
    border-radius: 3px;
    font-weight: 700;
    white-space: normal;
  }

  .lesson-info div:last-child {
    font-size: 0.52rem;
    margin-top: 0.1rem;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    color: var(--primary);
    font-weight: 500;
  }

  .lesson-info div:last-child strong {
    font-weight: 700;
    color: var(--text);
  }

  .message {
    padding: 1.2rem 0.8rem;
    background: white;
    border-radius: 10px;
  }

  .message-icon {
    font-size: 1.8rem;
  }

  .message h3 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
  }

  .message p {
    font-size: 0.75rem;
    color: var(--text-light);
  }

  .teacher-modal.active {
    padding: 0.5rem;
  }

  .teacher-modal-content {
    border-radius: 28px;
    max-height: 96vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 20px 50px rgba(183, 77, 63, 0.35);
  }

  .teacher-photo-wrapper {
    border-radius: 28px 28px 0 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  .teacher-photo {
    height: 70vw;
    max-height: 420px;
    border-radius: 0;
    width: 100%;
    display: block;
  }

  .teacher-modal-body {
    padding: 0.65rem 1rem 1rem;
  }

  .teacher-modal-name {
    margin-bottom: 0.15rem;
  }

  .tm-surname {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
  }

  .tm-nameparts {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-light);
  }

  .teacher-position {
    font-size: 0.6rem;
    margin-bottom: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .teacher-contacts {
    gap: 0.28rem;
    margin-bottom: 0.55rem;
  }

  .teacher-contact-item {
    border-radius: 10px;
    padding: 0.4rem 0.7rem;
    gap: 0.55rem;
  }

  .teacher-contact-item svg {
    width: 14px;
    height: 14px;
  }

  .teacher-contact-item:active {
    background: #eeecec;
    transform: translateX(3px);
  }

  .teacher-contact-link,
  .teacher-contact-item span {
    font-size: 0.74rem;
  }

  .teacher-profile-btn {
    border-radius: 12px;
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
  }

  .teacher-profile-btn:active {
    transform: scale(0.97);
  }

  .calendar-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .calendar-popup.active {
    opacity: 1;
    pointer-events: all;
  }

  .calendar-popup .calendar-container {
    background: white;
    border-radius: 28px;
    padding: 1.5rem;
    box-shadow: 0 22px 48px rgba(var(--primary-rgb, 183, 77, 63), 0.34), 0 10px 24px rgba(0, 0, 0, 0.22);
    max-width: 420px;
    width: 92%;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 0 auto;
  }

  .calendar-popup.active .calendar-container {
    transform: scale(1);
  }

  .calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid rgba(var(--primary-rgb, 183, 77, 63), 0.18);
  }

  .calendar-nav-btn {
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }

  .calendar-nav-btn:active {
    transform: scale(0.95);
  }

  .calendar-month-year {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
  }

  .calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.3rem;
    margin-bottom: 0.5rem;
  }

  .calendar-weekday {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
    padding: 0.6rem 0;
  }

  .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
  }

  .calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 2px solid transparent;
    background: rgba(var(--primary-rgb, 49, 130, 206), 0.10);
  }

  .calendar-day:not(.other-month):active {
    transform: scale(0.95);
    background: rgba(var(--primary-rgb, 183, 77, 63), 0.18);
  }

  .calendar-day.other-month {
    background: transparent;
    color: #B8ACAA;
    cursor: default;
  }

  .calendar-day.today {
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%);
    color: white;
    font-weight: 700;
  }

  .calendar-day.selected {
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%);
    color: white;
  }

  .calendar-day.has-lessons {
    position: relative;
    font-weight: 700;
  }

  .calendar-day.has-lessons::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
  }

  .calendar-day.has-lessons.today::after,
  .calendar-day.has-lessons.selected::after {
    background: white;
  }

  .calendar-close {
    margin-top: 1.5rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%);
    color: white;
    border: none;
    border-radius: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
  }

  .calendar-close:active {
    transform: scale(0.98);
  }
}

@media (max-width: 360px) {
  .week-nav-btn {
    width: 32px;
    height: 32px;
  }

  .week-nav-btn svg {
    width: 18px;
    height: 18px;
  }

  .current-week {
    font-size: 0.8rem;
  }

  .week-range {
    font-size: 0.6rem;
  }

  .schedule-grid {
    min-width: 780px;
    grid-template-columns: 65px repeat(7, 1fr);
  }

  .stat-item {
    padding: 0.1rem;
  }

  .stat-icon {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }

  .stat-value {
    font-size: 0.85rem;
  }

  .stat-label {
    font-size: 0.5rem;
  }

  .lesson-subject {
    font-size: 0.64rem;
  }

  .lesson-info {
    font-size: 0.56rem;
  }

  .teacher-modal-body {
    padding: 1rem 1.2rem 1.5rem;
  }

  .teacher-photo {
    height: 170px;
  }

  .tm-surname {
    font-size: 1.35rem;
  }

  .tm-nameparts {
    font-size: 1rem;
  }

  .teacher-contact-item {
    padding: 0.65rem 0.9rem;
    gap: 0.75rem;
  }

  .teacher-contact-link,
  .teacher-contact-item span {
    font-size: 0.88rem;
  }

  .teacher-profile-btn {
    padding: 0.85rem;
    font-size: 0.95rem;
    border-radius: 16px;
  }

}

@media (max-width: 768px) {
  .today-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb, 183, 77, 63), 0.12);
    color: var(--primary);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
  }

  .today-btn:active {
    background: rgba(183, 77, 63, 0.2);
    transform: scale(0.95);
  }

  .mobile-time {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background 0.15s;
  }

  .mobile-time:active {
    background: rgba(183, 77, 63, 0.08);
  }

  .mobile-time.time-numbered .slot-start {
    color: var(--primary);
  }

  .mobile-time.time-numbered .slot-end {
    color: var(--primary);
    opacity: 0.7;
  }
}

.theme-toggle {
  width: 90px;
  height: 40px;
}

.theme-toggle-thumb {
  width: 28px;
  height: 28px;
  top: 6px;
  left: 6px;
}

.theme-icon {
  width: 13px;
  height: 13px;
}

.theme-toggle.is-dark .theme-toggle-thumb {
  transform: translateX(50px);
}

.theme-toggle.is-dark:hover .theme-toggle-thumb {
  transform: translateX(50px);
}

body.dark-mode {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 77, 109, 0.14) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 5%, rgba(192, 68, 255, 0.11) 0%, transparent 38%),
    #0a0812 !important;
  background-attachment: fixed !important;
}

@media (max-width: 768px) {

  body.dark-mode .mobile-settings-toggle {
    background: linear-gradient(135deg,
        rgba(220, 60, 80, 0.92) 0%, rgba(160, 16, 40, 0.96) 100%) !important;
    border: 1px solid rgba(255, 130, 150, 0.28) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 0 22px rgba(255, 77, 109, 0.40),
      0 4px 18px rgba(0, 0, 0, 0.50) !important;
    color: #fff !important;
    backdrop-filter: blur(16px) !important;
  }

  body.dark-mode .settings-overlay {
    background: rgba(4, 1, 12, 0.80) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
  }

  body.dark-mode .settings-card {
    position: fixed !important;
    background: rgba(14, 7, 28, 0.97) !important;
    backdrop-filter: blur(32px) saturate(1.8) !important;
    -webkit-backdrop-filter: blur(32px) saturate(1.8) !important;
    border: 1px solid rgba(var(--primary-rgb, 49, 130, 206), 0.34) !important;
    box-shadow:
      inset 0 1.5px 0 rgba(255, 255, 255, 0.09),
      0 0 50px rgba(var(--primary-rgb, 49, 130, 206), 0.22),
      0 24px 70px rgba(0, 0, 0, 0.75) !important;
  }

  body.dark-mode .settings-card h2 {
    color: #ff4d6d !important;
    text-shadow: 0 0 18px rgba(255, 77, 109, 0.50) !important;
  }

  body.dark-mode .role-selector {
    background: rgba(10, 4, 22, 0.85) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(var(--primary-rgb, 49, 130, 206), 0.26) !important;
    box-shadow: 0 0 20px rgba(var(--primary-rgb, 49, 130, 206), 0.14) !important;
  }

  body.dark-mode .role-selector>label {
    color: rgba(144, 128, 184, 0.75) !important;
  }

  body.dark-mode .role-option {
    background: transparent !important;
    border: none !important;
  }

  body.dark-mode .role-option .role-icon-label {
    background: rgba(20, 10, 36, 0.92) !important;
    border: 1.5px solid rgba(120, 80, 200, 0.25) !important;
    color: rgba(200, 185, 240, 0.9) !important;
    box-shadow: none !important;
  }

  body.dark-mode .role-option .role-icon {
    background-color: rgba(200, 185, 240, 0.9) !important;
    opacity: 0.88 !important;
  }

  body.dark-mode .role-option .role-icon-label:hover {
    border-color: rgba(255, 77, 109, 0.55) !important;
    background: rgba(255, 77, 109, 0.1) !important;
    color: rgba(255, 110, 140, 0.95) !important;
  }

  body.dark-mode .role-option input[type="radio"]:checked + .role-icon-label {
    background: rgba(255, 77, 109, 0.14) !important;
    border-color: rgba(255, 77, 109, 0.58) !important;
    color: rgba(255, 110, 140, 0.98) !important;
    box-shadow: 0 0 16px rgba(255, 77, 109, 0.16) !important;
  }

  body.dark-mode .role-option input[type="radio"]:checked + .role-icon-label .role-icon {
    background-color: rgba(255, 110, 140, 0.98) !important;
    opacity: 1 !important;
  }

  body.dark-mode .filter-group select,
  body.dark-mode .search-input {
    background: rgba(10, 4, 22, 0.88) !important;
    color: #f0ecff !important;
    border: 1.5px solid rgba(120, 80, 200, 0.28) !important;
  }

  body.dark-mode .filter-group label {
    color: rgba(144, 128, 184, 0.75) !important;
  }

  body.dark-mode .close-settings-btn {
    background: linear-gradient(135deg,
        rgba(220, 60, 80, 0.90) 0%, rgba(160, 16, 40, 0.96) 100%) !important;
    border-top: 1px solid rgba(255, 130, 150, 0.22) !important;
    border-radius: 0 0 20px 20px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 24px rgba(255, 77, 109, 0.32) !important;
    color: #fff !important;
  }

  body.dark-mode .close-settings-btn:active {
    opacity: 0.80 !important;
    transform: scale(0.99) !important;
  }

  body.dark-mode .week-switcher {
    position: sticky !important;
    top: 0 !important;
    background: rgba(8, 4, 18, 0.97) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-bottom: 1px solid rgba(255, 77, 109, 0.12) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.65) !important;
    position: relative !important;
  }

  body.dark-mode .week-switcher::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    background: linear-gradient(90deg,
        transparent 0%, #ff4d6d 20%, #c044ff 50%, #4dc8ff 80%, transparent 100%);
    background-size: 200% 100%;
    animation: rgb-h 4s linear infinite;
    pointer-events: none;
  }

  body.dark-mode .current-week {
    color: #ff4d6d !important;
    text-shadow: 0 0 14px rgba(255, 77, 109, 0.55) !important;
  }

  body.dark-mode .week-range {
    color: rgba(144, 128, 184, 0.65) !important;
  }

  body.dark-mode .week-nav-btn {
    background: linear-gradient(135deg,
        rgba(220, 60, 80, 0.78) 0%, rgba(160, 16, 40, 0.90) 100%) !important;
    border: 1px solid rgba(255, 130, 150, 0.20) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      0 0 16px rgba(255, 77, 109, 0.38) !important;
  }

  body.dark-mode .week-nav-btn:active {
    transform: scale(0.93) !important;
    background: rgba(255, 77, 109, 0.55) !important;
  }

  body.dark-mode .today-btn {
    background: rgba(22, 10, 40, 0.85) !important;
    color: #ff4d6d !important;
    border: 1px solid rgba(255, 77, 109, 0.28) !important;
    box-shadow: 0 0 12px rgba(255, 77, 109, 0.20) !important;
  }

  body.dark-mode .today-btn svg {
    color: #ff4d6d !important;
    filter: drop-shadow(0 0 4px rgba(255, 77, 109, 0.50)) !important;
  }

  body.dark-mode .today-btn:active {
    background: rgba(255, 77, 109, 0.22) !important;
    transform: scale(0.94) !important;
  }

  body.dark-mode .stats-container {
    background: rgba(14, 7, 28, 0.90) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.60) !important;
  }

  body.dark-mode .stats-container .stats-bar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  body.dark-mode .container {
    background: transparent !important;
  }

  body.dark-mode .mobile-time:active {
    background: rgba(192, 68, 255, 0.10) !important;
  }

  body.dark-mode .mobile-time.time-numbered .slot-start,
  body.dark-mode .mobile-time.time-numbered .slot-end {
    color: #ff4d6d !important;
  }

}

.theme-toggle-stats {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-room-capacity-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    height: 38px;
    border: 2px solid var(--primary, #B74D3F);
    border-radius: 10px;
    background: white;
    color: var(--primary, #B74D3F);
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .mobile-room-capacity-lbl {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.75;
    margin-top: 1px;
  }

  body.dark-mode .mobile-room-capacity-badge {
    background: #1e1624;
    border-color: #c9756a;
    color: #c9756a;
  }

  #stat-room-capacity-block {
    display: none !important;
  }

  #export-ics-btn,
  #export-print-btn,
  #mobile-theme-btn {
    border-width: 1.5px !important;
  }

  #mobile-theme-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 2px solid var(--primary);
    border-radius: 10px;
    background: white;
    color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }

  #mobile-theme-btn:active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }

  body.dark-mode #mobile-theme-btn {
    background: rgba(12,6,22,0.75) !important;
    border-color: rgba(255,77,109,0.35) !important;
    color: var(--nr, #ff4d6d) !important;
  }
  body.dark-mode #mobile-theme-btn:active {
    background: rgba(255,77,109,0.20) !important;
  }

  .stats-toggle-mobile-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    margin: 0 auto;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    opacity: 0.6;
  }

  .stats-toggle-mobile-btn:active {
    opacity: 1;
  }

  .stats-toggle-mobile-btn svg {
    transition: transform 0.3s;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .stats-toggle-mobile-btn.expanded svg {
    transform: rotate(180deg);
  }

  .mobile-day-past {
    display: none;
  }

  .mobile-schedule.show-past .mobile-day-past {
    display: block;
  }

  .mobile-week-expand-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 0.52rem 1rem;
    margin-bottom: 0.6rem;
    background: transparent;
    border: 1.5px solid rgba(183, 77, 63, 0.30);
    border-radius: 12px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: "Inter", sans-serif;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    justify-content: center;
  }

  .mobile-week-expand-btn:active {
    background: rgba(183, 77, 63, 0.10);
  }

.mobile-schedule.show-past .mobile-week-expand-btn {
  background: transparent;
  border-color: rgba(183, 77, 63, 0.30);
  color: var(--primary);
}

  .mobile-week-expand-btn svg {
    flex-shrink: 0;
    transition: transform 0.22s;
  }

}

.lesson .lesson-progress {
  height: 3px;
}

.mobile-lesson .lesson-progress {
  height: 3px;
}
