:root {
  --ink: #14231f;
  --ink-soft: #3d524c;
  --muted: #6b7f78;
  --line: rgba(20, 35, 31, 0.08);
  --surface: #f3f6f4;
  --surface-2: #ffffff;
  --brand: #0f766e;
  --brand-deep: #0b5f59;
  --brand-soft: #ccfbf1;
  --accent: #d97706;
  --accent-soft: #ffedd5;
  --sky: #0284c7;
  --sky-soft: #e0f2fe;
  --danger: #be123c;
  --sidebar: #0c1f1c;
  --sidebar-text: #c8ddd7;
  --sidebar-active: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(20, 35, 31, 0.04), 0 12px 32px -16px rgba(12, 31, 28, 0.18);
  --font: "Manrope", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --sidebar-w: 272px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(13, 148, 136, 0.12), transparent 55%),
    radial-gradient(900px 500px at -10% 30%, rgba(217, 119, 6, 0.08), transparent 50%),
    linear-gradient(165deg, #eef3f1 0%, #f7f8f6 42%, #e8efec 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ——— Sidebar ——— */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.75rem 0.75rem;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.18) 0%, transparent 28%),
    linear-gradient(160deg, #0c1f1c 0%, #102824 55%, #0a1916 100%);
  color: var(--sidebar-text);
  z-index: 40;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: auto -40% -20% -20%;
  height: 280px;
  background: radial-gradient(circle, rgba(13, 148, 136, 0.25), transparent 65%);
  pointer-events: none;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.15rem 0.5rem 0.7rem;
  position: relative;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  animation: mark-in 0.8s var(--ease) both;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1.1;
}

.brand-tag {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  justify-content: flex-start;
}

.sidebar__nav > .nav-item:not([hidden]) {
  flex: 0 0 auto;
}

/* У админа много пунктов: равномерные промежутки, без растягивания самих вкладок */
.app[data-role="orgadmin"] .sidebar__nav {
  justify-content: space-between;
  gap: 0;
}

.app[data-role="orgadmin"] .sidebar__nav > .nav-item:not([hidden]) {
  flex: 0 0 auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-align: left;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  box-sizing: border-box;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}

.nav-item > span {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-active);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-icon {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.is-active .nav-icon {
  opacity: 1;
}

.sidebar__footer {
  position: relative;
  flex-shrink: 0;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.logout-link {
  display: block;
  margin-top: 0;
  padding: 0.45rem 0.7rem;
  border-radius: 9px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  color: #c8ddd7;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.2s, color 0.2s;
}

.logout-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.user-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0d9488, #115e59);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.user-chip__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-chip__meta strong {
  color: #fff;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip__meta span {
  font-size: 0.68rem;
  opacity: 0.6;
}

/* ——— Main ——— */
.main-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.75rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(243, 246, 244, 0.92), rgba(243, 246, 244, 0.65));
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
}

.topbar__search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.topbar__search:focus-within {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.topbar__search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.topbar__search input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
}

.topbar__search input::placeholder {
  color: var(--muted);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  transition: background 0.2s, transform 0.2s;
}

.icon-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn .dot {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #fff;
}

.icon-btn .dot[hidden] {
  display: none !important;
}

.notif-wrap {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.05rem;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}

.notif-badge[hidden] {
  display: none !important;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(22.5rem, calc(100vw - 1.5rem));
  max-height: min(28rem, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 80;
  overflow: hidden;
}

.notif-panel[hidden] {
  display: none !important;
}

.notif-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}

.notif-panel__head strong {
  font-size: 0.95rem;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  overflow-y: auto;
  flex: 1 1 auto;
}

.notif-item {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover {
  background: rgba(15, 118, 110, 0.06);
}

.notif-item.is-unread {
  background: rgba(217, 119, 6, 0.08);
}

.notif-item.is-unread:hover {
  background: rgba(217, 119, 6, 0.12);
}

.notif-item strong {
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.3;
}

.notif-item span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.notif-item time {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.85;
}

.notif-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
  box-sizing: border-box;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.btn--sm {
  min-height: 2.4rem;
  padding: 0.6rem 1.05rem;
  font-size: 0.85rem;
}

.btn--primary {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px -10px rgba(15, 118, 110, 0.7);
}

.btn--primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #0b5f59, #0f766e);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  background: #fff;
  border-color: rgba(15, 118, 110, 0.22);
}

.content {
  padding: 0.75rem 1.75rem 2.5rem;
  flex: 1;
}

.page {
  display: none;
}

.page.is-visible {
  display: block;
  animation: page-in 0.45s var(--ease);
}

#page-personnel.is-visible {
  /* native <select> dropdown position breaks under page animation */
  animation: none;
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}

.student-picker {
  margin: 0;
  padding: 0;
  border: none;
}

.student-picker legend {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
}

.student-picker__list {
  display: grid;
  gap: 0.35rem;
  max-height: 200px;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.student-picker__list label {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
}

.student-picker__list input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.class-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.15rem;
  align-items: center;
}

.class-card__actions .btn--tiny {
  margin: 0;
}

.class-detail-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1.1rem;
  align-items: start;
}

.class-back {
  display: inline-flex;
  margin-bottom: 0.65rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.class-detail-side h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.class-detail-side__actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.class-detail-side__actions .btn {
  width: 100%;
}

.class-chat {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.15rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--line);
  min-height: 340px;
}

.class-chat__head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.class-chat__head h3 {
  margin: 0;
  font-size: 0.98rem;
}

.class-chat__head .auth-note {
  margin: 0;
  font-size: 0.78rem;
}

.class-chat__messages {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 220px;
  max-height: min(48vh, 420px);
  overflow: auto;
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.04);
  border: 1px solid var(--line);
}

.class-chat__empty {
  margin: auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.class-chat__msg {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(20, 35, 31, 0.06);
}

.class-chat__msg.is-self {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.14);
}

.class-chat__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}

.class-chat__author {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.class-chat__meta-right {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.class-chat__time {
  flex: 0 0 auto;
  font-size: 0.68rem;
  color: var(--muted);
}

.class-chat__action {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  cursor: pointer;
  border-radius: 4px;
}

.class-chat__action:hover {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.08);
}

.class-chat__block-user {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #b91c1c;
}

.class-chat__text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.class-chat__composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.class-chat__composer input {
  min-width: 0;
  min-height: 2.4rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.88rem;
}

.class-chat__composer input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

/* ——— Staff lounge (учительская) ——— */
.lounge-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.lounge-layout {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 1.1rem;
  align-items: start;
}

.lounge-chat {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 520px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(204, 251, 241, 0.22));
}

.lounge-chat__head h2 {
  margin: 0 0 0.2rem;
}

.lounge-chat__head .auth-note {
  margin: 0;
}

.lounge-chat__messages {
  flex: 1 1 auto;
  min-height: 320px;
  max-height: min(58vh, 560px);
}

.lounge-chat__composer {
  margin-top: auto;
}

.lounge-side {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(255, 237, 213, 0.28));
}

.lounge-colleagues {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: min(62vh, 620px);
  overflow: auto;
}

.lounge-colleague {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 35, 31, 0.06);
}

.lounge-colleague.is-me {
  border-color: rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.08);
}

.lounge-colleague__avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0d9488, #115e59);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.lounge-colleague.is-me .lounge-colleague__avatar {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.lounge-colleague__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
  flex: 1 1 auto;
}

.lounge-colleague__meta strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lounge-colleague__meta span {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.lounge-colleague__block {
  flex: 0 0 auto;
  margin-left: auto;
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.22);
}

.lounge-colleague__block:hover {
  background: rgba(185, 28, 28, 0.08);
}

@media (max-width: 900px) {
  .lounge-layout {
    grid-template-columns: 1fr;
  }

  .lounge-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ——— Materials library ——— */
.lounge-materials {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(204, 251, 241, 0.18));
}

.lounge-materials__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.lounge-materials__head h2 {
  margin: 0 0 0.2rem;
}

.lounge-materials__head .auth-note {
  margin: 0;
}

.materials-browser {
  display: grid;
  grid-template-columns: minmax(200px, 0.85fr) 1.4fr;
  gap: 0.9rem;
  align-items: stretch;
  min-height: 360px;
}

.materials-folders {
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 340px;
}

.materials-folders__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.materials-folders__head h3 {
  margin: 0;
  font-size: 0.92rem;
}

.materials-folders__list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: auto;
  max-height: min(52vh, 480px);
}

