/* ─────────────────────────────────────────────────────────────
   «Расписание» — дизайн в духе Apple HIG:
   сгруппированные списки iOS, крупные радиусы (continuous corners),
   pill-элементы, тонкие separator'ы, спокойная типографика,
   никаких тяжёлых теней и рамок.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #f2f2f7;            /* iOS systemGroupedBackground */
  --card: #ffffff;          /* iOS secondarySystemGroupedBackground */
  --text: #1c1c1e;
  --secondary: #6e6e73;     /* iOS secondaryLabel */
  --tertiary: #aeaeb2;      /* iOS tertiaryLabel */
  --fill: rgba(120, 120, 128, .16);   /* iOS systemFill */
  --fill-2: rgba(120, 120, 128, .10);
  --accent: #0a84ff;        /* iOS systemBlue (dark-vibrant) */
  --accent-tint: rgba(10, 132, 255, .12);
  --green: #30d158;
  --green-tint: rgba(48, 209, 88, .12);
  --green-text: #248a3d;
  --orange: #ff9f0a;
  --orange-text: #c93400;
  --star: #ffd60a;
  --danger: #ff453a;
  --sep: rgba(60, 60, 67, .08);
  --r-lg: 24px;   /* крупные карточки */
  --r-md: 16px;   /* ячейки, уроки */
  --r-sm: 12px;
  --tap: 46px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-feature-settings: 'tnum';
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.container {
  flex: 1; width: 100%; max-width: 620px;
  margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom));
}

/* ════════ верхняя плашка YakutSBP — ненавязчивая pill ════════ */
.support-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap; text-align: center;
  padding: 9px 14px;
  font-size: .78rem; color: var(--secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--sep);
}
.support-bar span a { font-weight: 600; color: #7c3aed; }
.btn-yakut {
  background: #7c3aed; color: #fff;
  padding: 4px 13px; border-radius: 999px;
  font-weight: 600; font-size: .74rem; white-space: nowrap;
  transition: transform .12s ease, opacity .12s ease;
}
.btn-yakut:active { transform: scale(.95); opacity: .85; }

/* ════════ типографика ════════ */
.page-title {
  font-size: 1.55rem; font-weight: 800; letter-spacing: -.035em;
  margin: 0; line-height: 1.15;
}
.page-sub { margin: 5px 0 0; font-size: .95rem; color: var(--secondary); }
.section-label {
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  color: var(--secondary);
  margin: 22px 14px 8px;
}
.muted { color: var(--secondary); font-size: .92rem; }

/* ════════ главная ════════ */
.home { display: flex; flex-direction: column; padding-top: 5vh; }
.home-hero { text-align: center; margin-bottom: 8px; }
.home-icon {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-tint); color: var(--accent);
  border-radius: 20px;
}
.home-icon svg { width: 30px; height: 30px; }
.school-name {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.035em;
  margin: 0 0 5px; line-height: 1.2;
}
.today { margin: 0 0 24px; font-size: .95rem; color: var(--secondary); }

.fav-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px; width: 100%;
}

.btn-classes {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 58px; margin-top: 26px;
  padding: 0 12px 0 22px;
  background: var(--accent); color: #fff;
  border-radius: 999px;
  font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em;
  transition: transform .12s ease, filter .12s ease;
}
.btn-classes svg { color: rgba(255, 255, 255, .75); }
.btn-classes:active { transform: scale(.97); filter: brightness(1.08); }

/* ════════ шапка страницы ════════ */
.page { padding-top: 2px; }
.page-title-row { display: flex; align-items: center; gap: 6px; }
.back {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin-left: -12px;
  color: var(--accent); border-radius: 50%;
  transition: background .12s ease;
}
.back:active { background: var(--fill); }

.fav-toggle {
  margin-left: auto; background: none; border: none; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  color: var(--tertiary);
  display: flex; align-items: center; justify-content: center;
  transition: transform .14s ease, color .14s ease;
}
.fav-toggle:active { transform: scale(1.2); }
.fav-toggle.is-fav { color: var(--star); }

/* ════════ бейдж смены ════════ */
.smena-badge {
  display: inline-flex; align-items: center;
  margin-top: 8px; padding: 4px 12px;
  border-radius: 999px;
  font-size: .8rem; font-weight: 700;
}
.smena-1 { background: var(--accent-tint); color: var(--accent); }
.smena-2 { background: var(--green-tint); color: var(--green-text); }

/* ════════ навигация по дням — pill-кнопки ════════ */
.day-nav {
  display: flex; align-items: center; gap: 8px; margin: 16px 0 4px;
}
.nav-arrow {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: var(--tap);
  background: var(--card);
  border-radius: 999px;
  color: var(--accent);
  transition: transform .12s ease, background .12s ease;
}
.nav-arrow:active { transform: scale(.96); background: var(--accent-tint); }
.nav-arrow.off { color: var(--tertiary); opacity: .45; pointer-events: none; }
.nav-today {
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px; min-height: var(--tap);
  background: var(--accent-tint); color: var(--accent);
  border-radius: 999px;
  font-size: .9rem; font-weight: 700; white-space: nowrap;
  transition: transform .12s ease;
}
.nav-today:active { transform: scale(.96); }
.nav-cal {
  display: flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  background: var(--card);
  border-radius: 999px; color: var(--accent);
  transition: transform .12s ease, background .12s ease;
}
.nav-cal:active { transform: scale(.96); background: var(--accent-tint); }

