:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-soft: rgba(255, 255, 255, 0.035);
  --panel: #1c1c1e;
  --panel-strong: #242426;
  --border: rgba(255, 255, 255, 0.105);
  --border-strong: rgba(255, 255, 255, 0.20);
  --text: #f5f5f7;
  --muted: rgba(235, 235, 245, 0.54);
  --muted-strong: rgba(245, 245, 247, 0.70);
  --accent: #0a84ff;
  --accent-2: #64d2ff;
  --success: #30d158;
  --warning: #ffd60a;
  --danger: #ff453a;
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --shadow-glass: 0 18px 48px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --shadow-elevated: 0 26px 70px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --nav-glass:
    linear-gradient(135deg, rgba(62, 62, 66, 0.42), rgba(28, 28, 30, 0.28)),
    rgba(28, 28, 30, 0.46);
  --nav-glass-border: rgba(255, 255, 255, 0.16);
  --nav-glass-shadow:
    0 24px 70px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  --font-display: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-body: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-left: 244px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: padding-left var(--transition), padding-top var(--transition);
}

body.sidebar-collapsed {
  padding-left: 76px;
}

body.sidebar-top {
  padding-left: 0;
  padding-top: 88px;
}

body.sidebar-layout-switching .site-header {
  transition: none !important;
}

