:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a1d23;
  --muted: #8a94a6;
  --accent: #2f6fed;
  --accent-soft: #eaf0ff;
  --border: #e3e8ef;
  --warn: #e8590c;
  --warn-soft: #fff1e6;
  --today: #2f9e44;
  --today-soft: #e6f6e9;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 14px 16px 6px;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.2px;
}
.refresh-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--white, #fff);
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .2s;
}
.refresh-btn:active { transform: rotate(180deg); }
.update-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  min-width: 60px;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  box-shadow: var(--shadow);
}
.tab .tab-abbr { font-weight: 700; font-size: 13px; display: block; }
.tab .tab-date { font-size: 10px; color: var(--muted); display: block; margin-top: 1px; }
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
}
.tab.active .tab-abbr { color: #fff; }
.tab.active .tab-date { color: rgba(255,255,255,.85); }
.tab.today .tab-abbr::after {
  content: "•";
  color: var(--today);
  margin-left: 2px;
}
.tab.today.active .tab-abbr::after { color: #fff; }

/* Content */
.content {
  flex: 1;
  padding: 8px 16px 16px;
}
.loading, .error {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 15px;
}
.error { color: #c60b0b; }

.day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.day-card.is-today { border-color: var(--today); }
.day-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.day-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.badge-today {
  font-size: 11px;
  font-weight: 600;
  color: var(--today);
  background: var(--today-soft);
  padding: 3px 8px;
  border-radius: 999px;
}

.lesson {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.lesson:last-child { border-bottom: none; }
.lesson-num {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lesson-body { flex: 1; min-width: 0; }
.lesson-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}
.lesson-time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lesson-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 8px;
  padding: 6px 8px;
  line-height: 1.35;
}
.lesson-note::before { content: "📝 "; }
.lesson.empty .lesson-name { color: var(--muted); font-weight: 500; font-style: italic; }

.holiday-card {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* Footer */
.footer {
  padding: 8px 16px 24px;
  display: flex;
  gap: 10px;
}
.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost {
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn:active { opacity: .85; }

/* Share sheet (ложный шеринг через копирование) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1a1d23;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; }