.materials-folder {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(15, 118, 110, 0.04);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.materials-folder:hover {
  background: rgba(15, 118, 110, 0.1);
}

.materials-folder.is-active {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.2);
}

.materials-folder__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0d9488, #115e59);
  color: #fff;
  flex-shrink: 0;
}

.materials-folder__icon svg {
  width: 16px;
  height: 16px;
}

.materials-folder__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 0.05rem;
}

.materials-folder__meta strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.materials-folder__meta span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.materials-folder__delete {
  flex: 0 0 auto;
  opacity: 0.55;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--danger);
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
}

.materials-folder__delete:hover {
  opacity: 1;
  background: rgba(190, 18, 60, 0.08);
}

.materials-files {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.15rem 0.1rem;
  min-width: 0;
}

.materials-files__toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.materials-files__toolbar strong {
  display: block;
  font-size: 1rem;
}

.materials-files__toolbar .auth-note {
  margin: 0.15rem 0 0;
}

.materials-upload-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.materials-upload-btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.materials-files__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 220px;
}

.materials-file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(20, 35, 31, 0.06);
}

.materials-file__icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-deep);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.materials-file__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.materials-file__meta strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.materials-file__meta span {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.materials-file__actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.materials-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.04);
  border: 1px dashed rgba(15, 118, 110, 0.18);
}

@media (max-width: 900px) {
  .materials-browser {
    grid-template-columns: 1fr;
  }
}

.student-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.student-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.student-row__avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0d9488, #115e59);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.student-row__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.student-row__meta strong {
  font-size: 0.92rem;
}

.student-row__meta span {
  font-size: 0.78rem;
  color: var(--muted);
}

.class-card.is-clickable {
  cursor: pointer;
}

.class-card.is-clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -18px rgba(12, 31, 28, 0.35);
}

.diary-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.diary-table select,
.diary-table input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.connect-status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.08);
  font-weight: 600;
  color: var(--brand-deep);
}

.connect-status__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0d9488;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.18);
}

.connect-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.85rem 0 1rem;
}

.connect-mode__option {
  display: grid;
  gap: 0.35rem;
  text-align: left;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.connect-mode__option strong {
  font-size: 0.95rem;
}

.connect-mode__option span {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.connect-mode__option:hover {
  border-color: rgba(15, 118, 110, 0.35);
}

.connect-mode__option.is-selected {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(204, 251, 241, 0.55);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.12);
}

@media (max-width: 560px) {
  .connect-mode {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .class-detail-layout {
    grid-template-columns: 1fr;
  }
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 1.5rem;
  margin-bottom: 1.85rem;
  flex-wrap: wrap;
}

.page-head > div {
  flex: 1 1 16rem;
  min-width: 0;
}

.page-head > .btn,
.page-head > .page-head__actions,
.page-head > .week-nav,
.page-head > .filter-tabs {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  margin-bottom: 0.15rem;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.page-head__actions .btn {
  margin: 0;
}

.page-head h1,
.page-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 2.8vw, 2.55rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.lede {
  margin: 0.55rem 0 0;
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.55;
}

/* ——— Home hero ——— */
.page-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1.75rem 2rem;
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.55)),
    linear-gradient(120deg, rgba(13, 148, 136, 0.08), rgba(217, 119, 6, 0.06));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.page-hero::after {
  content: "";
  position: absolute;
  right: -8%;
  top: -40%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13, 148, 136, 0.18), transparent 70%);
  pointer-events: none;
}

.page-hero__visual {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.hero-orbit {
  position: relative;
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(15, 118, 110, 0.35);
  animation: spin 28s linear infinite;
}

.orbit-ring--2 {
  inset: 18px;
  border-style: solid;
  border-color: rgba(217, 119, 6, 0.25);
  animation-duration: 18s;
  animation-direction: reverse;
}

.hero-stat {
  text-align: center;
  z-index: 1;
}

.hero-stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--brand-deep);
  line-height: 1;
}

.hero-stat span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.1rem;
}

.panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.panel--accent {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(204, 251, 241, 0.35));
}

.panel--wide {
  grid-column: 1 / -1;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

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

.panel__head h2 {
  margin: 0;
}

.soft-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  opacity: 0.9;
}

.soft-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline li {
  display: grid;
  gap: 0.15rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(15, 118, 110, 0.25);
}

.timeline time {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.02em;
}

.timeline strong {
  font-size: 0.95rem;
}

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

.activity-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.55rem;
  align-items: end;
  height: 140px;
  padding-top: 0.5rem;
}

.bar {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
}

.bar::before {
  content: "";
  width: 100%;
  max-width: 28px;
  height: var(--h);
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #5eead4, #0f766e);
  opacity: 0.55;
  transition: height 0.6s var(--ease), opacity 0.3s;
}

.bar.is-today::before {
  opacity: 1;
  background: linear-gradient(180deg, #fbbf24, #d97706);
}

.bar span {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.course-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}

.course-tile {
  display: grid;
  gap: 0.35rem;
  padding: 1.1rem 1.15rem 1.15rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}

.course-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -18px rgba(12, 31, 28, 0.35);
}

.course-tile__tone {
  width: 36px;
  height: 4px;
  border-radius: 4px;
  margin-bottom: 0.55rem;
}

.tone-teal { background: var(--brand); }
.tone-amber { background: var(--accent); }
.tone-sky { background: var(--sky); }

.course-tile strong {
  font-size: 1rem;
}

.course-tile span {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ——— Classes ——— */
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.classes-grid--admin {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.15rem;
}

.class-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease);
  animation: rise 0.5s var(--ease) both;
}

.class-card:hover {
  transform: translateY(-3px);
}

.class-card--admin {
  position: relative;
  overflow: hidden;
  gap: 1rem;
  padding: 0;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(204, 251, 241, 0.22));
  border: 1px solid rgba(15, 118, 110, 0.1);
  box-shadow:
    0 1px 0 rgba(20, 35, 31, 0.03),
    0 18px 40px -24px rgba(12, 31, 28, 0.28);
  transition:
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.class-card--admin::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #0f766e, #2dd4bf);
  border-radius: 4px 0 0 4px;
}

.class-card--admin[data-tone="1"]::before {
  background: linear-gradient(180deg, #d97706, #fbbf24);
}

.class-card--admin[data-tone="2"]::before {
  background: linear-gradient(180deg, #0284c7, #38bdf8);
}

.class-card--admin .class-card__glow {
  position: absolute;
  top: -40%;
  right: -18%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.22), transparent 68%);
  pointer-events: none;
}

.class-card--admin[data-tone="1"] .class-card__glow {
  background: radial-gradient(circle, rgba(251, 191, 36, 0.2), transparent 68%);
}

.class-card--admin[data-tone="2"] .class-card__glow {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2), transparent 68%);
}

.class-card--admin:hover {
  transform: translateY(-5px);
  border-color: rgba(15, 118, 110, 0.22);
  box-shadow:
    0 1px 0 rgba(20, 35, 31, 0.03),
    0 24px 48px -20px rgba(12, 31, 28, 0.32);
}

.class-card--admin .class-card__top {
  position: relative;
  z-index: 1;
  padding: 1.15rem 1.25rem 0 1.35rem;
}

.class-card--admin .class-card__body {
  position: relative;
  z-index: 1;
  padding: 0 1.25rem 0 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.class-card--admin h3 {
  font-size: 1.28rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.class-card__desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.class-card__desc--muted {
  font-style: italic;
  opacity: 0.75;
}

.class-card__people {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.55rem;
  padding: 0 1.15rem 0 1.25rem;
}

.class-card__person {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 35, 31, 0.06);
}

.class-card__person.is-empty {
  opacity: 0.72;
}

.class-card__avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0d9488, #115e59);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.class-card__avatar--amber {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.class-card__person.is-empty .class-card__avatar--amber {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  font-size: 0.95rem;
}

.class-card__person-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.class-card__person-meta span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.class-card__person-meta strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.class-card__stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  padding: 0 1.15rem 0 1.25rem;
}

.class-card--admin .class-card__stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 35, 31, 0.06);
}

.class-card__stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.class-card--admin .class-card__stat strong {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--brand-deep);
  line-height: 1.2;
}

.class-card--admin .class-card__actions {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0.85rem 1.15rem 1.15rem 1.25rem;
  border-top: 1px solid rgba(20, 35, 31, 0.06);
  background: rgba(255, 255, 255, 0.45);
  gap: 0.45rem;
}