body.light-theme {
  color-scheme: light;
  --bg: #f2f1f7;
  --surface: #ffffff;
  --surface-soft: rgba(0, 0, 0, 0.035);
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --border: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text: #1d1d1f;
  --muted: rgba(60, 60, 67, 0.70);
  --muted-strong: rgba(60, 60, 67, 0.86);
  --shadow-glass: 0 18px 48px rgba(27, 31, 40, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --shadow-elevated: 0 28px 76px rgba(27, 31, 40, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  --nav-glass:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(238, 243, 250, 0.42) 50%, rgba(226, 236, 250, 0.46)),
    rgba(255, 255, 255, 0.54);
  --nav-glass-border: rgba(255, 255, 255, 0.76);
  --nav-glass-shadow:
    0 24px 70px rgba(58, 72, 96, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  background: var(--bg);
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) {
  padding-left: 0;
  padding-top: 0;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: #64d2ff;
}

.site-header {
  position: fixed;
  top: 1rem;
  left: 1rem;
  bottom: 1rem;
  z-index: 20;
  width: 220px;
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 1.2rem 0.75rem;
  background: var(--nav-glass);
  border: 1px solid var(--nav-glass-border);
  border-radius: 24px;
  box-shadow: var(--nav-glass-shadow);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  transition: width var(--transition), padding var(--transition), opacity var(--transition), transform var(--transition), border-radius var(--transition), min-height var(--transition), left var(--transition), top var(--transition), bottom var(--transition);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 42%);
  opacity: 0.82;
  pointer-events: none;
}

.site-brand {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-brand-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle,
.sidebar-toggle {
  position: relative;
  width: 38px;
  min-height: 38px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 10px 24px rgba(0, 0, 0, 0.16);
}

.theme-toggle {
  position: relative;
}

.theme-icon {
  position: absolute;
  transition: opacity var(--transition), transform var(--transition);
}

.theme-icon.moon,
body.light-theme .theme-icon.sun {
  opacity: 0;
  transform: scale(0.72) rotate(-18deg);
}

body.light-theme .theme-icon.moon {
  opacity: 1;
  transform: scale(1) rotate(0);
}

body.light-theme .site-header {
  background: var(--nav-glass);
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: var(--nav-glass-shadow);
}

body.light-theme .site-header,
body.light-theme .panel,
body.light-theme .auth-box,
body.light-theme .modal-card {
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
}

body.light-theme .theme-toggle,
body.light-theme .sidebar-toggle,
body.light-theme .nav-user {
  border-color: rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 10px 24px rgba(40, 50, 68, 0.10);
}

body.sidebar-collapsed .site-header {
  width: 60px;
  padding: 0.9rem 0.45rem;
  border-radius: 20px;
}

body.sidebar-collapsed .site-brand {
  display: grid;
  justify-items: center;
  justify-content: center;
  gap: 0.6rem;
}

body.sidebar-collapsed .site-brand-actions {
  display: grid;
  gap: 0.45rem;
}

body.sidebar-collapsed .logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  font-size: 0;
  text-align: center;
}

body:not(.light-theme).sidebar-collapsed .logo {
  background: transparent;
  box-shadow: none;
}

body.sidebar-collapsed .logo::before {
  content: "W";
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  width: auto;
  min-height: 48px;
  flex-direction: row;
  justify-content: space-between;
  padding: 0 1.25rem;
  opacity: 0.08;
  transform: translateY(-34px);
  border-right: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-header {
  background: rgba(246, 246, 248, 0.78);
  border-bottom-color: rgba(0, 0, 0, 0.09);
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-header:hover,
body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-header:focus-within {
  opacity: 1;
  transform: translateY(0);
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-brand {
  width: auto;
  display: flex;
  justify-items: initial;
  justify-content: flex-start;
  gap: 0.75rem;
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-brand-actions {
  display: inline-flex;
}

body.sidebar-collapsed:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .logo {
  width: auto;
  height: auto;
  display: inline;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: 1.55rem;
}

body.sidebar-collapsed:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .logo::before {
  content: none;
}

.logo {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 760;
  letter-spacing: 0;
  white-space: nowrap;
  transition: width var(--transition), font-size var(--transition);
}

.nav {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.nav a,
.nav-user,
.btn-link {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.62rem;
  border-radius: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0 0.72rem;
}

.nav a::before,
.btn-link::before {
  content: "";
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  background: currentColor;
  color: var(--muted-strong);
  -webkit-mask: var(--nav-icon) center / 18px 18px no-repeat;
  mask: var(--nav-icon) center / 18px 18px no-repeat;
}

.nav a[href="/dashboard"]::before {
  content: "К";
}

.nav a[href="/schedule"]::before {
  content: "Р";
}

.nav a[href="/boards"]::before {
  content: "Д";
}

.nav a[href="/chat"]::before {
  content: "Ч";
}

.nav a[href="/login"]::before {
  content: "→";
}

.nav a[href="/register"]::before {
  content: "+";
}

.btn-link::before {
  content: "⎋";
}

.nav a[href="/dashboard"]::before {
  content: "";
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11.5 12 4l9 7.5'/%3E%3Cpath d='M5 10.5V20h14v-9.5'/%3E%3Cpath d='M9.5 20v-6h5v6'/%3E%3C/svg%3E");
}

.nav a[href="/schedule"]::before {
  content: "";
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

.nav a[href="/boards"]::before {
  content: "";
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='12' rx='2'/%3E%3Cpath d='M8 20h8'/%3E%3Cpath d='M12 16v4'/%3E%3Cpath d='M8 8h8M8 11h5'/%3E%3C/svg%3E");
}

.nav a[href="/chat"]::before {
  content: "";
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-8 8H7l-4 3 1.3-5.2A8 8 0 1 1 21 12Z'/%3E%3C/svg%3E");
}

.nav a[href="/login"]::before {
  content: "";
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpath d='M10 17l5-5-5-5'/%3E%3Cpath d='M15 12H3'/%3E%3C/svg%3E");
}

.nav a[href="/register"]::before {
  content: "";
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M19 8v6'/%3E%3Cpath d='M22 11h-6'/%3E%3C/svg%3E");
}

.btn-link::before {
  content: "";
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='M16 17l5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E");
}

.nav a.has-unread::after,
.chat-row.has-unread::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(10, 10, 12, 0.92);
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.nav a.has-unread::after {
  top: -0.35rem;
  right: -0.55rem;
}

.nav a.active,
.nav a:hover,
.btn-link:hover {
  color: var(--text);
}

.nav a.active,
.nav a:hover,
.btn-link:hover {
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.075);
}

.nav-user {
  margin-top: 0;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#logoutButton {
  margin-top: auto;
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .btn-link,
body.sidebar-collapsed .nav-user {
  width: 42px;
  min-height: 42px;
  justify-content: center;
  overflow: visible;
  padding: 0;
  color: var(--muted-strong);
  font-size: 0;
  gap: 0;
  white-space: nowrap;
}

body.sidebar-collapsed .nav a::before,
body.sidebar-collapsed .btn-link::before {
  content: "";
  width: 22px;
  min-width: 22px;
  height: 22px;
  background-color: currentColor;
  -webkit-mask-image: var(--nav-icon);
  -webkit-mask-position: center;
  -webkit-mask-size: 18px 18px;
  -webkit-mask-repeat: no-repeat;
  mask-image: var(--nav-icon);
  mask-position: center;
  mask-size: 18px 18px;
  mask-repeat: no-repeat;
}

body.sidebar-collapsed .nav a.active,
body.sidebar-collapsed .nav a:hover,
body.sidebar-collapsed .btn-link:hover {
  color: var(--text);
}

body.sidebar-collapsed .nav a.active {
  border-color: rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.055)),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 10px 26px rgba(0, 0, 0, 0.18);
}

body.sidebar-collapsed .nav a:hover,
body.sidebar-collapsed .btn-link:hover {
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.sidebar-collapsed .nav a.active::before,
body.sidebar-collapsed .nav a:hover::before,
body.sidebar-collapsed .btn-link:hover::before {
  background-color: currentColor;
}

body.sidebar-collapsed .nav-user {
  display: none;
}

body.sidebar-collapsed .nav {
  overflow: visible;
}

body.sidebar-collapsed .nav a.has-unread::after {
  top: 0.45rem;
  right: 0.45rem;
}

body.sidebar-collapsed .nav a[aria-label]::after,
body.sidebar-collapsed .btn-link[aria-label]::after,
body.sidebar-collapsed .theme-toggle[aria-label]::after,
body.sidebar-collapsed .sidebar-toggle[aria-label]::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(100% + 0.65rem);
  top: 50%;
  z-index: 60;
  width: max-content;
  max-width: 220px;
  padding: 0.45rem 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(24, 25, 30, 0.94);
  color: var(--text);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-4px, -50%);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: nowrap;
}

body.sidebar-collapsed .nav a[aria-label]:hover::after,
body.sidebar-collapsed .nav a[aria-label]:focus-visible::after,
body.sidebar-collapsed .btn-link[aria-label]:hover::after,
body.sidebar-collapsed .btn-link[aria-label]:focus-visible::after,
body.sidebar-collapsed .theme-toggle[aria-label]:hover::after,
body.sidebar-collapsed .theme-toggle[aria-label]:focus-visible::after,
body.sidebar-collapsed .sidebar-toggle[aria-label]:hover::after,
body.sidebar-collapsed .sidebar-toggle[aria-label]:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

body.light-theme.sidebar-collapsed .nav a[aria-label]::after,
body.light-theme.sidebar-collapsed .btn-link[aria-label]::after,
body.light-theme.sidebar-collapsed .theme-toggle[aria-label]::after,
body.light-theme.sidebar-collapsed .sidebar-toggle[aria-label]::after {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
  color: #1d1d1f;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .site-header {
  top: 1rem;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(760px, calc(100vw - 2rem));
  min-height: 58px;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 999px;
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  transform: translateX(-50%);
}

body.light-theme.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .site-header {
  box-shadow:
    0 18px 54px rgba(50, 64, 88, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(0, 0, 0, 0.035);
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .site-brand {
  width: auto;
  flex: 0 0 auto;
  gap: 0.35rem;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .logo::before {
  content: "W";
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
}

body.light-theme.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .logo {
  background: rgba(0, 0, 0, 0.055);
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .site-brand-actions {
  gap: 0.3rem;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .theme-toggle,
body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .sidebar-toggle {
  width: 38px;
  min-height: 38px;
  border-radius: 50%;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .nav {
  width: auto;
  flex: 0 1 auto;
  min-height: auto;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .nav a,
body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .btn-link {
  width: auto;
  min-height: 38px;
  justify-content: center;
  padding: 0 0.9rem;
  border-radius: 999px;
  font-size: 0.92rem;
  gap: 0;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .nav a::before,
body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .btn-link::before {
  content: none;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .nav-user {
  display: none;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) #logoutButton {
  margin-top: 0;
}

body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .nav a.has-unread::after {
  top: 0.35rem;
  right: 0.5rem;
}

@keyframes sidebarJellySide {
  0% {
    transform: translateX(-18px) scale(0.965);
  }

  58% {
    transform: translateX(6px) scale(1.014);
  }

  100% {
    transform: translateX(0) scale(1);
  }
}

@keyframes sidebarJellyTop {
  0% {
    transform: translateX(-50%) translateY(-18px) scale(0.945);
  }

  58% {
    transform: translateX(-50%) translateY(5px) scale(1.018);
  }

  100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

body.sidebar-jelly.sidebar-side:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .site-header {
  animation: sidebarJellySide 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-jelly.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .site-header {
  animation: sidebarJellyTop 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-brand {
  width: auto;
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .logo {
  width: auto;
  overflow: visible;
  color: var(--text);
  font-size: 1.7rem;
}

body.sidebar-collapsed:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .logo::before {
  content: none;
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .sidebar-toggle {
  display: none;
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .nav {
  width: auto;
  flex-direction: row;
  gap: 0.65rem;
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .nav a,
body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .btn-link,
body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .nav-user {
  width: auto;
  min-height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .nav a::before,
body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .btn-link::before {
  content: none;
}

body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .nav-user {
  margin-top: 0;
  padding-left: 0.9rem;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.container {
  width: min(1200px, 100%);
  min-height: calc(100vh - 148px);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.container:has(#schedulePage:not(.hidden)) {
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

.container:has(#chatPage:not(.hidden)) {
  width: min(1320px, 100%);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 2rem 1.5rem;
}

.container:has(#chatPage:not(.hidden)) #chatPage {
  height: 100%;
  min-height: 0;
  display: grid;
}

.container:has(#chatPage:not(.hidden)) #chatPage > .hero {
  display: none;
}

.container:has(#dashboardPage:not(.hidden)) {
  width: min(1440px, calc(100% - 2rem));
  min-height: calc(100vh - 2rem);
  margin: 1rem auto;
  padding: 3.2rem 2.4rem 2.4rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.container:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) {
  width: 100%;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.container:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) #lessonPage {
  height: 100%;
  min-height: 0;
}

.page {
  animation: fadeSlideIn 0.35s ease both;
}

.hero {
  margin-bottom: 1.75rem;
}

#dashboardPage > .hero {
  margin-bottom: 1.45rem;
}

#dashboardPage > .hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 650;
  color: rgba(245, 245, 247, 0.92);
  text-shadow: none;
}

#dashboardPage > .hero h1::after {
  content: " 👋";
  font-size: 0.82em;
}

#dashboardPage > .hero .lead {
  max-width: 720px;
  color: rgba(235, 235, 245, 0.56);
  font-size: 0.98rem;
}

.dashboard-profile-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dashboard-profile-hero > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.dashboard-profile-hero .profile-avatar-preview {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  font-size: 1.35rem;
}

.dashboard-profile-hero .btn {
  flex: 0 0 auto;
}

.dashboard-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.period-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.period-toggle button {
  min-height: 34px;
  padding: 0 0.85rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: rgba(235, 235, 245, 0.58);
  font-size: 0.84rem;
  font-weight: 750;
}

.period-toggle button.active {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(245, 245, 247, 0.94);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

#dashboardPage > .hero h1::after {
  content: none;
}

.hero h1,
.auth-box h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0;
}

.lead,
.muted,
.hint,
.form-footer {
  color: var(--muted);
}

.lead {
  max-width: 660px;
  margin: 0.65rem 0 0;
  font-size: 1.05rem;
}

.panel,
.auth-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#dashboardPage .panel {
  border-color: rgba(255, 255, 255, 0.105);
  background: #1c1c1e;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.panel::before,
.auth-box::before,
.modal-card::before {
  content: none;
  position: absolute;
  left: 1rem;
  right: 1rem;
  top: 0;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

.panel {
  padding: 1.45rem;
}

.auth-box {
  width: min(430px, 100%);
  margin: 2rem auto;
  padding: 2rem;
  box-shadow: var(--shadow-elevated);
}

.auth-box-wide {
  width: min(520px, 100%);
}

.auth-box h1 {
  text-align: center;
  font-size: 2.25rem;
  margin-bottom: 1.6rem;
}

.form,
.inline-form,
.lesson-form,
.message-form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  padding: 0 0.9rem;
  outline: none;
  transition: all var(--transition);
}

select option {
  background: #141418;
  color: var(--text);
}

body.light-theme select option {
  background: #ffffff;
  color: #1d1d1f;
}

input:focus,
select:focus {
  border-color: rgba(10, 132, 255, 0.68);
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.18);
}

button,
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  cursor: pointer;
  font-weight: 600;
  padding: 0 1.05rem;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

button:hover,
.btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.11);
  transform: translateY(-1px);
}

body.light-theme input,
body.light-theme select {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #1d1d1f;
}

body.light-theme input:focus,
body.light-theme select:focus {
  background: rgba(255, 255, 255, 0.92);
}

body.light-theme button,
body.light-theme .btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #1d1d1f;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 12px 30px rgba(27, 31, 40, 0.08);
}

body.light-theme button:hover,
body.light-theme .btn:hover {
  background: #f8f8fa;
  border-color: rgba(0, 0, 0, 0.18);
}

button:active,
.btn:active {
  transform: scale(0.97);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: wait;
  opacity: 0.62;
}

.btn-sm {
  min-height: 36px;
  padding: 0 0.9rem;
  font-size: 0.82rem;
}

.btn-link {
  min-height: auto;
  border: 0;
  background: none;
  box-shadow: none;
  padding: 0;
}

.btn-link:hover {
  background: none;
  transform: none;
}

.form-footer {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.92rem;
}

.role-picker {
  display: grid;
  gap: 0.7rem;
  border: 0;
  padding: 0;
  margin: 0;
}

.role-picker legend {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.radio-card {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
}

.radio-card input {
  width: auto;
  min-height: auto;
}

.landing-page {
  display: grid;
  gap: 1.4rem;
}

.landing-hero {
  min-height: min(680px, calc(100vh - 5rem));
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  align-items: center;
  gap: 2rem;
}

.landing-copy {
  display: grid;
  gap: 1.05rem;
  max-width: 650px;
}

.landing-kicker {
  width: fit-content;
  padding: 0.36rem 0.62rem;
  border: 1px solid rgba(10, 132, 255, 0.32);
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 760;
}

.landing-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.landing-copy p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.045);
}

.landing-preview {
  min-height: 460px;
  display: grid;
  align-items: center;
}

.landing-window {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.035)),
    rgba(18, 19, 24, 0.76);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
}

.landing-window-head {
  display: flex;
  gap: 0.45rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.landing-window-head span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.landing-window-head span:nth-child(1) { background: #ff5f57; }
.landing-window-head span:nth-child(2) { background: #ffbd2e; }
.landing-window-head span:nth-child(3) { background: #28c840; }

.landing-board-preview {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 24% 20%, rgba(10, 132, 255, 0.16), transparent 32%),
    #08090d;
  background-size: 28px 28px, 28px 28px, auto, auto;
}

.landing-stroke {
  position: absolute;
  height: 7px;
  border-radius: 999px;
  background: rgba(245, 245, 247, 0.92);
  transform-origin: left center;
}

.landing-stroke.one {
  width: 250px;
  left: 18%;
  top: 38%;
  transform: rotate(-12deg);
}

.landing-stroke.two {
  width: 190px;
  left: 45%;
  top: 58%;
  transform: rotate(18deg);
}

.landing-card-mini,
.landing-chat-mini {
  position: absolute;
  display: grid;
  gap: 0.18rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.landing-card-mini {
  right: 9%;
  top: 14%;
}

.landing-chat-mini {
  left: 11%;
  bottom: 14%;
}

.landing-card-mini span,
.landing-chat-mini span {
  color: var(--muted);
  font-size: 0.78rem;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.landing-features article {
  min-height: 140px;
  display: grid;
  align-content: start;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: var(--shadow-glass);
}

.landing-features strong {
  font-size: 1rem;
}

.landing-features span {
  color: var(--muted);
  font-size: 0.88rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.student-dashboard .dashboard-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.student-dashboard .dashboard-grid .panel:first-child {
  grid-column: 1 / -1;
}

.student-dashboard .dashboard-grid .panel:first-child .student-card {
  grid-template-columns: minmax(0, 1.2fr) auto;
  align-items: center;
}

.student-dashboard .dashboard-grid .panel:first-child .student-card-actions {
  justify-content: flex-end;
}

.student-dashboard .dashboard-grid .panel:first-child .student-learning-summary {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 1.1rem;
  padding: 1.2rem 0.85rem;
}

.student-learning-info {
  display: grid;
  gap: 0.32rem;
  min-width: 0;
}

.student-learning-info strong {
  font-size: 1.05rem;
}

.student-learning-info span {
  color: rgba(143, 199, 255, 0.88);
  font-weight: 750;
}

.student-learning-info small {
  color: rgba(235, 235, 245, 0.52);
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.student-learning-summary .student-card-meta {
  justify-content: flex-end;
  min-width: max-content;
  padding: 0 1.05rem;
  border-left: 1px solid rgba(255, 255, 255, 0.085);
  border-right: 1px solid rgba(255, 255, 255, 0.085);
}

.student-learning-summary .student-card-actions {
  flex-wrap: nowrap;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 1rem;
  margin-bottom: 1.55rem;
}

.dash-stat {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  min-width: 0;
  min-height: 92px;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 24px;
  background: #1c1c1e;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.dash-stat i {
  width: 50px;
  min-width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.92), rgba(41, 98, 255, 0.76));
  box-shadow: 0 12px 28px rgba(10, 132, 255, 0.22);
}

.dash-stat i::before {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.dash-stat-students i::before { content: "👥"; }
.dash-stat-subjects i::before { content: "📖"; }
.dash-stat-planned i::before { content: "▦"; }
.dash-stat-completed i::before { content: "✓"; }
.dash-stat-next i::before { content: "◴"; }
.dash-stat-notifications i::before { content: "⌁"; }

.dash-stat-subjects i {
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.92), rgba(20, 184, 166, 0.72));
  box-shadow: 0 12px 28px rgba(45, 212, 191, 0.16);
}

.dash-stat-planned i {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.92), rgba(124, 58, 237, 0.72));
  box-shadow: 0 12px 28px rgba(168, 85, 247, 0.18);
}

.dash-stat-completed i {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.92), rgba(194, 65, 12, 0.74));
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.18);
}

.dash-stat-next i {
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.94), rgba(202, 138, 4, 0.74));
  box-shadow: 0 12px 28px rgba(250, 204, 21, 0.15);
}

.dash-stat-notifications i {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.92), rgba(37, 99, 235, 0.72));
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.16);
}

.dash-stat strong {
  display: block;
  color: rgba(245, 245, 247, 0.92);
  font-size: clamp(1.22rem, 1.6vw, 1.45rem);
  line-height: 1.08;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dash-stat span {
  display: block;
  margin-top: 0.18rem;
  color: rgba(235, 235, 245, 0.54);
  font-size: clamp(0.74rem, 1.1vw, 0.82rem);
  font-weight: 650;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dash-stat > div {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
}

.invite-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
  gap: 1.25rem;
  align-items: end;
  margin-bottom: 1.25rem;
}

.invite-actions,
.inline-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
}

#subjectForm.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 1rem;
}

#subjectForm input {
  min-height: 44px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.10);
}

#subjectForm button,
#openInviteModalButton {
  border-color: rgba(10, 132, 255, 0.38);
  background: rgba(10, 132, 255, 0.18);
  color: #fff;
}

