/* ============================================================
   PL_EU_BOT — Mini App UI
   Dark, minimalist, Bento-style design system.
   Семантичні кольори Zoom/Meet навмисно збережені як були:
   Zoom #2563eb, Meet #16a34a (#10b981 base), missing #6b7280,
   а також статусні (#ef4444 скасовано, #f59e0b перенесено,
   #ef4444/#22c55e/#f59e0b статуси PIN/студентів).
   ============================================================ */

:root {
  --bg-color: #121212;
  --card-bg: #1a1a1a;
  --card-bg-alt: #121212;
  --text-primary: #ececf1;
  --text-title: #ffffff;
  --text-muted: #9ca3af;
  --accent-color: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-text: #160b2e;
  --accent-tint: rgba(167, 139, 250, 0.14);
  --accent-tint-strong: rgba(139, 92, 246, 0.2);
  --lime-color: #a3e635;
  --lime-tint: rgba(163, 230, 53, 0.14);
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(26, 26, 26, 0.82);
  --canceled-color: #e53935;
  --current-glow: rgba(139, 92, 246, 0.28);
  --radius-card: 18px;
  --radius-hero: 22px;
  --radius-pill: 999px;
  --radius-btn: 14px;
  --bg-alt: var(--card-bg-alt);
  --text-secondary: var(--text-muted);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  padding: 16px;
  min-height: 100vh;
  min-height: 100dvh;
}

#app,
.container {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
}

code,
kbd,
samp,
pre,
.url-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

input,
textarea,
select,
button {
  max-width: 100%;
}

/* Flex/grid children must be allowed to shrink, otherwise long words overflow */
:where(
  .card,
  .schedule-list,
  .list-card,
  .day-section,
  .day-body,
  .settings-group,
  .settings-card,
  .admin-info-body,
  .admin-group-list,
  .admin-user-form,
  .admin-modal-sheet
) > * {
  max-width: 100%;
}

/* ---------- Header ---------- */
.header {
  margin-bottom: 16px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 2px;
}

.user-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.user-name-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.25;
  color: var(--text-title);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.user-name.is-privacy {
  opacity: 0.92;
}

.user-course {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.1px;
  line-height: 1.35;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-tint);
  color: var(--accent-color);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(167, 139, 250, 0.28);
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
  max-width: 50%;
  min-width: 0;
  line-height: 1.25;
}

.badge-group-label {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-group.is-admin-view {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(14, 165, 233, 0.35);
  color: #38bdf8;
}

.badge-group.is-admin-clickable {
  cursor: pointer;
  position: relative;
  z-index: 5;
  pointer-events: auto !important;
}

.badge-group.is-admin-clickable::after {
  content: '▾';
  margin-left: 2px;
  opacity: 0.75;
  font-size: 0.75em;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.24);
  border: 1px solid var(--border-color);
}

/* ---------- Hero ---------- */
.hero-card {
  border-radius: var(--radius-hero);
  background:
    linear-gradient(180deg, var(--accent-tint) 0%, rgba(255, 255, 255, 0.02) 55%),
    var(--card-bg);
  max-width: 100%;
  min-width: 0;
}

.hero-card.is-break {
  border-left-color: #f59e0b;
  background:
    linear-gradient(180deg, rgba(245, 158, 11, 0.1) 0%, rgba(255, 255, 255, 0.02) 55%),
    var(--card-bg);
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-color);
  background: var(--accent-tint);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.hero-label.is-break {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.hero-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 8px;
  line-height: 1.3;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.time-badge {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-color);
  background: var(--accent-tint);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.teacher-name {
  font-weight: 500;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.hero-timer {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-color);
  display: none;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.hero-timer.visible {
  display: block;
}

/* Hero progress bar */
.hero-progress {
  margin-top: 12px;
  display: none;
}
.hero-progress.visible {
  display: block;
}
.hero-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.hero-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: var(--accent-color);
  transition: width 1s linear;
}
.hero-card.is-break .hero-progress-fill {
  background: #f59e0b;
}
.hero-card.is-current-meet .hero-progress-fill {
  background: #16a34a;
}
.hero-card.is-current-zoom .hero-progress-fill {
  background: #2563eb;
}

.hero-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
  filter: brightness(0.88);
}