.class-card--admin .class-card__actions .btn--tiny {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.class-card--admin .class-card__actions .btn--ghost {
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-deep);
  border: 1px solid rgba(15, 118, 110, 0.12);
}

.class-card--admin .class-card__actions .btn--ghost:hover {
  background: rgba(15, 118, 110, 0.14);
}

.class-card--admin .class-card__actions .btn--danger {
  background: rgba(190, 18, 60, 0.08);
  color: #be123c;
  border: 1px solid rgba(190, 18, 60, 0.12);
}

.class-card--admin .class-card__actions .btn--danger:hover {
  background: rgba(190, 18, 60, 0.14);
}

.class-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.class-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.class-badge--live {
  background: rgba(190, 18, 60, 0.14);
  color: #be123c;
  letter-spacing: 0.06em;
}

.class-live-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  background: rgba(190, 18, 60, 0.08);
  border: 1px solid rgba(190, 18, 60, 0.18);
}

.class-live-banner[hidden] {
  display: none !important;
}

.class-live-banner__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #e11d48;
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.45);
  animation: lesson-live-pulse 1.6s ease-out infinite;
  flex-shrink: 0;
}

.class-live-banner strong {
  display: block;
  font-size: 0.92rem;
  color: var(--ink);
}

.class-live-banner span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.connect-status__dot.is-live {
  background: #e11d48;
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.45);
  animation: lesson-live-pulse 1.6s ease-out infinite;
}

@keyframes lesson-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}

.class-badge--sky {
  background: var(--sky-soft);
  color: #075985;
}

.class-card h3 {
  margin: 0;
  font-size: 1.15rem;
  font-family: var(--serif);
  font-weight: 650;
}

.class-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.class-card__meta {
  display: flex;
  gap: 1rem;
  margin-top: auto;
  padding-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: rgba(15, 118, 110, 0.12);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: var(--p, 50%);
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
}

/* ——— Schedule ——— */
.week-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.15rem 0;
}

.week-nav .icon-btn {
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
  line-height: 1;
}

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

.schedule-day {
  min-height: 280px;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.schedule-day.is-today {
  background: linear-gradient(180deg, rgba(204, 251, 241, 0.55), rgba(255, 255, 255, 0.85));
  border-color: rgba(15, 118, 110, 0.28);
}

.schedule-day header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.schedule-day header span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.schedule-day header strong {
  font-family: var(--serif);
  font-size: 1.35rem;
}

.lesson {
  display: grid;
  gap: 0.1rem;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
}

.lesson time {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand);
}

.lesson strong {
  font-size: 0.82rem;
  line-height: 1.25;
}

.lesson span {
  font-size: 0.72rem;
  color: var(--muted);
}

.lesson--live {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--brand-soft);
}

.lesson--task {
  border-color: rgba(217, 119, 6, 0.35);
  background: var(--accent-soft);
}

.empty-day {
  margin: auto 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.schedule-head-actions {
  align-items: center;
  flex-wrap: wrap;
}

.schedule-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.schedule-toolbar__left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1.1rem;
}

.schedule-week-tabs {
  flex-shrink: 0;
}

.lesson-week {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.lesson-week--1 {
  background: rgba(15, 118, 110, 0.14);
  color: var(--brand);
}

.lesson-week--2 {
  background: rgba(180, 83, 9, 0.14);
  color: #b45309;
}

.lesson-week--all {
  background: rgba(100, 116, 139, 0.14);
  color: var(--muted);
}

.lesson-busy {
  display: grid;
  gap: 0.35rem;
  align-content: end;
  min-height: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.lesson-busy__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.lesson-busy__text {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.lesson-busy.is-free {
  border-color: rgba(15, 118, 110, 0.35);
  background: rgba(204, 251, 241, 0.45);
}

.lesson-busy.is-free .lesson-busy__text {
  color: var(--brand);
}

.lesson-busy.is-busy {
  border-color: rgba(185, 28, 28, 0.35);
  background: rgba(254, 226, 226, 0.55);
}

.lesson-busy.is-busy .lesson-busy__text {
  color: #b91c1c;
}

.lesson-busy.is-pending .lesson-busy__text {
  color: var(--muted);
  font-weight: 500;
}

.lesson {
  position: relative;
  text-align: left;
  cursor: default;
  width: 100%;
  font: inherit;
  color: inherit;
  appearance: none;
}

.lesson--editable {
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.lesson--editable:hover {
  border-color: rgba(15, 118, 110, 0.4);
  transform: translateY(-1px);
}

.lesson time .lesson-range {
  font-weight: 600;
  color: var(--muted);
}

.periods-editor {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.period-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(110px, 1fr) minmax(110px, 1fr) minmax(100px, 0.9fr) minmax(120px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.period-row__break-empty {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding-bottom: 0.15rem;
}

.period-row__break-empty .auth-note {
  margin: 0;
  white-space: nowrap;
}

.period-row label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.period-row input {
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
  width: 100%;
}

.periods-editor__bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.period-row__remove {
  width: 38px;
  height: 38px;
  margin-bottom: 0.1rem;
}

@media (max-width: 700px) {
  .period-row {
    grid-template-columns: 1fr 1fr;
  }

  .period-row__remove {
    grid-column: 1 / -1;
    width: 100%;
  }

  .period-row__break-empty {
    grid-column: 1 / -1;
  }
}

/* ——— Assignments ——— */
.filter-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.filter-tab {
  padding: 0.55rem 0.95rem;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}

.filter-tab.is-active {
  background: var(--ink);
  color: #fff;
}

.assign-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.assign-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  overflow: visible;
  position: relative;
  z-index: 4;
}

.assign-toolbar[hidden] {
  display: none !important;
}

.assign-toolbar__left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1.1rem;
  width: 100%;
}

.assign-toolbar .assign-filter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  flex: 0 0 220px;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.assign-toolbar .assign-menu-filter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  flex: 0 0 220px;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  position: relative;
  z-index: 5;
}

.assign-toolbar .assign-menu-filter:has(.role-filter__trigger[aria-expanded="true"]) {
  z-index: 30;
}

.assign-toolbar .assign-menu-filter .role-filter__control {
  width: 100%;
  position: relative;
}

.assign-toolbar .assign-menu-filter .role-filter__trigger {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 2.35rem 0.7rem 0.95rem;
  font-size: 0.92rem;
  border-radius: 12px;
}

.assign-toolbar .assign-menu-filter .role-filter__menu {
  left: 0;
  right: auto;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  z-index: 40;
}

.assign-toolbar .assign-filter[hidden],
.assign-toolbar .assign-menu-filter[hidden] {
  display: none !important;
}

.assign-filter__label {
  line-height: 1.2;
}

.assign-filter__control {
  position: relative;
  display: block;
  width: 100%;
}

.assign-filter__control::after {
  content: "";
  position: absolute;
  right: 0.95rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.assign-toolbar .assign-filter select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 2.35rem 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.assign-toolbar .assign-filter select:hover {
  border-color: rgba(15, 118, 110, 0.22);
}

.assign-toolbar .assign-filter select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* Селекты в модалках — тот же вид, что фильтры «Класс / Предмет» */
.modal__body .modal-select-field {
  width: 100%;
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.modal__body .modal-select-field .assign-filter__control {
  position: relative;
  display: block;
  width: 100%;
}

.modal__body .modal-select-field .assign-filter__control::after {
  content: "";
  position: absolute;
  right: 0.95rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  z-index: 1;
}

.modal__body .modal-select-field select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 2.35rem 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal__body .modal-select-field select:hover {
  border-color: rgba(15, 118, 110, 0.22);
}

.modal__body .modal-select-field select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.modal__body .modal-select-field select::-ms-expand {
  display: none;
}

.assign-toolbar__tabs {
  flex-shrink: 0;
  margin-left: auto;
  align-self: flex-end;
}

@media (max-width: 720px) {
  .assign-toolbar__tabs {
    margin-left: 0;
    width: 100%;
  }

  .assign-toolbar__tabs .filter-tab {
    flex: 1 1 0;
    text-align: center;
  }

  .assign-toolbar .assign-filter,
  .assign-toolbar .assign-menu-filter {
    width: 100%;
    min-width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }
}

.assign-list--cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.15rem;
  align-items: stretch;
}

.assign-list--cards > .admin-empty {
  grid-column: 1 / -1;
}

.assign-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.94) 0%, rgba(247, 250, 249, 0.88) 100%);
  border: 1px solid rgba(20, 35, 31, 0.07);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 10px 28px -18px rgba(12, 31, 28, 0.28);
  transition:
    transform 0.28s var(--ease),
    box-shadow 0.28s var(--ease),
    border-color 0.28s var(--ease);
  animation: rise 0.5s var(--ease) both;
}

@media (min-width: 900px) {
  .assign-list--cards {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    align-items: start;
  }

  .assign-card {
    height: 560px;
    min-height: 560px;
    max-height: 560px;
  }

  .assign-card__inner {
    height: 100%;
    min-height: 0;
  }

  .assign-card__title {
    min-height: 2.55em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .assign-card .assign-desc {
    min-height: 3.9em;
  }

  .assign-card__slots {
    flex: 0 0 auto;
  }

  .assign-card__file,
  .assign-card__nofile,
  .assign-card__slot,
  .assign-card__grade {
    min-height: 3.15rem;
    box-sizing: border-box;
  }

  .assign-card .assign-actions {
    margin-top: auto;
    min-height: 2.15rem;
  }
}

.assign-card:hover {
  transform: translateY(-4px);
  border-color: rgba(15, 118, 110, 0.18);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 22px 40px -20px rgba(12, 31, 28, 0.32);
}

.assign-card__accent {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #0d9488 0%, #0f766e 55%, #115e59 100%);
}

.assign-card--closed .assign-card__accent {
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}

.assign-card--closed {
  background:
    linear-gradient(165deg, rgba(248, 250, 249, 0.92) 0%, rgba(241, 245, 243, 0.88) 100%);
}

.assign-card__inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1 1 auto;
  padding: 1.25rem 1.25rem 1.2rem 1.4rem;
}

.assign-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
}