.profile-panel {
  margin-bottom: 1.35rem;
}

.profile-modal-card {
  max-width: 620px;
}

.profile-form {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 0.85rem;
  align-items: end;
}

.profile-form-modal {
  grid-template-columns: 1fr;
  align-items: stretch;
  margin-top: 1rem;
}

.profile-form-modal .profile-avatar-block {
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.profile-avatar-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-avatar-preview {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.95), rgba(79, 70, 229, 0.88));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.profile-avatar-preview img,
.student-avatar img,
.chat-row-avatar img,
.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-actions {
  display: grid;
  gap: 0.45rem;
}

.profile-form label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-weight: 700;
}

.profile-form input:not([type="file"]) {
  min-height: 44px;
  border-radius: 12px;
}

.invite-modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  margin-top: 1rem;
}

.student-card,
.subject-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 0.7rem;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.student-card:first-of-type,
.subject-card:first-of-type {
  border-top: 0;
  padding-top: 0.4rem;
}

.student-card {
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
}

.subject-card {
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  position: relative;
}

.student-card-clickable {
  cursor: pointer;
}

.student-card-clickable:hover {
  background: rgba(255, 255, 255, 0.035);
  border-radius: 18px;
}

.student-card.archived {
  opacity: 0.74;
  border-style: dashed;
}

.student-card strong,
.subject-card strong {
  color: rgba(245, 245, 247, 0.90);
  font-size: 1rem;
}

.student-card-title {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  min-width: 0;
}

.student-card-title > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-card-main,
.subject-card-main {
  min-width: 0;
  display: grid;
  gap: 0.38rem;
}

.student-avatar,
.subject-icon {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.student-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6288ff, #3347e9);
  overflow: hidden;
}

.student-card:nth-child(3n + 1) .student-avatar:not(.has-image) {
  background: linear-gradient(180deg, #34d399, #15803d);
}

.student-card:nth-child(3n + 2) .student-avatar:not(.has-image) {
  background: linear-gradient(180deg, #a855f7, #6b21a8);
}

.subject-delete-button {
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.72);
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.subject-card:hover .subject-delete-button,
.subject-delete-button:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.subject-delete-button:hover {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

.subject-icon {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.78), rgba(88, 28, 135, 0.72));
  font-size: 1.35rem;
}

.subject-card:nth-child(3n + 1) .subject-icon {
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.78), rgba(29, 78, 216, 0.72));
}

.subject-card:nth-child(3n + 2) .subject-icon {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.78), rgba(21, 128, 61, 0.72));
}

.student-card span,
.subject-card span,
.student-card p {
  margin: 0;
  color: rgba(235, 235, 245, 0.52);
  font-size: 0.88rem;
}

.student-label {
  display: inline-flex;
  width: fit-content;
  margin-top: 0.45rem;
  padding: 0.24rem 0.5rem;
  border: 1px solid rgba(10, 132, 255, 0.34);
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.13);
  color: rgba(245, 245, 247, 0.86);
  font-size: 0.78rem;
  font-style: normal;
}

.student-label.inline {
  margin-top: 0;
  margin-left: 0.35rem;
  vertical-align: 0.08em;
}

.lesson-block .student-label.inline,
.chat-row-main .student-label.inline {
  padding: 0.12rem 0.38rem;
  font-size: 0.68rem;
}

.student-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.student-card-meta span {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem 0;
  border-radius: 999px;
  background: transparent;
}

.student-card-meta span:first-child {
  color: #8fc7ff;
  background: transparent;
}

.student-card-meta span:nth-child(2) {
  color: #7ee2a8;
  background: transparent;
}

.student-card-meta b {
  color: inherit;
}

.student-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.student-card-actions .link-button {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.08);
}

.student-card-actions .link-button::before {
  content: "";
  width: 18px;
  height: 18px;
  background: rgba(245, 245, 247, 0.86);
  -webkit-mask: var(--action-icon) center / 18px 18px no-repeat;
  mask: var(--action-icon) center / 18px 18px no-repeat;
}

.student-card-actions .link-button[data-student-schedule],
.student-card-actions .link-button[data-open-schedule] {
  --action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}

.student-card-actions .link-button[data-student-chat],
.student-card-actions .link-button[data-open-chat] {
  --action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-8 8H7l-4 3 1.3-5.2A8 8 0 1 1 21 12Z'/%3E%3C/svg%3E");
}

.link-button {
  min-height: 34px;
  padding: 0 0.75rem;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  font-size: 0.86rem;
}

.student-profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0;
}

.student-profile-stats div {
  display: grid;
  gap: 0.18rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
}

.student-profile-stats strong {
  color: var(--text);
  font-size: 1.05rem;
}

.student-profile-stats span {
  color: var(--muted);
  font-size: 0.82rem;
}

.student-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.student-profile-grid section {
  display: grid;
  gap: 0.5rem;
}

.student-profile-grid .wide {
  grid-column: 1 / -1;
}

.student-profile-grid h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.compact-list {
  display: grid;
  gap: 0.45rem;
}

.student-profile-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
}

.student-profile-avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
}

.student-profile-head h2 {
  margin: 0 2rem 0.35rem 0;
}

.student-profile-actions {
  display: flex;
  gap: 0.55rem;
}

.student-label-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
  margin: 0.75rem 0;
}

.student-label-form label {
  gap: 0.35rem;
}

.student-label-form button {
  min-height: 46px;
}

.subject-chip-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.subject-assignment-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.subject-toggle {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.84rem;
}

.subject-toggle input {
  width: 16px;
  height: 16px;
  min-height: 0;
  accent-color: var(--accent);
}

.subject-toggle:has(input:checked) {
  border-color: rgba(10, 132, 255, 0.38);
  background: rgba(10, 132, 255, 0.13);
  color: var(--text);
}

.subject-toggle.readonly {
  display: block;
}

.compact-list > span,
.compact-lesson-line {
  width: 100%;
  display: grid;
  gap: 0.12rem;
  justify-items: start;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
  text-align: left;
}

.student-profile-grid .wide .compact-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-lesson-line strong {
  color: var(--text);
}

.compact-lesson-line span,
.compact-list > span {
  color: var(--muted);
  font-size: 0.84rem;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 1rem;
}

.lesson-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1.3rem;
}

.lesson-form button {
  grid-column: span 2;
}

.list,
.timeline {
  display: grid;
  gap: 0.8rem;
}

.boards-panel {
  max-width: 980px;
}

.boards-list {
  display: grid;
  gap: 0.8rem;
}

.board-card {
  width: 100%;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.board-card:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 132, 255, 0.42);
  background: rgba(255, 255, 255, 0.075);
}

.board-card-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, #0a84ff, #8b5cf6);
  color: #fff;
  box-shadow: 0 14px 32px rgba(10, 132, 255, 0.20);
}

.board-card-main {
  min-width: 0;
  display: grid;
  gap: 0.22rem;
}

.board-card-main strong {
  font-size: 1.04rem;
}

.board-card-main em,
.board-card-main small {
  color: var(--muted);
  font-style: normal;
}

body.light-theme .board-card {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(28, 32, 39, 0.12);
  color: #1d1d1f;
}

body.light-theme .board-card:hover {
  background: #fff;
  border-color: rgba(10, 132, 255, 0.32);
}

.item,
.timeline-item,
.chat-row,
.message {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
}

.chat-history-marker {
  justify-self: center;
  width: fit-content;
  margin: 0.2rem auto 0.55rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.76rem;
}

.item {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem;
}

.item strong,
.timeline-item strong,
.chat-row strong {
  color: var(--text);
}

.item span,
.timeline-item span,
.chat-row span,
.message span {
  color: var(--muted);
  font-size: 0.86rem;
}

.notification-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  cursor: pointer;
}

.notification-item.unread {
  border-color: rgba(10, 132, 255, 0.34);
  background: rgba(10, 132, 255, 0.10);
}

.notification-main {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.notification-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-main small,
.notification-state {
  color: var(--muted);
  font-size: 0.76rem;
}

.notification-state {
  opacity: 0.76;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(10, 132, 255, 0.36);
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.16);
  color: #d8ecff;
  padding: 0.22rem 0.58rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.timeline-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem;
}

.timeline-item.done {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.12);
}

.timeline-item.planned {
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.12);
}

.timeline-item.late {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
}

.date-pill {
  display: grid;
  justify-items: center;
  min-width: 78px;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-md);
  background: rgba(10, 132, 255, 0.13);
  border: 1px solid rgba(10, 132, 255, 0.24);
}

.date-pill strong {
  font-size: 0.95rem;
}

.date-pill span {
  color: #bfdbfe;
}

.schedule-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: calc(100vh - 2rem);
  margin: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  background: #1c1c1e;
}

.schedule-sidebar {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: 0.65rem;
  background:
    linear-gradient(135deg, rgba(62, 62, 66, 0.38), rgba(28, 28, 30, 0.28)),
    rgba(28, 28, 30, 0.48);
  border-right: 1px solid rgba(255, 255, 255, 0.095);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.035), 16px 0 42px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(34px) saturate(170%);
  -webkit-backdrop-filter: blur(34px) saturate(170%);
}