.btn-zoom {
  background-color: #2563eb;
  color: #ffffff;
}

.btn-meet {
  background-color: #10b981;
  color: #ffffff;
}

.hero-actions .btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  width: 100%;
  border-radius: var(--radius-pill);
  min-height: 36px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto !important;
  opacity: 1 !important;
  color: #fff !important;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.hero-actions .btn:active {
  transform: scale(0.96);
  filter: brightness(0.85);
}

.hero-actions .btn-zoom { background: #2563eb !important; }
.hero-actions .btn-meet { background: #16a34a !important; }

.hero-actions .btn.pressed {
  transform: scale(0.96);
  filter: brightness(0.82);
}

/* Hero-кнопка: повна лише для поточної пари; інакше (перерва / наступна пара) — компактна */
.hero-actions.is-compact .btn {
  width: auto;
  padding: 0 14px;
}

.hero-actions.is-compact {
  justify-content: flex-start;
}

/* ---------- Tabs ---------- */
.tabs-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 10px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.tab-btn.active {
  background: var(--accent-tint-strong);
  color: var(--accent-color);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.25);
}

.tab-btn:active {
  transform: scale(0.96);
}

/* ---------- Updated-at ---------- */
.updated-at {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin: 6px 0 10px;
  min-height: 1.2em;
  line-height: 1.35;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 0.9;
  cursor: default;
  user-select: none;
}

.updated-at.is-cache {
  color: var(--lime-color);
}

/* ---------- Schedule list / lesson cards (grouped, Bento) ---------- */
.schedule-list {
  transition: opacity 0.18s ease;
}
.schedule-list.is-fading {
  opacity: 0;
}

.lesson-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 16px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.list-card,
.day-section:not(.collapsed) .day-body {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.list-card .lesson-card,
.day-body .lesson-card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 0;
  animation: none;
}

.list-card .lesson-card + .lesson-card,
.day-body .lesson-card + .lesson-card {
  border-top: 1px solid var(--border-color);
}

/* Current-pair highlight (кольори Zoom/Meet збережені) */
.list-card .lesson-card.is-current-zoom,
.day-body .lesson-card.is-current-zoom,
.list-card .lesson-card.is-current-meet,
.day-body .lesson-card.is-current-meet {
  border: none;
  box-shadow: none;
}
.list-card .lesson-card.is-current-zoom::before,
.list-card .lesson-card.is-current-meet::before,
.day-body .lesson-card.is-current-zoom::before,
.day-body .lesson-card.is-current-meet::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
}
.list-card .lesson-card.is-current-zoom::before {
  background: #2563eb;
}
.list-card .lesson-card.is-current-meet::before {
  background: #16a34a;
}

.lesson-card.canceled {
  opacity: 0.85;
}
.lesson-card.canceled::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #ef4444;
}
.list-card .lesson-card.canceled,
.day-body .lesson-card.canceled {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, transparent 32%);
}
.lesson-card.canceled .lesson-title {
  text-decoration: line-through;
  color: #fca5a5;
}

.lesson-card.rescheduled::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #f59e0b;
}
.list-card .lesson-card.rescheduled,
.day-body .lesson-card.rescheduled {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, transparent 32%);
}

.lesson-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: right;
}

.canceled-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.rescheduled-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.lesson-room {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.lesson-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  margin-bottom: 0;
}

.lesson-time {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-color);
  line-height: 1.2;
  margin-top: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

.lesson-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

.lesson-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-title);
  margin-top: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.lesson-details {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-height: 22px;
  min-width: 0;
  flex-wrap: wrap;
}

.lesson-details-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 140px;
  flex-wrap: wrap;
}

.lesson-teacher {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-type-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 60%;
}

.lesson-resource-inline {
  flex-shrink: 0;
  margin-left: auto;
}