/* ════════ классы: смены → параллели → плитки ════════ */
.smena-block { margin-bottom: 4px; }
.grade { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.grade-label {
  flex: none; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill); color: var(--secondary);
  border-radius: 10px;
  font-size: .88rem; font-weight: 800;
}
.class-grid {
  flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.class-card {
  display: flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 10px 4px;
  background: var(--card);
  border-radius: var(--r-md);
  font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em;
  transition: transform .12s ease, background .12s ease;
}
.class-card:active { transform: scale(.94); background: var(--accent-tint); color: var(--accent); }
@media (min-width: 480px) { .class-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 600px) { .class-grid { grid-template-columns: repeat(6, 1fr); } }

/* ════════ уроки — сгруппированный список iOS ════════ */
.lessons {
  background: var(--card);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.lesson {
  display: flex; gap: 14px; align-items: center;
  padding: 13px 16px;
}
.lesson + .lesson { border-top: 1px solid var(--sep); }
.lesson-n {
  flex: none; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill); color: var(--secondary);
  border-radius: 50%;
  font-size: .85rem; font-weight: 800;
}
.lesson-main { flex: 1; min-width: 0; }
.lesson-subj { font-weight: 650; font-size: 1rem; line-height: 1.3; letter-spacing: -.01em; }
.lesson-teacher { color: var(--secondary); font-size: .83rem; margin-top: 2px; }
.lesson-side {
  flex: none; text-align: right;
  font-size: .82rem; color: var(--secondary);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}
.lesson-room {
  display: inline-block; margin-top: 3px;
  padding: 1px 8px;
  background: var(--fill-2); color: var(--secondary);
  border-radius: 999px;
  font-size: .78rem; font-weight: 600;
}

/* ════════ «обновлено» ════════ */
.updated-line {
  margin: 22px 0 0;
  font-size: .82rem; color: var(--secondary);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.updated-line svg { color: var(--tertiary); }
.home .updated-line { margin-top: 30px; }

/* ════════ календарь ════════ */
.cal-title { flex: 2; align-self: center; text-align: center; font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; }
.calendar {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 14px 12px 14px;
}
.cal-weekdays { display: grid; grid-template-columns: repeat(6, 1fr); margin-bottom: 4px; }
.cal-weekdays span {
  text-align: center; font-size: .68rem; font-weight: 700;
  letter-spacing: .06em; color: var(--tertiary); padding: 4px 0;
  text-transform: uppercase;
}
.cal-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.cal-cell {
  aspect-ratio: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: .95rem; font-weight: 500; color: var(--text);
  transition: transform .1s ease;
}
.cal-cell:active { transform: scale(.9); }
.cal-cell.empty { visibility: hidden; }
.cal-cell.has { font-weight: 700; }
.cal-cell.has i {
  position: absolute; bottom: 12%;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.cal-cell.today { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.today i { background: #fff; }
.cal-legend {
  display: flex; align-items: center; gap: 7px;
  margin: 12px 14px 0;
  font-size: .8rem; color: var(--secondary);
}
.cal-legend i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ════════ пустое состояние ════════ */
.empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; color: var(--secondary);
  padding: 44px 24px; margin-top: 14px;
  background: var(--card);
  border-radius: var(--r-lg);
}
.empty-icon {
  width: 56px; height: 56px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill-2); color: var(--tertiary);
  border-radius: 18px;
}
.empty-icon svg { width: 26px; height: 26px; }
.empty p { margin: 0 0 16px; line-height: 1.5; font-size: .95rem; }

/* ════════ анимация появления ════════ */
@keyframes tt-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
#app > * { animation: tt-in .18s ease-out; }
@media (prefers-reduced-motion: reduce) {
  #app > * { animation: none; }
  * { transition: none !important; }
}

/* ════════════════════════════════════════════════
   АДМИНКА
   ════════════════════════════════════════════════ */
.admin-body { background: var(--bg); }
.admin-wrap { max-width: 780px; margin: 0 auto; padding: 20px 16px 64px; }
.admin-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-head h1 { margin: 0; margin-right: auto; font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; }
.admin-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 14px;
}
.admin-card h2 { margin: 0 0 14px; font-size: 1.05rem; font-weight: 700; }
.admin-card label { display: block; margin-bottom: 12px; font-size: .85rem; font-weight: 500; color: var(--secondary); }
.admin-card input {
  display: block; width: 100%; margin-top: 5px; padding: 11px 14px;
  border: none; border-radius: var(--r-sm);
  background: var(--fill-2);
  font-size: .95rem; font-family: inherit; color: var(--text);
}
.admin-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--card); }
.admin-card input[type=file] { margin-top: 6px; }
.admin-card input[type=number] { width: 90px; display: inline-block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; min-height: 44px;
  border-radius: 999px; border: none;
  background: var(--fill); color: var(--text);
  font-size: .92rem; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.96); opacity: .85; }
.btn-primary, .btn.btn-primary { background: var(--accent); color: #fff; }
.btn-danger, .btn.btn-danger { color: var(--danger); background: rgba(255, 69, 58, .1); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .8rem; }
.btn-ghost, .btn.btn-ghost { background: none; color: var(--secondary); }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--tertiary);
  padding: 8px; border-bottom: 1px solid var(--sep);
}
.admin-table td { padding: 9px 8px; border-bottom: 1px solid var(--sep); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table td input {
  width: 100%; padding: 8px 10px;
  border: none; border-radius: 9px;
  background: var(--fill-2);
  font-size: .88rem; font-family: inherit; color: var(--text);
}
.admin-class-list { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions { white-space: nowrap; }
.add-lesson { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.upload-result { margin-top: 12px; font-size: .88rem; }
.upload-result.ok { color: var(--green-text); }
.upload-result.err { color: var(--danger); }
.error { color: var(--danger); }
.admin-link-row { display: flex; gap: 8px; align-items: center; }