.mini-calendar-panel {
  padding: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.mini-calendar-head {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.mini-calendar-head strong {
  font-size: 0.95rem;
  text-align: center;
  text-transform: capitalize;
}

.icon-btn {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: none;
}

.mini-weekdays,
.mini-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.mini-calendar-grid {
  gap: 0.18rem 0;
}

.mini-weekdays span {
  padding: 0.28rem 0 0.45rem;
  color: rgba(235, 235, 245, 0.56);
  font-size: 0.68rem;
  font-weight: 760;
  text-align: center;
  text-transform: uppercase;
}

.mini-day {
  position: relative;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(245, 245, 247, 0.88);
  padding: 0;
  font-weight: 720;
}

.mini-day:hover {
  background: transparent;
  transform: none;
}

.mini-day.muted-day {
  color: rgba(235, 235, 245, 0.32);
}

.mini-day.selected {
  background: transparent;
  outline: 0;
}

.mini-day span {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 3px auto 0;
  border-radius: 50%;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.mini-day:hover span {
  background: rgba(255, 255, 255, 0.08);
}

.mini-day.selected span {
  background: linear-gradient(180deg, #0a84ff, #006bd6);
  color: #fff;
  box-shadow: 0 8px 20px rgba(10, 132, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.mini-day.today span {
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.58);
}

.mini-day.today:not(.selected) span {
  background: rgba(10, 132, 255, 0.13);
}

.mini-day i {
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  transform: translateX(-50%);
  z-index: 2;
}

.month-stats {
  display: grid;
  gap: 0.55rem;
  margin-top: 0;
  padding: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.month-stats strong {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.month-stats span {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: rgba(235, 235, 245, 0.68);
  font-size: 0.86rem;
}

.month-stats b {
  color: var(--text);
}

.schedule-tools {
  display: grid;
  gap: 1rem;
  padding: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.10);
}

.schedule-tools h2 {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.schedule-tools label {
  color: rgba(235, 235, 245, 0.70);
}

.schedule-tools input,
.schedule-tools select {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.schedule-tools input:focus,
.schedule-tools select:focus {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.11);
}

.schedule-tools .lesson-form {
  grid-template-columns: 1fr;
  margin: 0;
}

.schedule-tools .lesson-form button {
  grid-column: auto;
}

.repeat-options {
  display: grid;
  grid-column: 1 / -1;
  gap: 0.75rem;
  min-width: 0;
}

.repeat-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.repeat-days label {
  display: block;
  min-width: 0;
}

.repeat-days input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.repeat-days span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(235, 235, 245, 0.74);
  font-size: 0.82rem;
  font-weight: 800;
}

.repeat-days input:checked + span {
  border-color: rgba(59, 130, 246, 0.82);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.72), rgba(139, 92, 246, 0.58));
  color: #fff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

.week-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0.75rem;
  background: #1c1c1e;
  color: var(--text);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.week-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.2rem 0 0.75rem;
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.week-toolbar .icon-btn {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.week-toolbar strong {
  min-width: 180px;
  font-size: 0.98rem;
  text-transform: lowercase;
}

.week-spacer {
  flex: 1;
}

.schedule-filters {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.schedule-filters select {
  min-height: 38px;
  max-width: 150px;
  padding: 0 2rem 0 0.75rem;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.070);
  color: var(--text);
  box-shadow: none;
}

.schedule-filters .icon-btn {
  width: 38px;
  min-height: 38px;
  font-size: 1.05rem;
  opacity: 0.72;
}

.schedule-filters .icon-btn.active,
.schedule-filters .icon-btn:hover {
  opacity: 1;
}

.schedule-stats {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.schedule-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 38px;
  padding: 0 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.schedule-stats b {
  color: var(--text);
  font-size: 0.9rem;
}

.week-grid {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  overflow-x: hidden;
  overflow-y: auto;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 24px;
  background: #1c1c1e;
}

.week-grid,
.chat-list,
.messages,
.chat-pending-files {
  scrollbar-width: thin;
  scrollbar-color: rgba(170, 170, 182, 0.42) transparent;
}

.week-grid::-webkit-scrollbar,
.chat-list::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.chat-pending-files::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.week-grid::-webkit-scrollbar-button,
.chat-list::-webkit-scrollbar-button,
.messages::-webkit-scrollbar-button,
.chat-pending-files::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.week-grid::-webkit-scrollbar-track,
.chat-list::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.chat-pending-files::-webkit-scrollbar-track {
  background: transparent;
}

.week-grid::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.chat-pending-files::-webkit-scrollbar-thumb {
  border: 2px solid rgba(14, 14, 18, 0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(214, 214, 226, 0.48), rgba(139, 139, 154, 0.34));
}

.week-grid::-webkit-scrollbar-thumb:hover,
.chat-list::-webkit-scrollbar-thumb:hover,
.messages::-webkit-scrollbar-thumb:hover,
.chat-pending-files::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(232, 232, 242, 0.68), rgba(10, 132, 255, 0.42));
}

.time-column {
  display: grid;
  grid-template-rows: 50px repeat(15, 84px);
  min-height: 100%;
  background: rgba(0, 0, 0, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.075);
}

.week-corner {
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.time-slot {
  display: flex;
  justify-content: flex-end;
  padding: 0.25rem 0.42rem 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  color: rgba(235, 235, 245, 0.72);
  font-size: 0.74rem;
  font-weight: 700;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  min-height: 100%;
}

.week-day-column {
  min-width: 0;
  display: grid;
  grid-template-rows: 50px minmax(1260px, 1fr);
  border-right: 1px solid rgba(255, 255, 255, 0.070);
}

.week-day-head {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.08);
  box-shadow: none;
  color: var(--text);
  padding: 0;
}

.week-day-head:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: none;
}

.week-day-head span {
  color: var(--muted);
  text-transform: lowercase;
}

.day-track {
  position: relative;
  height: 1260px;
  min-height: 1260px;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(255, 255, 255, 0.030) 20px, rgba(255, 255, 255, 0.030) 21px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 83px, rgba(255, 255, 255, 0.060) 83px, rgba(255, 255, 255, 0.060) 84px);
}

.day-track.is-drop-target {
  background:
    linear-gradient(180deg, rgba(10, 132, 255, 0.16), rgba(100, 210, 255, 0.08)),
    repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(255, 255, 255, 0.045) 20px, rgba(255, 255, 255, 0.045) 21px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 83px, rgba(255, 255, 255, 0.11) 83px, rgba(255, 255, 255, 0.11) 84px);
}

.lesson-block {
  position: relative;
  width: calc(100% - 16px);
  margin-right: 8px;
  margin-left: 8px;
  min-height: 42px;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 0.1rem;
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: var(--text);
  padding: 0.58rem 0.6rem;
  text-align: left;
  overflow: hidden;
  cursor: grab;
}

.day-track > .lesson-block {
  top: auto;
  height: var(--lesson-height, auto);
  transform: none;
}

.lesson-block.resizing {
  z-index: 25;
  cursor: ns-resize;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.22) inset;
}

.lesson-block.drag-source {
  opacity: 0.22;
}

.schedule-drag-ghost {
  position: fixed !important;
  z-index: 80;
  width: var(--ghost-width, auto) !important;
  margin: 0 !important;
  opacity: 0.92;
  pointer-events: none;
  cursor: grabbing;
  transform: none !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.20) inset;
}

.lesson-block:hover {
  transform: translateY(-1px);
}

.schedule-drag-ghost.lesson-block,
.schedule-drag-ghost.lesson-block:hover {
  transform: none;
}

.lesson-resize-handle {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 10px;
  cursor: ns-resize;
}

.lesson-resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity var(--transition);
}

.lesson-block:hover .lesson-resize-handle::after,
.lesson-block.resizing .lesson-resize-handle::after {
  opacity: 1;
}

.lesson-block strong {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.94);
}

.lesson-block span {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.86);
}

.lesson-block.done {
  border-color: rgba(48, 209, 88, 0.58);
  background:
    linear-gradient(180deg, rgba(48, 209, 88, 0.30), rgba(20, 83, 45, 0.56)),
    rgba(16, 92, 50, 0.38);
}

.lesson-block.planned {
  border-color: rgba(255, 214, 10, 0.62);
  background:
    linear-gradient(180deg, rgba(255, 214, 10, 0.32), rgba(120, 82, 8, 0.54)),
    rgba(120, 82, 8, 0.38);
  color: #fff7cc;
}

.lesson-block.late {
  border-color: rgba(255, 69, 58, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 69, 58, 0.34), rgba(127, 29, 29, 0.58)),
    rgba(127, 29, 29, 0.42);
  color: #ffe3e3;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.052)),
    rgba(24, 25, 30, 0.96);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(34px) saturate(170%);
  -webkit-backdrop-filter: blur(34px) saturate(170%);
  padding: 1.5rem;
}

.wide-modal .modal-card {
  width: min(980px, 100%);
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
}

.modal-card h2 {
  margin: 0.8rem 2rem 1rem 0;
  font-family: var(--font-display);
  font-size: 2rem;
}

.lesson-details {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.lesson-details div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lesson-details dt {
  color: var(--muted);
}

.lesson-details dd {
  margin: 0;
}

.lesson-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.lesson-edit-form button {
  grid-column: 1 / -1;
}

.lesson-duration-hint {
  align-self: end;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.9rem;
}

.lesson-status.done {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.16);
  color: #a7f3d0;
}

.badge.lesson-status {
  width: max-content;
  max-width: calc(100% - 3rem);
  min-width: 0;
  justify-content: center;
  padding: 0.34rem 0.78rem;
  border-radius: 999px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  word-break: normal;
  overflow-wrap: normal;
}

.lesson-status.planned {
  border-color: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
}

.lesson-status.late {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn-muted {
  background: transparent;
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.btn-danger:hover {
  border-color: rgba(248, 113, 113, 0.72);
  background: rgba(248, 113, 113, 0.18);
}

.lesson-shell {
  min-height: calc(100vh - 160px);
}

#lessonPage:has(#lessonRoomView:not(.hidden)) .lesson-shell {
  height: 100%;
  min-height: 0;
}

.device-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 380px;
  gap: 1.25rem;
}

.device-preview-panel {
  display: grid;
  gap: 1rem;
}

.device-preview-panel video,
.video-tile video {
  width: 100%;
  min-height: 420px;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.36);
  object-fit: contain;
}

.video-mirrored {
  transform: scaleX(-1);
}

.video-stage .video-tile video {
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  object-fit: cover;
}

.video-stage .video-tile.main video {
  min-height: 0;
}

.mic-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.mic-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--accent-2));
  transition: width 0.08s linear;
}

.device-controls {
  align-self: start;
  display: grid;
  gap: 1rem;
}

.device-controls h2 {
  margin: 0;
}

.device-actions {
  display: grid;
  gap: 0.75rem;
}

.prejoin-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.prejoin-toggles .btn {
  min-width: 0;
  padding-inline: 0.8rem;
}

.btn.is-off {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(248, 113, 113, 0.10);
  color: #fecaca;
}

.lesson-room {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.lesson-room-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.55rem;
}

.lesson-exit-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(248, 113, 113, 0.52);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  font-size: 1rem;
  line-height: 1;
  box-shadow: none;
}

.lesson-exit-button:hover,
.lesson-exit-button:focus-visible {
  border-color: rgba(248, 113, 113, 0.86);
  background: rgba(239, 68, 68, 0.24);
  color: #fee2e2;
}

.lesson-room-top h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.15;
}

.lesson-room-top p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.lesson-room-grid {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  contain: layout paint;
}

.lesson-room.video-collapsed .video-stage {
  display: none;
}