.lesson-resources {
  display: none;
}

/* ---------- Resource buttons (кольори Zoom/Meet збережені) ---------- */
.lesson-resource-button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: var(--radius-pill);
  min-width: 44px;
  height: 22px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  pointer-events: auto !important;
  opacity: 1 !important;
  color: #ffffff !important;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform 0.1s ease, filter 0.1s ease;
}

.lesson-resource-button:active {
  transform: scale(0.92);
  filter: brightness(0.85);
}

.lesson-resource-button.zoom-button {
  background: #2563eb !important;
}

.lesson-resource-button.meet-button {
  background: #16a34a !important;
}

/* Zoom та Meet завжди однакового розміру (у картках пар) */
.lesson-resource-inline > .lesson-resource-button.zoom-button,
.lesson-resource-inline > .lesson-resource-button.meet-button {
  width: 64px;
}

.lesson-resource-button.missing-button {
  background: #6b7280 !important;
  color: #ffffff !important;
  cursor: default;
  font-size: 9px;
  letter-spacing: -0.5px;
  min-width: 44px;
  padding: 0 8px;
}

.lesson-resource-button.hidden {
  display: none !important;
}

/* ---------- Day sections (week view) ---------- */
.day-section {
  margin-bottom: 10px;
}

.day-header {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 8px 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.day-header:active {
  opacity: 0.85;
}

.day-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.day-header-left > span:not(.day-chevron) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-chevron {
  font-size: 12px;
  transition: transform 0.2s ease;
  color: var(--accent-color);
  flex: 0 0 auto;
}

.day-section.collapsed .day-chevron {
  transform: rotate(-90deg);
}

.day-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.day-body {
  overflow: hidden;
  border-radius: var(--radius-card);
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.day-section.collapsed .day-body {
  display: none;
  max-height: 0;
  opacity: 0;
}

.day-section:not(.collapsed) .day-body {
  max-height: 2000px;
  opacity: 1;
}

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.day-empty {
  padding: 14px 12px;
  margin: 0;
  font-size: 13px;
}

.error-card {
  text-align: center;
  padding: 32px 16px;
  max-width: 100%;
}

.error-card h3,
.error-card p {
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.error-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.hidden {
  display: none !important;
}

/* ---------- Loader skeleton (імітує форму карток пар) ---------- */
.loader-skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton-list {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.skeleton-lesson {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skeleton-lesson + .skeleton-lesson {
  border-top: 1px solid var(--border-color);
}

.skeleton-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.skeleton-block {
  display: block;
  background: #262626;
  overflow: hidden;
  position: relative;
}
.skeleton-block::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

.skeleton-time { width: 52px; height: 12px; border-radius: var(--radius-pill); }
.skeleton-type { width: 46px; height: 12px; border-radius: var(--radius-pill); }
.skeleton-title { width: 88%; height: 15px; border-radius: 6px; }
.skeleton-detail { width: 62%; height: 10px; border-radius: 6px; }
.skeleton-chip { width: 46px; height: 22px; border-radius: var(--radius-pill); }

@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* ---------- Toast ---------- */
.toast-message {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: max-content;
  max-width: min(86vw, 320px);
  max-height: 42vh;
  overflow: hidden;
  background: rgba(38, 38, 42, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toast-message.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Bottom bars ---------- */
.admin-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--glass-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.admin-bottom-bar.hidden { display: none !important; }

.student-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--glass-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.student-bottom-bar.hidden { display: none !important; }

.admin-bottom-btn {
  flex: 1 1 0;
  max-width: 72px;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, transform 0.1s ease;
}
.admin-bottom-btn:active {
  background: var(--accent-tint);
  transform: scale(0.92);
}
.admin-bottom-btn.is-disabled {
  opacity: 0.28;
  cursor: default;
}
.admin-bottom-icon {
  font-size: 18px;
  line-height: 1;
  color: var(--accent-color);
  max-width: 100%;
}
.admin-bottom-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: var(--text-muted);
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-bottom-btn:not(.is-disabled) .admin-bottom-label {
  color: var(--text-primary);
}

.student-bottom-btn {
  flex: 1 1 0;
  max-width: 72px;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, opacity 0.12s ease;
}
.student-bottom-btn:active {
  background: var(--accent-tint);
  transform: scale(0.92);
}
.student-bottom-btn .admin-bottom-label {
  color: var(--text-primary);
}

body.has-admin-bar {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
body.has-student-bar {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Admin modals (bottom sheets) ---------- */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.admin-modal.hidden { display: none !important; }

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  transition: opacity 0.2s ease;
}

.admin-modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: min(78vh, 640px);
  background: var(--card-bg);
  border-radius: 26px 26px 0 0;
  border: 1px solid var(--border-color);
  border-bottom: none;
  padding: 10px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  animation: adminSheetIn 0.22s ease-out;
  color: var(--text-primary);
  overflow-x: clip;
}
@keyframes adminSheetIn {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.admin-modal-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  margin: 2px auto 6px;
}

.admin-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.admin-modal-head > div {
  min-width: 0;
}

.admin-badge {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-tint-strong);
  color: var(--accent-color);
  margin-bottom: 4px;
}

.admin-modal-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-title);
  font-weight: 700;
  line-height: 1.3;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.admin-modal-close {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #a3aab4;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-modal-close:active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

/* ---------- Admin inputs / actions ---------- */
.admin-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-search {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--card-bg-alt);
  color: #f1f5f9;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.admin-search:focus {
  border-color: var(--accent-strong);
}
.admin-search.hidden { display: none !important; }

.admin-apply {
  flex-shrink: 0;
  border: none;
  border-radius: 14px;
  background: var(--accent-strong);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  padding: 11px 16px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.1s ease;
}
.admin-apply:active {
  filter: brightness(0.9);
  transform: scale(0.97);
}

.admin-my-group {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--accent-color);
  font-size: 13px;
  padding: 2px 0 6px;
  cursor: pointer;
}

/* ---------- Admin group picker ---------- */
.admin-group-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
  min-width: 0;
  max-width: 100%;
}

.admin-group-item {
  text-align: left;
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  color: var(--text-primary);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.35;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.admin-group-item:active,
.admin-group-item.is-active {
  border-color: var(--accent-strong);
  background: var(--accent-tint);
}
.admin-group-item small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.admin-group-name {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.admin-group-count {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-tint-strong);
  color: var(--accent-color);
  vertical-align: middle;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-group-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 8px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---------- PIN ---------- */
.admin-pin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}
.admin-pin-actions .admin-apply {
  flex: 1 1 0;
}
.admin-cancel-btn {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  border-radius: var(--radius-btn);
  background: var(--bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}
.admin-cancel-btn:active {
  background: var(--card-bg-alt);
}
.admin-search.is-error {
  border-color: rgba(229, 57, 53, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.15);
}
.admin-pin-status-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.admin-pin-status-actions .tool-btn-danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}
#admin-pin-input {
  letter-spacing: 0.35em;
  font-size: 20px;
  text-align: center;
  font-weight: 700;
  padding: 12px;
}
#admin-pin-desc {
  font-size: 13px;
}
#admin-pin-input.is-error {
  border-color: #ef4444;
  animation: shake 0.3s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- Admin user card ---------- */
.admin-user-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 4px;
  min-width: 0;
  max-width: 100%;
}
.admin-user-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 0;
  max-width: 100%;
}
.admin-user-label .admin-search {
  font-weight: 400;
  color: #f1f5f9;
}
.admin-user-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.admin-user-meta code {
  color: #e2e8f0;
  overflow-wrap: anywhere;
}
.admin-user-actions {
  display: flex;
  gap: 8px;
  max-width: 100%;
}
.admin-user-actions .admin-apply {
  flex: 1 1 0;
  min-width: 0;
}
.admin-user-block-btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  border: 1px solid #ef4444;
  background: transparent;
  color: #ef4444;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  padding: 11px 14px;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.admin-user-block-btn .icon {
  flex: 0 0 auto;
}
.admin-user-block-btn.is-blocked {
  border-color: #22c55e;
  color: #22c55e;
}
.admin-user-chat-btn[disabled],
#admin-user-chat[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Admin info / status ---------- */
.admin-info-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
  max-height: 62vh;
  max-height: 62dvh;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.admin-info-card {
  flex: 0 0 auto;
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.35;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.admin-info-card strong {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.admin-info-card .meta {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 3px;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.admin-info-card.is-clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.admin-info-card.is-clickable:active {
  border-color: var(--accent-strong);
  background: var(--accent-tint);
}

.status-pill {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  flex: none;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.status-pill.status-approved { background: rgba(34, 197, 94, 0.18); color: #22c55e; }
.status-pill.status-blocked { background: rgba(239, 68, 68, 0.18); color: #ef4444; }
.status-pill.status-pending { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.status-pill.status-active { background: rgba(34, 197, 94, 0.18); color: #22c55e; }
.status-pill.status-used { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.status-pill.status-expired { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.status-pill.status-revoked { background: rgba(239, 68, 68, 0.18); color: #f87171; }

.admin-info-stat {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.admin-info-pill {
  background: var(--accent-tint);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.admin-status-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

/* ---------- Schedule tools / changelog ---------- */
.schedule-tools {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

.tool-btn {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.tool-btn:active {
  opacity: 0.85;
}
.tool-btn-muted {
  color: var(--text-muted);
}
.tool-btn-danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}
.tool-btn-danger:active {
  background: rgba(239, 68, 68, 0.16);
}

.changelog-card {
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.changelog-card .ver {
  font-weight: 700;
  color: var(--accent-color);
}
.changelog-card ul {
  margin: 6px 0 0 18px;
  padding: 0;
  color: var(--text-primary);
}
.changelog-card li {
  line-height: 1.45;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

/* ---------- Settings ---------- */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
  max-width: 100%;
}

.settings-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 10px 2px 4px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.settings-card {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-primary);
  max-width: 100%;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  min-width: 0;
}
.settings-row + .settings-row {
  border-top: 1px solid var(--border-color);
}

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
}
.settings-row-info strong {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-title);
  overflow-wrap: anywhere;
}
.settings-row-info .meta {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.settings-value {
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 55%;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.settings-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 7px 30px 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.settings-select:focus {
  border-color: var(--accent-strong);
  outline: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  transition: background 0.2s ease;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #f8fafc;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch input:checked + .switch-slider {
  background: #22c55e;
}
.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.settings-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.settings-status.is-on {
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
}
.settings-status.is-off {
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-muted);
}

.settings-actions {
  display: flex;
  gap: 8px;
  padding: 4px 0 10px;
  flex-wrap: wrap;
  max-width: 100%;
}

.settings-action {
  width: 100%;
  max-width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 10px 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
  overflow-wrap: anywhere;
}
.settings-action .icon {
  flex: 0 0 auto;
}
.settings-action:active {
  opacity: 0.8;
}

/* ---------- Hero change animation ---------- */
.hero-card.hero-changed {
  animation: heroChangePulse 0.75s ease;
}
@keyframes heroChangePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
  35% { transform: scale(1.015); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 45%, transparent); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Transition animations ---------- */
@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lesson-card {
  animation: cardEnter 0.3s ease both;
}

.lesson-card:nth-child(1) { animation-delay: 0ms; }
.lesson-card:nth-child(2) { animation-delay: 40ms; }
.lesson-card:nth-child(3) { animation-delay: 80ms; }
.lesson-card:nth-child(4) { animation-delay: 120ms; }
.lesson-card:nth-child(5) { animation-delay: 160ms; }
.lesson-card:nth-child(6) { animation-delay: 200ms; }
.lesson-card:nth-child(7) { animation-delay: 240ms; }
.lesson-card:nth-child(8) { animation-delay: 280ms; }

.empty-state {
  animation: cardEnter 0.3s ease both;
}

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

.day-section {
  animation: daySectionEnter 0.25s ease both;
}
.day-section:nth-child(1) { animation-delay: 0ms; }
.day-section:nth-child(2) { animation-delay: 50ms; }
.day-section:nth-child(3) { animation-delay: 100ms; }
.day-section:nth-child(4) { animation-delay: 150ms; }
.day-section:nth-child(5) { animation-delay: 200ms; }

.hero-title,
.hero-meta,
.hero-timer {
  transition: opacity 0.2s ease;
}

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

.hero-card {
  animation: heroSlideIn 0.35s ease both;
}

#admin-info-modal .admin-modal-sheet {
  animation: adminSheetIn 0.22s ease-out;
}
#admin-user-modal .admin-modal-sheet {
  animation: adminSheetIn 0.22s ease-out;
}
#admin-pin-modal .admin-modal-sheet {
  animation: adminSheetIn 0.22s ease-out;
}

.schedule-list.swipe-slide {
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.schedule-list.swipe-out-left {
  transform: translateX(-30px);
  opacity: 0;
}
.schedule-list.swipe-out-right {
  transform: translateX(30px);
  opacity: 0;
}
.schedule-list.swipe-in {
  transform: translateX(0);
  opacity: 1;
}
/* ---------- Alert card (сигнал повітряної тривоги) ---------- */
.alert-card {
  padding: 14px;
  max-width: 100%;
}
.alert-card .alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
  flex-wrap: wrap;
}
.alert-card .alert-status-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 140px;
}
.alert-card .alert-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 0 rgba(156, 163, 175, 0.5);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.alert-card .alert-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-title);
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-card .alert-since {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}
.alert-card .alert-map-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
}
.alert-card .alert-map {
  display: block;
  width: 100%;
  height: auto;
  transition: filter 0.4s ease, opacity 0.4s ease;
}
.alert-card .alert-map-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: transparent;
  transition: background 0.4s ease;
}
.alert-card .alert-meta {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.alert-card.state-loading .alert-dot {
  background: var(--accent-strong);
  animation: alertBreathe 1.2s ease-in-out infinite;
}
.alert-card.state-loading .alert-title {
  color: var(--text-muted);
}

.alert-card.state-clear {
  border-left-color: rgba(22, 163, 74, 0.55);
}
.alert-card.state-clear .alert-dot {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}
.alert-card.state-clear .alert-map {
  filter: saturate(0.82) brightness(0.96);
  opacity: 0.9;
}

.alert-card.state-alert {
  border-color: rgba(229, 57, 53, 0.5);
  border-left-color: #e53935;
  background:
    linear-gradient(180deg, rgba(229, 57, 53, 0.13) 0%, rgba(255, 255, 255, 0.02) 55%),
    var(--card-bg);
  animation: alertPulseCard 1.6s ease-in-out infinite;
}
.alert-card.state-alert .alert-dot {
  background: #e53935;
  animation: alertBlink 1s steps(2, start) infinite;
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.8);
}
.alert-card.state-alert .alert-title {
  color: #fca5a5;
}
.alert-card.state-alert .alert-since {
  color: #fca5a5;
}
.alert-card.state-alert .alert-map {
  filter: hue-rotate(98deg) saturate(1.3) brightness(0.92);
}
.alert-card.state-alert .alert-map-overlay {
  background: radial-gradient(ellipse at center, rgba(229, 57, 53, 0.24) 0%, rgba(229, 57, 53, 0) 62%);
}
.alert-card.state-alert .alert-meta {
  color: #f3b6b4;
}

.alert-card.state-off .alert-dot {
  background: var(--text-muted);
}
.alert-card.state-off .alert-map {
  filter: grayscale(0.7) brightness(0.8);
  opacity: 0.55;
}

@keyframes alertBlink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0.25; }
}
@keyframes alertPulseCard {
  0%, 100% {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.24), 0 0 0 0 rgba(229, 57, 53, 0);
  }
  50% {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.24), 0 0 24px 0 rgba(229, 57, 53, 0.3);
  }
}
@keyframes alertBreathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ---------- Alerts view (вкладка «Тривога») ---------- */
.alerts-head {
  margin: 4px 2px 10px;
  max-width: 100%;
}
.alerts-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-title);
  min-width: 0;
  overflow-wrap: anywhere;
}
.alerts-title .icon {
  flex: 0 0 auto;
}
.alerts-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---------- Week navigation (previous/next weeks) ---------- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.week-nav-btn {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--card-bg);
  color: var(--text-title);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.week-nav-btn:active {
  transform: scale(0.9);
}

