:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --ink: #1C1C1E;
  --ink2: #8E8E93;
  --accent: #007AFF;
  --line: rgba(60, 60, 67, 0.12);
  /* Эталон карточки: ИПГС 3-2 · четверг · нечётная — одинаковый кегль во всех днях */
  --lesson-time-size: 13px;
  --lesson-subj-size: 14.5px;
  --lesson-meta-size: 12.5px;
  --lesson-time-col: 59px;
  --hub-pad: 4px;
  --hub-web-nudge: 0px;
  --app-bottom-gap: 0px;
  /*
   * HUB GEOMETRY — LOCKED (see docs/hub-geometry.md).
   * Do not change without explicit user approval.
   */
  --hub-left: max(20px, calc(env(safe-area-inset-left, 0px) + 14px));
  --hub-bottom: max(
    0px,
    calc(var(--hub-pad) + env(safe-area-inset-bottom, 0px) + var(--app-bottom-gap) - var(--hub-web-nudge))
  );
  --hub-pad-top: 3px;
  --hub-pad-bottom: 6px;
  --hub-pad-left: 11px;
  --hub-pad-right: 11px;
  --hub-search-gap: 8px;
  --search-hub-right: max(20px, calc(env(safe-area-inset-right, 0px) + 10px));
  --search-hub-size: 62px;
  --search-hub-ico: 32px;
  --pane-bottom-pad: max(
    96px,
    calc(110px + env(safe-area-inset-bottom, 0px) + var(--app-bottom-gap) - var(--hub-web-nudge))
  );
}
[data-theme="dark"] {
  --bg: #000000;
  --card: #1C1C1E;
  --ink: #F5F5F7;
  --ink2: #8E8E93;
  --accent: #0A84FF;
  --line: rgba(84, 84, 88, 0.45);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
}
.phone { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
.body {
  padding: 14px 16px 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}
html[data-shell="web"] .body {
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.scroll-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  margin: 0 -16px;
  padding-bottom: 0;
}
.panes {
  display: flex;
  width: 300%;
  height: 100%;
  position: relative;
  transition: transform 0.42s cubic-bezier(0.34, 1.35, 0.48, 1);
}
.panes.dragging { transition: none; }
.panes.sliding {
  will-change: transform;
}
.pane {
  width: 33.3333%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
#paneImportant,
#paneOther {
  overflow-y: auto;
  padding: 0 16px;
  padding-bottom: var(--pane-bottom-pad);
}
#paneOther.other-sub {
  touch-action: pan-y;
  position: relative;
}
#paneOther.other-sub.other-short {
  /* Короткие экраны: жест назад полностью на JS */
  touch-action: none;
  overflow: hidden;
}
#paneOther.other-sub .other-slide {
  touch-action: pan-y;
  min-height: 100%;
  box-sizing: border-box;
}
#paneOther.other-sub.other-short .other-slide {
  position: relative;
  z-index: 1;
  height: auto;
  min-height: 0;
  /* Пустые участки слайда пропускают касания на fill под ним */
  pointer-events: none;
  touch-action: none;
}
#paneOther.other-sub.other-short .other-slide .sub-head,
#paneOther.other-sub.other-short .other-slide .menu-list,
#paneOther.other-sub.other-short .other-slide .menu-btn,
#paneOther.other-sub.other-short .other-slide .back-btn,
#paneOther.other-sub.other-short .other-slide .empty,
#paneOther.other-sub.other-short .other-slide .install-guide,
#paneOther.other-sub.other-short .other-slide a,
#paneOther.other-sub.other-short .other-slide button {
  pointer-events: auto;
}
#paneOther.other-sub.other-short .other-swipe-fill {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* Почти прозрачный фон — WKWebView иначе не хит-тестит «пустые» зоны */
  background: rgba(0, 0, 0, 0.001);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#paneOther .other-back-edge {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 56px;
  z-index: 6;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.other-swipe-space {
  display: none;
}
.pane::-webkit-scrollbar { display: none; }
.day-viewport {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
  /* Let the browser keep vertical scroll; give horizontal pans to JS */
  touch-action: pan-y;
}
.day-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}
.day-track.animating {
  transition: transform 0.34s cubic-bezier(0.22, 0.9, 0.28, 1);
}
.day-page {
  height: 100%;
  overflow-y: auto;
  padding: 0 16px;
  padding-bottom: var(--pane-bottom-pad);
  box-sizing: border-box;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 0 0 auto;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
}
.day-page::-webkit-scrollbar { display: none; }
.day-swipe-space {
  flex: 1 0 auto;
  min-height: 160px;
  width: 100%;
  touch-action: pan-y;
}
#paneSchedule,
.header,
#scrollViewport {
  touch-action: pan-y;
}

.groupbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.group-chip, .role-pill {
  border: none; background: var(--card); border-radius: 12px; padding: 7px 10px;
  font-size: 12px; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); font-family: inherit;
}
.group-chip { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink); max-width: 72%; }
.group-chip span { color: var(--ink2); font-weight: 500; }
.role-pill { color: var(--accent); background: rgba(0,122,255,.1); }

.header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.header.hide-on-important { display: none; }
.daynav { display: flex; align-items: center; gap: 8px; touch-action: manipulation; }
.navbtn {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--card);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); cursor: pointer; flex-shrink: 0; padding: 0;
}
.navbtn svg {
  width: 16px; height: 16px; display: block;
  stroke: var(--accent); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.daytitle { font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.daysub { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 1px; text-transform: lowercase; }
.datepill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 6px 2px;
  cursor: pointer;
  box-shadow: none;
  min-width: 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.datepill:active { opacity: 0.55; }
.weeklabel { font-size: 10px; font-weight: 600; letter-spacing: .02em; color: var(--accent); text-transform: uppercase; }
.datenum {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.list { display: flex; flex-direction: column; gap: 10px; flex: 0 0 auto; }
.empty {
  background: var(--card); border-radius: 14px; padding: 28px 16px; text-align: center;
  color: var(--ink2); font-size: 13px;
}
.item {
  background: var(--card); border-radius: 14px; padding: 12px 14px; display: flex; gap: 19px;
  align-items: flex-start; box-shadow: 0 1px 2px rgba(0,0,0,.05);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.time {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  font-size: var(--lesson-time-size); font-weight: 600; color: var(--ink2); line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.time-start, .time-end {
  display: block; white-space: nowrap;
  font-size: var(--lesson-time-size);
  font-weight: 600;
  line-height: 1.25;
}
.stripe { width: 3px; align-self: stretch; border-radius: 3px; background: var(--accent); flex: 0 0 3px; }
.stripe.red { background: #FF3B30; }
.stripe.yellow { background: #FFCC00; }
.stripe.green { background: #34C759; }
.stripe.gray { background: #8E8E93; }
.time-block {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: var(--lesson-time-col); flex: 0 0 var(--lesson-time-col);
  min-width: var(--lesson-time-col); max-width: var(--lesson-time-col);
  overflow: hidden;
}
.time-stars {
  display: flex; gap: 0; line-height: 1;
  width: 100%; max-width: 100%; overflow: hidden;
}
.time-stars .stars {
  display: flex; letter-spacing: 0; gap: 0;
  width: 100%; justify-content: space-between;
}
.time-stars .star { font-size: 11px; letter-spacing: 0; line-height: 1; }

.sub-count {
  color: var(--ink2);
  font-weight: 600;
  font-size: 0.92em;
}

.lesson-pick-sheet { padding-bottom: 28px; }
.lesson-pick-title {
  font-size: 13px; font-weight: 600; color: var(--ink2);
  margin: 0 0 12px; letter-spacing: .02em; text-transform: uppercase;
}
.lesson-pick-actions { display: flex; flex-direction: column; gap: 10px; }
.lesson-pick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; border: none; border-radius: 16px;
  padding: 16px 18px; text-align: left; cursor: pointer;
  background: var(--card); color: var(--ink);
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  -webkit-tap-highlight-color: transparent;
}
.lesson-pick-btn:active { opacity: 0.72; transform: scale(0.99); }
.lp-label { font-size: var(--lesson-subj-size); font-weight: 700; letter-spacing: -0.01em; }
.lp-sub { font-size: var(--lesson-meta-size); font-weight: 500; color: var(--ink2); line-height: 1.35; }

.subject-sheet { padding-bottom: max(28px, calc(16px + env(safe-area-inset-bottom, 0px))); }
.subject-head { text-align: left; touch-action: pan-y; }
.subject-name {
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25;
  margin-bottom: 10px;
}
.subject-agg {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 14px; color: var(--ink2); margin-bottom: 18px;
}
.subject-agg b { color: var(--ink); }
.subject-agg .muted { color: var(--ink2); }
.subject-colors-label {
  font-size: 12px; font-weight: 600; color: var(--ink2);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px;
}

/* iOS-style importance wheel: fixed shell + scrolling labels (3D) */
.imp-drum-shell {
  --imp-row: 56px;
  position: relative;
  width: 100%;
  height: calc(var(--imp-row) * 5);
  margin: 0 0 18px;
  border-radius: 16px;
  background: var(--bg);
  overflow: hidden;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.imp-drum-highlight {
  pointer-events: none;
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  height: var(--imp-row);
  margin-top: calc(var(--imp-row) / -2);
  z-index: 4;
  box-sizing: border-box;
  border-top: 1.5px solid rgba(60, 60, 67, 0.28);
  border-bottom: 1.5px solid rgba(60, 60, 67, 0.28);
  background: rgba(0, 122, 255, 0.06);
  border-radius: 10px;
}
[data-theme="dark"] .imp-drum-highlight {
  border-top-color: rgba(235, 235, 245, 0.32);
  border-bottom-color: rgba(235, 235, 245, 0.32);
  background: rgba(10, 132, 255, 0.12);
}
.imp-drum {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior: contain;
  touch-action: pan-y;
  perspective: 1000px;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 16%,
    #000 84%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 16%,
    #000 84%,
    transparent 100%
  );
}
.imp-drum::-webkit-scrollbar { display: none; }
.imp-drum-track {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
}
.imp-drum-spacer { height: calc(var(--imp-row) * 2); width: 100%; }
.imp-drum-item {
  height: var(--imp-row);
  width: 100%;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 650;
  color: var(--ink2);
  letter-spacing: -0.01em;
  opacity: 0.35;
  transform-origin: center center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
  box-sizing: border-box;
}
.imp-drum-item.on {
  color: var(--ink);
  font-weight: 700;
}
.imp-drum-lab {
  text-align: center;
  max-width: 100%;
}
.subject-confirm {
  width: 100%;
  margin-top: 6px;
  min-height: 54px;
  padding: 16px 18px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 14px;
  letter-spacing: -0.01em;
}
.subject-change {
  font-size: 19px;
  min-height: 58px;
  padding: 17px 18px;
}
.subject-agg.muted-line { color: var(--ink2); }
.subject-bars {
  display: flex; flex-direction: column; gap: 12px;
  margin: 0 0 18px;
}
.subject-bar-row { display: flex; flex-direction: column; gap: 6px; }
.subject-bar-top {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.subject-bar-lab { flex: 1; min-width: 0; }
.subject-bar-n {
  color: var(--ink2); font-size: 12.5px; font-weight: 600; flex: 0 0 auto;
}
.subject-bar-track {
  height: 8px; border-radius: 999px; background: rgba(60, 60, 67, 0.12);
  overflow: hidden;
}
[data-theme="dark"] .subject-bar-track { background: rgba(84, 84, 88, 0.45); }
.subject-bar-fill {
  height: 100%; border-radius: 999px; min-width: 0;
  transition: width 0.35s ease;
}
.subject-bar-fill.red { background: #FF3B30; }
.subject-bar-fill.yellow { background: #FFCC00; }
.subject-bar-fill.green { background: #34C759; }
.subject-bar-fill.gray { background: #8E8E93; }
.subject-done {
  width: 100%;
  margin-top: 10px;
  min-height: 48px;
  padding: 14px 18px;
  border: none;
  border-radius: 14px;
  background: var(--bg);
  color: var(--accent);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.subject-done:active { opacity: 0.65; }
.subj-chip {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.subj-chip.red { background: #FF3B30; }
.subj-chip.yellow { background: #FFCC00; }
.subj-chip.green { background: #34C759; }
.subj-chip.gray { background: #8E8E93; }
.item-main { flex: 1; min-width: 0; }
.item-subj {
  font-size: var(--lesson-subj-size);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
}
.item-meta {
  font-size: var(--lesson-meta-size);
  font-weight: 500;
  color: var(--ink2);
  margin-top: 2px;
  line-height: 1.35;
}
.item-note {
  margin-top: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 8px; display: inline-block;
}
.item-tap {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.item-tap:active { transform: scale(0.985); opacity: 0.7; }
svg.item-chev,
.item-chev-slot {
  width: 15px; height: 15px; align-self: center; flex: 0 0 15px; display: block;
}
svg.item-chev {
  stroke: var(--ink2); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

/* Liquid-glass floating tab bar + Telegram-like bubble lens
   IMPORTANT: backdrop-filter must NOT be on the same element that
   contains the bubble — WebKit clips overflow to the pill shape. */
.tabbar {
  position: fixed;
  left: var(--hub-left);
  right: calc(var(--search-hub-right) + var(--search-hub-size) + var(--hub-search-gap));
  width: auto;
  max-width: none;
  margin: 0;
  /* TG: 4px + safe + contentSafeArea. Web: чуть ниже, как в Mini App */
  bottom: var(--hub-bottom);
  display: block;
  gap: 4px;
  /* LOCKED vertical pads — docs/hub-geometry.md */
  padding: var(--hub-pad-top) var(--hub-pad-right) var(--hub-pad-bottom) var(--hub-pad-left);
  min-height: 0;
  z-index: 8;
  border-radius: 999px;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transform-origin: center bottom;
  will-change: transform;
}
.search-hub {
  position: fixed;
  right: var(--search-hub-right);
  bottom: var(--hub-bottom);
  width: var(--search-hub-size);
  height: var(--search-hub-size);
  z-index: 8;
  border: none;
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-hub-glass {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.28)),
    rgba(245, 245, 247, 0.55);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 0.5px solid rgba(255,255,255,0.75);
  box-shadow:
    0 8px 28px rgba(0,0,0,.12),
    0 1px 2px rgba(0,0,0,.04),
    inset 0 1px 0 rgba(255,255,255,.85);
}
[data-theme="dark"] .search-hub-glass {
  background:
    linear-gradient(180deg, rgba(120,120,128,0.22), rgba(120,120,128,0.10)),
    rgba(28, 28, 30, 0.72);
  border: 0.5px solid rgba(255,255,255,0.10);
  box-shadow:
    0 8px 28px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(255,255,255,.10);
}
.search-hub-ico {
  position: relative;
  z-index: 1;
  width: var(--search-hub-ico);
  height: var(--search-hub-ico);
  display: block;
  stroke: var(--ink);
  fill: none;
  stroke-width: 2.05;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.search-hub:active { transform: scale(0.94); opacity: 0.85; }

.search-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
}
.search-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 8px;
  flex: 0 0 auto;
}
.search-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.search-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--card); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.search-close svg {
  width: 16px; height: 16px; display: block;
  stroke: var(--accent); fill: none; stroke-width: 2.4; stroke-linecap: round;
}
.search-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 12px;
  -webkit-overflow-scrolling: touch;
}
.search-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%;
  background: var(--card); border: none; border-radius: 16px;
  padding: 15px 16px; margin-bottom: 8px;
  font-family: inherit; font-size: 16px; font-weight: 600; color: var(--ink);
  text-align: left; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  -webkit-tap-highlight-color: transparent;
}
.search-row:active { opacity: 0.65; }
.search-row-name { min-width: 0; line-height: 1.3; }
.search-row-sub {
  display: block; margin-top: 2px;
  font-size: 12.5px; font-weight: 500; color: var(--ink2);
}
.search-dock {
  flex: 0 0 auto;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 0.5px solid var(--line);
}
.search-field {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.search-field svg {
  width: 18px; height: 18px; flex: 0 0 auto;
  stroke: var(--ink2); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.search-field input {
  flex: 1; min-width: 0;
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 16px; font-weight: 600; color: var(--ink);
  -webkit-appearance: none;
}
.search-field input::placeholder { color: var(--ink2); font-weight: 500; }

.tabbar-glass {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.28)),
    rgba(245, 245, 247, 0.55);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 0.5px solid rgba(255,255,255,0.75);
  box-shadow:
    0 8px 28px rgba(0,0,0,0.12),
    0 1px 2px rgba(0,0,0,0.04),
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -0.5px 0 rgba(0,0,0,0.04);
}
/* Full-pill hit target under lens: catches gaps/padding dead zones */
.tabbar-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
}
[data-theme="dark"] .tabbar-glass {
  background:
    linear-gradient(180deg, rgba(120,120,128,0.22), rgba(120,120,128,0.10)),
    rgba(28, 28, 30, 0.72);
  border: 0.5px solid rgba(255,255,255,0.10);
  box-shadow:
    0 8px 28px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -0.5px 0 rgba(0,0,0,0.35);
}
[data-theme="dark"] .tab-lens { background: rgba(120, 120, 128, 0.30); }
[data-theme="dark"] .tab-lens.bubble {
  background:
    linear-gradient(165deg, rgba(255,255,255,0.20) 0%, rgba(255,255,255,0.06) 45%, rgba(10,132,255,0.22) 100%);
  border: 1px solid rgba(255,255,255,0.20);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 0 0 1px rgba(255,255,255,0.10);
}
[data-theme="dark"] .badge { box-shadow: 0 0 0 1.5px rgba(28,28,30,0.9); }
.tab-lens {
  position: absolute;
  top: 6px;
  left: 0;
  width: 50%;
  height: calc(100% - 12px);
  border-radius: 999px;
  z-index: 2;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  transform-origin: center center;
  /* Idle lens = gray pill; selected icon stays blue on top */
  background: rgba(120, 120, 128, 0.16);
  border: none;
  box-shadow: none;
  transform: translate3d(5px, 0, 0);
  will-change: transform, width, height, border-radius, box-shadow, top;
}
.tab-lens::after {
  display: none;
}
.tab-lens:active, .tab-lens.dragging { cursor: grabbing; }
.tab-lens.bubble {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 -2px 6px rgba(0,122,255,0.08),
    inset 0 0 0 1px rgba(255,255,255,0.75);
  background:
    linear-gradient(165deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 45%, rgba(200,220,255,0.28) 100%);
  border: 1px solid rgba(255,255,255,0.85);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.tab-lens.bubble.traveling {
  background:
    linear-gradient(165deg, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0.12) 50%, rgba(186,214,255,0.22) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.9),
    inset 0 0 0 1px rgba(255,255,255,0.7);
}
.tab-lens.bubble::after {
  display: block;
  content: '';
  position: absolute;
  left: 14%;
  right: 28%;
  top: 10%;
  height: 28%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0));
  pointer-events: none;
  opacity: 0.55;
}
.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  padding: 5px 8px 6px;
  min-width: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  position: relative;
  z-index: 2;
  font-family: inherit;
  cursor: pointer;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  transform-origin: center 60%;
  box-sizing: border-box;
}
.tab-stack {
  position: relative;
  display: block;
  width: 100%;
  z-index: 3;
  /* Let touches fall through to the lens except on real tab buttons */
  pointer-events: none;
}
.tab-layer {
  display: flex;
  gap: 4px;
  width: 100%;
  align-items: flex-end;
  justify-content: space-between;
}
.tab-layer-base {
  position: static;
  z-index: 1;
}
.tab-layer-base .tab {
  pointer-events: auto;
}
/* Expand each item's tap target into gaps / pill padding */
.tab-layer-base .tab::before {
  content: '';
  position: absolute;
  top: -14px;
  bottom: -14px;
  left: -10px;
  right: -10px;
}
.tab-layer-blue {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  color: var(--accent);
  pointer-events: none;
  /* clip-path updated in JS to match bubble */
  clip-path: inset(0 100% 0 0);
  -webkit-clip-path: inset(0 100% 0 0);
}
.tab-layer-blue .tab {
  color: var(--accent);
  pointer-events: none;
  cursor: default;
  z-index: 1;
}
.tab.hot { color: var(--ink); }
.tab.active {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  /* press/drag goes to lens under the active tab */
  pointer-events: none;
}
.tab-layer-blue .tab.active {
  color: var(--accent);
  pointer-events: none;
}
.tabbar.dragging .tab {
  pointer-events: none;
}
.tab.active::after { display: none; }
.tab i, .tab .tab-ico { font-size: 28px; line-height: 1; }
.tab svg.tab-ico {
  width: 28px;
  height: 28px;
  display: block;
  margin-bottom: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.badge {
  position: absolute;
  top: 6px;
  right: 22%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FF3B30;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,0.85);
}
@media (prefers-reduced-motion: reduce) {
  .tab-lens, .tab, .panes { transition: none !important; }
}

.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 40; display: flex; align-items: flex-end;
  max-width: 480px; margin: 0 auto; left: 0; right: 0;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.backdrop.open { opacity: 1; }
.backdrop.closing { opacity: 0; pointer-events: none; }
.sheet {
  width: 100%; background: var(--card); border-radius: 20px 20px 0 0; padding: 10px 18px 28px;
  box-shadow: 0 -8px 24px rgba(0,0,0,.18); max-height: 85%; overflow-y: auto;
  transform: translate3d(0, 110%, 0);
  transition: transform 0.38s cubic-bezier(0.22, 0.9, 0.28, 1);
  overscroll-behavior: none;
}
.cal-sheet {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}
.backdrop.open .sheet { transform: translate3d(0, 0, 0); }
.backdrop.closing .sheet { transform: translate3d(0, 110%, 0); }
.sheet.dragging { transition: none !important; }
.handle {
  width: 36px; height: 24px; margin: 0 auto 8px; padding: 0;
  position: relative; background: transparent; cursor: grab; touch-action: none;
}
.handle::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 4px; border-radius: 2px; background: var(--line);
}
.teacher-sheet .teacher-head { touch-action: pan-y; }
.sheet-title { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-body {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
.cal-nav button {
  width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 50%; color: var(--accent);
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.cal-nav button svg {
  width: 16px; height: 16px; display: block;
  stroke: var(--accent); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekdays { margin-bottom: 6px; gap: 0; }
.cal-weekdays span { font-size: 11px; color: var(--ink2); text-align: center; font-weight: 600; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  font-size: 13px; font-weight: 500; border: none; background: transparent; cursor: pointer; font-family: inherit;
}
.cal-day.today { border: 1px solid var(--accent); color: var(--accent); }
.cal-day.selected { background: var(--accent); color: #fff; }

.group-option {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 14px;
  border: none; background: var(--bg); border-radius: 12px; margin-bottom: 8px; cursor: pointer;
  font-family: inherit; text-align: left;
}
.group-option.active { outline: 2px solid var(--accent); background: rgba(0,122,255,.06); }
.group-option strong { display: block; font-size: 14px; }
.group-option small { color: var(--ink2); font-size: 12px; }

.imp-add {
  display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: #fff;
  border: none; border-radius: 14px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer;
  width: 100%; font-family: inherit;
}
.imp-hint { font-size: 12px; color: var(--ink2); text-align: center; margin: 4px 0 8px; line-height: 1.4; }
.status { display: flex; gap: 8px; margin-bottom: 12px; }
.status-pill {
  flex: 1; background: var(--card); border-radius: 12px; padding: 8px 10px; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.status-pill b { display: block; font-size: 15px; font-weight: 700; }
.status-pill span { font-size: 10px; color: var(--ink2); font-weight: 500; text-transform: uppercase; }

.ticket {
  background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.ticket-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; border-radius: 8px; }
.ticket-del { border: none; background: transparent; color: var(--ink2); cursor: pointer; font-size: 16px; }
.ticket-subj { font-size: 14px; font-weight: 600; margin-top: 7px; }
.ticket-desc { font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.ticket-meta { font-size: 11px; color: var(--ink2); margin-top: 6px; }

.form {
  background: var(--card); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); margin-bottom: 4px;
}
.form select, .form input, .form textarea {
  font-family: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; background: var(--bg); color: var(--ink);
}
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px;
  font-size: 13px; color: var(--ink2); cursor: pointer; font-family: inherit;
}
.btn-save {
  background: var(--accent); border: none; border-radius: 10px; padding: 8px 14px; font-size: 13px;
  color: #fff; font-weight: 600; cursor: pointer; font-family: inherit;
}
.onboard {
  background: var(--card); border-radius: 16px; padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.onboard h2 { margin: 0 0 8px; font-size: 20px; }
.onboard p { margin: 0 0 14px; color: var(--ink2); font-size: 13px; line-height: 1.45; }
.error { color: #B23A2E; font-size: 13px; text-align: center; padding: 20px; }
[data-theme="dark"] .error { color: #FF6B5E; }

/* «Другое» pane */
.menu-list { display: flex; flex-direction: column; gap: 12px; padding: 2px 0 8px; }
.menu-list-sub { gap: 10px; }
.menu-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--card); border: none; border-radius: 20px;
  padding: 18px 18px;
  font-family: inherit; font-size: 17px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.01em; line-height: 1.25;
  text-align: left; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, opacity .12s ease;
}
.menu-btn:active { opacity: 0.72; transform: scale(0.985); }
.menu-btn.on { outline: 2px solid var(--accent); }
.menu-btn.locked,
.menu-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  filter: grayscale(0.25);
}
.menu-btn.locked:active,
.menu-btn:disabled:active {
  opacity: 0.42;
  transform: none;
}
.menu-btn svg.lock {
  width: 17px; height: 17px; flex: 0 0 auto; display: block;
  stroke: var(--ink2); fill: none; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round;
}
.menu-btn-sub {
  justify-content: space-between;
  padding: 16px 18px;
  font-size: 16px;
  border-radius: 16px;
}
.menu-label { flex: 1; min-width: 0; }
.menu-ico {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.menu-ico svg { width: 22px; height: 22px; display: block; }
.menu-ico[data-ico="palette"] { color: #AF52DE; background: rgba(175, 82, 222, .12); }
.menu-ico[data-ico="exam"] { color: #FF9500; background: rgba(255, 149, 0, .14); }
.menu-ico[data-ico="person"] { color: #007AFF; background: rgba(0, 122, 255, .12); }
.menu-ico[data-ico="star"] { color: #FFB000; background: rgba(255, 176, 0, .16); }
.menu-ico[data-ico="map"] { color: #34C759; background: rgba(52, 199, 89, .14); }
.menu-ico[data-ico="install"] { color: #5856D6; background: rgba(88, 86, 214, .12); }
[data-theme="dark"] .menu-ico[data-ico="palette"] { background: rgba(191, 90, 242, .18); color: #BF5AF2; }
[data-theme="dark"] .menu-ico[data-ico="exam"] { background: rgba(255, 159, 10, .18); color: #FF9F0A; }
[data-theme="dark"] .menu-ico[data-ico="person"] { background: rgba(10, 132, 255, .18); color: #0A84FF; }
[data-theme="dark"] .menu-ico[data-ico="star"] { background: rgba(255, 214, 10, .16); color: #FFD60A; }
[data-theme="dark"] .menu-ico[data-ico="map"] { background: rgba(48, 209, 88, .18); color: #30D158; }
[data-theme="dark"] .menu-ico[data-ico="install"] { background: rgba(94, 92, 230, .18); color: #5E5CE6; }
.menu-btn svg.check {
  width: 18px; height: 18px; flex: 0 0 auto; display: block;
  stroke: var(--accent); fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
}
.other-slide {
  min-height: 100%;
  will-change: transform, opacity;
}
.other-slide.swipe-back {
  transition: transform .18s cubic-bezier(.2,.8,.2,1), opacity .18s ease;
}
.sub-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sub-head-solo { padding: 2px 2px 4px; }
.back-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--card);
  display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.back-btn svg {
  width: 17px; height: 17px; display: block;
  stroke: var(--accent); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.sub-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

.contacts { display: flex; flex-direction: column; }
.contact-letter {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  font-size: 12px; font-weight: 700; color: var(--ink2); letter-spacing: .04em;
  padding: 8px 4px 5px;
}
.contact-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  background: var(--card); border: none; border-radius: 12px; padding: 11px 14px; margin-bottom: 6px;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.contact-row:active { opacity: 0.6; }
.contact-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-rating {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.contact-rating.muted { color: var(--ink2); font-weight: 500; }
.contact-rating small { color: var(--ink2); font-size: 11px; font-weight: 500; }

.contacts-reviews { gap: 0; }
.contacts-reviews .contact-letter {
  font-size: 13px;
  padding: 12px 4px 8px;
}
.contacts-reviews .contact-row {
  border-radius: 18px;
  padding: 18px 18px;
  margin-bottom: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.contacts-reviews .contact-name {
  white-space: normal;
  line-height: 1.3;
}
.contacts-reviews .contact-rating {
  font-size: 15px;
  gap: 5px;
}
.contacts-reviews .contact-rating small { font-size: 12px; }

/* Install guide */
.install-guide { padding: 2px 2px 24px; }
.install-hero {
  font-size: 14px; font-weight: 600; color: var(--ink2); line-height: 1.35;
  margin: 0 2px 16px;
}
.install-steps {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.install-steps li {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border-radius: 14px; padding: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.install-n {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700;
}
.install-body { min-width: 0; flex: 1; }
.install-body strong {
  display: block; font-size: 14.5px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.01em; margin-bottom: 4px;
}
.install-body p {
  margin: 0; font-size: 13px; font-weight: 500; color: var(--ink2); line-height: 1.4;
}
.install-link {
  display: inline;
  margin-top: 8px;
  font-size: 15px; font-weight: 700; color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.install-link:active { opacity: 0.65; }

/* Teacher sheet */
.stars { letter-spacing: 1px; }
.star { color: var(--line); font-size: 13px; }
.star.on { color: #FFB000; }
.teacher-head { text-align: left; margin-bottom: 14px; }
.teacher-title-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.teacher-title-text { min-width: 0; flex: 1; }
.teacher-name {
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25;
}
.teacher-subj {
  margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--ink2);
}
.teacher-sched-btn {
  flex: 0 0 auto;
  border: none; border-radius: 12px;
  padding: 8px 12px;
  background: #34C759; color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(52, 199, 89, .35);
}
.teacher-sched-btn:active { opacity: 0.82; transform: scale(0.97); }
.teacher-rating {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px; margin-top: 8px;
  font-size: 13px; color: var(--ink2);
}
.teacher-rating b { color: var(--ink); font-size: 14px; }
.teacher-sched-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.teacher-sched-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.teacher-sched-name {
  font-size: 14px; font-weight: 600; color: var(--ink2); margin-bottom: 14px;
}
.teacher-sched-name .teacher-subj { display: inline; margin: 0; font-weight: 500; }
.teacher-block { margin-bottom: 14px; }
.block-title {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink2); margin-bottom: 8px;
}
.teacher-note {
  background: var(--bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 13px; font-weight: 600; color: var(--ink2); text-align: center;
}
.review-form { display: flex; flex-direction: column; }
.review-form textarea {
  font-family: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; background: var(--bg); color: var(--ink); resize: vertical; margin-bottom: 8px;
}
.stars-input { display: flex; gap: 4px; margin-bottom: 8px; }
.star-btn {
  border: none; background: transparent; padding: 2px 4px; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--line); font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.star-btn.on { color: #FFB000; }
.form-err { font-size: 12px; color: #B23A2E; margin-bottom: 8px; }
.review {
  background: var(--bg); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
.review-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review-when { font-size: 11px; color: var(--ink2); }
.review-text { font-size: 13px; margin-top: 5px; line-height: 1.4; }
.tsched-day { margin-bottom: 10px; }
.tsched-wd { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.tsched-row {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); margin-bottom: 8px;
}
.tsched-time {
  display: flex; flex-direction: column; gap: 0;
  font-size: var(--lesson-time-size); font-weight: 600; color: var(--ink2);
  flex: 0 0 var(--lesson-time-col); width: var(--lesson-time-col); line-height: 1.25;
  white-space: nowrap;
}
.tsched-main { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.tsched-main b {
  font-size: var(--lesson-subj-size); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3;
}
.tsched-main small {
  font-size: var(--lesson-meta-size); color: var(--ink2); margin-top: 2px; line-height: 1.35;
}
