/* Раскладка кабинета для телефона. На компьютере новые элементы скрыты. */
.today-agenda,.mobile-stats-toggle,.mobile-tabbar,.mobile-fab,.mobile-to-top{display:none}

/* Установленное приложение на iPhone рисует страницу под строкой состояния:
   отступаем сверху и закрываем эту полосу фоном при прокрутке. */
body{padding-top:env(safe-area-inset-top)}
.status-bar-backdrop{position:fixed;top:0;left:0;right:0;height:env(safe-area-inset-top);background:var(--ig-paper,#f4f3ea);z-index:2500;pointer-events:none}

@media(max-width:650px){
  #appShell{padding-bottom:calc(104px + env(safe-area-inset-bottom))}

  /* Шапка дня: дата и счётчики в одну строку, большая кнопка уходит в «+» внизу */
  .hero{margin-bottom:12px}
  .hero-summary{flex-direction:row;flex-wrap:wrap;align-items:center;gap:8px}
  .hero-summary .date-title{flex-basis:100%;margin:0 0 2px}
  .hero .student-pill,.hero .attention-pill{padding:7px 11px;gap:7px}
  .hero .student-pill strong{font-size:18px}
  .hero .attention-pill strong{min-width:22px;height:22px;font-size:13px}
  #quickLesson{display:none}

  /* Сегодня */
  .today-agenda{display:block;margin:0 0 10px;padding:14px 14px 6px;background:var(--ig-card);border:1px solid var(--ig-line);border-radius:18px;box-shadow:0 8px 24px #4b523914}
  .today-agenda-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:6px}
  .today-agenda-head h2{margin:0;font-size:20px}
  .today-agenda-head span{color:var(--ig-muted);font-size:13.5px;font-weight:600}
  .today-item{display:grid;grid-template-columns:58px minmax(0,1fr);gap:2px 12px;padding:12px 0;border-top:1px solid var(--ig-line);cursor:pointer}
  .today-item:first-child{border-top:0}
  .today-time{display:flex;flex-direction:column;font-weight:750;font-size:16px;color:var(--ig-olive);line-height:1.3;padding-top:1px}
  .today-time small{font-size:12.5px;font-weight:600;color:var(--ig-muted)}
  .today-main{min-width:0;display:flex;flex-direction:column;gap:2px}
  .today-main b{font-size:16.5px;line-height:1.3}
  .today-main small{color:var(--ig-muted);font-size:13px}
  .today-state{font-size:13.5px;color:#5d6450}
  .today-item.cancelled .today-main b{color:#8b9084;text-decoration:line-through;text-decoration-color:#c9cdbf}
  .today-item.cancelled .today-state{color:#985447}
  .today-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px}
  .today-agenda .today-primary{padding:9px 15px;border-radius:12px;font-size:14.5px;font-weight:750;background:var(--ig-olive-dark);color:#fffef8;box-shadow:none}
  .today-agenda .today-primary.today-pay{background:var(--ig-lime);color:#343a29;border:1px solid #aab978}
  .today-secondary{display:flex;gap:2px}
  .today-secondary button{padding:9px 8px;border-radius:10px;background:transparent;color:var(--ig-olive-dark);font-size:14px;font-weight:650;box-shadow:none}
  .today-secondary button:last-child{color:#985447}
  .today-empty{margin:4px 0 6px;color:var(--ig-muted)}
  .today-agenda .today-next{display:block;width:100%;margin:0 0 10px;padding:11px 14px;border-radius:12px;background:#eef1df;color:var(--ig-olive-dark);font-weight:700;text-align:left;box-shadow:none}

  /* Сводка (уроки и доход) свёрнута, пока её не откроют */
  .mobile-stats-toggle{display:flex;align-items:center;justify-content:space-between;width:100%;margin:0 0 14px;padding:12px 14px;border-radius:14px;background:transparent;border:1px dashed #c6cdb0;color:var(--ig-olive-dark);font-weight:700;box-shadow:none}
  .mobile-stats-toggle::after{content:'';width:8px;height:8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg) translateY(-2px);transition:transform .15s}
  .mobile-stats-open .mobile-stats-toggle::after{transform:rotate(-135deg) translateY(-2px)}
  .stats{display:none}
  .mobile-stats-open .stats{display:grid;margin-bottom:16px}

  /* Разделы переезжают вниз экрана; фильтры расписания остаются на месте */
  main>nav>button[data-view]{display:none}
  .mobile-tabbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr)) 76px repeat(2,minmax(0,1fr));align-items:end;position:fixed;left:0;right:0;bottom:0;z-index:900;padding:6px 8px calc(6px + env(safe-area-inset-bottom));background:#fffef8f2;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border-top:1px solid var(--ig-line)}
  .mobile-tabbar button{position:relative;display:flex;flex-direction:column;align-items:center;gap:3px;min-height:52px;padding:6px 2px;border-radius:14px;background:transparent;color:#7b8170;font-size:11.5px;font-weight:700;box-shadow:none}
  .mobile-tabbar button.active{background:#eef1df;color:var(--ig-olive-dark)}
  .mobile-tabbar svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .mobile-tab-count{position:absolute;top:3px;left:calc(50% + 6px);min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#c24c44;color:#fff;font-size:11px;font-style:normal;line-height:18px}
  .mobile-tab-count[hidden]{display:none}
  .mobile-tabbar .mobile-fab{display:grid;place-items:center;justify-self:center;align-self:start;width:60px;height:60px;min-height:0;margin-top:-26px;padding:0;border-radius:50%;background:var(--ig-olive-dark);color:#fffef8;font-size:34px;font-weight:500;line-height:1;box-shadow:0 0 0 6px #fffef8,0 10px 22px #464b3855}
  .mobile-tabbar .mobile-fab:active{transform:scale(.96)}
  .mobile-tabbar .mobile-fab span{margin-top:-3px}

  /* Всплывающие сообщения поднимаем над нижней панелью */
  .undo-toast,.app-update-notice,.schedule-issue-toast{bottom:calc(150px + env(safe-area-inset-bottom))!important}

  /* «Наверх»: появляется, когда страница прокручена дальше чем на экран */
  .mobile-to-top{display:grid;place-items:center;position:fixed;right:16px;bottom:calc(90px + env(safe-area-inset-bottom));z-index:899;width:46px;height:46px;padding:0;border-radius:50%;background:#fffef8f0;color:var(--ig-olive-dark);border:1px solid var(--ig-line);box-shadow:0 8px 20px #3d443026}
  .mobile-to-top[hidden]{display:none}
  .mobile-to-top svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}

  /* Неделя списком сверху вниз вместо прокрутки вбок */
  .week-calendar{display:flex;flex-direction:column;gap:8px;overflow:visible;padding-bottom:0}
  .week-calendar .day-column{min-height:0;padding:10px 12px}
  .week-calendar .day-head{display:flex;align-items:baseline;gap:8px;text-align:left;padding:0 0 8px;margin-bottom:8px}
  .week-calendar .day-name{font-size:13px}
  .week-calendar .day-number{font-size:18px;margin:0}
  .week-calendar .day-column:has(.no-lessons):not(:has(.calendar-lesson,.birthday-card)){display:flex;align-items:center;gap:12px;padding:8px 12px}
  .week-calendar .day-column:has(.no-lessons):not(:has(.calendar-lesson,.birthday-card)) .day-head{border:0;padding:0;margin:0}
  .week-calendar .no-lessons{padding:0;text-align:left}
  .week-calendar .calendar-lesson{margin-bottom:8px;padding:10px 12px}
  .week-calendar .lesson-actions{gap:6px}
  .week-calendar .lesson-actions button{padding:8px 11px;font-size:12.5px}

  /* «День» на телефоне: только выбранный день на всю ширину */
  .timeline-calendar.mobile-one-day{grid-template-columns:54px minmax(0,1fr);overflow:visible}
  .timeline-calendar.mobile-one-day .timeline-day-head:not(.mobile-selected),
  .timeline-calendar.mobile-one-day .timeline-cell:not(.mobile-selected){display:none}
  .timeline-calendar.mobile-one-day .timeline-day-head{display:flex;align-items:baseline;justify-content:flex-start;gap:8px;padding:10px 12px;text-align:left}
  .timeline-calendar.mobile-one-day .timeline-event{left:6px;right:6px;width:auto}
  .timeline-calendar.mobile-one-day .timeline-day-head,.timeline-calendar.mobile-one-day .timeline-corner{top:env(safe-area-inset-top)}
  .mobile-day-nav{margin-left:auto;display:flex;gap:6px;align-self:center}
  .mobile-day-nav button{display:grid;place-items:center;width:38px;height:34px;padding:0;border-radius:10px;background:#fffef8;color:var(--ig-olive-dark);border:1px solid var(--ig-line);font-size:22px;line-height:1;box-shadow:none}
}