.week-nav-btn[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.week-nav-label {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-title);
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.week-nav-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  cursor: default;
  border: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.week-nav-tag.week-nav-now {
  cursor: pointer;
  color: var(--accent-color);
  background: var(--accent-tint);
}

.week-nav-tag.week-nav-now:active {
  filter: brightness(0.9);
}

/* ---------- Admin Dashboard (Status tab) ---------- */
.dash-server {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  border-radius: 14px;
  padding: 12px 14px;
}
.server-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 3px;
  background: #64748b;
}
.server-dot.ok { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15); }
.server-dot.bad { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
.server-dot.idle { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15); }
.dash-server-body { min-width: 0; flex: 1 1 auto; }
.dash-server-title { font-size: 13px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.dash-server-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.dash-server-sub.is-error { color: #ef4444; }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  max-width: 100%;
}
.dash-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  border-radius: 14px;
  padding: 12px 13px;
  min-width: 0;
  max-width: 100%;
}
.dash-tile-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.dash-tile-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.dash-tile-sub {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.dash-card {
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.dash-card-sub { font-size: 11px; color: var(--text-muted); line-height: 1.4; overflow-wrap: anywhere; }
.dash-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
.dash-card-actions .meta {
  flex: 1 1 160px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.dash-more {
  border: none;
  background: var(--accent-tint);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}
.dash-more:active { filter: brightness(0.92); }

.dash-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.dash-group-name {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-bar {
  display: block;
  width: 56px;
  height: 5px;
  border-radius: 99px;
  background: var(--border-color);
  overflow: hidden;
  flex: none;
}
.dash-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent-color);
}
.dash-group-count {
  min-width: 22px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dash-recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.dash-recent-name {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-recent-group {
  color: var(--text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 96px;
}

/* Compact alert tile (admin dashboard) */
.dash-alert-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-color);
  background: var(--card-bg-alt);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 0;
  max-width: 100%;
}
.dash-alert-tile .alert-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--text-muted);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.dash-alert-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.dash-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-alert-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-alert-since {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}

.dash-alert-tile.state-clear { border-left-color: rgba(22, 163, 74, 0.55); }
.dash-alert-tile.state-clear .alert-dot {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}
.dash-alert-tile.state-alert {
  border-color: rgba(229, 57, 53, 0.5);
  border-left-color: #e53935;
  background:
    linear-gradient(180deg, rgba(229, 57, 53, 0.13) 0%, rgba(255, 255, 255, 0.02) 55%),
    var(--card-bg);
  animation: alertPulseCard 1.6s ease-in-out infinite;
}
.dash-alert-tile.state-alert .alert-dot {
  background: #e53935;
  animation: alertBlink 1s steps(2, start) infinite;
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.8);
}
.dash-alert-tile.state-alert .alert-title,
.dash-alert-tile.state-alert .alert-since { color: #fca5a5; }
.dash-alert-tile.state-alert .alert-meta { color: #f3b6b4; }
.dash-alert-tile.state-loading .alert-dot {
  background: var(--accent-strong);
  animation: alertBreathe 1.2s ease-in-out infinite;
}
.dash-alert-tile.state-loading .alert-title { color: var(--text-muted); }
.dash-alert-tile.state-off .alert-dot { background: var(--text-muted); }

/* Activity chart (admin dashboard) */
.dash-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  margin-top: 12px;
  max-width: 100%;
}
.dash-chart-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
  min-width: 0;
  max-width: 100%;
}
.dash-chart-val {
  font-size: 9.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.dash-chart-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  min-height: 3px;
  transition: height 0.3s ease;
}
.dash-chart-bar.is-today {
  background: linear-gradient(180deg, #16a34a, #22c55e);
}
.dash-chart-label {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1;
}

.admin-apply {
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  border: none;
  border-radius: 14px;
  background: var(--accent-strong);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  padding: 11px 16px;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: filter 0.12s ease, transform 0.1s ease;
}
.admin-apply:active {
  filter: brightness(0.9);
  transform: scale(0.97);
}
.admin-apply-danger {
  background: #dc2626;
  color: #ffffff;
}
.admin-apply-danger:active {
  background: #b91c1c;
}

.admin-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 100%;
}
.admin-form-actions .admin-apply,
.admin-form-actions .admin-cancel-btn {
  flex: 1 1 0;
  min-width: 0;
}

.admin-form-error {
  font-size: 12px;
  line-height: 1.4;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.32);
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.admin-form-error[hidden] {
  display: none;
}

.admin-confirm-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.admin-confirm-warning {
  font-size: 12px;
  line-height: 1.45;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.admin-confirm-warning[hidden] {
  display: none;
}

.admin-code-success {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 100%;
}
.admin-code-success[hidden] {
  display: none;
}
.admin-code-value {
  border: 1px dashed var(--accent-strong);
  background: var(--accent-tint);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  max-width: 100%;
}
.admin-code-value code {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;
  color: var(--text-title);
  overflow-wrap: anywhere;
  word-break: break-all;
}

.code-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.code-value {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-title);
  overflow-wrap: anywhere;
  word-break: break-all;
}
.code-status {
  margin-left: auto;
}

.admin-title-count {
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.admin-title-count[hidden] {
  display: none;
}

.user-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.user-card-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.3;
}
.user-card-top .status-pill {
  margin-left: 0;
  flex: 0 0 auto;
  font-size: 11px;
  padding: 2px 10px;
}
.user-card {
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.45;
}
.user-card .meta {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary, var(--text-muted));
  overflow-wrap: anywhere;
}
.user-card .meta + .meta {
  margin-top: 2px;
}
.user-card-group {
  color: var(--text-primary) !important;
  font-weight: 600;
}
.user-card .meta .icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.12em;
  opacity: 0.7;
}
.code-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 100%;
}
.code-card-actions .tool-btn {
  flex: 1 1 130px;
  min-width: 0;
}