.lesson-room.board-prep-room .lesson-room-top {
  position: absolute;
  z-index: 30;
  left: 5.25rem;
  top: 1rem;
  max-width: min(520px, calc(100% - 11rem));
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  background: rgba(18, 18, 20, 0.72);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.lesson-room.board-prep-room .lesson-room-grid {
  border-radius: var(--radius-lg);
}

.lesson-room.board-prep-room .video-panel-toggle,
.lesson-room.board-prep-room .video-panel-restore {
  display: none;
}

body.light-theme .lesson-room.board-prep-room .lesson-room-top {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(28, 32, 39, 0.12);
}

.video-stage {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.video-stage {
  position: absolute;
  z-index: 40;
  top: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  overflow: visible;
  width: 300px;
  min-width: 300px;
  max-width: 300px;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.65rem;
  padding: 0.65rem;
}

.lesson-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.lesson-status {
  min-width: 0;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  align-items: center;
  column-gap: 0.35rem;
  padding: 0.42rem 0.48rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
}

.lesson-status i {
  grid-row: 1 / 3;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.lesson-status span,
.lesson-status small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-status span {
  color: var(--muted-strong);
  font-size: 0.62rem;
  font-weight: 700;
}

.lesson-status small {
  color: var(--muted);
  font-size: 0.58rem;
}

.lesson-status[data-state="on"] i,
.lesson-status[data-state="connected"] i {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

.lesson-status[data-state="off"] i {
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

.lesson-status[data-state="waiting"] i,
.lesson-status[data-state="connecting"] i {
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12);
}

.lesson-status[data-state="connecting"] i {
  animation: lesson-status-pulse 1.1s ease-in-out infinite;
}

@keyframes lesson-status-pulse {
  50% { opacity: 0.38; }
}

.video-panel-toggle,
.video-panel-restore {
  z-index: 40;
  width: 30px;
  min-width: 30px;
  height: 58px;
  min-height: 58px;
  border-radius: 999px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.video-panel-toggle {
  position: absolute;
  left: -17px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 1;
}

.video-panel-restore {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
}

.video-tile {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.045);
}

.video-tile > span {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-weight: 700;
}

.remote-placeholder {
  min-height: 0;
  display: grid;
  place-items: center;
  text-align: center;
}

.remote-placeholder video {
  display: none;
  min-height: 0;
  height: 100%;
}

.remote-placeholder.has-video video {
  display: block;
}

.remote-media-indicators {
  position: absolute;
  z-index: 3;
  right: 0.65rem;
  top: 0.65rem;
  display: flex;
  gap: 0.35rem;
  pointer-events: none;
}

.remote-media-indicator {
  min-width: 32px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0 0.42rem;
  border: 1px solid rgba(248, 113, 113, 0.46);
  border-radius: 999px;
  background: rgba(13, 13, 16, 0.74);
  color: #ffffff;
  font-size: 0;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.remote-media-indicator::before {
  content: "";
  display: block;
  border-color: #ffffff;
}

#remoteMicOffIndicator::before {
  width: 7px;
  height: 11px;
  border: 2px solid #ffffff;
  border-radius: 6px;
}

#remoteCameraOffIndicator::before {
  width: 14px;
  height: 9px;
  border: 2px solid #ffffff;
  border-radius: 3px;
}

.remote-media-indicator::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #f87171;
  transform: rotate(-38deg);
}

.remote-placeholder.remote-camera-off video {
  display: none;
}

.remote-placeholder.remote-camera-off .remote-waiting {
  display: grid;
}

.remote-placeholder.remote-camera-off {
  background:
    radial-gradient(circle at 50% 38%, rgba(248, 113, 113, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.045);
}

.remote-waiting {
  display: grid;
  gap: 0.35rem;
  padding: 1.25rem;
}

.remote-placeholder.has-video .remote-waiting {
  display: none;
}

.remote-placeholder span,
.board-status {
  color: var(--muted);
}

.lesson-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  align-self: end;
  min-width: 0;
}

.lesson-controls .btn {
  min-height: 38px;
  padding: 0 0.7rem;
}

.lesson-controls .btn.active {
  border-color: rgba(10, 132, 255, 0.50);
  background: rgba(10, 132, 255, 0.16);
  color: #d8ecff;
}

body.light-theme .lesson-controls .btn.active {
  border-color: rgba(10, 132, 255, 0.42);
  background: rgba(10, 132, 255, 0.12);
  color: #0a4f9e;
}

.lesson-board {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(10, 132, 255, 0.08), transparent 32%),
    #07080b;
}

.board-toolbar {
  position: absolute;
  z-index: 35;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  padding: 0.35rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(28, 29, 34, 0.82);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  transition: top 160ms ease, right 160ms ease, bottom 160ms ease, left 160ms ease, transform 160ms ease;
}

.board-toolbar[data-dock="top"] {
  top: 0.75rem;
  left: 50%;
  max-width: calc(100% - 2rem);
  transform: translateX(-50%);
}

.board-toolbar[data-dock="bottom"] {
  bottom: 0.75rem;
  left: 50%;
  max-width: calc(100% - 2rem);
  transform: translateX(-50%);
}

.board-toolbar[data-dock="left"],
.board-toolbar[data-dock="right"] {
  top: 50%;
  width: 52px;
  max-height: calc(100% - 1.5rem);
  flex-direction: column;
  align-items: center;
  padding: 0.35rem;
  gap: 0.2rem;
  transform: translateY(-50%);
}

.board-toolbar[data-dock="left"] {
  left: 0.75rem;
}

.board-toolbar[data-dock="right"] {
  right: 0.75rem;
}

.lesson-room:not(.video-collapsed) .board-toolbar[data-dock="right"] {
  right: 312px;
}

.lesson-room:not(.video-collapsed) .board-toolbar[data-dock="top"],
.lesson-room:not(.video-collapsed) .board-toolbar[data-dock="bottom"] {
  left: calc(50% - 156px);
  max-width: calc(100% - 330px);
}

.board-toolbar.is-dragging {
  border-color: rgba(10, 132, 255, 0.62);
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.16), 0 22px 60px rgba(0, 0, 0, 0.42);
  transition: none;
}

.board-toolbar-handle {
  min-width: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  transition: background 150ms ease, color 150ms ease;
}

.board-toolbar-handle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.board-toolbar-handle:active {
  cursor: grabbing;
  background: rgba(255, 255, 255, 0.08);
}

.board-sep {
  width: 1px;
  height: 20px;
  margin: 0 0.25rem;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.board-undo-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.board-undo-group button {
  min-width: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.board-undo-group button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.board-undo-group button:active {
  background: rgba(255, 255, 255, 0.12);
}

.board-undo-group button + button {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.board-toolbar[data-dock="left"] .board-tool,
.board-toolbar[data-dock="right"] .board-tool {
  width: 38px;
  height: 38px;
}

.board-toolbar[data-dock="left"] .board-toolbar-handle,
.board-toolbar[data-dock="right"] .board-toolbar-handle {
  width: 38px;
  height: 38px;
}

.board-toolbar[data-dock="left"] .board-undo-group,
.board-toolbar[data-dock="right"] .board-undo-group {
  width: 42px;
  flex-direction: column;
}

.board-toolbar[data-dock="left"] .board-undo-group button,
.board-toolbar[data-dock="right"] .board-undo-group button {
  width: 42px;
  height: 28px;
}

.board-toolbar[data-dock="left"] .board-undo-group button + button,
.board-toolbar[data-dock="right"] .board-undo-group button + button {
  border-left: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.board-toolbar[data-dock="left"] .board-zoom,
.board-toolbar[data-dock="right"] .board-zoom {
  width: 42px;
  flex-direction: column;
  gap: 0;
}

.board-toolbar[data-dock="left"] .board-zoom button,
.board-toolbar[data-dock="right"] .board-zoom button {
  width: 42px;
  height: 26px;
}

.board-toolbar[data-dock="left"] .board-zoom span,
.board-toolbar[data-dock="right"] .board-zoom span {
  min-width: 0;
  width: 42px;
  font-size: 0.7rem;
}

.board-toolbar[data-dock="left"] .board-sep,
.board-toolbar[data-dock="right"] .board-sep {
  width: 24px;
  height: 1px;
  margin: 0.1rem 0;
}

.board-toolbar[data-dock="left"] .pen-popover,
.board-toolbar[data-dock="right"] .pen-popover {
  top: 0;
  left: calc(100% + 0.5rem);
  transform: none;
}

.board-toolbar[data-dock="right"] .pen-popover {
  right: calc(100% + 0.5rem);
  left: auto;
}

.board-toolbar[data-dock="left"] .shape-menu-list {
  top: 0;
  left: calc(100% + 0.5rem);
  transform: none;
}

.board-toolbar[data-dock="right"] .shape-menu-list {
  top: 0;
  right: calc(100% + 0.5rem);
  left: auto;
  transform: none;
}

.board-tool,
.board-toolbar input,
.board-zoom button {
  min-height: 34px;
}

.board-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  transition: all 150ms ease;
  user-select: none;
  flex-shrink: 0;
}

.board-tool svg {
  flex-shrink: 0;
}

.board-tool:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
}

.board-tool.active {
  border-color: rgba(10, 132, 255, 0.52);
  background: rgba(10, 132, 255, 0.17);
  color: #d8ecff;
}

.board-tool.active:hover {
  background: rgba(10, 132, 255, 0.22);
  border-color: rgba(10, 132, 255, 0.62);
}

.board-tool:active {
  transform: scale(0.93);
}

.pen-dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5f5f7;
  border: 1.5px solid rgba(22, 22, 27, 0.9);
  pointer-events: none;
  transition: background 150ms ease;
}

.pen-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: 180px;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(22, 22, 27, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.pen-popover.is-open {
  display: flex;
}

.pen-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pen-popover-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.pen-popover-val {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
  min-width: 18px;
  text-align: center;
}

#penPopover #boardColor {
  width: 32px;
  height: 26px;
  padding: 2px;
}

#penPopover #boardSize {
  width: 100%;
  height: 6px;
  accent-color: var(--accent);
}

#boardColor {
  width: 32px;
  height: 26px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: border-color 150ms ease;
}

#boardColor:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

#boardColor::-webkit-color-swatch-wrapper {
  padding: 1px;
}

#boardColor::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

#boardSize {
  width: 100%;
  height: 34px;
  accent-color: var(--accent);
}