.assign-card__subject {
  display: inline-flex;
  max-width: 100%;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-deep);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assign-card--closed .assign-card__subject {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}

.assign-card__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.assign-card .assign-desc {
  margin: 0 !important;
  font-size: 0.88rem !important;
  line-height: 1.45;
  color: var(--ink-soft) !important;
  opacity: 1 !important;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.assign-card__slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.assign-card__slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px dashed rgba(20, 35, 31, 0.12);
  background: rgba(20, 35, 31, 0.025);
}

.assign-card__slot strong {
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.25;
}

.assign-card__slot--filled strong {
  color: var(--ink);
}

.assign-card__slot--empty {
  opacity: 0.92;
}

.assign-actions--placeholder {
  visibility: hidden;
  pointer-events: none;
}

.assign-card__file {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.06);
  border: 1px dashed rgba(15, 118, 110, 0.2);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.assign-card__file:hover {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.35);
}

.assign-card__file--mine {
  background: rgba(2, 132, 199, 0.07);
  border-color: rgba(2, 132, 199, 0.2);
  border-style: solid;
}

.assign-card__file--mine .assign-card__file-icon {
  background: linear-gradient(135deg, #0369a1, #0284c7);
}

.assign-card__file--mine:hover {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(2, 132, 199, 0.35);
}

.assign-card__grade {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.14);
  min-height: 0;
}

.assign-card__grade strong {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  border-radius: 9px;
  background: rgba(15, 118, 110, 0.14);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-deep);
  line-height: 1;
}

.assign-card__grade-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.assign-card__grade-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assign-card__file-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  font-size: 0.85rem;
  flex: 0 0 auto;
}

.assign-card__file-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.assign-card__file-text strong {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assign-card__file-text small {
  font-size: 0.72rem;
  color: var(--muted);
}

.assign-card__nofile {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(20, 35, 31, 0.03);
  color: var(--muted);
  font-size: 0.8rem;
}

.assign-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.15rem;
}

.assign-card__stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 35, 31, 0.06);
}

.assign-card__stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.assign-card__stat strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.assign-card__meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  overflow: hidden;
}

.assign-card__meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  transition: width 0.45s var(--ease);
}

.assign-card--closed .assign-card__meter span {
  background: linear-gradient(90deg, #94a3b8, #64748b);
}

.assign-card .assign-actions {
  width: 100%;
  justify-content: stretch;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.assign-card .assign-actions .btn--tiny {
  flex: 1 1 0;
  min-width: 0;
}

.assign-card .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  flex: 0 0 auto;
}

.assign-card .status--open {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.16);
  color: var(--brand-deep);
}

.assign-card .status--review {
  background: var(--sky-soft);
  border-color: rgba(2, 132, 199, 0.16);
  color: #075985;
}

.assign-card .status--done {
  background: var(--brand-soft);
  border-color: rgba(15, 118, 110, 0.16);
  color: var(--brand-deep);
}

.assign-card .status--closed {
  background: rgba(100, 116, 139, 0.14);
  border-color: rgba(100, 116, 139, 0.18);
  color: #475569;
}

@media (max-width: 420px) {
  .assign-card .assign-actions {
    flex-wrap: wrap;
  }

  .assign-card .assign-actions .btn--tiny {
    flex: 1 1 calc(50% - 0.2rem);
  }
}

.assign-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.45s var(--ease) both;
}

.assign-item[hidden] {
  display: none;
}

.assign-main {
  min-width: 0;
}

.assign-item h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.assign-item p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.assign-desc {
  margin-top: 0.45rem !important;
  white-space: pre-wrap;
  color: var(--ink) !important;
  opacity: 0.85;
}

.assign-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  min-width: 0;
}

.assign-due {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: right;
  white-space: nowrap;
}

.assign-progress {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.assign-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.assign-actions .btn--tiny {
  margin: 0;
  flex: 0 0 auto;
}

.assign-actions .btn--tiny.btn--primary {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 14px -8px rgba(15, 118, 110, 0.65);
}

.assign-actions .btn--tiny.btn--primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #0b5f59, #0f766e);
}

.assign-actions .btn--tiny.btn--ghost {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--line);
  color: var(--ink-soft);
}

.assign-actions .btn--tiny.btn--ghost:hover {
  background: #fff;
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--brand-deep);
}

.assign-actions .btn--tiny.btn--danger {
  background: rgba(190, 18, 60, 0.08);
  border-color: rgba(190, 18, 60, 0.14);
  color: var(--danger);
}

.assign-actions .btn--tiny.btn--danger:hover {
  background: rgba(190, 18, 60, 0.14);
  border-color: rgba(190, 18, 60, 0.22);
  transform: translateY(-1px);
}

.assign-actions .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.assign-actions .status--open {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.14);
  color: var(--brand-deep);
}

.assign-actions .status--closed {
  background: rgba(107, 127, 120, 0.12);
  border-color: rgba(107, 127, 120, 0.16);
  color: var(--muted);
}

.assign-actions .status--done {
  background: var(--brand-soft);
  border-color: rgba(15, 118, 110, 0.16);
  color: var(--brand-deep);
}

.assign-actions .status--review {
  background: var(--sky-soft);
  border-color: rgba(2, 132, 199, 0.16);
  color: #075985;
}

.assign-file {
  margin: 0.45rem 0 0 !important;
  font-size: 0.86rem !important;
}

.assign-file__label {
  color: var(--muted);
  margin-right: 0.35rem;
}

.assign-file--mine {
  opacity: 0.95;
}

.assign-answers {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(55vh, 420px);
  overflow: auto;
}

