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

    :root {
      --primary: #B74D3F;
      --primary-dark: #8C3530;
      --accent: #B74D3F;
      --success: #DCA44E;
      --pink: #B74D3F;
      --bg: #FBF6F1;
      --card: #ffffff;
      --text: #202020;
      --text-light: #6B5350;
      --border: #E0D4D0;
      --gold: #DCA44E;
    }

    body {
      font-family: "Inter", sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.4;
      zoom: 0.78;
    }
    /* На мобильных экранах (до 768px) сбросить zoom */
    @media (max-width: 768px) {
        body {
            zoom: 1; /* нормальный масштаб на телефоне */
        }
    }
    /* ── RGB АНИМАЦИЯ ── */
    @keyframes rgb-border {
      0%   { background-position: 0% 50%; }
      100% { background-position: 200% 50%; }
    }
    @keyframes rgb-border-v {
      0%   { background-position: 50% 0%; }
      100% { background-position: 50% 200%; }
    }
    @keyframes card-rgb {
      0%   { background-position: 0% 50%; }
      100% { background-position: 200% 50%; }
    }

    .header {
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white;
      padding: 2rem 0;
      box-shadow:
        0 4px 20px rgba(183, 77, 63, 0.20),
        0 1px 0 rgba(255,255,255,0.08) inset;
      position: relative;
      overflow: hidden;
      max-width: 1400px;
      margin: 0 auto;
      border-radius: 0 0 18px 18px;
    }

    /* Стеклянный блик сверху */
    .header::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 40%;
      background: linear-gradient(180deg,
        rgba(255,255,255,0.10) 0%,
        transparent 100%
      );
      pointer-events: none;
      z-index: 1;
    }

    /* RGB полоска снизу (светлая тема) */
    .header::after {
      content: '';
      position: absolute;
      bottom: 0; left: 0; right: 0;
      height: 2px;
      background: linear-gradient(90deg,
        #B74D3F, #DCA44E, #FAEBD9,
        #DCA44E, #B74D3F, #8C3530, #B74D3F
      );
      background-size: 200% 100%;
      animation: rgb-border 4s linear infinite;
      pointer-events: none;
    }

    .header-content { position: relative; z-index: 2; }

    .header-content {
      padding: 0 1.5rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .header-text {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    .header-logo {
      height: 90px;
      width: auto;
      /* Лого чёрное на тёмном фоне — делаем белым */
      filter: brightness(0) invert(1);
      object-fit: contain;
      object-position: left center;
    }

    .header-subtitle {
      font-size: 0.68rem;
      font-weight: 400;
      opacity: 0.60;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      padding-left: 1px;
    }

    .container {
      max-width: 1400px;
      margin: 0 auto;
      padding: 1rem;
    }

    .settings-card {
      background: white;
      border-radius: 16px;
      padding: 2rem;
      margin-bottom: 1.5rem;
      box-shadow: 0 2px 12px rgba(183, 77, 63, 0.08);
      border: 1px solid rgba(183, 77, 63, 0.08);
    }

    .settings-card h2 {
      font-size: 1.25rem;
      margin-bottom: 1.5rem;
      font-weight: 700;
      color: var(--primary);
    }

    /* Desktop settings gear btn - only hover highlight, no active state */

    /* Скрыть мобильный бейдж вместимости на десктопе */
    @media (min-width: 769px) {
      #mobile-cap-badge {
        display: none !important;
      }
    }

    .settings-card.settings-hidden {
      display: none;
    }

    /* Desktop: hide mobile theme btn */
    @media (min-width: 769px) {
      #mobile-theme-btn { display: none !important; }
    }

    /* Mobile: hide desktop settings gear btn */
    @media (max-width: 768px) {
      #week-settings-btn { display: none !important; }
    }

    .role-selector {
      margin-bottom: 1.5rem;
    }

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

    .role-options {
      display: flex;
      gap: 1.5rem;
    }

    .role-option {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .role-option input[type="radio"] {
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: var(--accent);
    }

    .role-option label {
      font-size: 0.9375rem;
      font-weight: 500;
      cursor: pointer;
    }

    .filters-section {
      display: none;
    }

    .filters-section.visible {
      display: block;
    }

    .filters-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 1rem;
      margin-bottom: 1rem;
    }

    .filter-group label {
      font-size: 0.8125rem;
      font-weight: 600;
      color: var(--text-light);
      display: block;
      margin-bottom: 0.4rem;
    }

    .filter-group select {
      width: 100%;
      padding: 0.65rem;
      border: 2px solid var(--border);
      border-radius: 8px;
      font-size: 0.875rem;
      background: white;
      cursor: pointer;
      transition: all 0.2s;
    }

    .filter-group select:hover {
      border-color: var(--accent);
    }

    .filter-group select:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
    }

    .filter-group select:disabled {
      background: #F7F1EC;
      cursor: not-allowed;
      opacity: 0.6;
    }

    .btn {
      padding: 0.75rem 1.5rem;
      border: none;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      font-family: inherit;
    }

    .btn-primary {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      box-shadow: 0 2px 8px rgba(183, 77, 63, 0.25);
    }

    .btn-primary:hover:not(:disabled) {
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.35);
    }

    .btn-primary:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .week-navigation {
      background: white;
      border-radius: 16px;
      padding: 0;
      margin-bottom: 1rem;
      margin-left: auto;
      margin-right: auto;
      max-width: 800px;
      box-shadow: 0 2px 12px rgba(183,77,63,0.1), 0 1px 3px rgba(0,0,0,0.06);
      display: none;
      overflow: hidden;
      border: 1.5px solid rgba(183,77,63,0.15);
    }

    .week-navigation.visible {
      display: block;
    }

    .week-nav-content {
      display: flex;
      align-items: stretch;
      justify-content: space-between;
      min-height: 72px;
    }

    .week-controls {
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1;
    }

    .week-arrow-btn {
      width: 64px;
      height: 72px;
      border: none;
      background: transparent;
      color: #D4A09C;
      cursor: pointer;
      transition: all 0.18s;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .week-arrow-btn:hover {
      color: var(--primary);
      background: rgba(183,77,63,0.05);
    }

    .week-arrow-btn:active {
      background: rgba(183,77,63,0.1);
    }

    .week-arrow-btn svg {
      width: 18px;
      height: 18px;
      stroke-width: 2.5;
    }

    .week-dates-wrapper {
      text-align: center;
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 0.15rem;
      padding: 0.75rem 0;
    }

    .week-label {
      font-size: 0.58rem;
      color: rgba(183,77,63,0.5);
      text-transform: uppercase;
      letter-spacing: 0.14em;
      font-weight: 600;
    }

    .week-dates {
      font-size: 1.3rem;
      font-weight: 600;
      color: var(--text);
      cursor: pointer;
      padding: 0.25rem 1rem;
      border-radius: 8px;
      transition: all 0.18s;
      display: inline-flex;
      align-items: center;
      white-space: nowrap;
      letter-spacing: -0.01em;
    }

    .week-dates:hover {
      background: rgba(183,77,63,0.06);
      color: var(--primary);
    }

    /* 7 точек — индикаторы дней недели */
    .week-days-strip {
      display: flex;
      gap: 4px;
    }

    .week-day-dot {
      width: 20px;
      height: 3px;
      border-radius: 2px;
      background: rgba(183,77,63,0.12);
    }

    .week-day-dot.has-lessons {
      background: var(--primary);
      opacity: 0.5;
    }

    .week-day-dot.today {
      background: var(--primary);
      opacity: 1;
    }

    .week-today-btn {
      padding: 0 1.6rem;
      height: 72px;
      border: none;
      border-left: 1.5px solid rgba(183,77,63,0.15);
      background: rgba(183,77,63,0.04);
      color: var(--primary);
      font-size: 0.72rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s;
      white-space: nowrap;
      min-width: 130px;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
    }

    .week-today-btn svg {
      width: 16px;
      height: 16px;
      color: var(--primary);
      opacity: 0.6;
    }

    .week-today-btn:hover {
      background: var(--primary);
      color: white;
    }

    .week-today-btn:hover svg {
      color: white;
      opacity: 1;
    }

    .week-today-btn:active {
      background: #8C3530;
      color: white;
    }

    /* СЕТКА РАСПИСАНИЯ */
    .schedule-wrapper {
      background: white;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 4px 16px rgba(183, 77, 63, 0.08);
      border: 1px solid rgba(183, 77, 63, 0.08);
    }

    .schedule-grid {
      display: grid;
      grid-template-columns: 85px repeat(7, 1fr);
      border: 1px solid var(--border);
    }

    .schedule-cell {
      border-right: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
      min-height: 90px;
    }

    .schedule-cell:nth-child(8n) {
      border-right: none;
    }

    /* ЗАГОЛОВОК ВРЕМЕНИ */
    .time-header {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 0.9375rem;
      padding: 1rem 0.5rem;
    }

    /* ЗАГОЛОВКИ ДНЕЙ */
    .day-header {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      padding: 1rem 0.75rem;
      text-align: center;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }

    .day-name {
      font-weight: 700;
      font-size: 0.9375rem;
      margin-bottom: 0.35rem;
      letter-spacing: 0.02em;
    }

    .day-date {
      font-size: 0.8125rem;
      opacity: 0.95;
      font-weight: 500;
    }

    /* ЯЧЕЙКИ ВРЕМЕНИ */
    .time-cell {
      background: #FBF6F1;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      font-size: 0.6875rem;
      font-weight: 600;
      color: var(--text-light);
      padding: 0.5rem;
      line-height: 1.3;
    }

    .time-header-toggle {
      cursor: pointer;
      user-select: none;
      gap: 0.25rem;
      flex-direction: column;
      transition: background 0.2s;
      -webkit-tap-highlight-color: transparent;
    }

    .time-header-toggle:hover {
      background: rgba(255,255,255,0.15);
    }

    .time-header-toggle:active {
      background: rgba(255,255,255,0.25);
    }

    .time-switch-icon {
      opacity: 0.55;
      line-height: 1;
      margin-top: 0.15rem;
      transition: opacity 0.2s;
    }

    .time-header-toggle:hover .time-switch-icon,
    .time-header-toggle:active .time-switch-icon {
      opacity: 0.9;
    }

    /* Формат ячеек времени */
    .time-cell {
      flex-direction: column;
      gap: 0;
    }

    .slot-start {
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--text);
      line-height: 1.2;
    }

    .slot-sep {
      font-size: 0.6rem;
      color: var(--text-light);
      line-height: 1;
    }

    .slot-end {
      font-size: 0.7rem;
      font-weight: 500;
      color: var(--text-light);
      line-height: 1.2;
    }

    /* Мобильная кнопка ICS — только иконка */
    @media (max-width: 600px) {
      #export-ics-btn .ics-label {
        display: none;
      }
    }

    /* ===== МОБИЛЬНЫЙ LAYOUT РАСПИСАНИЯ ===== */
    @media (max-width: 768px) {
      .schedule-wrapper { overflow-x: visible !important; }
      .schedule-grid { display: none !important; }
      .mobile-schedule { display: block !important; }
    }

    .mobile-schedule { display: none; }

    .mobile-day {
      margin-bottom: 0.75rem;
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }

    .mobile-day-header {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      padding: 0.6rem 1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .mobile-day-header.current-day {
      background: linear-gradient(135deg, #DCA44E 0%, #A07828 100%);
    }

    .mobile-day-name {
      font-weight: 700;
      font-size: 0.95rem;
      letter-spacing: 0.02em;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .mobile-day-date {
      font-size: 0.8rem;
      opacity: 0.88;
      font-weight: 500;
    }

    .mobile-slot {
      background: white;
      display: flex;
      border-bottom: 1px solid rgba(0,0,0,0.06);
    }

    .mobile-slot:last-child { border-bottom: none; }

    .mobile-time {
      flex: 0 0 56px;
      background: #F7F1EC;
      border-right: 1px solid rgba(0,0,0,0.07);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 0.6rem 0.3rem;
      text-align: center;
    }

    .mobile-time .slot-start { font-size: 0.82rem; font-weight: 700; color: var(--text); line-height: 1.2; }
    .mobile-time .slot-sep   { font-size: 0.6rem; color: #D0C4C0; line-height: 1; margin: 1px 0; }
    .mobile-time .slot-end   { font-size: 0.68rem; color: var(--text-light); line-height: 1.2; }

    .mobile-lessons {
      flex: 1;
      padding: 0.4rem 0.5rem;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    .mobile-lesson {
      border-left: 3px solid var(--primary);
      border-radius: 8px;
      padding: 0.45rem 0.6rem;
      background: #fdfdfd;
      box-shadow: 0 1px 3px rgba(0,0,0,0.07);
      cursor: pointer;
      transition: box-shadow 0.2s, transform 0.15s;
      -webkit-tap-highlight-color: transparent;
    }

    .mobile-lesson:active { transform: scale(0.985); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
    .mobile-lesson.exam     { background: #F4E8E7; }

    .mobile-lesson-subject {
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text);
      line-height: 1.25;
      margin-bottom: 0.2rem;
    }

    .mobile-lesson-meta {
      font-size: 0.68rem;
      color: var(--text-light);
      line-height: 1.3;
      display: flex;
      flex-wrap: wrap;
      gap: 0.15rem 0.4rem;
      align-items: center;
    }

    .mobile-lesson-type {
      display: inline-block;
      font-size: 0.58rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 0.1rem 0.35rem;
      border-radius: 3px;
      color: white;
    }

    .mobile-lesson-type.lecture  { background: #B74D3F; }
    .mobile-lesson-type.practice { background: #DCA44E; }
    .mobile-lesson-type.lab      { background: #3A7EC0; }
    .mobile-lesson-type.exam     { background: #B74D3F; }

    .mobile-day-empty {
      background: white;
      padding: 0.7rem 1rem;
      color: #C8BCBA;
      font-size: 0.78rem;
      text-align: center;
    }

    /* ЯЧЕЙКИ С ЗАНЯТИЯМИ */
    .lesson-cell {
      padding: 0.4rem;
      background: white;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .lesson-cell:hover {
      background: #FBF6F1;
    }

    .lesson-cell:has(.lesson:only-child) .lesson {
      flex: 1;
      min-height: 100%;
    }

    .lesson {
      background: white;
      border-left: 4px solid var(--primary);
      padding: 0.5rem;
      border-radius: 6px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
      font-size: 0.75rem;
      line-height: 1.4;
      transition: all 0.25s;
      cursor: pointer;
      display: flex;
      flex-direction: column;
    }

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

    .lesson.lecture {
      border-left-color: #B74D3F;
    }

    .lesson.practice {
      border-left-color: #DCA44E;
    }

    .lesson.lab {
      border-left-color: #DCA44E;
    }

    .lesson.exam {
      border-left-color: #B74D3F;
      background: #F4E8E7;
    }

    .lesson-type {
      display: inline-block;
      padding: 0.2rem 0.5rem;
      border-radius: 4px;
      font-size: 0.6875rem;
      font-weight: 700;
      text-transform: uppercase;
      margin-bottom: 0.35rem;
      letter-spacing: 0.03em;
    }

    .lesson-type.lecture {
      background: #F4E8E7;
      color: #8C3530;
    }

    .lesson-type.practice {
      background: #FBF0DC;
      color: #A07828;
    }

    .lesson-type.lab {
      background: #FBF0DC;
      color: #A07828;
    }

    .lesson-type.exam {
      background: #F4E8E7;
      color: #8C3530;
    }

    .lesson-type-badge {
      position: absolute;
      bottom: 0.3rem;
      right: 0.35rem;
      font-size: 0.6rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      padding: 0.15rem 0.4rem;
      border-radius: 4px;
      line-height: 1.4;
    }

    .lesson-type-badge.lecture  { background: #F4E8E7; color: #8C3530; }
    .lesson-type-badge.practice { background: #FBF0DC; color: #A07828; }
    .lesson-type-badge.lab      { background: #E0EEFB; color: #2A5A9E; }
    .lesson-type-badge.exam     { background: #F4E8E7; color: #8C3530; }

    .lesson-subject {
      font-weight: 600;
      color: var(--text);
      margin-bottom: 0.25rem;
      line-height: 1.2;
    }

    .lesson-info {
      color: var(--text-light);
      font-size: 0.625rem;
      line-height: 1.3;
    }

    .lesson-teacher {
      margin-bottom: 0.125rem;
    }

    .message {
      background: white;
      border-radius: 12px;
      padding: 3rem 2rem;
      text-align: center;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .message-icon {
      margin-bottom: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--primary);
      opacity: 0.35;
    }

    .message h3 {
      font-size: 1.25rem;
      margin-bottom: 0.5rem;
    }

    /* КАЛЕНДАРЬ */
    .calendar-popup {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s;
    }

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

    .calendar-container {
      background: white;
      border-radius: 16px;
      padding: 1.5rem;
      box-shadow: 0 20px 60px rgba(183, 77, 63, 0.3);
      max-width: 380px;
      width: 90%;
      transform: scale(0.9);
      transition: transform 0.25s;
    }

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

    .calendar-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1.5rem;
      padding-bottom: 1rem;
      border-bottom: 2px solid rgba(183, 77, 63, 0.1);
    }

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

    .calendar-nav-btn:hover {
      transform: scale(1.1);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.3);
    }

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

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

    .calendar-weekday {
      text-align: center;
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--text-light);
      padding: 0.5rem;
      text-transform: uppercase;
    }

    .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: 8px;
      cursor: pointer;
      font-size: 0.875rem;
      font-weight: 600;
      transition: all 0.2s;
      border: 2px solid transparent;
    }

    .calendar-day:not(.other-month):hover {
      background: rgba(183, 77, 63, 0.1);
      transform: scale(1.1);
    }

    .calendar-day.other-month {
      color: var(--text-light);
      opacity: 0.3;
      cursor: default;
    }

    .calendar-day.today {
      background: linear-gradient(135deg, #DCA44E 0%, #A07828 100%);
      color: white;
      font-weight: 700;
    }

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

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

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

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

    .calendar-close {
      margin-top: 1rem;
      width: 100%;
      padding: 0.75rem;
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      border: none;
      border-radius: 8px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.25s;
    }

    .calendar-close:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.3);
    }

    /* МОДАЛЬНОЕ ОКНО ПРЕПОДАВАТЕЛЯ */
    /* ===== TEACHER MODAL ===== */
    .teacher-modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0; top: 0;
      width: 100%; height: 100%;
      background: rgba(0, 0, 0, 0.55);
      backdrop-filter: blur(4px);
    }

    .teacher-modal.active {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1.5rem;
    }

    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes slideUp {
      from { opacity: 0; transform: translateY(22px) scale(0.97); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    .teacher-modal-content {
      background: white;
      border-radius: 28px;
      width: 100%;
      max-width: 480px;
      max-height: 88vh;
      overflow-y: auto;
      overflow-x: hidden;
      box-shadow: 0 24px 56px rgba(183, 77, 63, 0.22), 0 4px 16px rgba(0,0,0,0.12);
      position: relative;
      animation: slideUp 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
    }

    .teacher-modal-content::-webkit-scrollbar { width: 4px; }
    .teacher-modal-content::-webkit-scrollbar-thumb { background: rgba(183,77,63,0.2); border-radius: 4px; }

    .teacher-modal-close {
      position: absolute;
      right: 0.9rem; top: 0.9rem;
      width: 34px; height: 34px;
      border: none;
      background: rgba(255,255,255,0.88);
      color: var(--primary);
      font-size: 20px;
      border-radius: 50%;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 3;
      box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .teacher-modal-close:hover {
      background: var(--primary);
      color: white;
      transform: rotate(90deg);
    }

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

    .teacher-photo {
      width: 100%;
      height: 420px;
      object-fit: cover;
      object-position: center top;
      display: block;
    }

    .teacher-modal-body {
      padding: 1.1rem 1.4rem 1.5rem;
    }

    .teacher-info { text-align: center; }

    .teacher-modal-name {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0;
      margin: 0 0 0.2rem 0;
      line-height: 1.2;
    }

    .tm-surname {
      font-size: 1.4rem;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.01em;
      display: block;
    }

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

    .teacher-position {
      color: var(--primary);
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      margin-bottom: 1.1rem;
      padding-bottom: 1rem;
      border-bottom: 1.5px solid rgba(183,77,63,0.12);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
    }

    .tm-dept {
      font-size: 0.74rem;
      font-weight: 400;
      color: #8A7876;
      text-transform: none;
      letter-spacing: 0;
    }

    .teacher-contacts {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      margin-bottom: 1rem;
      text-align: left;
    }

    .teacher-contact-item {
      display: flex;
      align-items: center;
      gap: 0.8rem;
      padding: 0.65rem 0.9rem;
      background: #F7F1EC;
      border-radius: 14px;
      border-left: 4px solid var(--primary);
      transition: background 0.15s;
    }

    .teacher-contact-item:hover { background: #F4E8E7; }

    .teacher-contact-item svg {
      color: var(--primary);
      flex-shrink: 0;
      width: 18px; height: 18px;
    }

    .teacher-contact-link,
    .teacher-contact-item span {
      color: var(--text);
      text-decoration: none;
      font-weight: 500;
      font-size: 0.9rem;
      line-height: 1.4;
      flex: 1;
      word-break: break-word;
      transition: color 0.15s;
    }

    .teacher-contact-link:hover { color: var(--primary); }

    .teacher-profile-btn {
      display: block;
      width: 100%;
      padding: 0.85rem 1.5rem;
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white;
      text-decoration: none;
      border-radius: 16px;
      font-weight: 700;
      font-size: 0.95rem;
      text-align: center;
      transition: all 0.2s;
      box-shadow: 0 4px 14px rgba(183, 77, 63, 0.3);
      border: none;
      cursor: pointer;
    }

    .teacher-profile-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 18px rgba(183, 77, 63, 0.4);
    }

        /* ПОИСК */
    .search-box {
      margin-bottom: 1rem;
      position: relative;
    }

    .search-input {
      width: 100%;
      padding: 0.875rem 1rem 0.875rem 3rem;
      border: 2px solid var(--border);
      border-radius: 12px;
      font-size: 0.9375rem;
      transition: all 0.25s;
      background: white;
    }

    .search-input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 4px rgba(183, 77, 63, 0.1);
    }

    .search-icon {
      position: absolute;
      left: 1rem;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-light);
      display: flex;
      align-items: center;
    }

    /* СТАТИСТИКА */
    .stats-container {
      margin-bottom: 1rem;
    }

    .stats-container.hidden {
      display: none;
    }

    .stats-toggle-btn {
      height: 72px;
      width: 52px;
      background: transparent;
      border: none;
      color: #D4A09C;
      cursor: pointer;
      transition: all 0.18s;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      padding: 0;
      margin-bottom: 0;
    }

    .stats-toggle-btn:hover {
      color: var(--primary);
      background: rgba(183,77,63,0.05);
    }

    .stats-toggle-btn svg {
      transition: transform 0.3s;
    }

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

    .week-stats-divider {
      width: 1px;
      height: 36px;
      background: rgba(183,77,63,0.18);
      flex-shrink: 0;
      align-self: center;
    }



    .stats-bar {
      background: white;
      border-radius: 12px;
      padding: 1rem;
      display: flex;
      align-items: center;
      gap: 1.5rem;
      flex-wrap: wrap;
      border: 1px solid rgba(183, 77, 63, 0.1);
      max-height: 500px;
      overflow: hidden;
      transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
      opacity: 1;
    }

    .stats-bar.collapsed {
      max-height: 0;
      opacity: 0;
      padding: 0 1rem;
    }

    .stat-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .stats-btn-group {
      margin-left: auto;
      display: flex;
      gap: 0.5rem;
      align-items: center;
      flex-shrink: 0;
    }

    .stats-grid-bottom {
      display: contents;
    }

    .stat-divider {
      width: 1px;
      height: 40px;
      background: rgba(0,0,0,0.1);
      flex-shrink: 0;
    }

    .stat-divider-desktop {
      width: 1px;
      height: 36px;
      background: rgba(183,77,63,0.15);
      flex-shrink: 0;
      align-self: center;
    }

    .stat-item-progress {
      flex-direction: column;
      align-items: flex-start;
      gap: 0;
    }

    .stat-progress-wrap {
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
      min-width: 110px;
    }

    .stat-progress-nums {
      display: flex;
      align-items: baseline;
      gap: 0.1rem;
      line-height: 1;
    }

    .stat-done {
      font-size: 1.5rem;
      font-weight: 800;
      color: var(--primary);
      letter-spacing: -0.5px;
    }

    .stat-sep-slash {
      font-size: 1rem;
      font-weight: 400;
      color: var(--text-light);
      margin: 0 0.1rem;
    }

    .stat-sem-total {
      font-size: 1rem;
      font-weight: 600;
      color: var(--text-light);
    }

    .stat-progress-bar-track {
      width: 100%;
      height: 5px;
      background: rgba(183,77,63,0.12);
      border-radius: 3px;
      overflow: hidden;
    }

    .stat-progress-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, #B74D3F, #B74D3F);
      border-radius: 3px;
      transition: width 0.5s ease;
      width: 0%;
    }

    .stat-icon {
      width: 44px;
      height: 44px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      background: none;
    }

    .stat-icon svg {
      width: 24px;
      height: 24px;
    }

    .stat-icon.lectures {
      background: none;
      color: var(--primary);
      border: 1.5px solid rgba(183,77,63,0.3);
    }

    .stat-icon.practices {
      background: none;
      color: var(--primary);
      border: 1.5px solid rgba(183,77,63,0.3);
    }

    .stat-icon.labs {
      background: none;
      color: var(--primary);
      border: 1.5px solid rgba(183,77,63,0.3);
    }

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

    .stat-value {
      font-size: 1.25rem;
      font-weight: 700;
      color: var(--primary);
    }

    .stat-label {
      font-size: 0.75rem;
      color: var(--text-light);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    /* ТЕКУЩИЙ ДЕНЬ */
    .current-day {
      background: linear-gradient(135deg, #DCA44E 0%, #A07828 100%) !important;
    }

    .today-indicator {
      display: inline-block;
      width: 10px;
      height: 10px;
      background: #B74D3F;
      border-radius: 50%;
      margin-left: 8px;
      animation: pulse-indicator 2s ease-in-out infinite;
      box-shadow: 0 0 0 0 rgba(183, 77, 63, 0.7);
    }

    @keyframes pulse-indicator {

      0%,
      100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(183, 77, 63, 0.7);
      }

      50% {
        opacity: 0.4;
        box-shadow: 0 0 0 8px rgba(183, 77, 63, 0);
      }
    }

    @media (max-width: 768px) {
      .stats-bar {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 0;
        padding: 0.75rem;
        align-items: stretch;
      }

      /* Скрываем разделитель */
      .stat-divider { display: none !important; }
      .stat-divider-desktop { display: none !important; }

      /* Кубок+прогресс — левая верхняя ячейка */
      #stat-semester-block {
        grid-column: 1;
        grid-row: 1;
        padding-right: 0.75rem;
        border-right: 1px solid rgba(0,0,0,0.08);
        border-bottom: 1px solid rgba(0,0,0,0.08);
        padding-bottom: 0.6rem;
        align-items: center;
        gap: 0.4rem;
      }

      #stat-cup-icon svg { width: 42px; height: 50px; }
      .stat-done { font-size: 1.15rem; }
      .stat-sem-total { font-size: 0.8rem; }
      .stat-progress-wrap { min-width: 52px; }

      /* Кнопки — правая верхняя ячейка */
      .stats-btn-group {
        grid-column: 2;
        grid-row: 1;
        margin-left: 0;
        padding-left: 0.75rem;
        padding-bottom: 0.6rem;
        border-bottom: 1px solid rgba(0,0,0,0.08);
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.5rem;
      }

      #export-ics-btn,
      #export-print-btn {
        width: 40px !important;
        height: 40px !important;
        padding: 0.45rem !important;
        border-radius: 10px !important;
        border-width: 1.5px !important;
      }

      /* Сетка статистики — нижняя строка на всю ширину */
      .stats-grid-bottom {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        padding-top: 0.6rem;
        gap: 0;
      }

      .stat-item:not(#stat-semester-block) {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1rem;
        padding: 0 0.3rem;
        position: relative;
        min-width: 0;
      }

      /* Вертикальные разделители между ячейками */
      .stat-item:not(#stat-semester-block):not(:last-child)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 15%;
        height: 70%;
        width: 1px;
        background: rgba(0,0,0,0.08);
      }

      .stat-item:not(#stat-semester-block) .stat-icon {
        width: 30px;
        height: 30px;
        border-radius: 7px;
        background: none !important;
        color: var(--primary) !important;
        border: 1.5px solid rgba(183,77,63,0.3) !important;
      }

      .stat-item:not(#stat-semester-block) .stat-icon svg {
        width: 18px;
        height: 18px;
      }

      .stat-item:not(#stat-semester-block) .stat-text {
        align-items: center;
      }

      .stat-item:not(#stat-semester-block) .stat-value {
        font-size: 1rem;
        line-height: 1.1;
      }

      .stat-item:not(#stat-semester-block) .stat-label {
        font-size: 0.55rem;
        letter-spacing: 0.03em;
        text-align: center;
      }
    }

    @media (max-width: 768px) {
      .schedule-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Плавный свайп без рывков */
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
      }

      /* Каждый день — точка привязки */
      .schedule-cell.day-header {
        scroll-snap-align: start;
      }

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

      .schedule-wrapper::-webkit-scrollbar-track {
        background: #F0E8E3;
        border-radius: 4px;
      }

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

      .schedule-grid {
        min-width: 0;
        width: max-content;
        grid-template-columns: 52px repeat(7, 110px);
      }

      .day-header {
        padding: 0.5rem 0.3rem;
      }

      .day-name {
        font-size: 0.75rem;
        margin-bottom: 0.15rem;
      }

      .day-date {
        font-size: 0.7rem;
      }

      .time-cell {
        padding: 0.3rem 0.2rem;
        font-size: 0.6rem;
      }

      .slot-start {
        font-size: 0.68rem;
      }

      .slot-end {
        font-size: 0.6rem;
      }

      .schedule-cell {
        min-height: 0;
      }

      .lesson-cell {
        padding: 0.25rem;
        gap: 0.3rem;
      }

      .lesson {
        padding: 0.35rem 0.4rem;
        font-size: 0.67rem;
        border-left-width: 3px;
        border-radius: 5px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.07);
      }

      .lesson:hover {
        transform: none;
      }

      .lesson-subject {
        font-size: 0.67rem;
        margin-bottom: 0.15rem;
        line-height: 1.2;
      }

      .lesson-info {
        font-size: 0.58rem;
        line-height: 1.25;
      }

      /* Залипающая колонка времени при горизонтальном свайпе */
      .time-cell {
        position: sticky;
        left: 0;
        z-index: 2;
        background: #FBF6F1;
        box-shadow: 2px 0 5px rgba(0,0,0,0.08);
      }

      .time-header {
        position: sticky;
        left: 0;
        z-index: 3;
      }

      .week-controls {
        gap: 1rem;
      }

      .week-arrow-btn {
        width: 40px;
        height: 40px;
      }

      .week-dates-wrapper {
        max-width: 300px;
      }

      .week-dates {
        font-size: 1rem;
        padding: 0.75rem 1rem;
        min-height: 48px;
      }

      .week-label {
        font-size: 0.75rem;
      }
    }

    /* Виджет поддержки */
    /* ===================== SUPPORT WIDGET ===================== */
    .support-widget {
      position: fixed;
      bottom: 20px;
      right: 20px;
      z-index: 1000;
      font-family: "Inter", sans-serif;
    }

    /* --- Круглая кнопка --- */
    .support-button {
      width: 56px; height: 56px;
      border-radius: 50%;
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      border: none;
      box-shadow: 0 4px 20px rgba(183,77,63,0.35);
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: transform 0.25s, box-shadow 0.25s;
      position: relative;
    }
    .support-button:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(183,77,63,0.45); }
    .support-button svg { width: 26px; height: 26px; fill: white; transition: transform 0.3s; }
    #support-icon-unread circle { fill: #DCA44E; }
    #support-icon-unread text { fill: white; }

    .support-badge {
      position: absolute; top: -3px; right: -3px;
      min-width: 19px; height: 19px;
      background: #DCA44E; color: white;
      border-radius: 10px; font-size: .68rem; font-weight: 800;
      display: flex; align-items: center; justify-content: center;
      padding: 0 4px; border: 2px solid white;
      animation: badge-pop 0.4s cubic-bezier(.36,2,.6,1) forwards;
      box-shadow: 0 2px 6px rgba(0,0,0,.2);
    }
    @keyframes badge-pop {
      0% { transform: scale(0); opacity: 0; }
      70% { transform: scale(1.25); }
      100% { transform: scale(1); opacity: 1; }
    }
    .support-button.has-unread::before {
      content: ''; position: absolute; inset: -4px; border-radius: 50%;
      border: 2.5px solid #B74D3F;
      animation: ring-pulse 1.8s ease-in-out infinite;
    }
    .support-button.has-unread::after {
      content: ''; position: absolute; inset: -10px; border-radius: 50%;
      border: 2px solid rgba(183,77,63,0.4);
      animation: ring-pulse 1.8s ease-in-out infinite 0.5s;
    }
    @keyframes ring-pulse {
      0% { transform: scale(1); opacity: 1; }
      70%, 100% { transform: scale(1.2); opacity: 0; }
    }
    .support-button.has-unread svg {
      animation: bell-shake 2.5s ease-in-out infinite;
    }
    @keyframes bell-shake {
      0%,50%,100% { transform: rotate(0deg); }
      52% { transform: rotate(-15deg); }
      55% { transform: rotate(15deg); }
      58% { transform: rotate(-10deg); }
      61% { transform: rotate(10deg); }
      64% { transform: rotate(0deg); }
    }

    /* --- Всплывающее окно --- */
    .support-chat {
      position: absolute;
      bottom: 68px; right: 0;
      width: 360px;
      height: 520px;           /* фиксированная высота */
      background: white;
      border-radius: 18px;
      box-shadow: 0 12px 40px rgba(0,0,0,0.18);
      display: flex;
      flex-direction: column;  /* header + body */
      overflow: hidden;
      opacity: 0; pointer-events: none; visibility: hidden;
      transform: translateY(10px) scale(0.97);
      transform-origin: bottom right;
      transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s 0.22s;
    }
    .support-chat.active {
      opacity: 1; pointer-events: auto; visibility: visible;
      transform: translateY(0) scale(1);
      transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s 0s;
    }

    /* --- Header (фиксированный) --- */
    .support-chat-header {
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      padding: 1rem 1.1rem 0;
      flex-shrink: 0;
    }
    .sp-header-top {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: .7rem;
    }
    .sp-header-info { display: flex; align-items: center; gap: .6rem; }
    .sp-avatar {
      width: 36px; height: 36px; border-radius: 50%;
      background: rgba(255,255,255,0.2);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .sp-header-title { font-size: .95rem; font-weight: 700; color: white; }
    .sp-header-sub { font-size: .68rem; color: rgba(255,255,255,0.75); margin-top: .05rem; }
    .sp-close-btn {
      background: rgba(255,255,255,0.15); border: none; border-radius: 50%;
      width: 28px; height: 28px; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: background .15s; flex-shrink: 0;
    }
    .sp-close-btn:hover { background: rgba(255,255,255,0.25); }

    /* --- Tabs (иконки) --- */
    .sp-tabs {
      display: flex; gap: 2px;
    }
    .sp-tab {
      flex: 1; display: flex; align-items: center; justify-content: center; gap: .35rem;
      padding: .55rem .4rem;
      background: transparent; border: none;
      border-bottom: 2.5px solid transparent;
      color: rgba(255,255,255,0.6);
      font-size: .75rem; font-weight: 500;
      cursor: pointer; font-family: "Inter", sans-serif;
      transition: all 0.18s; position: relative;
    }
    .sp-tab.active {
      color: white; font-weight: 700;
      border-bottom-color: white;
    }
    .sp-tab:hover:not(.active) { color: rgba(255,255,255,0.85); }
    .sp-tab svg { flex-shrink: 0; }
    .sp-tab-badge {
      position: absolute; top: 4px; right: 8px;
      min-width: 16px; height: 16px;
      background: #DCA44E; color: white;
      border-radius: 8px; font-size: .6rem; font-weight: 800;
      display: flex; align-items: center; justify-content: center;
      padding: 0 3px;
    }

    /* --- Body (скроллируемая) --- */
    .sp-body {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 1.1rem;
      display: flex;
      flex-direction: column;
    }
    .sp-body::-webkit-scrollbar { width: 4px; }
    .sp-body::-webkit-scrollbar-track { background: transparent; }
    .sp-body::-webkit-scrollbar-thumb { background: #e0d0ce; border-radius: 4px; }

    /* --- Форма --- */
    #support-panel-form { display: flex; flex-direction: column; gap: .1rem; }
    .support-form-group { margin-bottom: 1rem; }
    .support-form-group label {
      display: block; font-size: .8rem; font-weight: 600;
      color: #444; margin-bottom: .35rem;
    }
    .support-form-group select,
    .support-form-group textarea {
      width: 100%; padding: .65rem .75rem;
      border: 1.5px solid #e5dbd9; border-radius: 10px;
      font-size: .85rem; font-family: "Inter", sans-serif;
      color: var(--text); background: white;
      transition: border-color .18s; box-sizing: border-box;
    }
    .support-form-group select:focus,
    .support-form-group textarea:focus { outline: none; border-color: var(--primary); }
    .support-form-group textarea { resize: none; height: 100px; line-height: 1.5; }
    .support-submit {
      width: 100%; padding: .8rem;
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white; border: none; border-radius: 10px;
      font-size: .9rem; font-weight: 600; cursor: pointer;
      font-family: "Inter", sans-serif;
      transition: opacity .2s, transform .15s;
    }
    .support-submit:hover { opacity: .9; transform: translateY(-1px); }
    .support-submit:disabled { opacity: .55; cursor: not-allowed; transform: none; }
    .sp-btn-outline {
      background: transparent !important;
      border: 1.5px solid var(--primary) !important;
      color: var(--primary) !important;
    }
    .sp-btn-outline:hover { background: rgba(183,77,63,0.06) !important; }

    /* --- Success screen --- */
    .support-success { text-align: center; padding: 1rem 0; }
    .support-success-icon {
      width: 56px; height: 56px; margin: 0 auto .85rem;
      background: #fef2f0; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
    }
    .support-success-icon svg { width: 30px; height: 30px; fill: var(--primary); }
    .support-success h4 { font-size: 1rem; font-weight: 700; margin: 0 0 .4rem; color: #222; }
    .support-success p { font-size: .8rem; color: #777; margin: 0 0 .8rem; line-height: 1.5; }
    #support-ticket-id {
      font-size: .7rem; color: #aaa; font-family: monospace;
      margin-bottom: .75rem; word-break: break-all;
    }

    /* --- Список обращений --- */
    .support-ticket-item {
      border: 1px solid #ede8e7; border-radius: 11px;
      padding: .75rem .85rem; margin-bottom: .5rem;
      cursor: pointer; transition: background .15s, box-shadow .15s;
      position: relative;
    }
    .support-ticket-item:hover { background: #fdf6f5; box-shadow: 0 2px 8px rgba(183,77,63,0.08); }
    .sw-ticket-row { cursor: pointer; }
    .support-ticket-id {
      font-size: .68rem; font-family: monospace; color: var(--primary);
      font-weight: 700; font-variant-ligatures: none; font-feature-settings: "liga" 0;
    }
    .support-ticket-date-small { font-size: .68rem; color: #bbb; margin-top: .15rem; }
    .sw-head { display: flex; justify-content: space-between; align-items: center; }
    .sw-status {
      font-size: .65rem; font-weight: 700; padding: .15rem .45rem;
      border-radius: 8px; flex-shrink: 0;
    }
    .sw-replied { background: #dcfce7; color: #16a34a; }
    .sw-waiting { background: #f1f5f9; color: #94a3b8; }
    .sw-loading { color: #ccc; font-size: .7rem; }
    .support-empty-tickets {
      text-align: center; color: #bbb; font-size: .82rem; padding: 2.5rem 1rem;
    }

    /* --- Чат внутри тикета --- */
    .sw-back-btn {
      background: none; border: none; color: var(--primary);
      font-size: .82rem; font-weight: 600; cursor: pointer;
      padding: 0 0 .6rem 0; font-family: "Inter", sans-serif;
      display: flex; align-items: center; gap: .25rem;
    }

    /* Чат-область: занимает всё доступное место в .sp-body */
    #support-panel-my { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    #my-tickets-list { display: flex; flex-direction: column; flex: 1; min-height: 0; }

    /* Контейнер чата тикета — flex колонка чтобы input был внизу */
    .sw-ticket-chat-wrap {
      display: flex; flex-direction: column; flex: 1; min-height: 0;
    }

    .sw-chat-full {
      flex: 1; min-height: 0;
      display: flex; flex-direction: column; gap: .4rem;
      overflow-y: auto; padding: .25rem 0 .5rem;
    }
    .sw-chat-full::-webkit-scrollbar { width: 3px; }
    .sw-chat-full::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

    /* Сообщения */
    .sw-msg { display: flex; flex-direction: column; max-width: 84%; }
    .sw-user { align-self: flex-start; }
    .sw-admin { align-self: flex-end; }
    .sw-bubble {
      padding: .5rem .75rem; border-radius: 12px;
      font-size: .83rem; line-height: 1.45;
      word-break: break-word; white-space: pre-wrap;
    }
    .sw-user .sw-bubble {
      background: #fdf2f1; border-bottom-left-radius: 3px;
      border-left: 2.5px solid var(--primary);
    }
    .sw-admin .sw-bubble {
      background: #f0fdf4; border-bottom-right-radius: 3px;
      border-right: 2.5px solid #22c55e; color: #14532d;
    }
    .sw-time { font-size: .6rem; color: #c0b8b7; margin-top: .15rem; padding: 0 .25rem; }
    .sw-user .sw-time { text-align: left; }
    .sw-admin .sw-time { text-align: right; }

    /* Поле ввода внизу чата */
    .sw-input-row {
      display: flex; gap: .4rem; align-items: flex-end;
      padding-top: .5rem; flex-shrink: 0;
      border-top: 1px solid #f0e8e6; margin-top: .4rem;
    }
    .sw-input-row textarea {
      flex: 1; border: 1.5px solid #e5dbd9; border-radius: 10px;
      padding: .5rem .65rem; font-size: .83rem;
      font-family: "Inter", sans-serif; resize: none;
      outline: none; background: white; color: var(--text);
      line-height: 1.45; min-height: 36px; max-height: 90px;
      transition: border-color .15s; box-sizing: border-box;
    }
    .sw-input-row textarea:focus { border-color: var(--primary); }
    .sw-send-btn {
      width: 36px; height: 36px; border-radius: 50%;
      background: var(--primary); border: none; color: white;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; flex-shrink: 0; transition: opacity .15s;
    }
    .sw-send-btn:hover { opacity: .85; }
    .sw-send-btn:disabled { opacity: .45; cursor: default; }

    /* Мобильная адаптация */
    @media (max-width: 440px) {
      .support-chat {
        position: fixed;
        bottom: 0; right: 0; left: 0;
        width: 100%; border-radius: 20px 20px 0 0;
        height: 90dvh;
      }
    }

    .sw-loading { color: #ccc; font-size: .7rem; }

    .support-chat-body {
      padding: 1.5rem;
      overflow-y: auto;
      flex: 1;
    }

    .support-form-group {
      margin-bottom: 1.25rem;
    }

    .support-form-group label {
      display: block;
      font-size: 0.875rem;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 0.5rem;
    }

    .support-form-group select,
    .support-form-group textarea {
      width: 100%;
      padding: 0.75rem;
      border: 2px solid #E8DDD9;
      border-radius: 8px;
      font-size: 0.875rem;
      font-family: "Inter", sans-serif;
      transition: border-color 0.2s;
    }

    .support-form-group select:focus,
    .support-form-group textarea:focus {
      outline: none;
      border-color: var(--primary);
    }

    .support-form-group textarea {
      resize: vertical;
      min-height: 120px;
    }

    .support-submit {
      width: 100%;
      padding: 0.875rem;
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
    }

    .support-submit:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.3);
    }

    .support-submit:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    .support-success {
      text-align: center;
      padding: 2rem;
    }

    .support-success-icon {
      width: 64px;
      height: 64px;
      margin: 0 auto 1rem;
      background: #DCA44E;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .support-success h4 {
      font-size: 1.125rem;
      margin-bottom: 0.5rem;
    }

    .support-success p {
      font-size: 0.875rem;
      color: var(--text-light);
      margin-bottom: 1.5rem;
    }

    @media (max-width: 768px) {
      .support-chat {
        position: fixed;
        bottom: 136px;
        left: 20px;
        right: 20px;
        width: auto;
        transform: translateY(12px);
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
      }
      .support-chat.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0s;
      }
      .support-widget:has(.support-chat.active) .support-button {
        z-index: 1010;
      }
    }

    /* ===== LIQUID GLASS THEME TOGGLE (кнопка в шапке) ===== */

    .theme-toggle {
      position: relative;
      width: 120px;
      height: 48px;
      background: none;
      border: none;
      cursor: pointer;
      padding: 0;
      flex-shrink: 0;
      outline: none;
      -webkit-tap-highlight-color: transparent;
    }

    .theme-toggle-track {
      position: absolute;
      inset: 0;
      border-radius: 24px;
      background: linear-gradient(145deg,
        rgba(255,255,255,0.32) 0%,
        rgba(255,255,255,0.14) 50%,
        rgba(255,255,255,0.22) 100%
      );
      border: 1px solid rgba(255,255,255,0.55);
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.80),
        inset 0 -1px 0 rgba(255,255,255,0.22),
        inset 2px 0 0 rgba(255,255,255,0.30),
        inset -1px 0 0 rgba(255,255,255,0.12),
        0 4px 20px rgba(0,0,0,0.18),
        0 1px 6px rgba(0,0,0,0.10);
      transition: all 0.42s cubic-bezier(0.34,1.4,0.64,1);
      overflow: hidden;
    }

    /* Линзовый блик сверху */
    .theme-toggle-track::before {
      content: '';
      position: absolute;
      top: 5px; left: 14px; right: 14px;
      height: 42%;
      background: linear-gradient(180deg,
        rgba(255,255,255,0.62) 0%,
        rgba(255,255,255,0.18) 55%,
        transparent 100%
      );
      border-radius: 50%;
      filter: blur(1px);
      pointer-events: none;
    }

    /* Радужный подсвет */
    .theme-toggle-track::after {
      content: '';
      position: absolute; inset: 0;
      background: linear-gradient(110deg,
        rgba(255,200,180,0.16) 0%,
        rgba(210,180,255,0.12) 33%,
        rgba(180,220,255,0.10) 66%,
        rgba(255,210,200,0.14) 100%
      );
      border-radius: 24px;
      pointer-events: none;
    }

    /* Шарик */
    .theme-toggle-thumb {
      position: absolute;
      top: 5px; left: 5px;
      width: 38px; height: 38px;
      border-radius: 50%;
      background: linear-gradient(150deg,
        rgba(255,255,255,0.98) 0%,
        rgba(248,245,255,0.92) 50%,
        rgba(235,228,255,0.88) 100%
      );
      border: 1px solid rgba(255,255,255,0.75);
      box-shadow:
        inset 0 2.5px 0 rgba(255,255,255,1),
        inset 0 -1px 0 rgba(0,0,0,0.05),
        0 4px 14px rgba(0,0,0,0.22),
        0 1.5px 5px rgba(0,0,0,0.12);
      display: flex; align-items: center; justify-content: center;
      transition: transform 0.42s cubic-bezier(0.34,1.4,0.64,1),
                  background 0.3s, box-shadow 0.3s;
      z-index: 3;
      overflow: hidden;
    }

    /* Блик на шарике */
    .theme-toggle-thumb::before {
      content: '';
      position: absolute;
      top: 6px; left: 8px;
      width: 13px; height: 8px;
      background: rgba(255,255,255,0.82);
      border-radius: 50%;
      filter: blur(2px);
      pointer-events: none;
    }

    .theme-icon {
      width: 16px; height: 16px;
      position: absolute;
      transition: opacity 0.25s, transform 0.25s;
      z-index: 4;
    }

    .icon-sun  {
      opacity: 1; transform: rotate(0deg) scale(1);
      color: #DCA44E;
      filter: drop-shadow(0 1px 3px rgba(230,130,0,0.40));
    }
    .icon-moon {
      opacity: 0; transform: rotate(-45deg) scale(0.5);
      color: #7c5cbf;
      filter: drop-shadow(0 1px 3px rgba(100,60,200,0.40));
    }

    /* Hover */
    .theme-toggle:hover .theme-toggle-track {
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.88),
        inset 0 -1px 0 rgba(255,255,255,0.28),
        inset 2px 0 0 rgba(255,255,255,0.35),
        inset -1px 0 0 rgba(255,255,255,0.15),
        0 6px 26px rgba(0,0,0,0.22),
        0 2px 8px rgba(0,0,0,0.12);
      transform: scale(1.05);
    }

    .theme-toggle:active .theme-toggle-track { transform: scale(0.96); }

    /* === IS-DARK — шарик едет вправо === */
    .theme-toggle.is-dark .theme-toggle-thumb {
      transform: translateX(72px);
      background: linear-gradient(150deg,
        rgba(210,195,255,0.98) 0%,
        rgba(175,155,240,0.90) 50%,
        rgba(145,120,220,0.88) 100%
      );
      box-shadow:
        inset 0 2.5px 0 rgba(230,220,255,1),
        inset 0 -1px 0 rgba(0,0,0,0.08),
        0 4px 14px rgba(100,60,200,0.35),
        0 1.5px 5px rgba(0,0,0,0.14);
    }

    .theme-toggle.is-dark .theme-toggle-track {
      background: linear-gradient(145deg,
        rgba(130,90,255,0.28) 0%,
        rgba(90,55,180,0.16) 50%,
        rgba(110,75,220,0.22) 100%
      );
      border-color: rgba(200,180,255,0.48);
      box-shadow:
        inset 0 2px 0 rgba(210,200,255,0.62),
        inset 0 -1px 0 rgba(255,255,255,0.10),
        inset 2px 0 0 rgba(200,180,255,0.20),
        0 4px 22px rgba(80,40,180,0.28),
        0 2px 8px rgba(0,0,0,0.14);
    }

    .theme-toggle.is-dark .icon-sun  {
      opacity: 0; transform: rotate(45deg) scale(0.5);
    }
    .theme-toggle.is-dark .icon-moon {
      opacity: 1; transform: rotate(0deg) scale(1);
    }

    .theme-toggle.is-dark:hover .theme-toggle-thumb {
      transform: translateX(72px);
    }
    .theme-toggle.is-dark:active .theme-toggle-track {
      transform: scale(0.96);
    }

    /* ── RGB ПЕРЕЛИВЫ ПО КРАЯМ КАРТОЧЕК (светлая тема) ── */
    .settings-card,
    .week-navigation,
    .schedule-wrapper,
    .stats-bar {
      position: relative;
      overflow: hidden;
    }

    .settings-card::before,
    .week-navigation::before,
    .schedule-wrapper::before,
    .stats-bar::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 2px;
      background: linear-gradient(90deg,
        rgba(183,77,63,0.0) 0%,
        rgba(183,77,63,0.6) 20%,
        rgba(200,100,50,0.5) 40%,
        rgba(183,77,63,0.6) 60%,
        rgba(109,37,39,0.4) 80%,
        rgba(183,77,63,0.0) 100%
      );
      background-size: 200% 100%;
      animation: card-rgb 5s linear infinite;
      pointer-events: none;
      z-index: 2;
    }

    /* Кнопка «Закрыть» скрыта на десктопе */
    .close-settings-btn { display: none; }
/* ===== Только для ПК версии ===== */
@media (min-width: 769px) {

  /* Убираем подпись */
  .header-subtitle {
    display: none;
  }

  /* Растягиваем логотип по ширине,
     но сохраняем высоту шапки */
  .header-logo {
    width: 460px;
    height: 85px;      /* оставляем прежнюю высину */
    object-fit: contain;
  }

}

    /* Кнопка мобильных настроек — только на мобиле */
    @media (min-width: 769px) {
      .mobile-settings-toggle {
        display: none !important;
      }
    }

    @media (max-width: 768px) {
      .support-widget {
        bottom: 88px !important;
        right: 20px !important;
        z-index: 1002 !important;
      }
      .support-button {
        width: 40px !important;
        height: 40px !important;
      }
      .support-button svg {
        width: 18px !important;
        height: 18px !important;
      }
    }

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


    @media (min-width: 769px) {
      .stats-toggle-mobile-btn { display: none !important; }
    }

    .week-cal-divider {
      width: 1px;
      height: 36px;
      background: rgba(183,77,63,0.18);
      flex-shrink: 0;
      align-self: center;
    }

    .site-watermark {
      display: none;
    }

    .schedule-watermark {
      display: none;
      width: 180px;
      height: auto;
      opacity: 0.32;
      pointer-events: none;
      user-select: none;
      -webkit-user-select: none;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      filter: sepia(0.4) saturate(0.9) hue-rotate(340deg) brightness(0.75) contrast(1.1);
    }

    .schedule-watermark.visible {
      display: block;
    }

    body.dark-mode .schedule-watermark {
      display: none !important;
    }

    @media (max-width: 768px) {
      .schedule-watermark { display: none !important; }
    }

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

    :root {
      --primary: #B74D3F;
      --primary-dark: #8C3530;
      --accent: #B74D3F;
      --success: #DCA44E;
      --pink: #B74D3F;
      --bg: #FBF6F1;
      --card: #ffffff;
      --text: #202020;
      --text-light: #6B5350;
      --border: #E0D4D0;
      --gold: #DCA44E;
    }

    body {
      font-family: "Inter", sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.4;
      zoom: 0.78;
    }
    /* На мобильных экранах (до 768px) сбросить zoom */
    @media (max-width: 768px) {
        body {
            zoom: 1; /* нормальный масштаб на телефоне */
        }
    }
    /* ── RGB АНИМАЦИЯ ── */
    @keyframes rgb-border {
      0%   { background-position: 0% 50%; }
      100% { background-position: 200% 50%; }
    }
    @keyframes rgb-border-v {
      0%   { background-position: 50% 0%; }
      100% { background-position: 50% 200%; }
    }
    @keyframes card-rgb {
      0%   { background-position: 0% 50%; }
      100% { background-position: 200% 50%; }
    }

    .header {
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white;
      padding: 2rem 0;
      box-shadow:
        0 4px 20px rgba(183, 77, 63, 0.20),
        0 1px 0 rgba(255,255,255,0.08) inset;
      position: relative;
      overflow: hidden;
      max-width: 1400px;
      margin: 0 auto;
      border-radius: 0 0 18px 18px;
    }

    /* Стеклянный блик сверху */
    .header::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 40%;
      background: linear-gradient(180deg,
        rgba(255,255,255,0.10) 0%,
        transparent 100%
      );
      pointer-events: none;
      z-index: 1;
    }

    /* RGB полоска снизу (светлая тема) */
    .header::after {
      content: '';
      position: absolute;
      bottom: 0; left: 0; right: 0;
      height: 2px;
      background: linear-gradient(90deg,
        #B74D3F, #DCA44E, #FAEBD9,
        #DCA44E, #B74D3F, #8C3530, #B74D3F
      );
      background-size: 200% 100%;
      animation: rgb-border 4s linear infinite;
      pointer-events: none;
    }

    .header-content { position: relative; z-index: 2; }

    .header-content {
      padding: 0 1.5rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .header-text {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    .header-logo {
      height: 90px;
      width: auto;
      /* Лого чёрное на тёмном фоне — делаем белым */
      filter: brightness(0) invert(1);
      object-fit: contain;
      object-position: left center;
    }

    .header-subtitle {
      font-size: 0.68rem;
      font-weight: 400;
      opacity: 0.60;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      padding-left: 1px;
    }

    .container {
      max-width: 1400px;
      margin: 0 auto;
      padding: 1rem;
    }

    .settings-card {
      background: white;
      border-radius: 16px;
      padding: 2rem;
      margin-bottom: 1.5rem;
      box-shadow: 0 2px 12px rgba(183, 77, 63, 0.08);
      border: 1px solid rgba(183, 77, 63, 0.08);
    }

    .settings-card h2 {
      font-size: 1.25rem;
      margin-bottom: 0;
      font-weight: 700;
      color: var(--primary);
    }

    .settings-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 1.5rem;
    }

    .settings-collapse-btn {
      display: none;
      align-items: center;
      gap: 0.4rem;
      padding: 0.35rem 0.75rem;
      border: 1.5px solid rgba(183,77,63,.25);
      border-radius: 20px;
      background: transparent;
      color: var(--primary);
      font-size: 0.78rem;
      font-weight: 500;
      cursor: pointer;
      font-family: inherit;
      transition: all 0.15s;
    }

    .settings-collapse-btn:hover {
      background: rgba(183,77,63,.06);
      border-color: var(--primary);
    }

    .settings-collapse-btn svg {
      transition: transform 0.25s;
      flex-shrink: 0;
    }

    .settings-collapse-btn.collapsed svg {
      transform: rotate(180deg);
    }

    .settings-card-body {
      overflow: hidden;
      transition: opacity 0.25s, max-height 0.35s ease;
      max-height: 2000px;
      opacity: 1;
    }

    .settings-card-body.collapsed {
      max-height: 0;
      opacity: 0;
      pointer-events: none;
    }

    /* Desktop: show collapse btn, hide mobile theme btn */
    @media (min-width: 769px) {
      .settings-collapse-btn { display: flex; }
      #mobile-theme-btn { display: none !important; }
    }

    .role-selector {
      margin-bottom: 1.5rem;
    }

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

    .role-options {
      display: flex;
      gap: 1.5rem;
    }

    .role-option {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .role-option input[type="radio"] {
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: var(--accent);
    }

    .role-option label {
      font-size: 0.9375rem;
      font-weight: 500;
      cursor: pointer;
    }

    .filters-section {
      display: none;
    }

    .filters-section.visible {
      display: block;
    }

    .filters-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 1rem;
      margin-bottom: 1rem;
    }

    .filter-group label {
      font-size: 0.8125rem;
      font-weight: 600;
      color: var(--text-light);
      display: block;
      margin-bottom: 0.4rem;
    }

    .filter-group select {
      width: 100%;
      padding: 0.65rem;
      border: 2px solid var(--border);
      border-radius: 8px;
      font-size: 0.875rem;
      background: white;
      cursor: pointer;
      transition: all 0.2s;
    }

    .filter-group select:hover {
      border-color: var(--accent);
    }

    .filter-group select:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
    }

    .filter-group select:disabled {
      background: #F7F1EC;
      cursor: not-allowed;
      opacity: 0.6;
    }

    .btn {
      padding: 0.75rem 1.5rem;
      border: none;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      font-family: inherit;
    }

    .btn-primary {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      box-shadow: 0 2px 8px rgba(183, 77, 63, 0.25);
    }

    .btn-primary:hover:not(:disabled) {
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.35);
    }

    .btn-primary:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .week-navigation {
      background: white;
      border-radius: 16px;
      padding: 0;
      margin-bottom: 1rem;
      margin-left: auto;
      margin-right: auto;
      max-width: 800px;
      box-shadow: 0 2px 12px rgba(183,77,63,0.1), 0 1px 3px rgba(0,0,0,0.06);
      display: none;
      overflow: hidden;
      border: 1.5px solid rgba(183,77,63,0.15);
    }

    .week-navigation.visible {
      display: block;
    }

    .week-nav-content {
      display: flex;
      align-items: stretch;
      justify-content: space-between;
      min-height: 72px;
    }

    .week-controls {
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1;
    }

    .week-arrow-btn {
      width: 64px;
      height: 72px;
      border: none;
      background: transparent;
      color: #D4A09C;
      cursor: pointer;
      transition: all 0.18s;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .week-arrow-btn:hover {
      color: var(--primary);
      background: rgba(183,77,63,0.05);
    }

    .week-arrow-btn:active {
      background: rgba(183,77,63,0.1);
    }

    .week-arrow-btn svg {
      width: 18px;
      height: 18px;
      stroke-width: 2.5;
    }

    .week-dates-wrapper {
      text-align: center;
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 0.15rem;
      padding: 0.75rem 0;
    }

    .week-label {
      font-size: 0.58rem;
      color: rgba(183,77,63,0.5);
      text-transform: uppercase;
      letter-spacing: 0.14em;
      font-weight: 600;
    }

    .week-dates {
      font-size: 1.3rem;
      font-weight: 600;
      color: var(--text);
      cursor: pointer;
      padding: 0.25rem 1rem;
      border-radius: 8px;
      transition: all 0.18s;
      display: inline-flex;
      align-items: center;
      letter-spacing: -0.01em;
    }

    .week-dates:hover {
      background: rgba(183,77,63,0.06);
      color: var(--primary);
    }

    /* 7 точек — индикаторы дней недели */
    .week-days-strip {
      display: flex;
      gap: 4px;
    }

    .week-day-dot {
      width: 20px;
      height: 3px;
      border-radius: 2px;
      background: rgba(183,77,63,0.12);
    }

    .week-day-dot.has-lessons {
      background: var(--primary);
      opacity: 0.5;
    }

    .week-day-dot.today {
      background: var(--primary);
      opacity: 1;
    }

    .week-today-btn {
      padding: 0 1.6rem;
      height: 72px;
      border: none;
      border-left: 1.5px solid rgba(183,77,63,0.15);
      background: rgba(183,77,63,0.04);
      color: var(--primary);
      font-size: 0.72rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s;
      white-space: nowrap;
      min-width: 130px;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
    }

    .week-today-btn svg {
      width: 16px;
      height: 16px;
      color: var(--primary);
      opacity: 0.6;
    }

    .week-today-btn:hover {
      background: var(--primary);
      color: white;
    }

    .week-today-btn:hover svg {
      color: white;
      opacity: 1;
    }

    .week-today-btn:active {
      background: #8C3530;
      color: white;
    }

    /* СЕТКА РАСПИСАНИЯ */
    .schedule-wrapper {
      background: white;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 4px 16px rgba(183, 77, 63, 0.08);
      border: 1px solid rgba(183, 77, 63, 0.08);
    }

    .schedule-grid {
      display: grid;
      grid-template-columns: 85px repeat(7, 1fr);
      border: 1px solid var(--border);
    }

    .schedule-cell {
      border-right: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
      min-height: 90px;
    }

    .schedule-cell:nth-child(8n) {
      border-right: none;
    }

    /* ЗАГОЛОВОК ВРЕМЕНИ */
    .time-header {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 0.9375rem;
      padding: 1rem 0.5rem;
    }

    /* ЗАГОЛОВКИ ДНЕЙ */
    .day-header {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      padding: 1rem 0.75rem;
      text-align: center;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }

    .day-name {
      font-weight: 700;
      font-size: 0.9375rem;
      margin-bottom: 0.35rem;
      letter-spacing: 0.02em;
    }

    .day-date {
      font-size: 0.8125rem;
      opacity: 0.95;
      font-weight: 500;
    }

    /* ЯЧЕЙКИ ВРЕМЕНИ */
    .time-cell {
      background: #FBF6F1;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      font-size: 0.6875rem;
      font-weight: 600;
      color: var(--text-light);
      padding: 0.5rem;
      line-height: 1.3;
    }

    .time-header-toggle {
      cursor: pointer;
      user-select: none;
      gap: 0.25rem;
      flex-direction: column;
      transition: background 0.2s;
      -webkit-tap-highlight-color: transparent;
    }

    .time-header-toggle:hover {
      background: rgba(255,255,255,0.15);
    }

    .time-header-toggle:active {
      background: rgba(255,255,255,0.25);
    }

    .time-switch-icon {
      opacity: 0.55;
      line-height: 1;
      margin-top: 0.15rem;
      transition: opacity 0.2s;
    }

    .time-header-toggle:hover .time-switch-icon,
    .time-header-toggle:active .time-switch-icon {
      opacity: 0.9;
    }

    /* Формат ячеек времени */
    .time-cell {
      flex-direction: column;
      gap: 0;
    }

    .slot-start {
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--text);
      line-height: 1.2;
    }

    .slot-sep {
      font-size: 0.6rem;
      color: var(--text-light);
      line-height: 1;
    }

    .slot-end {
      font-size: 0.7rem;
      font-weight: 500;
      color: var(--text-light);
      line-height: 1.2;
    }

    /* Мобильная кнопка ICS — только иконка */
    @media (max-width: 600px) {
      #export-ics-btn .ics-label {
        display: none;
      }
    }

    /* ===== МОБИЛЬНЫЙ LAYOUT РАСПИСАНИЯ ===== */
    @media (max-width: 768px) {
      .schedule-wrapper { overflow-x: visible !important; }
      .schedule-grid { display: none !important; }
      .mobile-schedule { display: block !important; }
    }

    .mobile-schedule { display: none; }

    .mobile-day {
      margin-bottom: 0.75rem;
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }

    .mobile-day-header {
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      padding: 0.6rem 1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .mobile-day-header.current-day {
      background: linear-gradient(135deg, #DCA44E 0%, #A07828 100%);
    }

    .mobile-day-name {
      font-weight: 700;
      font-size: 0.95rem;
      letter-spacing: 0.02em;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .mobile-day-date {
      font-size: 0.8rem;
      opacity: 0.88;
      font-weight: 500;
    }

    .mobile-slot {
      background: white;
      display: flex;
      border-bottom: 1px solid rgba(0,0,0,0.06);
    }

    .mobile-slot:last-child { border-bottom: none; }

    .mobile-time {
      flex: 0 0 56px;
      background: #F7F1EC;
      border-right: 1px solid rgba(0,0,0,0.07);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 0.6rem 0.3rem;
      text-align: center;
    }

    .mobile-time .slot-start { font-size: 0.82rem; font-weight: 700; color: var(--text); line-height: 1.2; }
    .mobile-time .slot-sep   { font-size: 0.6rem; color: #D0C4C0; line-height: 1; margin: 1px 0; }
    .mobile-time .slot-end   { font-size: 0.68rem; color: var(--text-light); line-height: 1.2; }

    .mobile-lessons {
      flex: 1;
      padding: 0.4rem 0.5rem;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    .mobile-lesson {
      border-left: 3px solid var(--primary);
      border-radius: 8px;
      padding: 0.45rem 0.6rem;
      background: #fdfdfd;
      box-shadow: 0 1px 3px rgba(0,0,0,0.07);
      cursor: pointer;
      transition: box-shadow 0.2s, transform 0.15s;
      -webkit-tap-highlight-color: transparent;
    }

    .mobile-lesson:active { transform: scale(0.985); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
    .mobile-lesson.lecture  { border-left-color: #B74D3F; }
    .mobile-lesson.practice { border-left-color: #3A9E6B; }
    .mobile-lesson.lab      { border-left-color: #3A7EC0; }
    .mobile-lesson.exam     { border-left-color: #B74D3F; background: #F4E8E7; }

    .mobile-lesson-subject {
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text);
      line-height: 1.25;
      margin-bottom: 0.2rem;
    }

    .mobile-lesson-meta {
      font-size: 0.68rem;
      color: var(--text-light);
      line-height: 1.3;
      display: flex;
      flex-wrap: wrap;
      gap: 0.15rem 0.4rem;
      align-items: center;
    }

    .mobile-lesson-type {
      display: inline-block;
      font-size: 0.58rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 0.1rem 0.35rem;
      border-radius: 3px;
      color: white;
    }

    .mobile-lesson-type.lecture  { background: #B74D3F; }
    .mobile-lesson-type.practice { background: #DCA44E; }
    .mobile-lesson-type.lab      { background: #3A7EC0; }
    .mobile-lesson-type.exam     { background: #B74D3F; }

    .mobile-day-empty {
      background: white;
      padding: 0.7rem 1rem;
      color: #C8BCBA;
      font-size: 0.78rem;
      text-align: center;
    }

    /* ЯЧЕЙКИ С ЗАНЯТИЯМИ */
    .lesson-cell {
      padding: 0.4rem;
      background: white;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .lesson-cell:hover {
      background: #FBF6F1;
    }

    .lesson-cell:has(.lesson:only-child) .lesson {
      flex: 1;
      min-height: 100%;
    }

    .lesson {
      background: white;
      border-left: 4px solid var(--primary);
      padding: 0.5rem;
      border-radius: 6px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
      font-size: 0.75rem;
      line-height: 1.4;
      transition: all 0.25s;
      cursor: pointer;
      display: flex;
      flex-direction: column;
    }

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

    .lesson.lecture {
      border-left-color: #B74D3F;
    }

    .lesson.practice {
      border-left-color: #DCA44E;
    }

    .lesson.lab {
      border-left-color: #DCA44E;
    }

    .lesson.exam {
      border-left-color: #B74D3F;
      background: #F4E8E7;
    }

    .lesson-type {
      display: inline-block;
      padding: 0.2rem 0.5rem;
      border-radius: 4px;
      font-size: 0.6875rem;
      font-weight: 700;
      text-transform: uppercase;
      margin-bottom: 0.35rem;
      letter-spacing: 0.03em;
    }

    .lesson-type.lecture {
      background: #F4E8E7;
      color: #8C3530;
    }

    .lesson-type.practice {
      background: #FBF0DC;
      color: #A07828;
    }

    .lesson-type.lab {
      background: #FBF0DC;
      color: #A07828;
    }

    .lesson-type.exam {
      background: #F4E8E7;
      color: #8C3530;
    }

    .lesson-subject {
      font-weight: 600;
      color: var(--text);
      margin-bottom: 0.25rem;
      line-height: 1.2;
    }

    .lesson-info {
      color: var(--text-light);
      font-size: 0.625rem;
      line-height: 1.3;
    }

    .lesson-teacher {
      margin-bottom: 0.125rem;
    }

    .message {
      background: white;
      border-radius: 12px;
      padding: 3rem 2rem;
      text-align: center;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .message-icon {
      margin-bottom: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--primary);
      opacity: 0.35;
    }

    .message h3 {
      font-size: 1.25rem;
      margin-bottom: 0.5rem;
    }

    /* КАЛЕНДАРЬ */
    .calendar-popup {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s;
    }

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

    .calendar-container {
      background: white;
      border-radius: 16px;
      padding: 1.5rem;
      box-shadow: 0 20px 60px rgba(183, 77, 63, 0.3);
      max-width: 380px;
      width: 90%;
      transform: scale(0.9);
      transition: transform 0.25s;
    }

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

    .calendar-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1.5rem;
      padding-bottom: 1rem;
      border-bottom: 2px solid rgba(183, 77, 63, 0.1);
    }

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

    .calendar-nav-btn:hover {
      transform: scale(1.1);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.3);
    }

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

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

    .calendar-weekday {
      text-align: center;
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--text-light);
      padding: 0.5rem;
      text-transform: uppercase;
    }

    .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: 8px;
      cursor: pointer;
      font-size: 0.875rem;
      font-weight: 600;
      transition: all 0.2s;
      border: 2px solid transparent;
    }

    .calendar-day:not(.other-month):hover {
      background: rgba(183, 77, 63, 0.1);
      transform: scale(1.1);
    }

    .calendar-day.other-month {
      color: var(--text-light);
      opacity: 0.3;
      cursor: default;
    }

    .calendar-day.today {
      background: linear-gradient(135deg, #DCA44E 0%, #A07828 100%);
      color: white;
      font-weight: 700;
    }

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

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

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

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

    .calendar-close {
      margin-top: 1rem;
      width: 100%;
      padding: 0.75rem;
      background: linear-gradient(135deg, #B74D3F 0%, #B74D3F 100%);
      color: white;
      border: none;
      border-radius: 8px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.25s;
    }

    .calendar-close:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.3);
    }

    /* МОДАЛЬНОЕ ОКНО ПРЕПОДАВАТЕЛЯ */
    /* ===== TEACHER MODAL ===== */
    .teacher-modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0; top: 0;
      width: 100%; height: 100%;
      background: rgba(0, 0, 0, 0.55);
      backdrop-filter: blur(4px);
    }

    .teacher-modal.active {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1.5rem;
    }

    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes slideUp {
      from { opacity: 0; transform: translateY(22px) scale(0.97); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    .teacher-modal-content {
      background: white;
      border-radius: 28px;
      width: 100%;
      max-width: 480px;
      max-height: 88vh;
      overflow-y: auto;
      overflow-x: hidden;
      box-shadow: 0 24px 56px rgba(183, 77, 63, 0.22), 0 4px 16px rgba(0,0,0,0.12);
      position: relative;
      animation: slideUp 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
    }

    .teacher-modal-content::-webkit-scrollbar { width: 4px; }
    .teacher-modal-content::-webkit-scrollbar-thumb { background: rgba(183,77,63,0.2); border-radius: 4px; }

    .teacher-modal-close {
      position: absolute;
      right: 0.9rem; top: 0.9rem;
      width: 34px; height: 34px;
      border: none;
      background: rgba(255,255,255,0.88);
      color: var(--primary);
      font-size: 20px;
      border-radius: 50%;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 3;
      box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .teacher-modal-close:hover {
      background: var(--primary);
      color: white;
      transform: rotate(90deg);
    }

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

    .teacher-photo {
      width: 100%;
      height: 420px;
      object-fit: cover;
      object-position: center top;
      display: block;
    }

    .teacher-modal-body {
      padding: 1.1rem 1.4rem 1.5rem;
    }

    .teacher-info { text-align: center; }

    .teacher-modal-name {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0;
      margin: 0 0 0.2rem 0;
      line-height: 1.2;
    }

    .tm-surname {
      font-size: 1.4rem;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.01em;
      display: block;
    }

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

    .teacher-position {
      color: var(--primary);
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      margin-bottom: 1.1rem;
      padding-bottom: 1rem;
      border-bottom: 1.5px solid rgba(183,77,63,0.12);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
    }

    .tm-dept {
      font-size: 0.74rem;
      font-weight: 400;
      color: #8A7876;
      text-transform: none;
      letter-spacing: 0;
    }

    .teacher-contacts {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      margin-bottom: 1rem;
      text-align: left;
    }

    .teacher-contact-item {
      display: flex;
      align-items: center;
      gap: 0.8rem;
      padding: 0.65rem 0.9rem;
      background: #F7F1EC;
      border-radius: 14px;
      border-left: 4px solid var(--primary);
      transition: background 0.15s;
    }

    .teacher-contact-item:hover { background: #F4E8E7; }

    .teacher-contact-item svg {
      color: var(--primary);
      flex-shrink: 0;
      width: 18px; height: 18px;
    }

    .teacher-contact-link,
    .teacher-contact-item span {
      color: var(--text);
      text-decoration: none;
      font-weight: 500;
      font-size: 0.9rem;
      line-height: 1.4;
      flex: 1;
      word-break: break-word;
      transition: color 0.15s;
    }

    .teacher-contact-link:hover { color: var(--primary); }

    .teacher-profile-btn {
      display: block;
      width: 100%;
      padding: 0.85rem 1.5rem;
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white;
      text-decoration: none;
      border-radius: 16px;
      font-weight: 700;
      font-size: 0.95rem;
      text-align: center;
      transition: all 0.2s;
      box-shadow: 0 4px 14px rgba(183, 77, 63, 0.3);
      border: none;
      cursor: pointer;
    }

    .teacher-profile-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 18px rgba(183, 77, 63, 0.4);
    }

        /* ПОИСК */
    .search-box {
      margin-bottom: 1rem;
      position: relative;
    }

    .search-input {
      width: 100%;
      padding: 0.875rem 1rem 0.875rem 3rem;
      border: 2px solid var(--border);
      border-radius: 12px;
      font-size: 0.9375rem;
      transition: all 0.25s;
      background: white;
    }

    .search-input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 4px rgba(183, 77, 63, 0.1);
    }

    .search-icon {
      position: absolute;
      left: 1rem;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-light);
      display: flex;
      align-items: center;
    }

    /* СТАТИСТИКА */
    .stats-container {
      margin-bottom: 1rem;
    }

    .stats-container.hidden {
      display: none;
    }

    .stats-toggle-btn {
      height: 72px;
      width: 52px;
      background: transparent;
      border: none;
      color: #D4A09C;
      cursor: pointer;
      transition: all 0.18s;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      padding: 0;
      margin-bottom: 0;
    }

    .stats-toggle-btn:hover {
      color: var(--primary);
      background: rgba(183,77,63,0.05);
    }

    .stats-toggle-btn svg {
      transition: transform 0.3s;
    }

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

    .week-stats-divider {
      width: 1px;
      height: 36px;
      background: rgba(183,77,63,0.18);
      flex-shrink: 0;
      align-self: center;
    }



    .stats-bar {
      background: white;
      border-radius: 12px;
      padding: 1rem;
      display: flex;
      align-items: center;
      gap: 1.5rem;
      flex-wrap: wrap;
      border: 1px solid rgba(183, 77, 63, 0.1);
      max-height: 500px;
      overflow: hidden;
      transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
      opacity: 1;
    }

    .stats-bar.collapsed {
      max-height: 0;
      opacity: 0;
      padding: 0 1rem;
    }

    .stat-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .stats-btn-group {
      margin-left: auto;
      display: flex;
      gap: 0.5rem;
      align-items: center;
      flex-shrink: 0;
    }

    .stats-grid-bottom {
      display: contents;
    }

    .stat-divider {
      width: 1px;
      height: 40px;
      background: rgba(0,0,0,0.1);
      flex-shrink: 0;
    }

    .stat-item-progress {
      flex-direction: column;
      align-items: flex-start;
      gap: 0;
    }

    .stat-progress-wrap {
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
      min-width: 110px;
    }

    .stat-progress-nums {
      display: flex;
      align-items: baseline;
      gap: 0.1rem;
      line-height: 1;
    }

    .stat-done {
      font-size: 1.5rem;
      font-weight: 800;
      color: var(--primary);
      letter-spacing: -0.5px;
    }

    .stat-sep-slash {
      font-size: 1rem;
      font-weight: 400;
      color: var(--text-light);
      margin: 0 0.1rem;
    }

    .stat-sem-total {
      font-size: 1rem;
      font-weight: 600;
      color: var(--text-light);
    }

    .stat-progress-bar-track {
      width: 100%;
      height: 5px;
      background: rgba(183,77,63,0.12);
      border-radius: 3px;
      overflow: hidden;
    }

    .stat-progress-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, #B74D3F, #B74D3F);
      border-radius: 3px;
      transition: width 0.5s ease;
      width: 0%;
    }

    .stat-icon {
      width: 44px;
      height: 44px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      background: none;
    }

    .stat-icon svg {
      width: 24px;
      height: 24px;
    }

    .stat-icon.lectures {
      background: none;
      color: var(--primary);
      border: 1.5px solid rgba(183,77,63,0.3);
    }

    .stat-icon.practices {
      background: none;
      color: var(--primary);
      border: 1.5px solid rgba(183,77,63,0.3);
    }

    .stat-icon.labs {
      background: none;
      color: var(--primary);
      border: 1.5px solid rgba(183,77,63,0.3);
    }

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

    .stat-value {
      font-size: 1.25rem;
      font-weight: 700;
      color: var(--primary);
    }

    .stat-label {
      font-size: 0.75rem;
      color: var(--text-light);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    /* ТЕКУЩИЙ ДЕНЬ */
    .current-day {
      background: linear-gradient(135deg, #DCA44E 0%, #A07828 100%) !important;
    }

    .today-indicator {
      display: inline-block;
      width: 10px;
      height: 10px;
      background: #B74D3F;
      border-radius: 50%;
      margin-left: 8px;
      animation: pulse-indicator 2s ease-in-out infinite;
      box-shadow: 0 0 0 0 rgba(183, 77, 63, 0.7);
    }

    @keyframes pulse-indicator {

      0%,
      100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(183, 77, 63, 0.7);
      }

      50% {
        opacity: 0.4;
        box-shadow: 0 0 0 8px rgba(183, 77, 63, 0);
      }
    }

    @media (max-width: 768px) {
      .stats-bar {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 0;
        padding: 0.75rem;
        align-items: stretch;
      }

      /* Скрываем разделитель */
      .stat-divider { display: none !important; }

      /* Кубок+прогресс — левая верхняя ячейка */
      #stat-semester-block {
        grid-column: 1;
        grid-row: 1;
        padding-right: 0.75rem;
        border-right: 1px solid rgba(0,0,0,0.08);
        border-bottom: 1px solid rgba(0,0,0,0.08);
        padding-bottom: 0.6rem;
        align-items: center;
        gap: 0.4rem;
      }

      #stat-cup-icon svg { width: 42px; height: 50px; }
      .stat-done { font-size: 1.15rem; }
      .stat-sem-total { font-size: 0.8rem; }
      .stat-progress-wrap { min-width: 52px; }

      /* Кнопки — правая верхняя ячейка */
      .stats-btn-group {
        grid-column: 2;
        grid-row: 1;
        margin-left: 0;
        padding-left: 0.75rem;
        padding-bottom: 0.6rem;
        border-bottom: 1px solid rgba(0,0,0,0.08);
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.5rem;
      }

      #export-ics-btn,
      #export-print-btn {
        width: 40px !important;
        height: 40px !important;
        padding: 0.45rem !important;
        border-radius: 10px !important;
        border-width: 1.5px !important;
      }

      /* Сетка статистики — нижняя строка на всю ширину */
      .stats-grid-bottom {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        padding-top: 0.6rem;
        gap: 0;
      }

      .stat-item:not(#stat-semester-block) {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1rem;
        padding: 0 0.3rem;
        position: relative;
        min-width: 0;
      }

      /* Вертикальные разделители между ячейками */
      .stat-item:not(#stat-semester-block):not(:last-child)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 15%;
        height: 70%;
        width: 1px;
        background: rgba(0,0,0,0.08);
      }

      .stat-item:not(#stat-semester-block) .stat-icon {
        width: 30px;
        height: 30px;
        border-radius: 7px;
        background: none !important;
        color: var(--primary) !important;
        border: 1.5px solid rgba(183,77,63,0.3) !important;
      }

      .stat-item:not(#stat-semester-block) .stat-icon svg {
        width: 18px;
        height: 18px;
      }

      .stat-item:not(#stat-semester-block) .stat-text {
        align-items: center;
      }

      .stat-item:not(#stat-semester-block) .stat-value {
        font-size: 1rem;
        line-height: 1.1;
      }

      .stat-item:not(#stat-semester-block) .stat-label {
        font-size: 0.55rem;
        letter-spacing: 0.03em;
        text-align: center;
      }
    }

    @media (max-width: 768px) {
      .schedule-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Плавный свайп без рывков */
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
      }

      /* Каждый день — точка привязки */
      .schedule-cell.day-header {
        scroll-snap-align: start;
      }

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

      .schedule-wrapper::-webkit-scrollbar-track {
        background: #F0E8E3;
        border-radius: 4px;
      }

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

      .schedule-grid {
        min-width: 0;
        width: max-content;
        grid-template-columns: 52px repeat(7, 110px);
      }

      .day-header {
        padding: 0.5rem 0.3rem;
      }

      .day-name {
        font-size: 0.75rem;
        margin-bottom: 0.15rem;
      }

      .day-date {
        font-size: 0.7rem;
      }

      .time-cell {
        padding: 0.3rem 0.2rem;
        font-size: 0.6rem;
      }

      .slot-start {
        font-size: 0.68rem;
      }

      .slot-end {
        font-size: 0.6rem;
      }

      .schedule-cell {
        min-height: 0;
      }

      .lesson-cell {
        padding: 0.25rem;
        gap: 0.3rem;
      }

      .lesson {
        padding: 0.35rem 0.4rem;
        font-size: 0.67rem;
        border-left-width: 3px;
        border-radius: 5px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.07);
      }

      .lesson:hover {
        transform: none;
      }

      .lesson-subject {
        font-size: 0.67rem;
        margin-bottom: 0.15rem;
        line-height: 1.2;
      }

      .lesson-info {
        font-size: 0.58rem;
        line-height: 1.25;
      }

      /* Залипающая колонка времени при горизонтальном свайпе */
      .time-cell {
        position: sticky;
        left: 0;
        z-index: 2;
        background: #FBF6F1;
        box-shadow: 2px 0 5px rgba(0,0,0,0.08);
      }

      .time-header {
        position: sticky;
        left: 0;
        z-index: 3;
      }

      .week-controls {
        gap: 1rem;
      }

      .week-arrow-btn {
        width: 40px;
        height: 40px;
      }

      .week-dates-wrapper {
        max-width: 300px;
      }

      .week-dates {
        font-size: 1rem;
        padding: 0.75rem 1rem;
        min-height: 48px;
      }

      .week-label {
        font-size: 0.75rem;
      }
    }

    /* Виджет поддержки */
    .support-widget {
      position: fixed;
      bottom: 20px;
      right: 20px;
      z-index: 1000;
      font-family: "Inter", sans-serif;
    }

    .support-button {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      border: none;
      box-shadow: 0 4px 20px rgba(183, 77, 63, 0.3);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s ease;
      position: relative;
    }

    .support-button:hover {
      transform: scale(1.1);
      box-shadow: 0 6px 24px rgba(183, 77, 63, 0.4);
    }

    .support-button svg {
      width: 28px;
      height: 28px;
      fill: white;
      transition: transform 0.3s ease;
    }

    #support-icon-unread circle { fill: #DCA44E; }
    #support-icon-unread text { fill: white; }

    /* Бейдж с числом непрочитанных */
    .support-badge {
      position: absolute;
      top: -3px;
      right: -3px;
      min-width: 20px;
      height: 20px;
      background: #DCA44E;
      color: white;
      border-radius: 10px;
      font-size: .7rem;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 5px;
      border: 2px solid white;
      animation: badge-pop 0.4s cubic-bezier(.36,2,.6,1) forwards;
      box-shadow: 0 2px 8px rgba(0,0,0,.2);
    }

    @keyframes badge-pop {
      0%   { transform: scale(0); opacity: 0; }
      70%  { transform: scale(1.25); }
      100% { transform: scale(1); opacity: 1; }
    }

    /* Пульсирующее кольцо вокруг кнопки */
    .support-button.has-unread::before {
      content: '';
      position: absolute;
      inset: -4px;
      border-radius: 50%;
      border: 2.5px solid #B74D3F;
      animation: ring-pulse 1.8s ease-in-out infinite;
    }

    .support-button.has-unread::after {
      content: '';
      position: absolute;
      inset: -10px;
      border-radius: 50%;
      border: 2px solid rgba(183, 77, 63, 0.4);
      animation: ring-pulse 1.8s ease-in-out infinite 0.5s;
    }

    @keyframes ring-pulse {
      0%   { transform: scale(1);   opacity: 1; }
      70%  { transform: scale(1.2); opacity: 0; }
      100% { transform: scale(1.2); opacity: 0; }
    }

    /* SVG дрожит когда есть непрочитанные */
    .support-button.has-unread svg {
      animation: bell-shake 2.5s ease-in-out infinite;
    }

    @keyframes bell-shake {
      0%,50%,100% { transform: rotate(0deg); }
      52%  { transform: rotate(-15deg); }
      55%  { transform: rotate(15deg); }
      58%  { transform: rotate(-10deg); }
      61%  { transform: rotate(10deg); }
      64%  { transform: rotate(0deg); }
    }

    .support-chat {
      position: absolute;
      bottom: 80px;
      right: 0;
      width: 380px;
      max-height: 600px;
      background: white;
      border-radius: 16px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      opacity: 0;
      pointer-events: none;
      visibility: hidden;
      transform: translateY(12px);
      transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
    }

    .support-chat.active {
      opacity: 1;
      pointer-events: auto;
      visibility: visible;
      transform: translateY(0);
      transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0s;
    }

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

    .support-chat-header {
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white;
      padding: 1.25rem 1.5rem;
    }

    .support-chat-header h3 {
      font-size: 1.125rem;
      font-weight: 600;
      margin: 0 0 0.25rem 0;
    }

    .support-chat-header p {
      font-size: 0.75rem;
      opacity: 0.9;
      margin: 0;
    }

    .support-chat-body {
      padding: 1.5rem;
      overflow-y: auto;
      flex: 1;
    }

    .support-form-group {
      margin-bottom: 1.25rem;
    }

    .support-form-group label {
      display: block;
      font-size: 0.875rem;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 0.5rem;
    }

    .support-form-group select,
    .support-form-group textarea {
      width: 100%;
      padding: 0.75rem;
      border: 2px solid #E8DDD9;
      border-radius: 8px;
      font-size: 0.875rem;
      font-family: "Inter", sans-serif;
      transition: border-color 0.2s;
    }

    .support-form-group select:focus,
    .support-form-group textarea:focus {
      outline: none;
      border-color: var(--primary);
    }

    .support-form-group textarea {
      resize: vertical;
      min-height: 120px;
    }

    .support-submit {
      width: 100%;
      padding: 0.875rem;
      background: linear-gradient(135deg, #B74D3F 0%, #8C3530 100%);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
    }

    .support-submit:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(183, 77, 63, 0.3);
    }

    .support-submit:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    .support-success {
      text-align: center;
      padding: 2rem;
    }

    .support-success-icon {
      width: 64px;
      height: 64px;
      margin: 0 auto 1rem;
      background: #DCA44E;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .support-success h4 {
      font-size: 1.125rem;
      margin-bottom: 0.5rem;
    }

    .support-success p {
      font-size: 0.875rem;
      color: var(--text-light);
      margin-bottom: 1.5rem;
    }

    @media (max-width: 768px) {
      .support-chat {
        position: fixed;
        bottom: 136px;
        left: 20px;
        right: 20px;
        width: auto;
        transform: translateY(12px);
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
      }
      .support-chat.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0s;
      }
      .support-widget:has(.support-chat.active) .support-button {
        z-index: 1010;
      }
    }

    /* ===== LIQUID GLASS THEME TOGGLE (кнопка в шапке) ===== */

    .theme-toggle {
      position: relative;
      width: 120px;
      height: 48px;
      background: none;
      border: none;
      cursor: pointer;
      padding: 0;
      flex-shrink: 0;
      outline: none;
      -webkit-tap-highlight-color: transparent;
    }

    .theme-toggle-track {
      position: absolute;
      inset: 0;
      border-radius: 24px;
      background: linear-gradient(145deg,
        rgba(255,255,255,0.32) 0%,
        rgba(255,255,255,0.14) 50%,
        rgba(255,255,255,0.22) 100%
      );
      border: 1px solid rgba(255,255,255,0.55);
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.80),
        inset 0 -1px 0 rgba(255,255,255,0.22),
        inset 2px 0 0 rgba(255,255,255,0.30),
        inset -1px 0 0 rgba(255,255,255,0.12),
        0 4px 20px rgba(0,0,0,0.18),
        0 1px 6px rgba(0,0,0,0.10);
      transition: all 0.42s cubic-bezier(0.34,1.4,0.64,1);
      overflow: hidden;
    }

    /* Линзовый блик сверху */
    .theme-toggle-track::before {
      content: '';
      position: absolute;
      top: 5px; left: 14px; right: 14px;
      height: 42%;
      background: linear-gradient(180deg,
        rgba(255,255,255,0.62) 0%,
        rgba(255,255,255,0.18) 55%,
        transparent 100%
      );
      border-radius: 50%;
      filter: blur(1px);
      pointer-events: none;
    }

    /* Радужный подсвет */
    .theme-toggle-track::after {
      content: '';
      position: absolute; inset: 0;
      background: linear-gradient(110deg,
        rgba(255,200,180,0.16) 0%,
        rgba(210,180,255,0.12) 33%,
        rgba(180,220,255,0.10) 66%,
        rgba(255,210,200,0.14) 100%
      );
      border-radius: 24px;
      pointer-events: none;
    }

    /* Шарик */
    .theme-toggle-thumb {
      position: absolute;
      top: 5px; left: 5px;
      width: 38px; height: 38px;
      border-radius: 50%;
      background: linear-gradient(150deg,
        rgba(255,255,255,0.98) 0%,
        rgba(248,245,255,0.92) 50%,
        rgba(235,228,255,0.88) 100%
      );
      border: 1px solid rgba(255,255,255,0.75);
      box-shadow:
        inset 0 2.5px 0 rgba(255,255,255,1),
        inset 0 -1px 0 rgba(0,0,0,0.05),
        0 4px 14px rgba(0,0,0,0.22),
        0 1.5px 5px rgba(0,0,0,0.12);
      display: flex; align-items: center; justify-content: center;
      transition: transform 0.42s cubic-bezier(0.34,1.4,0.64,1),
                  background 0.3s, box-shadow 0.3s;
      z-index: 3;
      overflow: hidden;
    }

    /* Блик на шарике */
    .theme-toggle-thumb::before {
      content: '';
      position: absolute;
      top: 6px; left: 8px;
      width: 13px; height: 8px;
      background: rgba(255,255,255,0.82);
      border-radius: 50%;
      filter: blur(2px);
      pointer-events: none;
    }

    .theme-icon {
      width: 16px; height: 16px;
      position: absolute;
      transition: opacity 0.25s, transform 0.25s;
      z-index: 4;
    }

    .icon-sun  {
      opacity: 1; transform: rotate(0deg) scale(1);
      color: #DCA44E;
      filter: drop-shadow(0 1px 3px rgba(230,130,0,0.40));
    }
    .icon-moon {
      opacity: 0; transform: rotate(-45deg) scale(0.5);
      color: #7c5cbf;
      filter: drop-shadow(0 1px 3px rgba(100,60,200,0.40));
    }

    /* Hover */
    .theme-toggle:hover .theme-toggle-track {
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.88),
        inset 0 -1px 0 rgba(255,255,255,0.28),
        inset 2px 0 0 rgba(255,255,255,0.35),
        inset -1px 0 0 rgba(255,255,255,0.15),
        0 6px 26px rgba(0,0,0,0.22),
        0 2px 8px rgba(0,0,0,0.12);
      transform: scale(1.05);
    }

    .theme-toggle:active .theme-toggle-track { transform: scale(0.96); }

    /* === IS-DARK — шарик едет вправо === */
    .theme-toggle.is-dark .theme-toggle-thumb {
      transform: translateX(72px);
      background: linear-gradient(150deg,
        rgba(210,195,255,0.98) 0%,
        rgba(175,155,240,0.90) 50%,
        rgba(145,120,220,0.88) 100%
      );
      box-shadow:
        inset 0 2.5px 0 rgba(230,220,255,1),
        inset 0 -1px 0 rgba(0,0,0,0.08),
        0 4px 14px rgba(100,60,200,0.35),
        0 1.5px 5px rgba(0,0,0,0.14);
    }

    .theme-toggle.is-dark .theme-toggle-track {
      background: linear-gradient(145deg,
        rgba(130,90,255,0.28) 0%,
        rgba(90,55,180,0.16) 50%,
        rgba(110,75,220,0.22) 100%
      );
      border-color: rgba(200,180,255,0.48);
      box-shadow:
        inset 0 2px 0 rgba(210,200,255,0.62),
        inset 0 -1px 0 rgba(255,255,255,0.10),
        inset 2px 0 0 rgba(200,180,255,0.20),
        0 4px 22px rgba(80,40,180,0.28),
        0 2px 8px rgba(0,0,0,0.14);
    }

    .theme-toggle.is-dark .icon-sun  {
      opacity: 0; transform: rotate(45deg) scale(0.5);
    }
    .theme-toggle.is-dark .icon-moon {
      opacity: 1; transform: rotate(0deg) scale(1);
    }

    .theme-toggle.is-dark:hover .theme-toggle-thumb {
      transform: translateX(72px);
    }
    .theme-toggle.is-dark:active .theme-toggle-track {
      transform: scale(0.96);
    }

    /* ── RGB ПЕРЕЛИВЫ ПО КРАЯМ КАРТОЧЕК (светлая тема) ── */
    .settings-card,
    .week-navigation,
    .schedule-wrapper,
    .stats-bar {
      position: relative;
      overflow: hidden;
    }

    .settings-card::before,
    .week-navigation::before,
    .schedule-wrapper::before,
    .stats-bar::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 2px;
      background: linear-gradient(90deg,
        rgba(183,77,63,0.0) 0%,
        rgba(183,77,63,0.6) 20%,
        rgba(200,100,50,0.5) 40%,
        rgba(183,77,63,0.6) 60%,
        rgba(109,37,39,0.4) 80%,
        rgba(183,77,63,0.0) 100%
      );
      background-size: 200% 100%;
      animation: card-rgb 5s linear infinite;
      pointer-events: none;
      z-index: 2;
    }

    /* Кнопка «Закрыть» скрыта на десктопе */
    .close-settings-btn { display: none; }
/* ===== Только для ПК версии ===== */
@media (min-width: 769px) {

  /* Убираем подпись */
  .header-subtitle {
    display: none;
  }

  /* Растягиваем логотип по ширине,
     но сохраняем высоту шапки */
  .header-logo {
    width: 460px;
    height: 85px;      /* оставляем прежнюю высину */
    object-fit: contain;
  }

}

    /* Кнопка мобильных настроек — только на мобиле */
    @media (min-width: 769px) {
      .mobile-settings-toggle {
        display: none !important;
      }
    }

    @media (max-width: 768px) {
      .support-widget {
        bottom: 88px !important;
        right: 20px !important;
        z-index: 1002 !important;
      }
      .support-button {
        width: 40px !important;
        height: 40px !important;
      }
      .support-button svg {
        width: 18px !important;
        height: 18px !important;
      }
    }

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


    @media (min-width: 769px) {
      .stats-toggle-mobile-btn { display: none !important; }
    }

    .week-cal-divider {
      width: 1px;
      height: 36px;
      background: rgba(183,77,63,0.18);
      flex-shrink: 0;
      align-self: center;
    }

    .site-watermark {
      display: none;
    }

    .schedule-watermark {
      display: none;
      width: 180px;
      height: auto;
      opacity: 0.32;
      pointer-events: none;
      user-select: none;
      -webkit-user-select: none;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      filter: sepia(0.4) saturate(0.9) hue-rotate(340deg) brightness(0.75) contrast(1.1);
    }

    .schedule-watermark.visible {
      display: block;
    }

    body.dark-mode .schedule-watermark {
      display: none !important;
    }

    @media (max-width: 768px) {
      .schedule-watermark { display: none !important; }
    }

/* ===== CUSTOM SELECT ===== */










/* ---- Desktop dropdown (portal — рендерится в body, не обрезается overflow) ---- */



/* ---- Mobile bottom sheet ---- */



@keyframes cs-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}




/* ---- Shared option styles ---- */







/* Dark mode */