.board-zoom {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.board-zoom button {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: var(--muted-strong);
  transition: background 150ms ease, color 150ms ease;
}

.board-zoom button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.board-zoom span {
  min-width: 48px;
  text-align: center;
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#undoBoardButton,
#redoBoardButton {
  min-width: 38px;
  padding: 0;
  font-size: 1.05rem;
}

.shape-menu {
  position: relative;
}

.shape-menu summary {
  list-style: none;
}

.shape-menu summary::-webkit-details-marker {
  display: none;
}

.shape-menu-list {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.2rem;
  padding: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(22, 22, 27, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.shape-menu-list .board-tool {
  width: 40px;
  height: 36px;
}

.board-toolbar[data-dock="left"] .shape-menu-list {
  top: 0;
  left: calc(100% + 0.55rem);
}

.board-toolbar[data-dock="right"] .shape-menu-list {
  top: 0;
  right: calc(100% + 0.55rem);
  left: auto;
}

.shape-menu-list .board-tool {
  width: 100%;
  justify-content: flex-start;
}

.board-canvas-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(4, 4, 7, 0.36);
}

.board-canvas-wrap.screen-mode {
  background: rgba(0, 0, 0, 0.52);
}

.screen-share-board {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 3, 6, 0.84);
}

.screen-share-board video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.screen-share-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.35rem;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.screen-share-board.has-stream .screen-share-empty {
  display: none;
}

.board-canvas-wrap.is-drag-over,
.chat-panel.is-drag-over {
  border-color: rgba(10, 132, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.28), 0 24px 80px rgba(10, 132, 255, 0.16), var(--shadow-glass);
}

.board-canvas-wrap.is-drag-over::after,
.chat-panel.is-drag-over::after {
  content: "Отпустите файл";
  position: absolute;
  inset: 1rem;
  z-index: 4;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(10, 132, 255, 0.62);
  border-radius: inherit;
  background: rgba(10, 10, 12, 0.46);
  color: rgba(245, 245, 247, 0.88);
  font-weight: 800;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#lessonBoardCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  cursor: crosshair;
  outline: none;
  touch-action: none;
}

#lessonBoardCanvas:focus,
#lessonBoardCanvas:focus-visible {
  outline: none;
}

#lessonBoardCanvas[data-tool="pen"],
#lessonBoardCanvas[data-tool="eraser"] {
  cursor: none;
}

#lessonBoardCanvas[data-tool="select"] {
  cursor: default;
}

#lessonBoardCanvas.is-panning {
  cursor: grabbing;
}

#lessonBoardCanvas.is-resizing-nwse {
  cursor: nwse-resize;
}

#lessonBoardCanvas.is-resizing-nesw {
  cursor: nesw-resize;
}

.board-status {
  position: absolute;
  z-index: 32;
  right: 1.4rem;
  bottom: 1.3rem;
  min-width: 28px;
  min-height: 24px;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.68);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.chat-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

.chat-list-panel,
.chat-panel {
  min-height: 0;
  overflow: hidden;
}

.chat-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
}

.chat-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0.7rem;
  padding-right: 0.15rem;
}

.chat-row {
  position: relative;
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  justify-items: stretch;
  gap: 0.75rem;
  padding: 0.9rem;
  text-align: left;
  box-shadow: none;
}

.chat-row.has-unread::after {
  top: 0.55rem;
  right: 0.55rem;
}

.chat-row.active {
  border-color: rgba(10, 132, 255, 0.42);
  background: rgba(10, 132, 255, 0.13);
}

.reaction-preview-row {
  min-height: 74px;
}

.chat-row-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.46), rgba(100, 210, 255, 0.20));
  color: var(--text);
  font-weight: 900;
}

.chat-row-main {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
}

.chat-row-main strong,
.chat-row-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row-main strong b {
  font-weight: 800;
}

.chat-row-side {
  display: grid;
  justify-items: end;
  gap: 0.32rem;
}

.chat-row-side small {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  color: rgba(100, 210, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 700;
}

.chat-row-receipt {
  margin-right: 0.1rem;
  color: rgba(100, 210, 255, 0.84);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: -0.12em;
}

.chat-row-receipt.read {
  color: rgba(100, 210, 255, 0.98);
}

.chat-row-side b {
  font-size: 1.15rem;
  line-height: 1;
}

.chat-title {
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.chat-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1rem;
}

.messages {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.25rem;
}

.message {
  width: min(76%, 560px);
  max-width: min(76%, 560px);
  min-width: 0;
  display: grid;
  gap: 0.18rem;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: none;
}

.message {
  position: relative;
}

.message:not(.mine) {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: end;
}

.message-avatar {
  grid-column: 1;
  grid-row: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.45), rgba(100, 210, 255, 0.18));
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.message:not(.mine) .message-bubble,
.message:not(.mine) .message-reactions {
  grid-column: 2;
}

.message-date-divider {
  align-self: center;
  margin: 0.35rem 0;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(245, 245, 247, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
}

.message.mine {
  align-self: flex-end;
  background: transparent;
}

.message.image-message {
  border-color: transparent;
  background: transparent;
}

.message.image-message .message-bubble {
  padding: 0.32rem;
}

.message-bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 0.72rem 0.95rem;
  border-radius: 18px 18px 18px 6px;
  background: rgba(58, 58, 63, 0.92);
  color: #f5f5f7;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.message-bubble::after {
  content: none;
}

.message.mine .message-bubble {
  justify-self: end;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(180deg, #0a84ff, #006bd6);
}

.message.mine .message-bubble::after {
  content: none;
}

.message p {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.message-meta {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.45rem;
  color: rgba(235, 235, 245, 0.48);
  font-size: 0.74rem;
}

.message-meta.in-bubble {
  float: right;
  display: inline-flex;
  margin: 0.18rem 0 0 0.65rem;
  padding: 0;
  color: rgba(235, 235, 245, 0.58);
  line-height: 1.2;
}

.message.mine .message-meta {
  justify-self: end;
}

.message-receipt {
  color: rgba(235, 235, 245, 0.48);
  font-weight: 800;
  letter-spacing: -0.08em;
}

.message-receipt.read {
  color: rgba(100, 210, 255, 0.95);
}

.message-actions {
  position: absolute;
  top: -1.6rem;
  left: 0.35rem;
  z-index: 2;
  display: flex;
  gap: 0.35rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.message.mine .message-actions {
  right: 0.35rem;
  left: auto;
}

.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
  pointer-events: auto;
}

.message-actions button,
.reaction-pill {
  min-height: 28px;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(245, 245, 247, 0.88);
  font-size: 0.78rem;
  box-shadow: none;
}

.reaction-menu {
  display: flex;
  gap: 0.2rem;
  padding: 0.12rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.92);
}

.reaction-menu button {
  width: 28px;
  padding: 0;
  background: transparent;
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: -0.08rem;
}

.message.mine .message-reactions {
  justify-content: flex-end;
}

.reaction-pill.active {
  border-color: rgba(10, 132, 255, 0.52);
  background: rgba(10, 132, 255, 0.20);
}

.message-reply-quote {
  width: 100%;
  min-height: auto;
  display: grid;
  justify-items: start;
  gap: 0.05rem;
  margin-bottom: 0.45rem;
  padding: 0.42rem 0.55rem;
  border: 0;
  border-left: 3px solid rgba(255, 255, 255, 0.48);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  box-shadow: none;
  color: inherit;
  text-align: left;
}

.message-reply-quote strong {
  font-size: 0.78rem;
}

.message-reply-quote span {
  color: rgba(245, 245, 247, 0.72);
  font-size: 0.78rem;
}

.message-highlight .message-bubble {
  outline: 2px solid rgba(10, 132, 255, 0.78);
  outline-offset: 3px;
}

.reply-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid rgba(10, 132, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.reply-preview div {
  min-width: 0;
  display: grid;
}

.reply-preview strong,
.reply-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview span {
  color: var(--muted);
  font-size: 0.86rem;
}

.reply-preview button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
}

.message strong,
.message span,
.message-bubble {
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-form {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  padding-top: 0.25rem;
}

.message-form input[name="body"] {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.075);
}

.chat-pending-files {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.15rem 0.1rem 0.25rem;
}

.pending-file {
  position: relative;
  flex: 0 0 auto;
  width: 136px;
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.055);
}

.pending-file img,
.pending-file b {
  width: 100%;
  height: 74px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  object-fit: cover;
}

.pending-file b {
  display: grid;
  place-items: center;
  color: var(--text);
}

.pending-file span {
  overflow: hidden;
  color: rgba(245, 245, 247, 0.88);
  font-size: 0.8rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-file small {
  color: var(--muted);
  font-size: 0.74rem;
}

.pending-file button {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: var(--text);
}

.file-card {
  display: grid;
  gap: 0.35rem;
  width: min(260px, 100%);
  max-width: 100%;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
}

.file-card img {
  width: 100%;
  max-height: 160px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.28);
}

.file-card b {
  display: grid;
  place-items: center;
  width: 58px;
  height: 70px;
  border-radius: 8px;
  background: rgba(10, 132, 255, 0.18);
  color: var(--text);
}

.file-card small {
  color: var(--muted);
}

.chat-image-thumb {
  width: min(320px, 100%);
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
  overflow: hidden;
}

.chat-image-thumb:hover {
  transform: none;
  filter: brightness(1.08);
}

.chat-image-thumb img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 5rem;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.image-viewer img {
  max-width: min(100%, 1280px);
  max-height: 82vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.image-viewer-close,
.image-viewer-nav {
  position: fixed;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.34);
}

.image-viewer-close {
  top: 1.4rem;
  right: 1.4rem;
  width: 48px;
  min-height: 48px;
  border-radius: 50%;
  font-size: 2rem;
}

.image-viewer-nav {
  top: 50%;
  width: 58px;
  min-height: 82px;
  border-radius: 999px;
  font-size: 3rem;
  transform: translateY(-50%);
}

.image-viewer-nav.prev {
  left: 1.5rem;
}

.image-viewer-nav.next {
  right: 1.5rem;
}

.image-viewer-counter {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  transform: translateX(-50%);
}

@media (max-width: 720px) {
  .image-viewer {
    padding: 4rem 1rem;
  }

  .image-viewer img {
    max-height: 76vh;
  }

  .image-viewer-nav {
    top: auto;
    bottom: 1rem;
    width: 52px;
    min-height: 52px;
    font-size: 2.4rem;
    transform: none;
  }

  .image-viewer-counter {
    bottom: 1.45rem;
  }
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 1.4rem;
}

.hidden {
  display: none !important;
}

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: grid;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  background: rgba(20, 20, 25, 0.92);
  box-shadow: var(--shadow-elevated);
  color: var(--text);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  animation: toastIn 0.22s ease both;
}

.toast.success {
  border-color: rgba(52, 211, 153, 0.38);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.44);
  color: #fecaca;
}

.toast.is-hiding {
  animation: toastOut 0.2s ease both;
}

body.light-theme .toast {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(240, 243, 248, 0.88)),
    rgba(255, 255, 255, 0.86);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1d1d1f;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

body.light-theme .toast.success {
  border-color: rgba(21, 128, 61, 0.42);
  color: #14532d;
}

body.light-theme .toast.error {
  border-color: rgba(180, 35, 24, 0.42);
  color: #7f1d1d;
}