.assign-answer-row {
  display: grid;
  grid-template-columns: 1fr auto minmax(140px, 1.2fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.assign-answer-row strong {
  display: block;
}

.assign-answer-row span {
  font-size: 0.8rem;
  color: var(--muted);
}

.assign-answer-file {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
}

.assign-answer-file small {
  color: var(--muted);
  font-size: 0.75rem;
}

.assign-grade {
  margin: 0.4rem 0 0 !important;
  font-size: 0.88rem !important;
  color: var(--ink);
}

.assign-review {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.9fr);
  gap: 1.1rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.assign-review__preview {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
  min-height: 220px;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.assign-review__img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

.assign-review__frame {
  width: 100%;
  min-height: 380px;
  border: 0;
  border-radius: 10px;
  background: #fff;
}

.assign-review__grade {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.assign-review__grade label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.assign-review__grade select,
.assign-review__grade textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#gradeFileMeta {
  margin: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .assign-review {
    grid-template-columns: 1fr;
  }

  .assign-answer-row {
    grid-template-columns: 1fr;
  }
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 10px;
}

.status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  white-space: nowrap;
}

.status--open {
  background: var(--accent-soft);
  color: #9a3412;
}

.status--review {
  background: var(--sky-soft);
  color: #075985;
}

.status--done {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

/* ——— Settings ——— */
.settings-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1.1rem;
  align-items: start;
}

.settings-main {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.field-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-row--3:not(:has(#classShiftField:not([hidden]))) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
textarea,
select,
.settings-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
  font-weight: 500;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
  font-weight: 500;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* File picker — в одном стиле с остальными полями */
.file-field .file-field__control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.55rem 0.45rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.file-field .file-field__control:focus-within {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.file-field input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.file-field__btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.1rem;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-deep, #0f766e);
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.file-field__control:hover .file-field__btn {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.28);
}

.file-field__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
}

.file-field__name.is-filled {
  color: var(--ink);
  font-weight: 600;
}

.modal__body > .auth-note {
  margin: -0.15rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.toggles {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.toggles legend {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
  cursor: pointer;
}

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

.settings-side .meta-list {
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-side .meta-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.settings-side dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.settings-side dd {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
}

.settings-side p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.role-action[hidden] {
  display: none !important;
}

.nav-role[hidden] {
  display: none !important;
}

.sidebar-backdrop {
  display: none;
}

.role-hint {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.role-hint .soft-link {
  display: inline;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}

/* ——— Superadmin panel ——— */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-chip {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.2rem;
}

.stat-chip--quota {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(204, 251, 241, 0.45));
  border-color: rgba(15, 118, 110, 0.18);
}

.stat-chip strong {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--brand-deep);
  line-height: 1;
}

.stat-chip span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.settings-form .btn {
  margin-top: 0.65rem;
  align-self: flex-start;
  min-width: 10rem;
}

.admin-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  overflow: visible;
  position: relative;
  z-index: 3;
}

.admin-search {
  flex: 1;
  min-width: 220px;
  max-width: none;
}

.admin-filter {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* Custom filters: menu opens directly under the field */
.role-filter,
.menu-select {
  position: relative;
  z-index: 6;
}

.role-filter__control {
  position: relative;
  width: 100%;
}

.role-filter__trigger {
  position: relative;
  width: 100%;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 2.35rem 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.role-filter__trigger::after {
  content: "";
  position: absolute;
  right: 0.95rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.role-filter__control:has(.role-filter__trigger[aria-expanded="true"]) .role-filter__trigger,
.role-filter__trigger:focus {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  outline: none;
}

.role-filter__menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 40;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 28px rgba(12, 31, 28, 0.14);
  max-height: min(280px, 50vh);
  overflow-y: auto;
}

.role-filter__menu[hidden] {
  display: none !important;
}

.role-filter__menu li {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.role-filter__menu li:hover,
.role-filter__menu li:focus {
  background: rgba(15, 118, 110, 0.08);
  outline: none;
}

.role-filter__menu li[aria-selected="true"] {
  background: rgba(15, 118, 110, 0.14);
  color: var(--brand-deep);
}

.role-filter__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.admin-table-wrap {
  padding: 0;
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.95rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(243, 246, 244, 0.7);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover td {
  background: rgba(204, 251, 241, 0.2);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.user-cell__avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0d9488, #115e59);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.user-cell__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-cell__meta strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-cell__meta span {
  font-size: 0.78rem;
  color: var(--muted);
}

.role-select {
  min-width: 180px;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}

.role-select:focus {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  outline: none;
}

.role-select.is-locked {
  opacity: 0.7;
  cursor: not-allowed;
}

.user-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.55rem;
  border-radius: 7px;
  display: inline-block;
}

.user-status--active {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.user-status--invited {
  background: var(--accent-soft);
  color: #9a3412;
}

.user-status--blocked {
  background: rgba(190, 18, 60, 0.12);
  color: var(--danger);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.55rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-deep);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.user-actions .btn--danger {
  background: rgba(190, 18, 60, 0.1);
  color: var(--danger);
}

.user-actions .btn--danger:hover:not(:disabled) {
  background: rgba(190, 18, 60, 0.16);
}

.user-actions .btn--success {
  background: rgba(15, 118, 110, 0.12);
  color: var(--brand-deep);
}

.user-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--tiny {
  min-height: 2rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.78rem;
  line-height: 1.25;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-deep);
  font-weight: 700;
  box-sizing: border-box;
}

.btn--tiny:hover {
  background: rgba(15, 118, 110, 0.14);
}

.admin-empty {
  margin: 0;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

.platform-tabs {
  margin: 0.15rem 0 1.15rem;
  display: inline-flex;
}

.org-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.org-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 1.25rem;
  align-items: center;
  padding: 1.2rem 1.35rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.45s var(--ease) both;
}

.org-card.is-blocked {
  opacity: 0.72;
  background: rgba(255, 255, 255, 0.55);
}

.org-card__title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.org-card__title h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 650;
}

.org-card__meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.org-card__facts {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.org-card__facts strong {
  color: var(--ink);
  font-weight: 700;
}

.org-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-content: center;
  padding: 0.15rem 0;
}

.org-card__actions .btn {
  margin: 0;
}

.org-status {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
}

.org-status--pending {
  background: var(--accent-soft);
  color: #9a3412;
}

.org-status--active {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.org-status--blocked {
  background: #ffe4e6;
  color: #9f1239;
}

.org-status--expired {
  background: var(--sky-soft);
  color: #075985;
}

.btn--danger {
  background: #fff1f2;
  color: #9f1239;
  border-color: rgba(190, 18, 60, 0.15);
}

.btn--danger:hover {
  background: #ffe4e6;
}

.btn--success {
  background: var(--brand-soft);
  color: var(--brand-deep);
  border-color: rgba(15, 118, 110, 0.18);
}

.btn--success:hover {
  background: #99f6e4;
}

.modal-note {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.08);
  font-weight: 600;
  font-size: 0.92rem;
}

.field-optional {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.82em;
}

/* Modal */
.modal[hidden] {
  display: none;
}

.modal:not([hidden]) {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 1rem;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 31, 28, 0.48);
  backdrop-filter: blur(3px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 0;
  animation: page-in 0.3s var(--ease) both;
}

.modal__dialog--wide {
  width: min(560px, 100%);
}

.modal__dialog--class {
  width: min(860px, calc(100vw - 2rem));
  max-height: min(92vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal__dialog--class .modal__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

.modal__dialog--class .student-picker__list {
  max-height: min(320px, 38vh);
}

.modal__dialog--grade {
  width: min(960px, calc(100vw - 2rem));
}

.modal__dialog--periods {
  width: min(980px, 100%);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.modal__head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-family: var(--serif);
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.65rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.modal__actions .btn {
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 80;
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.9rem 1.15rem;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 16px 40px -18px rgba(12, 31, 28, 0.55);
  animation: page-in 0.3s var(--ease) both;
}

.toast[hidden] {
  display: none;
}

/* ——— Motion ——— */
@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes mark-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.class-card:nth-child(2) { animation-delay: 0.05s; }
.class-card:nth-child(3) { animation-delay: 0.1s; }
.class-card:nth-child(4) { animation-delay: 0.15s; }
.class-card:nth-child(5) { animation-delay: 0.2s; }
.class-card:nth-child(6) { animation-delay: 0.25s; }
.assign-item:nth-child(2),
.assign-card:nth-child(2) { animation-delay: 0.05s; }
.assign-item:nth-child(3),
.assign-card:nth-child(3) { animation-delay: 0.1s; }
.assign-item:nth-child(4),
.assign-card:nth-child(4) { animation-delay: 0.15s; }

/* ——— Responsive ——— */
@media (max-width: 1100px) {
  .schedule-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .course-row {
    grid-template-columns: 1fr 1fr;
  }

  .page-hero {
    grid-template-columns: 1fr;
  }

  .page-hero__visual {
    display: none;
  }

  .admin-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(var(--sidebar-w), 86vw);
    transform: translateX(-105%);
    transition: transform 0.35s var(--ease);
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.2);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 31, 28, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 35;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .home-grid,
  .settings-layout,
  .field-row,
  .field-row--3,
  .field-row--3:not(:has(#classShiftField:not([hidden]))) {
    grid-template-columns: 1fr;
  }

  .file-field__control {
    flex-wrap: wrap;
  }

  .content,
  .topbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .assign-item {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .assign-side {
    align-items: stretch;
    width: 100%;
  }

  .assign-due,
  .assign-progress {
    text-align: left;
  }

  .assign-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .assign-answer-row {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .admin-table-wrap {
    overflow-x: auto;
  }

  .admin-table {
    min-width: 720px;
  }

  /* Персонал (orgadmin): карточки вместо таблицы, без горизонтального скролла */
  #page-personnel .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    overflow: visible;
    position: relative;
    z-index: 5;
  }

  #page-personnel .admin-search,
  #page-personnel .admin-filter {
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  #page-personnel .role-filter {
    z-index: 8;
  }

  #page-personnel .admin-table-wrap {
    overflow: visible;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    position: relative;
    z-index: 0;
  }

  #page-personnel .admin-table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  #page-personnel .admin-table thead {
    display: none;
  }

  #page-personnel .admin-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  #page-personnel .admin-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "user status"
      "role role"
      "actions actions";
    gap: 0.55rem 0.65rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
  }

  #page-personnel .admin-table tbody tr:hover td {
    background: transparent;
  }

  #page-personnel .admin-table th,
  #page-personnel .admin-table td {
    display: block;
    width: auto;
    max-width: 100%;
    padding: 0;
    border: none;
    vertical-align: top;
  }

  #page-personnel .admin-table td:nth-child(1) {
    grid-area: user;
    min-width: 0;
  }

  #page-personnel .admin-table td:nth-child(2) {
    grid-area: role;
  }

  #page-personnel .admin-table td:nth-child(3) {
    grid-area: status;
    justify-self: end;
    align-self: start;
  }

  #page-personnel .admin-table td:nth-child(4) {
    grid-area: actions;
    padding-top: 0.35rem;
    border-top: 1px solid var(--line);
  }

  #page-personnel .user-cell__meta strong,
  #page-personnel .user-cell__meta span {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #page-personnel .user-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }

  #page-personnel .user-actions .btn {
    width: 100%;
    justify-content: center;
    min-width: 0;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  #page-personnel .page-head__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  #page-personnel .page-head__actions .btn {
    width: 100%;
  }

  .org-card {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .org-card__actions {
    justify-content: flex-start;
    margin-top: 0.25rem;
    padding-top: 0.35rem;
  }

  .page-head > .btn,
  .page-head > .page-head__actions {
    width: 100%;
  }

  .page-head__actions {
    width: 100%;
  }

  .page-head__actions .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 640px) {
  .course-row {
    grid-template-columns: 1fr;
  }

  .schedule-board {
    grid-template-columns: 1fr 1fr;
  }

  .role-cta {
    display: none;
  }

  .topbar__search {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ——— Roles page ——— */
.roles-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) 1.4fr;
  gap: 1.1rem;
  align-items: start;
}

.edu-programs-layout {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1rem;
  min-width: 0;
}

.edu-programs-list-panel,
.edu-program-detail {
  min-width: 0;
  width: 100%;
}

.edu-programs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.75rem;
  max-height: none;
  overflow: visible;
}