.admin-report-textarea {
  width: 100%;
  max-width: 100%;
  min-height: 96px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.admin-report-counter {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  max-width: 100%;
}

.icon {
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: middle;
}

button,
a[href],
select,
input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 44px;
}

.switch input {
  min-height: 0;
}

.hero-actions .btn,
.lesson-resource-button,
.admin-modal-close,
.week-nav-btn {
  min-height: 44px;
}

.hero-actions .btn {
  min-height: 36px;
}

.lesson-resource-button {
  min-height: 22px;
  height: 22px;
}

.lesson-resource-inline > .lesson-resource-button.zoom-button,
.lesson-resource-inline > .lesson-resource-button.meet-button {
  width: auto;
}

.admin-modal-sheet {
  max-height: min(78vh, 640px);
  max-height: min(78dvh, 640px);
}

.admin-info-card.is-clickable {
  display: block;
  width: 100%;
  color: var(--text-primary);
  text-align: left;
}
.admin-info-card.is-clickable strong,
.admin-info-card.is-clickable .meta {
  display: block;
}

:where(button, a, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

.connection-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
  font-size: 12px;
  line-height: 1.4;
  max-width: 100%;
  min-width: 0;
}

#connection-message {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.connection-retry {
  flex: 0 0 auto;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(245, 158, 11, 0.12);
  color: #fef3c7;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.updated-at.is-stale {
  color: #fbbf24;
}

.error-card .tool-btn {
  margin-top: 16px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