.site-footer {
  padding: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

body.light-theme .site-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .panel,
body.light-theme .auth-box {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 18px 48px rgba(27, 31, 40, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.light-theme .container:has(#dashboardPage:not(.hidden)) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

body.light-theme #dashboardPage > .hero .lead {
  color: rgba(60, 60, 67, 0.72);
}

body.light-theme #dashboardPage > .hero h1 {
  color: #1d1d1f;
}

body.light-theme .period-toggle {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 12px 28px rgba(27, 31, 40, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.light-theme .period-toggle button {
  color: rgba(60, 60, 67, 0.68);
}

body.light-theme .period-toggle button.active {
  background: #ffffff;
  color: rgba(29, 29, 31, 0.92);
  box-shadow: 0 10px 24px rgba(27, 31, 40, 0.10);
}

body.light-theme #dashboardPage .panel,
body.light-theme .dash-stat {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 18px 48px rgba(27, 31, 40, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.light-theme .landing-kicker {
  background: rgba(10, 132, 255, 0.10);
  color: rgba(0, 103, 200, 0.92);
}

body.light-theme .btn-ghost {
  background: rgba(255, 255, 255, 0.72);
}

body.light-theme .landing-window,
body.light-theme .landing-features article {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(234, 237, 242, 0.72)),
    rgba(240, 243, 248, 0.78);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

body.light-theme .landing-window-head {
  border-bottom-color: rgba(0, 0, 0, 0.09);
}

body.light-theme .landing-board-preview {
  background:
    linear-gradient(rgba(28, 32, 39, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 32, 39, 0.075) 1px, transparent 1px),
    radial-gradient(circle at 24% 20%, rgba(10, 132, 255, 0.12), transparent 32%),
    #f8f8fb;
  background-size: 28px 28px, 28px 28px, auto, auto;
}

body.light-theme .landing-stroke {
  background: rgba(29, 29, 31, 0.82);
}

body.light-theme .landing-card-mini,
body.light-theme .landing-chat-mini {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.10);
}

body.light-theme .panel::before,
body.light-theme .auth-box::before,
body.light-theme .modal-card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92), transparent);
}

body.light-theme .dash-stat {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.085);
  box-shadow: 0 14px 38px rgba(27, 31, 40, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.light-theme .student-card,
body.light-theme .subject-card,
body.light-theme .item,
body.light-theme .timeline-item {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

body.light-theme .student-card-actions .link-button {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

body.light-theme .student-card-actions .link-button::before {
  background: rgba(29, 29, 31, 0.72);
}

body.light-theme .student-card-actions .link-button:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(10, 132, 255, 0.34);
}

body.light-theme .student-card-actions .link-button:hover::before {
  background: rgba(0, 103, 200, 0.88);
}

body.light-theme .student-learning-summary .student-card-meta {
  border-left-color: rgba(0, 0, 0, 0.085);
  border-right-color: rgba(0, 0, 0, 0.085);
  border-top-color: rgba(0, 0, 0, 0.085);
}

body.light-theme .student-card-clickable:hover {
  background: rgba(0, 0, 0, 0.035);
  border-color: rgba(10, 132, 255, 0.28);
}

body.light-theme .student-card-meta span,
body.light-theme .subject-card .student-card-meta span,
body.light-theme .link-button {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.09);
  color: rgba(29, 29, 31, 0.84);
}

body.light-theme #dashboardPage .student-card,
body.light-theme #dashboardPage .subject-card {
  background: transparent;
  border-top-color: rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
}

body.light-theme #dashboardPage .student-card strong,
body.light-theme #dashboardPage .subject-card strong,
body.light-theme #dashboardPage .dash-stat strong,
body.light-theme #dashboardPage .panel h2 {
  color: #1d1d1f;
}

body.light-theme #dashboardPage .student-card span,
body.light-theme #dashboardPage .subject-card span,
body.light-theme #dashboardPage .student-card p,
body.light-theme #dashboardPage .dash-stat span {
  color: rgba(60, 60, 67, 0.72);
}

body.light-theme #dashboardPage .student-learning-info span {
  color: rgba(0, 103, 200, 0.86);
}

body.light-theme #dashboardPage .student-learning-info small {
  color: rgba(60, 60, 67, 0.66);
}

body.light-theme .inline-form input {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.11);
}

body.light-theme .schedule-shell {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 34px 90px rgba(27, 31, 40, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.light-theme .schedule-sidebar {
  background: rgba(255, 255, 255, 0.78);
  border-right-color: rgba(0, 0, 0, 0.10);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.92), 18px 0 46px rgba(27, 31, 40, 0.06);
}

body.light-theme .mini-weekdays span {
  color: rgba(60, 60, 67, 0.62);
}

body.light-theme .mini-day {
  color: rgba(29, 29, 31, 0.88);
}

body.light-theme .mini-day.muted-day {
  color: rgba(60, 60, 67, 0.34);
}

body.light-theme .mini-day:hover span {
  background: rgba(0, 0, 0, 0.06);
}

body.light-theme .mini-calendar-panel {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 32px rgba(27, 31, 40, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.light-theme .mini-calendar-grid {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.light-theme .mini-day,
body.light-theme .mini-day:hover,
body.light-theme .mini-day:focus-visible {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  transform: none;
}

body.light-theme .mini-day:not(.selected):not(:hover) span {
  background: transparent;
  box-shadow: none;
}

body.light-theme .week-panel {
  background: transparent;
}

body.light-theme .week-toolbar {
  background: transparent;
  border-bottom-color: transparent;
  box-shadow: none;
}

body.light-theme .week-grid {
  border-color: rgba(0, 0, 0, 0.10);
  background: #ffffff;
}

body.light-theme .time-column,
body.light-theme .week-day-head {
  background: rgba(255, 255, 255, 0.24);
}

body.light-theme .time-column,
body.light-theme .week-day-column {
  border-right-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .week-corner,
body.light-theme .time-slot,
body.light-theme .week-day-head {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .time-slot {
  color: rgba(60, 60, 67, 0.60);
}

body.light-theme .day-track {
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(0, 0, 0, 0.030) 20px, rgba(0, 0, 0, 0.030) 21px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 83px, rgba(0, 0, 0, 0.070) 83px, rgba(0, 0, 0, 0.070) 84px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04));
}

body.light-theme .lesson-block {
  color: #1d1d1f;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

body.light-theme .lesson-block strong,
body.light-theme .lesson-block span {
  color: rgba(29, 29, 31, 0.92);
}

body.light-theme .lesson-block.done {
  border-color: rgba(22, 163, 74, 0.72);
  background:
    linear-gradient(180deg, rgba(134, 239, 172, 0.70), rgba(187, 247, 208, 0.56)),
    rgba(187, 247, 208, 0.80);
}

body.light-theme .lesson-block.planned {
  border-color: rgba(245, 158, 11, 0.78);
  background:
    linear-gradient(180deg, rgba(253, 224, 71, 0.72), rgba(254, 215, 170, 0.58)),
    rgba(254, 240, 138, 0.78);
}

body.light-theme .lesson-block.late {
  border-color: rgba(239, 68, 68, 0.78);
  background:
    linear-gradient(180deg, rgba(252, 165, 165, 0.72), rgba(254, 202, 202, 0.60)),
    rgba(254, 202, 202, 0.82);
}

body.light-theme .month-stats,
body.light-theme .schedule-tools {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 32px rgba(27, 31, 40, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.light-theme .month-stats strong,
body.light-theme .schedule-tools h2,
body.light-theme .dash-stat strong,
body.light-theme .item strong,
body.light-theme .timeline-item strong,
body.light-theme .student-card strong,
body.light-theme .subject-card strong,
body.light-theme .chat-row strong,
body.light-theme .message strong,
body.light-theme .compact-lesson-line strong {
  color: rgba(29, 29, 31, 0.94);
}

body.light-theme .month-stats span,
body.light-theme .month-stats b,
body.light-theme .schedule-tools label,
body.light-theme .dash-stat span,
body.light-theme .lead,
body.light-theme .muted,
body.light-theme .hint,
body.light-theme .form-footer,
body.light-theme .item span,
body.light-theme .timeline-item span,
body.light-theme .student-card span,
body.light-theme .subject-card span,
body.light-theme .student-card p,
body.light-theme .student-card-title > span,
body.light-theme .compact-lesson-line span,
body.light-theme .compact-list > span,
body.light-theme .notification-main small,
body.light-theme .notification-state,
body.light-theme .empty {
  color: rgba(60, 60, 67, 0.72);
}

body.light-theme .student-label,
body.light-theme .badge,
body.light-theme .date-pill span,
body.light-theme .schedule-stats span,
body.light-theme .month-stat-label {
  color: rgba(29, 29, 31, 0.78);
}

body.light-theme .student-label,
body.light-theme .badge {
  background: rgba(10, 132, 255, 0.10);
  border-color: rgba(10, 132, 255, 0.28);
}

body.light-theme .schedule-stats b,
body.light-theme .date-pill strong {
  color: rgba(29, 29, 31, 0.94);
}

body.light-theme .schedule-tools input,
body.light-theme .schedule-tools select,
body.light-theme .schedule-filters select {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1d1d1f;
}

body.light-theme .repeat-days span {
  border-color: rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.74);
  color: rgba(29, 29, 31, 0.72);
}

body.light-theme .repeat-days input:checked + span {
  border-color: rgba(10, 132, 255, 0.72);
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.86), rgba(94, 92, 230, 0.74));
  color: #fff;
  box-shadow: 0 12px 28px rgba(10, 132, 255, 0.20);
}

body.light-theme .time-column,
body.light-theme .week-day-head {
  background: rgba(242, 241, 247, 0.72);
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .time-column,
body.light-theme .week-day-head span {
  color: rgba(29, 29, 31, 0.76);
}

body.light-theme .time-column span,
body.light-theme .time-column div {
  color: rgba(29, 29, 31, 0.76);
}

body.light-theme .week-day-column {
  border-right-color: rgba(0, 0, 0, 0.11);
}

body.light-theme .day-track {
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(0, 0, 0, 0.035) 20px, rgba(0, 0, 0, 0.035) 21px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 83px, rgba(0, 0, 0, 0.085) 83px, rgba(0, 0, 0, 0.085) 84px);
}

body.light-theme .day-track.is-drop-target {
  background:
    linear-gradient(180deg, rgba(10, 132, 255, 0.10), rgba(100, 210, 255, 0.06)),
    repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(0, 0, 0, 0.04) 20px, rgba(0, 0, 0, 0.04) 21px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 83px, rgba(0, 0, 0, 0.09) 83px, rgba(0, 0, 0, 0.09) 84px);
}

body.light-theme .lesson-block,
body.light-theme .lesson-block.planned,
body.light-theme .lesson-block.late {
  color: rgba(29, 29, 31, 0.92);
}

body.light-theme .lesson-block span,
body.light-theme .lesson-block strong {
  color: inherit;
}

body.light-theme .lesson-block.done {
  background: linear-gradient(180deg, rgba(48, 209, 88, 0.28), rgba(48, 209, 88, 0.13));
}

body.light-theme .lesson-block.planned {
  background: linear-gradient(180deg, rgba(255, 214, 10, 0.34), rgba(255, 159, 10, 0.16));
}

body.light-theme .lesson-block.late {
  background: linear-gradient(180deg, rgba(255, 69, 58, 0.28), rgba(255, 69, 58, 0.13));
}

body.light-theme .modal {
  background: rgba(255, 255, 255, 0.48);
}

body.light-theme .modal-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 245, 247, 0.88)),
    rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.14);
  color: #1d1d1f;
}

body.light-theme .modal-card h2,
body.light-theme .lesson-details dd,
body.light-theme .lesson-edit-form,
body.light-theme .lesson-duration-hint {
  color: #1d1d1f;
}

body.light-theme .lesson-details div {
  border-bottom-color: rgba(0, 0, 0, 0.09);
}