.edu-program-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 1rem 1.05rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(240, 253, 250, 0.55));
  box-shadow: var(--shadow);
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.edu-program-item:hover {
  border-color: rgba(15, 118, 110, 0.22);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.1);
  transform: translateY(-1px);
}

.edu-program-item.is-active {
  border-color: rgba(15, 118, 110, 0.35);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(204, 251, 241, 0.55));
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.12);
}

.edu-program-item__type {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-deep);
  background: var(--brand-soft);
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
}

.edu-program-item__title,
.edu-program-item strong {
  display: block;
  width: 100%;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.edu-program-item__code {
  margin-right: 0.35rem;
  color: var(--muted);
  font-weight: 600;
}

.edu-program-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.edu-program-detail__empty {
  padding: 2rem 1rem;
  text-align: center;
}

.edu-program-detail__head,
.edu-program-plan__head {
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.edu-program-detail__head h2,
.edu-program-detail__meta,
.edu-program-plan__head h3 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.edu-program-plan__head {
  padding: 0;
  border: 0;
  margin-bottom: 0.75rem;
}

.edu-program-plan__head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.edu-program-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.edu-program-plan h3 {
  font-weight: 650;
}

.edu-subjects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
  min-width: 0;
}

.edu-subject-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.edu-subject-card__name {
  min-width: 0;
  flex: 1;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.edu-subject-card__hours {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-deep);
  background: var(--brand-soft);
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

#page-edu-programs,
#page-edu-programs .edu-programs-layout,
#page-edu-programs .panel {
  min-width: 0;
  max-width: 100%;
}

#page-edu-programs .edu-programs-layout,
#page-edu-programs .edu-programs-list-panel,
#page-edu-programs .edu-program-detail {
  overflow-x: hidden;
}

#page-edu-programs .admin-toolbar {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  flex-wrap: nowrap;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  position: relative;
  z-index: 5;
}

#page-edu-programs .edu-type-filter {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  z-index: 6;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

#page-edu-programs .edu-type-filter.admin-filter {
  min-width: 0;
  width: 100%;
}

#page-edu-programs .edu-type-filter__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#page-edu-programs .edu-type-filter .role-filter__control {
  width: 100%;
}

#page-edu-programs .edu-type-filter .role-filter__trigger {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.7rem 2.35rem 0.7rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  border-radius: 12px;
  white-space: nowrap;
  box-sizing: border-box;
}

#page-edu-programs .edu-type-filter .role-filter__trigger::after {
  right: 0.95rem;
  width: 0.45rem;
  height: 0.45rem;
}

#page-edu-programs .edu-type-filter:has(.role-filter__trigger[aria-expanded="true"]) {
  min-width: 0;
  width: 100%;
}

#page-edu-programs .edu-type-filter:has(.role-filter__trigger[aria-expanded="true"]) .role-filter__trigger {
  width: 100%;
}

#page-edu-programs .edu-type-filter .role-filter__menu {
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
  max-width: none;
  box-sizing: border-box;
}

#page-edu-programs #eduCurriculumTemplateBtn {
  flex: 0 0 auto;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  border-radius: 12px;
  justify-content: center;
  box-sizing: border-box;
}

#page-edu-programs .page-head {
  gap: 0.85rem;
}

#page-edu-programs .page-head .btn {
  flex-shrink: 0;
}

.roles-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(70vh, 640px);
  overflow: auto;
}

.roles-list__item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  padding: 0.8rem 0.85rem;
  border-radius: 14px;
  border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.28)),
    rgba(15, 118, 110, 0.05);
  cursor: pointer;
  color: inherit;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.roles-list__item:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35)),
    rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.14);
}

.roles-list__item.is-active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(204, 251, 241, 0.45)),
    rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.08);
}

.roles-list__item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.roles-list__item strong {
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.25;
}

.roles-list__item-meta {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.roles-badge {
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.26rem 0.48rem;
  border-radius: 999px;
  line-height: 1;
}

.roles-badge--system {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.roles-badge--custom {
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
}

.roles-badge--locked {
  background: rgba(20, 35, 31, 0.08);
  color: #3f4f49;
}

.roles-editor__identity {
  flex: 1;
  min-width: min(100%, 280px);
}

.roles-editor__identity label {
  display: block;
}

.roles-editor__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.roles-editor__actions {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
}

.roles-kind {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(204, 251, 241, 0.75), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(240, 253, 250, 0.72));
}

.roles-kind--locked {
  border-color: rgba(20, 35, 31, 0.1);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(20, 35, 31, 0.06), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(244, 246, 245, 0.8));
}

.roles-kind--custom {
  border-color: rgba(14, 165, 233, 0.16);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(186, 230, 253, 0.65), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(240, 249, 255, 0.75));
}

.roles-kind__mark {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  flex: 0 0 auto;
  background: rgba(15, 118, 110, 0.12);
  color: var(--brand-deep);
}

.roles-kind--locked .roles-kind__mark {
  background: rgba(20, 35, 31, 0.08);
  color: #3f4f49;
}

.roles-kind--custom .roles-kind__mark {
  background: rgba(14, 165, 233, 0.14);
  color: #0369a1;
}

.roles-kind__body {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.roles-kind__eyebrow {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}

.roles-kind--locked .roles-kind__eyebrow {
  color: #566560;
}

.roles-kind--custom .roles-kind__eyebrow {
  color: #0284c7;
}

.roles-kind__body strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink, #14231f);
  line-height: 1.25;
}

.roles-kind__body > span:last-child {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}

.roles-locked-note {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px dashed rgba(20, 35, 31, 0.16);
  background: rgba(20, 35, 31, 0.03);
  color: var(--muted);
}

.roles-locked-note__icon {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 9px;
  background: rgba(20, 35, 31, 0.07);
  color: #3f4f49;
  flex: 0 0 auto;
}

.roles-locked-note strong {
  display: block;
  color: var(--ink, #14231f);
  font-size: 0.86rem;
  margin-bottom: 0.12rem;
}

.roles-locked-note span {
  display: block;
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 500;
}

.roles-perm-groups {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.roles-perm-group {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(240, 253, 250, 0.55)),
    rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.05);
}

.roles-perm-group__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 0;
  border-bottom: 1px solid rgba(15, 118, 110, 0.08);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(204, 251, 241, 0.55), transparent 55%),
    rgba(255, 255, 255, 0.45);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease;
}

.roles-perm-group__head:hover {
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(204, 251, 241, 0.7), transparent 55%),
    rgba(255, 255, 255, 0.62);
}

.roles-perm-group.is-collapsed .roles-perm-group__head {
  border-bottom-color: transparent;
}

.roles-perm-group__mark {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 12px;
  flex: 0 0 auto;
  background: rgba(15, 118, 110, 0.12);
  color: var(--brand-deep);
}

.roles-perm-group__titles {
  min-width: 0;
  flex: 1;
}

.roles-perm-group__titles h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink, #14231f);
  line-height: 1.2;
}

.roles-perm-group__titles p {
  margin: 0.18rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.3;
}

.roles-perm-group__count {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.roles-perm-group__chevron {
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.15rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.roles-perm-group.is-collapsed .roles-perm-group__chevron {
  transform: rotate(-45deg);
}

.roles-perm-group__list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem;
}

.roles-perm-group.is-collapsed .roles-perm-group__list {
  display: none;
}

.roles-perm-item {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.72rem 0.8rem;
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.42);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.roles-perm-item:hover {
  background: rgba(15, 118, 110, 0.06);
  border-color: rgba(15, 118, 110, 0.1);
}

.roles-perm-item.is-on {
  background:
    linear-gradient(145deg, rgba(204, 251, 241, 0.55), rgba(255, 255, 255, 0.65));
  border-color: rgba(15, 118, 110, 0.14);
}

.roles-perm-item.is-on:hover {
  background:
    linear-gradient(145deg, rgba(204, 251, 241, 0.7), rgba(255, 255, 255, 0.75));
}

.roles-perm-item.is-locked {
  cursor: default;
  opacity: 0.82;
}

.roles-perm-item.is-locked:hover {
  background: rgba(255, 255, 255, 0.42);
  border-color: transparent;
}

.roles-perm-item.is-locked.is-on:hover {
  background:
    linear-gradient(145deg, rgba(204, 251, 241, 0.55), rgba(255, 255, 255, 0.65));
  border-color: rgba(15, 118, 110, 0.14);
}

.roles-perm-item__row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

.roles-perm-item__name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink, #14231f);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roles-perm-item__desc {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
  padding-right: 3.4rem;
}

.roles-switch {
  position: relative;
  flex: 0 0 auto;
  width: 2.7rem;
  height: 1.5rem;
  align-self: center;
}

.roles-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.roles-switch input:disabled {
  cursor: not-allowed;
}

.roles-switch__track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(20, 35, 31, 0.14);
  box-shadow: inset 0 0 0 1px rgba(20, 35, 31, 0.06);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.roles-switch__thumb {
  position: absolute;
  top: 0.17rem;
  left: 0.17rem;
  width: 1.16rem;
  height: 1.16rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 35, 31, 0.28);
  transition: transform 0.18s ease;
  pointer-events: none;
  z-index: 1;
}

.roles-switch input:checked + .roles-switch__track {
  background: var(--brand);
  box-shadow:
    inset 0 0 0 1px rgba(11, 95, 89, 0.18),
    0 0 0 3px rgba(15, 118, 110, 0.1);
}

.roles-switch input:checked + .roles-switch__track .roles-switch__thumb {
  transform: translateX(1.2rem);
}

.roles-switch input:focus-visible + .roles-switch__track {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, white);
  outline-offset: 2px;
}

.roles-switch input:disabled + .roles-switch__track {
  opacity: 0.72;
}

.roles-perm-group--users .roles-perm-group__mark,
.roles-perm-group--classes .roles-perm-group__mark {
  background: rgba(15, 118, 110, 0.12);
}

.roles-perm-group--assignments .roles-perm-group__mark {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.roles-perm-group--lounge .roles-perm-group__mark {
  background: rgba(14, 165, 233, 0.14);
  color: #0369a1;
}

.roles-perm-group--assignments .roles-perm-group__count {
  background: rgba(254, 243, 199, 0.95);
  color: #92400e;
}

.roles-perm-group--lounge .roles-perm-group__count {
  background: rgba(186, 230, 253, 0.9);
  color: #075985;
}

@media (max-width: 900px) {
  .roles-layout {
    grid-template-columns: 1fr;
  }

  #page-edu-programs .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  #page-edu-programs .page-head .btn {
    width: 100%;
  }

  #page-edu-programs .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #page-edu-programs .edu-type-filter,
  #page-edu-programs .edu-type-filter .role-filter__trigger,
  #page-edu-programs #eduCurriculumTemplateBtn {
    width: 100%;
  }

  #page-edu-programs .edu-programs-list,
  #page-edu-programs .edu-subjects {
    grid-template-columns: 1fr;
  }

  #page-edu-programs .edu-program-detail__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  #page-edu-programs .edu-program-plan__head {
    flex-direction: column;
    align-items: stretch;
  }

  #page-edu-programs .edu-program-plan__head .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ——— Org performance stats ——— */
.page-head--compact {
  margin-bottom: 0.85rem;
}

.page-head--compact h2 {
  margin: 0.1rem 0 0.25rem;
  font-size: 1.35rem;
  font-family: var(--serif);
  font-weight: 650;
}

.page-head--compact .lede {
  margin: 0;
  font-size: 0.92rem;
}

.perf-section {
  margin-top: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.perf-dist {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.perf-dist__item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(15, 118, 110, 0.1);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(240, 253, 250, 0.55));
}

.perf-dist__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.perf-dist__grade {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--brand-deep);
}

.perf-dist__count {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
}

.perf-dist__bar {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  overflow: hidden;
}

.perf-dist__bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  min-width: 0;
}