body.light-theme .lesson-details dt,
body.light-theme .lesson-edit-form label,
body.light-theme .lesson-duration-hint {
  color: rgba(60, 60, 67, 0.72);
}

body.light-theme .modal-close {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.10);
  color: #1d1d1f;
}

body.light-theme .btn-danger {
  color: #b42318;
}

body.light-theme .lesson-board {
  background:
    radial-gradient(circle at 18% 12%, rgba(10, 132, 255, 0.08), transparent 32%),
    #f8f8fb;
}

body.light-theme .board-canvas-wrap {
  background: rgba(255, 255, 255, 0.62);
}

body.light-theme .board-toolbar,
body.light-theme .shape-menu-list,
body.light-theme .pen-popover {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

body.light-theme .board-tool,
body.light-theme .board-toolbar-handle,
body.light-theme .board-zoom button,
body.light-theme .board-zoom span,
body.light-theme .pen-popover-label,
body.light-theme .pen-popover-val {
  color: rgba(29, 29, 31, 0.88);
}

body.light-theme .board-tool:hover,
body.light-theme .board-toolbar-handle:hover,
body.light-theme .board-zoom button:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.light-theme .board-status {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.10);
  color: rgba(29, 29, 31, 0.82);
}

body.light-theme .chat-row.active {
  border-color: rgba(10, 132, 255, 0.34);
  background: rgba(10, 132, 255, 0.10);
}

body.light-theme .chat-row,
body.light-theme .message-actions button,
body.light-theme .reaction-pill,
body.light-theme .reaction-menu {
  border-color: rgba(0, 0, 0, 0.09);
  background: rgba(255, 255, 255, 0.58);
}

body.light-theme .chat-row-main span,
body.light-theme .message span,
body.light-theme .reply-preview span,
body.light-theme .message-reply-quote span,
body.light-theme .pending-file small,
body.light-theme .file-card small {
  color: rgba(60, 60, 67, 0.70);
}

body.light-theme .chat-title,
body.light-theme .panel h2,
body.light-theme .hero h1,
body.light-theme .auth-box h1 {
  color: #1d1d1f;
}

body.light-theme .message-bubble {
  background: rgba(229, 229, 234, 0.92);
  color: #1d1d1f;
}

body.light-theme .message.mine .message-bubble {
  background: linear-gradient(180deg, #0a84ff, #006bd6);
  color: #fff;
}

body.light-theme .message.mine .message-bubble p,
body.light-theme .message.mine .message-bubble span,
body.light-theme .message.mine .message-bubble strong {
  color: rgba(255, 255, 255, 0.94);
}

body.light-theme .message-meta,
body.light-theme .message-receipt {
  color: rgba(60, 60, 67, 0.56);
}

body.light-theme .message.mine .message-meta,
body.light-theme .message.mine .message-receipt {
  color: rgba(255, 255, 255, 0.72);
}

body.light-theme .message-date-divider,
body.light-theme .chat-history-marker {
  background: rgba(0, 0, 0, 0.055);
  color: rgba(60, 60, 67, 0.72);
}

body.light-theme .file-card,
body.light-theme .pending-file,
body.light-theme .reply-preview {
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(0, 0, 0, 0.10);
  color: #1d1d1f;
}

body.light-theme .file-card b,
body.light-theme .pending-file b {
  color: #1d1d1f;
}

body.light-theme .chat-list-panel,
body.light-theme .chat-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 244, 249, 0.84)),
    rgba(246, 248, 252, 0.92);
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

body.light-theme .chat-title {
  border-bottom-color: rgba(0, 0, 0, 0.10);
}

body.light-theme .messages {
  padding: 0.35rem 0.45rem 0.35rem 0.25rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(247, 248, 251, 0.62), rgba(238, 240, 245, 0.48));
}

body.light-theme .chat-row {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(236, 240, 246, 0.78)),
    rgba(240, 243, 248, 0.90);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

body.light-theme .chat-row.active {
  background: linear-gradient(180deg, rgba(220, 237, 255, 0.96), rgba(198, 224, 255, 0.90));
  border-color: rgba(10, 132, 255, 0.44);
  box-shadow: 0 10px 26px rgba(10, 132, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

body.light-theme .chat-row-main strong {
  color: rgba(29, 29, 31, 0.94);
}

body.light-theme .chat-row-main span {
  color: rgba(60, 60, 67, 0.76);
}

body.light-theme .chat-row-side small {
  color: rgba(0, 103, 200, 0.82);
}

body.light-theme .chat-row-receipt {
  color: rgba(0, 103, 200, 0.72);
}

body.light-theme .chat-row-receipt.read {
  color: rgba(0, 103, 200, 0.95);
}

body.light-theme .chat-row-avatar {
  background: linear-gradient(180deg, #acd7ff, #d8ecff);
  color: #24506f;
}

body.light-theme .message:not(.mine) .message-bubble {
  background: linear-gradient(180deg, #e6e8ed, #d8dce3);
  border: 1px solid rgba(0, 0, 0, 0.07);
  color: #1d1d1f;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.10);
}

body.light-theme .message:not(.mine) .message-bubble p,
body.light-theme .message:not(.mine) .message-bubble strong {
  color: #1d1d1f;
}

body.light-theme .message:not(.mine) .message-meta.in-bubble {
  color: rgba(60, 60, 67, 0.62);
}

body.light-theme .message.mine .message-bubble {
  box-shadow: 0 12px 30px rgba(0, 103, 200, 0.24);
}

body.light-theme .message.mine .message-reply-quote {
  background: rgba(255, 255, 255, 0.18);
  border-left-color: rgba(255, 255, 255, 0.66);
}

body.light-theme .message.mine .message-reply-quote strong,
body.light-theme .message.mine .message-reply-quote span {
  color: rgba(255, 255, 255, 0.88);
}

body.light-theme .message:not(.mine) .message-reply-quote {
  background: rgba(255, 255, 255, 0.46);
  border-left-color: rgba(10, 132, 255, 0.52);
}

body.light-theme .message:not(.mine) .message-reply-quote strong {
  color: rgba(29, 29, 31, 0.90);
}

body.light-theme .message-actions button,
body.light-theme .reaction-pill,
body.light-theme .reaction-menu {
  background: rgba(245, 247, 251, 0.96);
  border-color: rgba(0, 0, 0, 0.11);
  color: rgba(29, 29, 31, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

body.light-theme .reaction-pill.active {
  background: rgba(10, 132, 255, 0.16);
  border-color: rgba(10, 132, 255, 0.30);
}

body.light-theme .message-form input[name="body"] {
  background: rgba(255, 255, 255, 0.80);
  border-color: rgba(0, 0, 0, 0.13);
  color: #1d1d1f;
}

body.light-theme .image-viewer {
  background: rgba(245, 245, 247, 0.82);
}

body:has(#schedulePage:not(.hidden)) .site-footer,
body:has(#chatPage:not(.hidden)) .site-footer,
body:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden)) .site-footer {
  display: none;
}

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

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

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

@media (max-width: 900px) {
  body,
  body.sidebar-collapsed,
  body.sidebar-top {
    padding-left: 0;
    padding-top: 72px;
  }

  .container:has(#dashboardPage:not(.hidden)) {
    width: 100%;
    min-height: calc(100vh - 72px);
    margin: 0;
    padding: 1.25rem;
    border: 0;
    border-radius: 0;
  }

  .site-header {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    min-height: 72px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    transform: none;
  }

  body.sidebar-top:not(:has(#lessonPage:not(.hidden) #lessonRoomView:not(.hidden))) .site-header {
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    min-height: 72px;
    border-radius: 0;
    transform: none;
  }

  .site-brand {
    width: auto;
  }

  body.sidebar-collapsed .logo {
    width: auto;
    height: auto;
    display: inline;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: 1.7rem;
  }

  body.sidebar-collapsed .logo::before {
    content: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .nav {
    width: auto;
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .nav a,
  .btn-link,
  .nav-user {
    width: auto;
    min-height: 36px;
    padding: 0 0.55rem;
    color: var(--muted);
  }

  .nav a::before,
  .btn-link::before {
    content: none;
  }

  .dashboard-grid,
  .dashboard-stats,
  .landing-hero,
  .landing-features,
  .student-dashboard .dashboard-grid,
  .student-dashboard .dashboard-grid .panel:first-child .student-card,
  .student-profile-stats,
  .student-profile-grid,
  .invite-box,
  .lesson-form,
  .device-layout,
  .lesson-room-grid,
  .chat-shell,
  .schedule-shell {
    grid-template-columns: 1fr;
  }

  .student-card,
  .subject-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .student-card-actions {
    grid-column: 2;
  }

  .dashboard-hero-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .student-dashboard .dashboard-grid .panel:first-child .student-learning-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .student-learning-summary .student-card-meta {
    justify-content: flex-start;
    min-width: 0;
    padding: 0.7rem 0 0;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.085);
  }

  .student-learning-summary .student-card-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .schedule-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  .week-grid {
    height: 680px;
  }

  .lesson-form button {
    grid-column: auto;
  }

  .landing-hero {
    min-height: auto;
    gap: 1.25rem;
  }

  .landing-copy h1 {
    font-size: clamp(2.25rem, 12vw, 3.8rem);
  }

  .landing-preview {
    min-height: 340px;
  }

  .landing-board-preview {
    min-height: 310px;
  }

  .chat-list-panel,
  .chat-panel {
    min-height: 0;
  }

  .container:has(#chatPage:not(.hidden)) {
    height: calc(100dvh - 72px);
    padding: 1rem;
  }

  .chat-shell {
    grid-template-rows: minmax(160px, 28vh) minmax(0, 1fr);
    gap: 0.9rem;
  }

  .video-stage {
    right: 0.5rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: min(300px, calc(100% - 1rem));
    min-width: 0;
    max-width: none;
  }

  .lesson-room:not(.video-collapsed) .board-toolbar[data-dock="right"] {
    right: 0.75rem;
  }

  .lesson-room:not(.video-collapsed) .board-toolbar[data-dock="top"],
  .lesson-room:not(.video-collapsed) .board-toolbar[data-dock="bottom"] {
    left: 50%;
    max-width: calc(100% - 2rem);
  }
}

@media (max-width: 560px) {
  .container {
    padding: 1.5rem 1rem 3rem;
  }

  .nav {
    gap: 0.75rem;
  }

  .nav-user {
    width: 100%;
    padding-left: 0;
    border-left: 0;
  }

  .auth-box,
  .panel {
    border-radius: var(--radius-md);
    padding: 1.15rem;
  }

  .invite-actions,
  .invite-modal-actions,
  .inline-form,
  .profile-form,
  .message-form,
  .lesson-edit-form,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .profile-avatar-block {
    align-items: flex-start;
  }

  .dashboard-profile-hero {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-profile-hero .btn {
    width: 100%;
  }

  .dashboard-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .period-toggle {
    width: 100%;
  }

  .period-toggle button {
    flex: 1;
  }

  .student-dashboard .dashboard-grid .panel:first-child .student-learning-summary {
    grid-template-columns: 1fr;
  }

  .student-learning-summary .student-card-actions {
    grid-column: auto;
    grid-row: auto;
    justify-content: flex-start;
  }

  .message {
    width: 100%;
  }
}