.perf-dist__item--2 .perf-dist__grade { color: #be123c; }
.perf-dist__item--2 .perf-dist__bar > span { background: #e11d48; }
.perf-dist__item--3 .perf-dist__grade { color: #b45309; }
.perf-dist__item--3 .perf-dist__bar > span { background: #f59e0b; }
.perf-dist__item--4 .perf-dist__grade { color: #0369a1; }
.perf-dist__item--4 .perf-dist__bar > span { background: #0ea5e9; }
.perf-dist__item--5 .perf-dist__grade { color: var(--brand-deep); }
.perf-dist__item--5 .perf-dist__bar > span { background: var(--brand); }

.perf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  align-items: start;
}

.perf-grid .panel {
  min-width: 0;
}

.perf-filter {
  min-width: 200px;
  z-index: 6;
}

.perf-grid .panel__head {
  position: relative;
  z-index: 4;
  overflow: visible;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.perf-avg {
  font-weight: 750;
  color: var(--brand-deep);
}

.perf-avg--empty {
  color: var(--muted);
  font-weight: 600;
}

.perf-student-name {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.perf-student-name strong {
  font-weight: 650;
}

.perf-student-name span {
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 960px) {
  .perf-grid {
    grid-template-columns: 1fr;
  }

  .perf-dist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== School journal ===== */
/* ===== Journal (ESVO design) ===== */
.journal-plan-panel .panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.schedule-buildings-block {
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line, rgba(15, 23, 42, 0.08));
}

.schedule-shift-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0.85rem;
}

.schedule-shift-tab {
  border: 1px solid var(--line, rgba(15, 23, 42, 0.12));
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.schedule-shift-tab.is-active {
  border-color: var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent);
  font-weight: 600;
}

.schedule-buildings-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 650;
}

.building-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.building-row input {
  flex: 1;
}

.journal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1rem;
  margin-top: 1rem;
  padding: 1rem 1.15rem;
}

.journal-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
  padding: 0;
}

.journal-tabs__btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.journal-tabs__btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.journal-attestation-grid .journal-attestation__cell {
  min-width: 9.5rem;
  vertical-align: middle;
  text-align: left;
  padding: 0.35rem 0.45rem;
}

.journal-attestation__controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
}

.journal-attestation__admit {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.journal-attestation__admit input {
  margin: 0;
}

.journal-attestation__result {
  min-height: 2rem;
  font: inherit;
  font-size: 0.85rem;
}

.journal-attestation__result:disabled {
  opacity: 0.55;
}

.journal-toolbar .assign-filter {
  min-width: 160px;
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.journal-toolbar .assign-filter__control select {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.45rem 2.2rem 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: inherit;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.journal-toolbar .assign-filter__control select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.journal-toolbar .assign-filter__control select::-ms-expand {
  display: none;
}

.journal-toolbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.journal-grid-panel {
  margin-top: 1rem;
  padding: 0;
  overflow: hidden;
}

.journal-sheet {
  padding: 1rem 1.1rem 0.75rem;
  background: transparent;
}

.journal-sheet__subject {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.journal-sheet__subject span {
  font-weight: 650;
}

.journal-sheet__subject strong {
  flex: 1;
  min-width: 12rem;
  border-bottom: 1.5px solid rgba(15, 118, 110, 0.28);
  padding: 0.15rem 0.2rem 0.25rem;
  font-weight: 750;
  color: var(--ink);
}

.journal-scroll {
  overflow: auto;
  max-width: 100%;
  max-height: min(70vh, 720px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.journal-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--surface-2);
}

.journal-grid th,
.journal-grid td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  text-align: center;
  vertical-align: middle;
  background: var(--surface-2);
}

.journal-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, #f7fbfa, #eef6f4);
  font-weight: 700;
  color: var(--ink-soft);
}

.journal-grid__sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-2);
}

.journal-grid thead .journal-grid__sticky {
  z-index: 5;
  background: linear-gradient(180deg, #f0f7f5, #e7f2ef);
}

.journal-grid__num {
  left: 0;
  width: 2.7rem;
  min-width: 2.7rem;
  max-width: 2.7rem;
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.journal-grid__name {
  left: 2.7rem;
  width: 13.5rem;
  min-width: 13.5rem;
  max-width: 13.5rem;
  text-align: left !important;
  padding: 0.35rem 0.65rem !important;
  font-weight: 650;
  color: var(--ink);
  box-shadow: 2px 0 0 rgba(15, 118, 110, 0.1);
}

.journal-grid__corner-cell {
  height: 4.6rem;
  padding: 0 !important;
  vertical-align: stretch !important;
}

.journal-corner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 4.6rem;
  overflow: hidden;
  background:
    linear-gradient(
      to top right,
      transparent calc(50% - 0.7px),
      rgba(15, 118, 110, 0.35) calc(50% - 0.7px),
      rgba(15, 118, 110, 0.35) calc(50% + 0.7px),
      transparent calc(50% + 0.7px)
    ),
    linear-gradient(165deg, rgba(204, 251, 241, 0.45), rgba(255, 255, 255, 0.2));
}

.journal-corner__date,
.journal-corner__list {
  position: absolute;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brand-deep);
  line-height: 1.15;
}

.journal-corner__date {
  top: 0.4rem;
  right: 0.5rem;
}

.journal-corner__list {
  left: 0.4rem;
  bottom: 0.35rem;
  max-width: 7.8rem;
  text-transform: none;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: left;
  color: var(--ink-soft);
  letter-spacing: 0;
}

.journal-grid__month {
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.4rem !important;
  background: linear-gradient(180deg, #e8f6f3, #d9f0eb) !important;
  color: var(--brand-deep);
}

.journal-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 1.75rem;
}

.journal-month-nav__label {
  min-width: 9.5rem;
  text-align: center;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.journal-month-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--brand-deep);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.journal-month-nav__btn:hover {
  background: #fff;
  border-color: rgba(15, 118, 110, 0.4);
}

.journal-month-nav__btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.journal-grid__days-row th {
  top: 2rem;
}

.journal-grid__date {
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  height: 2rem;
  position: relative;
  padding: 0.15rem 0 !important;
  background: #f3faf8 !important;
}

.journal-grid__date.is-thick,
.journal-grid__mark.is-thick {
  border-right-width: 2px;
  border-right-color: rgba(15, 118, 110, 0.28);
}

.journal-grid__day {
  display: block;
  font-size: 0.78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
}

.journal-grid__date-del {
  position: absolute;
  top: -0.1rem;
  right: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0;
  opacity: 0;
}

.journal-grid__date:hover .journal-grid__date-del {
  opacity: 0.8;
}

.journal-grid__date-del:hover {
  color: var(--danger);
  opacity: 1;
}

.journal-grid__date--blank {
  background: var(--surface-2) !important;
}

.journal-grid__avg {
  width: 2.8rem;
  min-width: 2.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  color: var(--brand-deep);
  background: rgba(204, 251, 241, 0.35);
}

.journal-grid__mark {
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  height: 1.85rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
  line-height: 1.85rem;
}

.journal-grid__mark--blank {
  background: var(--surface-2);
}

.journal-grid__mark.is-absent {
  color: var(--danger);
  background: rgba(190, 18, 60, 0.07);
}

.journal-grid__mark.is-graded {
  color: var(--brand-deep);
}

.journal-grid tbody tr.is-row-thick td {
  border-bottom-width: 2px;
  border-bottom-color: rgba(15, 118, 110, 0.18);
}

.journal-mark-select {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 1.85rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: 750;
  line-height: 1.85rem;
  text-align: center;
  text-align-last: center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.journal-mark-select option {
  text-align: center;
}

.journal-mark-select:hover,
.journal-mark-select:focus {
  background: var(--brand-soft);
  outline: none;
}

.journal-empty-actions {
  text-align: center;
  padding: 1.1rem !important;
  background: rgba(243, 246, 244, 0.9) !important;
}

.journal-empty-hint {
  display: block;
  margin: 0.55rem auto 0;
  max-width: 26rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
  font-weight: 500;
}

.journal-topics {
  border-top: 1px solid var(--line);
  padding: 1rem 1.15rem 1.1rem;
  background: linear-gradient(180deg, rgba(243, 246, 244, 0.65), rgba(255, 255, 255, 0.4));
}

.journal-topics__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.journal-topics__title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 750;
  color: var(--ink);
}

.journal-topics__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.journal-topics__actions[hidden],
.journal-topics__manual[hidden],
.journal-topics[hidden],
.journal-plan-actions[hidden],
#workProgramTemplateBtn[hidden],
#journalTopicsClearBtn[hidden],
#journalTopicsAddBtn[hidden],
#journalTopicsTemplateBtn[hidden],
#journalTopicsUploadLabel[hidden],
#journalAddDateBtn[hidden],
#journalSyncScheduleBtn[hidden] {
  display: none !important;
}

.journal-topics__hint {
  margin: 0 0 0.65rem;
}

.journal-topics__manual {
  display: grid;
  grid-template-columns: minmax(9rem, 11rem) minmax(12rem, 1fr) auto;
  gap: 0.55rem 0.7rem;
  align-items: end;
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
}

.journal-topics__manual label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.journal-topics__manual input[type="date"],
.journal-topics__manual input[type="text"] {
  min-height: 2.2rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
}

.journal-topics__manual input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.journal-topics__manual .btn {
  justify-self: start;
  min-height: 2.2rem;
}

@media (max-width: 720px) {
  .journal-topics__manual {
    grid-template-columns: 1fr;
  }
}

.journal-topics__scroll {
  overflow: auto;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.journal-topics__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.journal-topics__table th,
.journal-topics__table td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: middle;
  background: transparent;
}

.journal-topics__table th {
  background: rgba(15, 118, 110, 0.06);
  font-weight: 700;
  color: var(--ink-soft);
  position: sticky;
  top: 0;
}

.journal-topics__date {
  width: 4.5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--brand-deep);
}

.journal-topic-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.25;
  padding: 0.4rem 0.55rem;
  color: var(--ink);
}

.journal-topic-input:hover,
.journal-topic-input:focus {
  border-color: rgba(15, 118, 110, 0.28);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.journal-grid tbody tr:hover td {
  background: rgba(204, 251, 241, 0.18);
}

.journal-grid tbody tr:hover .journal-grid__sticky {
  background: #eef8f5;
}

@media (max-width: 720px) {
  .journal-toolbar__right {
    margin-left: 0;
    width: 100%;
  }

  .journal-grid__name {
    width: 9.5rem;
    min-width: 9.5rem;
    max-width: 9.5rem;
  }

  .journal-corner__list {
    max-width: 5.5rem;
    font-size: 0.58rem;
  }
}

/* Remote licenses (hub) */
.license-mode-banner {
  margin-bottom: 1rem;
  line-height: 1.45;
}

.license-mode-banner code {
  font-size: 0.85em;
}

.license-mode-banner .modal-note {
  margin: 0.55rem 0 0;
}


