:root {
  --bg: #f4f0f1;
  --surface: #ffffff;
  --surface-soft: #faf7f8;
  --border: rgba(107, 33, 52, 0.14);
  --text: #1a1014;
  --muted: #6e5e64;
  --accent: #8b1e3f;
  --accent-glow: #c4315a;
  --accent-light: rgba(139, 30, 63, 0.1);
  --neon-pink: #d4566e;
  --neon-cyan: #b8a9ad;
  --neon-purple: #9a7080;
  --success: #2d6a4f;
  --success-light: rgba(45, 106, 79, 0.1);
  --danger: #b42318;
  --danger-light: rgba(180, 35, 24, 0.1);
  --warning: #a16207;
  --warning-light: rgba(161, 98, 7, 0.1);
  --shadow: 0 4px 22px rgba(107, 33, 52, 0.07), 0 1px 3px rgba(26, 16, 20, 0.05);
  --shadow-hover: 0 10px 34px rgba(107, 33, 52, 0.14), 0 4px 14px rgba(139, 30, 63, 0.08);
  --glow-soft: 0 0 16px rgba(196, 49, 90, 0.22), 0 0 28px rgba(139, 30, 63, 0.1);
  --glow-strong: 0 0 12px rgba(196, 49, 90, 0.55), 0 0 28px rgba(139, 30, 63, 0.32);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 74px;
  --topbar-bg: rgba(255, 251, 252, 0.97);
  --overlay-bg: rgba(20, 10, 14, 0.58);
  --backdrop-bg: rgba(20, 10, 14, 0.45);
  --scrollbar-thumb: #b6a3aa;
  --scrollbar-thumb-hover: #8f737c;
  --scrollbar-track: #ebe3e6;
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 0.2s var(--ease-smooth);
  --transition-smooth: 0.38s var(--ease-smooth);
  --transition-slow: 0.55s var(--ease-smooth);
}

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

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Golos Text", "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 60% at 10% -5%, rgba(139, 30, 63, 0.1), transparent 55%),
    radial-gradient(ellipse 70% 50% at 95% 105%, rgba(180, 120, 130, 0.09), transparent 50%),
    radial-gradient(ellipse 55% 40% at 50% 45%, rgba(110, 94, 98, 0.07), transparent 60%);
  background-size: 140% 140%, 130% 130%, 120% 120%;
  background-attachment: fixed;
  animation: auroraShift 16s ease-in-out infinite alternate;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  isolation: isolate;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 3px solid var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

body[data-theme="dark"] {
  --bg: #0f0a0c;
  --surface: rgba(24, 14, 18, 0.94);
  --surface-soft: rgba(32, 18, 24, 0.88);
  --border: rgba(232, 93, 122, 0.18);
  --text: #f9f4f5;
  --muted: #b09aa1;
  --accent: #e85d7a;
  --accent-glow: #ff8da6;
  --accent-light: rgba(232, 93, 122, 0.14);
  --neon-pink: #ff8da6;
  --neon-cyan: #c9b4ba;
  --neon-purple: #c49aaa;
  --success: #6fcf97;
  --success-light: rgba(111, 207, 151, 0.14);
  --danger: #ff8b8b;
  --danger-light: rgba(255, 139, 139, 0.14);
  --warning: #f0c674;
  --warning-light: rgba(240, 198, 116, 0.14);
  --shadow: 0 4px 28px rgba(0, 0, 0, 0.42), 0 0 1px rgba(232, 93, 122, 0.18);
  --shadow-hover: 0 10px 38px rgba(232, 93, 122, 0.12), 0 8px 30px rgba(0, 0, 0, 0.48);
  --glow-soft: 0 0 18px rgba(232, 93, 122, 0.28), 0 0 34px rgba(139, 30, 63, 0.16);
  --glow-strong: 0 0 14px rgba(255, 141, 166, 0.7), 0 0 30px rgba(232, 93, 122, 0.42);
  --topbar-bg: rgba(18, 10, 14, 0.96);
  --overlay-bg: rgba(4, 2, 4, 0.82);
  --backdrop-bg: rgba(4, 2, 4, 0.66);
  --scrollbar-thumb: #5a424a;
  --scrollbar-thumb-hover: #7a5d66;
  --scrollbar-track: #1a1014;
}

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

button {
  border: none;
  background: none;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px 18px 28px;
  background:
    radial-gradient(circle at top left, rgba(139, 30, 63, 0.14), transparent 38%),
    radial-gradient(circle at bottom right, rgba(180, 120, 130, 0.12), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--surface-soft));
  overflow-y: auto;
}

.auth-card {
  width: min(760px, 100%);
  margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 24px;
  box-shadow: var(--shadow-hover), var(--glow-soft);
  padding: 24px;
  backdrop-filter: blur(20px) saturate(1.4);
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.auth-brand {
  margin-bottom: 24px;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.auth-panel,
.auth-side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 20px;
}

.auth-panel h2,
.auth-side-card h3 {
  margin: 0 0 8px;
  font-family: "Unbounded", sans-serif;
  font-size: 20px;
  line-height: 1.25;
}

.auth-panel p,
.auth-side-card p,
.auth-side-list {
  margin: 0;
  color: var(--muted);
}

.account-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}

.account-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-smooth);
  display: grid;
  gap: 10px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.account-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 30, 63, 0.06), rgba(180, 120, 130, 0.05));
  opacity: 0;
  transition: opacity var(--transition-smooth);
  pointer-events: none;
}

.account-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-hover), var(--glow-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.account-card:hover::before {
  opacity: 1;
}

.account-card.role-college_admin {
  border-color: rgba(45, 91, 227, 0.28);
  background:
    radial-gradient(circle at top right, rgba(45, 91, 227, 0.12), transparent 42%),
    var(--surface-soft);
}

.account-card.role-college_admin .account-role {
  background: var(--accent-light);
  border-color: rgba(45, 91, 227, 0.3);
  color: var(--accent);
}

.account-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.account-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  position: relative;
  z-index: 1;
}

.account-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  position: relative;
  z-index: 1;
}

.account-enter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.auth-side-card {
  height: 100%;
  padding: 18px 20px;
}

.auth-inline-card {
  margin-top: 18px;
}

.auth-side-list {
  display: grid;
  gap: 12px;
  padding-left: 18px;
  margin-top: 14px;
}

.auth-login-hint,
#authLoginHint {
  margin-top: 16px;
}

/* ── Вкладки авторизации ─────────────────────────────────────────────────── */

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: "Golos Text", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-smooth);
  white-space: nowrap;
  position: relative;
}

.auth-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--accent-light) 60%, transparent);
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--accent-light), color-mix(in srgb, var(--surface) 80%, transparent));
  color: var(--accent);
  box-shadow: var(--glow-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.auth-tab-panel {
  display: none;
}

.auth-tab-panel.active {
  display: block;
  animation: viewEnter 0.45s var(--ease-smooth) both;
}

.auth-tab-panel h2 {
  margin: 0 0 8px;
  font-family: "Unbounded", sans-serif;
  font-size: 20px;
  line-height: 1.25;
}

.auth-tab-panel p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.auth-submit-btn {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  justify-content: center;
  font-size: 14px;
}

.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
}

.auth-error.hidden {
  display: none;
}

.auth-success {
  background: var(--success-light);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--success) 20%, transparent);
}

.auth-success.hidden {
  display: none;
}

.auth-tab-panel .form-group {
  margin-bottom: 14px;
}

.modal-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 500;
}

.form-check input {
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────────────────── */

.logout-button {
  width: 100%;
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 90;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.sidebar {
  width: var(--sidebar-width);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 4px 0 28px rgba(107, 33, 52, 0.06);
  transition:
    width var(--transition-smooth),
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth);
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  transition: all var(--transition-smooth);
}

.sidebar-toggle:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--glow-soft);
}

.sidebar-close,
.menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}

.sidebar-logo {
  padding: 24px 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 8px;
  position: relative;
}

.sidebar-logo .logo-badge,
.sidebar-logo .logo-sub {
  flex: 1 1 auto;
  min-width: 0;
}

.logo-badge {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.logo-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-label {
  margin: 16px 0 6px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
  text-align: left;
  transition: all var(--transition-smooth);
  user-select: none;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.nav-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent), var(--neon-pink));
  transform: translateY(-50%);
  transition: height var(--transition-smooth), box-shadow var(--transition-smooth);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
}

.nav-item:hover {
  background: color-mix(in srgb, var(--accent-light) 80%, transparent);
  color: var(--text);
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--accent-light), transparent 85%);
  color: var(--accent);
  font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: var(--glow-soft);
}

.nav-item.active::after {
  height: 70%;
}

.nav-item span:nth-child(2) {
  min-width: 0;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--danger), var(--neon-pink));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.45);
}

.icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.curator-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.curator-name {
  font-weight: 600;
  font-size: 13px;
}

.curator-role {
  color: var(--muted);
  font-size: 11px;
}

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-smooth);
}

.topbar {
  background: var(--topbar-bg);
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
  padding: 14px 32px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 6px 28px rgba(107, 33, 52, 0.07);
  transition: box-shadow var(--transition-smooth), border-color var(--transition-smooth);
  isolation: isolate;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--topbar-bg);
  opacity: 0.94;
  z-index: -1;
  pointer-events: none;
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 320px;
  min-width: 0;
}

.topbar-title {
  font-family: "Unbounded", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
}

.topbar-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 520px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--warning) 42%, var(--border));
  border-radius: 999px;
  background: var(--warning-light);
  color: var(--warning);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.group-badges {
  display: flex;
  gap: 8px;
  flex: 1 1 220px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.group-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.group-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.group-badge.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.35), transparent 65%);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.35s ease, transform 0.35s var(--ease-bounce);
  pointer-events: none;
}

.btn:active::after {
  opacity: 1;
  transform: scale(1.6);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--neon-pink) 30%, var(--accent)));
  color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn-secondary {
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 14%, transparent);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-light) 74%, var(--surface));
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--glow-soft), 0 6px 22px color-mix(in srgb, var(--accent) 45%, transparent);
  border-color: color-mix(in srgb, var(--neon-cyan) 40%, transparent);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--glow-strong);
}

.btn-ghost {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--muted);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--glow-soft);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--neon-pink));
  color: #fff;
  box-shadow: 0 4px 18px rgba(225, 29, 72, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.45);
}

.control-select {
  min-width: 76px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.control-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.theme-toggle {
  min-width: 132px;
}

.content {
  padding: 28px 32px;
  flex: 1;
  min-width: 0;
}

.view {
  display: none;
  min-width: 0;
  opacity: 0;
}

.view.active {
  display: block;
  animation: viewEnter 0.5s var(--ease-smooth) both;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.compact-stats {
  margin-bottom: 20px;
}

.stat-card,
.panel,
.report-card,
.event-card {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all var(--transition-smooth);
}

.stat-card {
  padding: 18px 20px;
}

.stat-card:hover,
.event-card:hover,
.report-card:hover,
.panel:hover {
  box-shadow: var(--shadow-hover), var(--glow-soft);
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.stat-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.stat-value {
  font-family: "Unbounded", sans-serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.stat-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.stat-card.blue .stat-value {
  color: var(--accent);
}

.stat-card.green .stat-value {
  color: var(--success);
}

.stat-card.red .stat-value {
  color: var(--danger);
}

.stat-card.yellow .stat-value {
  color: var(--warning);
}

.panel {
  padding: 18px;
  margin-bottom: 22px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2,
.report-card h3 {
  margin: 0 0 4px;
  font-family: "Unbounded", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.25px;
}

.panel-header p,
.report-card p {
  margin: 0;
  color: var(--muted);
}

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.student-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(150px, 1fr));
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 42%),
    var(--surface);
}

.student-filter-grid .search-input-wide,
.student-filter-grid .filter-select {
  min-width: 0;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.student-filter-grid .search-input-wide {
  height: 44px;
  min-height: 44px;
  font-size: 15px;
}

.student-filter-grid .filter-select {
  padding-right: 34px;
  font-size: 13px;
  font-weight: 600;
}

.filter-label {
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chat-shell {
  height: calc(100vh - 178px);
  min-height: 480px;
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
}

.chat-sidebar,
.chat-panel {
  min-height: 0;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-head,
.chat-panel-head {
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.chat-sidebar-head h2,
.chat-panel-head h2 {
  margin: 0 0 6px;
  font-family: "Unbounded", sans-serif;
  font-size: 15px;
}

.chat-sidebar-head p,
.chat-panel-head p {
  margin: 0;
  color: var(--muted);
}

.chat-thread-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  overflow: auto;
}

.chat-thread {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.chat-thread:hover,
.chat-thread.active {
  background: var(--accent-light);
  border-color: rgba(45, 91, 227, 0.18);
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--accent);
  font-weight: 800;
}

.chat-thread-main {
  min-width: 0;
}

.chat-thread-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.chat-thread-meta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.chat-thread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

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

.chat-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-call {
  white-space: nowrap;
}

.chat-messages {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  background: linear-gradient(180deg, var(--bg), var(--surface));
}

.chat-empty {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: var(--muted);
}

.chat-bubble {
  max-width: min(680px, 78%);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-bubble.own {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.chat-bubble.other {
  align-self: flex-start;
}

.chat-bubble-head {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.72;
}

.chat-bubble-text {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.chat-form {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
}

.chat-attach {
  cursor: pointer;
}

.chat-attachments {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.chat-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.chat-attachment img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  object-fit: cover;
}

.chat-file-preview {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
}

.ftab {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.ftab:hover {
  background: var(--accent-light);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  transform: translateY(-1px);
}

.ftab.active-all {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--neon-cyan) 40%, var(--accent)));
  color: #fff;
  box-shadow: var(--glow-soft);
  border-color: transparent;
}

.ftab.active-ach {
  background: var(--success-light);
  color: var(--success);
}

.ftab.active-viol {
  background: var(--danger-light);
  color: var(--danger);
}

.filter-select,
.search-input,
.form-input,
.form-select,
.form-textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: all 0.15s ease;
}

.filter-select,
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
}

.search-input {
  padding: 8px 12px;
  min-width: 220px;
}

.search-input-wide {
  flex: 1 1 260px;
}

.filter-select:focus,
.search-input:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-light), var(--glow-soft);
}

/* Unified select component. The native popup is replaced because browsers do
   not expose enough styling hooks for its opened option panel. */
.scm-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.scm-select-control {
  width: auto;
  min-width: 82px;
}

.scm-select-filter {
  width: auto;
  min-width: 180px;
  flex: 0 1 240px;
}

.scm-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.scm-select-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 92%, var(--accent-light)), var(--surface-soft));
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  outline: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 58%, transparent);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.scm-select-control .scm-select-trigger {
  min-height: 40px;
  min-width: 82px;
  padding-inline: 12px;
  background: var(--surface);
}

.scm-select-trigger:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: color-mix(in srgb, var(--surface) 88%, var(--accent-light));
}

.scm-select-trigger:focus-visible,
.scm-select.is-open .scm-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light), var(--glow-soft);
}

.scm-select.is-open .scm-select-trigger {
  transform: translateY(-1px);
}

.scm-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scm-select-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.72;
  transition: transform var(--transition-fast);
}

.scm-select.is-open .scm-select-chevron {
  transform: rotate(225deg) translate(-2px, -2px);
}

.scm-select.is-disabled {
  opacity: 0.58;
}

.scm-select.is-disabled .scm-select-trigger {
  cursor: not-allowed;
}

.scm-select-menu {
  position: fixed;
  z-index: 6000;
  display: grid;
  gap: 4px;
  padding: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text);
  box-shadow: 0 22px 60px rgba(38, 12, 21, 0.2), 0 0 0 1px color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(20px) saturate(1.25);
  transform: translateY(-7px) scale(0.985);
  transform-origin: top center;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.2s var(--ease-smooth);
}

.scm-select-menu.opens-up {
  transform: translateY(7px) scale(0.985);
  transform-origin: bottom center;
}

.scm-select-menu.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.scm-select-option {
  width: 100%;
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.scm-select-option:hover,
.scm-select-option.is-highlighted {
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
  background: var(--accent-light);
  color: var(--accent);
  transform: translateX(2px);
}

.scm-select-option.is-selected {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, var(--accent-glow)));
  color: #fff;
  box-shadow: 0 7px 20px color-mix(in srgb, var(--accent) 26%, transparent);
}

.scm-select-option:disabled {
  display: none;
}

.scm-select-check {
  opacity: 0;
  font-weight: 700;
}

.scm-select-option.is-selected .scm-select-check {
  opacity: 1;
}

.student-filter-grid .scm-select-filter,
.student-filter-grid .scm-select-trigger {
  min-width: 0;
  height: 44px;
}

.student-filter-grid .scm-select-filter {
  width: 100%;
}

.student-filter-grid .scm-select-trigger {
  border-radius: 14px;
  background: var(--surface-soft);
  font-size: 13px;
}

.curator-group-builder {
  display: grid;
  gap: 10px;
}

.curator-group-builder.hidden {
  display: none;
}

.group-builder-hint {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent-light) 68%, var(--surface));
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.table-wrap,
.card-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}

.card-wrap {
  overflow: hidden;
}

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

.admin-accounts-table {
  min-width: 1180px;
}

.student-registry-table {
  min-width: 1120px;
  table-layout: fixed;
}

.student-registry-table th:nth-child(1),
.student-registry-table td:nth-child(1) {
  width: 210px;
}

.student-registry-table th:nth-child(2),
.student-registry-table td:nth-child(2) {
  width: 90px;
}

.student-registry-table th:nth-child(3),
.student-registry-table td:nth-child(3) {
  width: 150px;
}

.student-registry-table th:nth-child(4),
.student-registry-table td:nth-child(4) {
  width: 150px;
}

.student-registry-table th:nth-child(5),
.student-registry-table td:nth-child(5) {
  width: 105px;
}

.student-registry-table th:nth-child(6),
.student-registry-table td:nth-child(6) {
  width: 185px;
}

.student-registry-table th:nth-child(7),
.student-registry-table td:nth-child(7) {
  width: 210px;
}

.student-registry-table th:nth-child(8),
.student-registry-table td:nth-child(8) {
  width: 150px;
}

.student-registry-table th:nth-child(9),
.student-registry-table td:nth-child(9) {
  width: 128px;
}

.student-registry-table tbody td {
  padding: 12px 14px;
}

.student-conclusion-col {
  display: none;
}

.student-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.student-meta-row span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg);
}

tbody td {
  padding: 13px 16px;
  font-size: 13.5px;
  vertical-align: middle;
}

.admin-accounts-table th,
.admin-accounts-table td {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: top;
}

.admin-accounts-table th:first-child,
.admin-accounts-table td:first-child {
  min-width: 180px;
}

.admin-accounts-table th:nth-child(2),
.admin-accounts-table td:nth-child(2) {
  min-width: 210px;
}

.admin-accounts-table th:nth-child(3),
.admin-accounts-table td:nth-child(3) {
  min-width: 120px;
}

.admin-accounts-table th:nth-child(4),
.admin-accounts-table td:nth-child(4),
.admin-accounts-table th:nth-child(5),
.admin-accounts-table td:nth-child(5),
.admin-accounts-table th:nth-child(7),
.admin-accounts-table td:nth-child(7),
.admin-accounts-table th:nth-child(8),
.admin-accounts-table td:nth-child(8) {
  white-space: nowrap;
}

.admin-accounts-table th:nth-child(6),
.admin-accounts-table td:nth-child(6) {
  min-width: 200px;
}

.admin-accounts-table th:last-child,
.admin-accounts-table td:last-child {
  min-width: 170px;
  width: 170px;
  text-align: right;
}

.student-name {
  font-weight: 600;
  line-height: 1.35;
}

.student-group,
.muted-text,
.table-note,
.table-helper {
  color: var(--muted);
  font-size: 11.5px;
}

.risk-note {
  margin-top: 6px;
  line-height: 1.45;
}

.table-note,
.table-helper {
  max-width: 760px;
  line-height: 1.45;
}

.table-helper {
  margin-top: 6px;
}

.admin-cell-account .student-group {
  margin-top: 4px;
  font-family: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.admin-cell-email {
  overflow-wrap: anywhere;
}

.admin-cell-role,
.admin-cell-source,
.admin-cell-group,
.admin-cell-status,
.admin-cell-created,
.admin-cell-actions {
  white-space: nowrap;
}

.admin-cell-linked {
  line-height: 1.45;
}

.admin-accounts-table .pill {
  white-space: nowrap;
}

.type-badge,
.pill,
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-ach,
.pill-active {
  background: var(--success-light);
  color: var(--success);
}

.badge-viol,
.pill-warn {
  background: var(--danger-light);
  color: var(--danger);
}

.pill-info {
  background: var(--accent-light);
  color: var(--accent);
}

.pill-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.mini-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 210px;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.4;
}

.student-social-cell .social-note {
  display: -webkit-box;
  max-width: 190px;
  margin-top: 6px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.student-balance-cell {
  display: grid;
  align-content: center;
  gap: 7px;
}

.balance-outcome {
  width: fit-content;
  max-width: 140px;
  white-space: normal;
  line-height: 1.25;
}

.risk-low {
  background: var(--success-light);
  color: var(--success);
}

.risk-medium {
  background: var(--warning-light);
  color: var(--warning);
}

.risk-high {
  background: var(--danger-light);
  color: var(--danger);
}

.points {
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.points.pos {
  color: var(--success);
}

.points.neg {
  color: var(--danger);
}

.points.zero {
  color: var(--muted);
}

.action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.table-actions-cell {
  white-space: nowrap;
  width: 1%;
}

.table-actions-cell .action-group,
.admin-cell-actions .action-group {
  flex-wrap: nowrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--muted);
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.action-btn.file {
  color: var(--accent);
  text-decoration: none;
}

.action-btn.file:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.action-btn.ai {
  color: var(--warning);
}

.action-btn.ai:hover {
  background: var(--warning-light);
  color: var(--warning);
}

.action-btn.disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.35;
}

.action-btn.disabled:hover {
  background: transparent;
  color: var(--muted);
}

.action-btn.del:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding: 18px;
}

.event-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.event-card h3 {
  margin: 0;
  font-size: 16px;
}

.event-meta,
.event-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.event-desc {
  color: var(--muted);
  min-height: 44px;
}

.event-footer {
  justify-content: space-between;
  margin-top: auto;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chart-grid,
.analytics-grid,
.settings-grid,
.report-grid {
  display: grid;
  gap: 18px;
}

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

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

.bar-chart,
.ranking-list,
.summary-list,
.settings-summary {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-row-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2d5be3, #79a2ff);
}

.bar-fill.negative {
  background: linear-gradient(90deg, #c8321a, #ff9a86);
}

.bar-fill.success {
  background: linear-gradient(90deg, #1a8a4a, #6dd391);
}

.ranking-row,
.summary-row,
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.summary-row {
  display: grid;
  gap: 4px;
}

.summary-row strong,
.ranking-row strong,
.settings-row strong {
  font-size: 14px;
}

.summary-row .risk-meta {
  font-weight: 600;
}

.summary-row .risk-score {
  color: var(--muted);
  font-size: 12px;
}

.report-preview {
  padding: 22px;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.report-card {
  padding: 18px;
}

.report-card-wide {
  grid-column: 1 / -1;
}

.report-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: "Golos Text", "Segoe UI", sans-serif;
  line-height: 1.7;
  color: var(--text);
}

.report-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.report-ai-meta {
  margin: 6px 0 0;
}

.report-ai-body {
  min-height: 220px;
  white-space: normal;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  font-family: "Golos Text", sans-serif;
  font-size: 13.5px;
  line-height: 1.65;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-span-2 {
  grid-column: 1 / -1;
}

.form-actions,
.inline-actions,
.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#studentRisk:disabled {
  background: var(--surface-soft);
  color: var(--text);
  opacity: 1;
  cursor: default;
}

.settings-summary {
  margin-top: 18px;
}

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

.settings-account-list {
  display: grid;
  gap: 14px;
}

.settings-account-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.settings-account-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.settings-account-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.settings-account-top strong {
  font-size: 15px;
}

.settings-account-meta,
.settings-account-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.settings-account-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.settings-account-badges {
  justify-content: flex-end;
}

.settings-account-note {
  margin: 0;
}

.settings-account-actions {
  display: flex;
  align-items: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
  margin: auto 0;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.modal-wide {
  max-width: 760px;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-title {
  font-family: "Unbounded", sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.form-textarea {
  resize: vertical;
  min-height: 84px;
}

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.toggle-opt {
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.toggle-opt.sel-ach {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.toggle-opt.sel-viol {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

.toggle-opt:not(.sel-ach):not(.sel-viol):hover {
  background: var(--bg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.ai-analysis-body {
  min-height: 240px;
  max-height: 55vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  font-family: "Golos Text", sans-serif;
  font-size: 13.5px;
  line-height: 1.65;
}

.report-ai-body p {
  margin: 0 0 8px;
}

.report-ai-body p:last-child {
  margin-bottom: 0;
}

.report-ai-body ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.report-ai-body li {
  margin-bottom: 5px;
  line-height: 1.55;
}

.report-ai-body strong {
  font-weight: 600;
}

.materials-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  margin-bottom: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 34%),
    linear-gradient(135deg, var(--surface), var(--surface-soft));
}

.materials-hero h2 {
  margin: 8px 0 8px;
  font-family: "Unbounded", sans-serif;
  font-size: 24px;
  letter-spacing: -0.7px;
}

.materials-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.materials-kicker {
  display: inline-flex;
  width: fit-content;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.materials-hero-badge {
  min-width: 128px;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  text-align: center;
  box-shadow: var(--shadow);
}

.materials-hero-badge strong {
  display: block;
  font-family: "Unbounded", sans-serif;
  color: var(--accent);
  font-size: 34px;
  line-height: 1;
}

.materials-hero-badge span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.materials-upload {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 18px;
  padding: 22px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 30%),
    var(--surface);
}

.materials-upload.hidden {
  display: none;
}

.materials-upload-copy {
  display: grid;
  gap: 10px;
}

.materials-upload-copy h3 {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  font-size: 18px;
  letter-spacing: -0.4px;
}

.materials-upload-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.materials-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.materials-upload-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.materials-upload-grid .form-span-2 {
  grid-column: 1 / -1;
}

.materials-file-input input {
  width: 100%;
  border: 1px dashed color-mix(in srgb, var(--accent) 32%, var(--border));
  border-radius: 16px;
  padding: 13px;
  background: var(--surface-soft);
  color: var(--muted);
  font: inherit;
}

.materials-file-input input::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 12px;
  padding: 9px 13px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.materials-upload-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.materials-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.material-folder {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 132px;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.material-folder:hover,
.material-folder.active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.material-folder.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 72%),
    var(--surface);
}

.material-folder-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-light);
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.material-folder-green .material-folder-number {
  background: var(--success-light);
  color: var(--success);
}

.material-folder-yellow .material-folder-number {
  background: var(--warning-light);
  color: var(--warning);
}

.material-folder-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.material-folder-body strong {
  font-family: "Unbounded", sans-serif;
  font-size: 14px;
  line-height: 1.3;
}

.material-folder-body small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.materials-detail {
  position: sticky;
  top: 96px;
  padding: 22px;
}

.materials-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.materials-delete-section {
  align-self: start;
  white-space: nowrap;
}

.materials-detail-tag,
.materials-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 42px;
  border-radius: 14px;
  background: var(--text);
  color: var(--surface);
  font-size: 11px;
  font-weight: 900;
}

.materials-detail h3 {
  margin: 0 0 8px;
  font-family: "Unbounded", sans-serif;
  font-size: 18px;
}

.materials-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.materials-file-list {
  display: grid;
  gap: 10px;
}

.materials-file-list h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.materials-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.materials-file-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.materials-file-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: var(--shadow);
}

.materials-file-card strong,
.materials-file-card small {
  display: block;
}

.materials-file-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.materials-delete-file {
  align-self: stretch;
  justify-content: center;
  min-width: 118px;
  color: var(--danger);
}

.materials-delete-file:hover {
  border-color: color-mix(in srgb, var(--danger) 32%, var(--border));
  background: var(--danger-light);
  color: var(--danger);
}

.materials-folder-upload {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 20px;
  padding: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    var(--surface-soft);
}

.materials-folder-upload-copy {
  display: grid;
  gap: 4px;
}

.materials-folder-upload-copy strong {
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
}

.materials-folder-upload-copy small {
  color: var(--muted);
  line-height: 1.45;
}

.materials-folder-file-input {
  width: 100%;
  border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 15px;
  padding: 11px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
}

.materials-folder-file-input::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: 11px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.materials-folder-upload-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.report-ai-body .ai-heading {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  margin: 18px 0 8px;
}

.report-ai-body .ai-heading:first-child {
  margin-top: 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.es-icon {
  margin-bottom: 12px;
  font-size: 40px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.card-pagination {
  padding-top: 0;
}

.page-info {
  color: var(--muted);
  font-size: 12px;
}

.page-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.page-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
  backdrop-filter: blur(8px);
}

.page-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--glow-soft);
  transform: translateY(-1px);
}

.page-btn.active {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--neon-cyan) 35%, var(--accent)));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow-soft);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--text) 92%, var(--accent)), var(--text));
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--glow-strong), 0 8px 32px rgba(0, 0, 0, 0.25);
  border: 1px solid color-mix(in srgb, var(--neon-cyan) 35%, transparent);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transition: all 0.4s var(--ease-bounce);
  backdrop-filter: blur(12px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.animate-in {
  animation: fadeIn 0.55s var(--ease-smooth) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    filter: blur(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@media (max-width: 1260px) {
  .stats-row,
  .report-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid,
  .analytics-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .chat-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .chat-sidebar,
  .chat-panel {
    min-height: auto;
  }

  .chat-messages {
    min-height: 420px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
  }

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

  .sidebar-close,
  .menu-button {
    display: inline-flex;
  }

  .sidebar-close {
    position: absolute;
    top: 14px;
    right: 14px;
  }

  .main {
    margin-left: 0;
  }

  body.sidebar-collapsed .main {
    margin-left: 0;
  }

  .topbar {
    padding: 14px 18px;
  }

  .content {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .auth-screen {
    padding: 12px 12px 20px;
  }

  .auth-card,
  .auth-panel,
  .auth-side-card {
    padding: 16px;
  }

  .account-picker {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: min(86vw, 340px);
    height: 100dvh;
  }

  .sidebar-logo {
    padding: 28px 58px 18px 18px;
  }

  .sidebar-nav {
    padding: 14px 10px;
  }

  .sidebar-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .topbar {
    position: static;
    padding: 18px 16px 14px;
    background: var(--surface);
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 22px rgba(18, 24, 38, 0.06);
  }

  .topbar-main {
    width: 100%;
    flex: 0 0 auto;
    align-items: flex-start;
  }

  .topbar-main > div {
    min-width: 0;
  }

  .menu-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    flex: 0 0 44px;
  }

  .topbar-title {
    font-size: 20px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .topbar-subtitle {
    font-size: 14px;
    line-height: 1.45;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
    flex: none;
  }

  .readonly-badge {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .group-badges {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    flex: none;
  }

  .topbar-actions .btn,
  .group-badge,
  .control-select,
  .scm-select-control,
  .scm-select-control .scm-select-trigger,
  .theme-toggle {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    border-radius: 16px;
    padding: 0 12px;
  }

  .content {
    padding: 14px;
  }

  .panel-header,
  .filter-bar,
  .inline-actions,
  .settings-actions,
  .form-actions {
    align-items: stretch;
  }

  .panel-header {
    flex-direction: column;
  }

  .report-ai-header {
    flex-direction: column;
  }

  .chat-shell {
    gap: 14px;
    height: auto;
    min-height: 0;
  }

  .chat-sidebar {
    max-height: 310px;
  }

  .chat-thread-list {
    max-height: 220px;
  }

  .chat-panel {
    min-height: min(620px, calc(100dvh - 120px));
  }

  .chat-form {
    grid-template-columns: 1fr 1fr;
  }

  .chat-input,
  .chat-file-preview {
    grid-column: 1 / -1;
  }

  .chat-panel-head {
    flex-direction: column;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .settings-account-card,
  .settings-account-top {
    flex-direction: column;
  }

  .topbar-actions,
  .group-badges,
  .filter-bar,
  .inline-actions,
  .settings-actions {
    width: 100%;
  }

  .settings-account-badges,
  .settings-account-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .btn,
  .filter-select,
  .search-input {
    width: 100%;
  }

  .stats-row,
  .report-metrics,
  .form-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }

  .stat-card {
    min-height: 92px;
    padding: 14px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-value {
    font-size: 23px;
  }

  .panel {
    padding: 14px;
    margin-bottom: 14px;
  }

  .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .table-wrap {
    border-radius: 18px;
  }

  .admin-accounts-table {
    min-width: 0;
  }

  .admin-accounts-table thead {
    display: none;
  }

  .admin-accounts-table,
  .admin-accounts-table tbody,
  .admin-accounts-table tr,
  .admin-accounts-table td {
    display: block;
    width: 100%;
  }

  .admin-accounts-table tbody tr {
    margin: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
  }

  .admin-accounts-table tbody tr:hover {
    background: var(--surface);
  }

  .admin-accounts-table td {
    min-width: 0 !important;
    width: 100% !important;
    padding: 9px 0;
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    text-align: left !important;
    border-bottom: 1px solid var(--border);
    white-space: normal;
  }

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

  .admin-accounts-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .admin-cell-actions .action-group {
    justify-content: flex-start;
  }

  .type-toggle {
    grid-template-columns: 1fr;
  }

  .modal {
    margin: 10px;
    padding: 18px;
    max-width: none;
  }
}

@media (max-width: 360px) {
  .topbar-actions,
  .group-badges,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .topbar-title {
    font-size: 18px;
  }

  .chat-panel {
    min-height: 560px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  #view-journal,
  #view-students,
  #view-events,
  #view-stats,
  #view-settings,
  .toast {
    display: none !important;
  }

  .main,
  .content,
  .report-preview,
  .report-card,
  .panel {
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
  }

  #view-reports {
    display: block !important;
  }
}

/* ═══════════════════════════════════════════════════════
   ИИ-АНАЛИЗ — чистый Markdown без лишних отступов
   ═══════════════════════════════════════════════════════ */
.ai-analysis-body {
  min-height: 240px;
  max-height: 55vh;
  overflow: auto;
  white-space: normal;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  font-family: "Golos Text", sans-serif;
  font-size: 13.5px;
  line-height: 1.65;
}
.ai-analysis-body p        { margin: 0 0 6px; }
.ai-analysis-body p:last-child { margin-bottom: 0; }
.ai-analysis-body .ai-heading {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  margin: 16px 0 6px;
}
.ai-analysis-body .ai-heading:first-child { margin-top: 0; }
.ai-analysis-body ul  { margin: 0 0 10px; padding-left: 20px; }
.ai-analysis-body li  { margin-bottom: 4px; line-height: 1.55; }
.ai-analysis-body strong { font-weight: 600; }

/* ═══════════════════════════════════════════════════════
   ПЛАН НА УЧЕБНЫЙ ГОД
   ═══════════════════════════════════════════════════════ */
#view-yearplan { padding: 0 !important; }
#yearPlanContainer { padding: 24px; max-width: 1280px; margin: 0 auto; }

.yp-wrap { display: flex; flex-direction: column; gap: 0; }

.yp-readonly-note {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 16px;
}

.yp-grid { display: flex; flex-direction: column; gap: 10px; }

.yp-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: background .2s, opacity .2s;
}
.yp-row--done {
  opacity: .6;
  background: color-mix(in srgb, var(--surface) 70%, var(--accent) 10%);
}

.yp-month-col {
  display: flex;
  align-items: flex-start;
  padding: 14px 12px;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.yp-done-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.yp-cb { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.yp-month-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.yp-done-badge { color: var(--accent); }
.yp-check { color: var(--accent); font-size: 12px; margin-left: 2px; }

.yp-cell {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.yp-cell:last-child { border-right: none; }

.yp-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 7px 10px 5px;
  border-bottom: 1px solid var(--border);
}

.yp-ta {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 10px;
  font-family: "Golos Text", sans-serif;
  font-size: 13px;
  line-height: 1.55;
  background: transparent;
  color: var(--text);
  min-height: 72px;
}
.yp-ta:focus { background: color-mix(in srgb, var(--bg) 60%, var(--accent) 6%); }

.yp-text {
  padding: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 60px;
}
.yp-empty { color: var(--muted); font-style: italic; }

.yp-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 4px;
}
.yp-status { font-size: 13px; color: var(--accent); font-weight: 500; }

/* ── Admin card ────────────────────────────────────────────── */
.account-item[data-auth-login="acc-admin"] .account-avatar {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

@media (max-width: 768px) {
  .yp-row { grid-template-columns: 1fr; }
  .yp-month-col { border-right: none; border-bottom: 1px solid var(--border); }
  .yp-cell { border-right: none; border-bottom: 1px solid var(--border); }
  .yp-cell:last-child { border-bottom: none; }
}

/* Performance: keep scrolling smooth on local/mobile browsers. */
html {
  scroll-behavior: auto;
}

.auth-card,
.topbar,
.modal-overlay {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.topbar {
  background: var(--surface);
}

@media (max-width: 1280px) {
  .student-filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .student-filter-grid .search-input-wide {
    grid-column: span 2;
    min-height: 46px;
  }

  .materials-layout {
    grid-template-columns: 1fr;
  }

  .materials-detail {
    position: static;
  }
}

@media (max-width: 860px) {
  .student-filter-grid,
  .materials-grid,
  .materials-upload,
  .materials-upload-grid,
  .materials-detail-head,
  .materials-file-row {
    grid-template-columns: 1fr;
  }

  .materials-delete-section,
  .materials-delete-file {
    width: 100%;
  }

  .materials-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Compact desktop registry: group and curator live inside the student cell. */
.student-registry-table {
  min-width: 800px;
}

.student-registry-table th:nth-child(2),
.student-registry-table td:nth-child(2),
.student-registry-table th:nth-child(3),
.student-registry-table td:nth-child(3),
.student-registry-table th:nth-child(9) {
  display: none;
}

.student-registry-table th:nth-child(1),
.student-registry-table td:nth-child(1) {
  width: 220px;
}

.student-registry-table th:nth-child(4),
.student-registry-table td:nth-child(4) {
  width: 124px;
}

.student-registry-table th:nth-child(5),
.student-registry-table td:nth-child(5) {
  width: 88px;
}

.student-registry-table th:nth-child(6),
.student-registry-table td:nth-child(6) {
  width: 134px;
}

.student-registry-table th:nth-child(7),
.student-registry-table td:nth-child(7) {
  width: 154px;
}

.student-registry-table th:last-child,
.student-registry-table td:last-child {
  width: 72px;
}

.student-registry-table tbody td {
  padding: 13px 12px;
}

.student-registry-table .student-name {
  line-height: 1.3;
}

.student-registry-table .table-note {
  line-height: 1.35;
}

.student-registry-table .risk-note,
.student-registry-table .social-note {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.student-registry-table .mini-chip-list {
  gap: 5px;
}

.student-registry-table .mini-chip-list .mini-chip {
  max-width: 100%;
  white-space: normal;
}

.student-registry-table .table-actions-cell {
  padding-left: 8px;
  padding-right: 8px;
}

.student-registry-table .table-actions-cell .action-group {
  display: grid;
  grid-template-columns: repeat(2, 28px);
  gap: 5px;
  justify-content: end;
}

.student-registry-table .action-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  box-shadow: none;
}

.student-registry-table .action-btn.ai {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.account-card,
.nav-item,
.primary-btn,
.secondary-btn,
.ghost-btn,
.page-btn,
.filter-tab,
.filter-select,
.chat-thread,
.modal,
.toast,
.yp-row,
.btn,
.ftab,
.group-badge,
.action-btn,
.auth-tab {
  transition-property: background-color, border-color, color, opacity, transform, box-shadow, filter;
  transition-duration: 0.38s;
  transition-timing-function: var(--ease-smooth);
}

/* ═══ NEON SYNTHWAVE EFFECTS ═══ */

@keyframes auroraShift {
  0% {
    background-position: 0% 0%, 100% 100%, 50% 50%;
  }

  50% {
    background-position: 80% 20%, 20% 80%, 60% 40%;
  }

  100% {
    background-position: 100% 50%, 0% 50%, 40% 60%;
  }
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    filter: blur(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes neonFlash {
  0% {
    box-shadow: 0 0 0 rgba(196, 49, 90, 0);
    filter: brightness(1);
  }

  35% {
    box-shadow: var(--glow-strong);
    filter: brightness(1.08);
  }

  100% {
    box-shadow: var(--glow-soft);
    filter: brightness(1);
  }
}

@keyframes statPulse {
  0%,
  100% {
    text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent);
  }

  50% {
    text-shadow: 0 0 16px color-mix(in srgb, var(--accent-glow) 45%, transparent);
  }
}

.layout {
  position: relative;
  z-index: 1;
}

.main {
  position: relative;
}

.avatar {
  background: linear-gradient(135deg, var(--accent-light), color-mix(in srgb, var(--neon-pink) 20%, var(--accent-light)));
  box-shadow: var(--glow-soft);
  transition: all var(--transition-smooth);
}

.avatar:hover {
  transform: scale(1.08);
  box-shadow: var(--glow-strong);
}

.group-badge {
  transition: all var(--transition-smooth);
}

.group-badge:hover,
.group-badge.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--glow-soft);
  transform: translateY(-1px);
}

.group-badge.active {
  background: linear-gradient(135deg, var(--accent-light), transparent);
}

.stat-value {
  animation: statPulse 4s ease-in-out infinite;
}

.table-wrap,
.card-wrap,
.filter-bar {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border));
  transition: all var(--transition-smooth);
}

.filter-bar:hover {
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.modal-overlay {
  transition: opacity var(--transition-smooth), backdrop-filter var(--transition-smooth);
  backdrop-filter: blur(0);
}

.modal-overlay.open {
  backdrop-filter: blur(8px) saturate(1.2);
}

.modal {
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  box-shadow: var(--shadow-hover), var(--glow-soft);
  backdrop-filter: blur(20px) saturate(1.3);
}

.modal-overlay.open .modal {
  animation: viewEnter 0.45s var(--ease-smooth) both;
}

.action-btn {
  transition: all var(--transition-smooth);
}

.action-btn:hover {
  box-shadow: var(--glow-soft);
  transform: scale(1.08);
}

.action-btn:active {
  box-shadow: var(--glow-strong);
  transform: scale(0.95);
}

.neon-flash {
  animation: neonFlash 0.55s var(--ease-smooth) both !important;
}

.topbar-title {
  color: var(--text);
}

.stat-card.blue .stat-value {
  color: var(--accent);
  text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 45%, transparent);
}

.stat-card.green .stat-value {
  text-shadow: 0 0 16px color-mix(in srgb, var(--success) 40%, transparent);
}

.stat-card.red .stat-value {
  text-shadow: 0 0 16px color-mix(in srgb, var(--danger) 40%, transparent);
}

.stat-card.yellow .stat-value {
  text-shadow: 0 0 16px color-mix(in srgb, var(--warning) 40%, transparent);
}

.control-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light), var(--glow-soft);
}

.sidebar-backdrop {
  transition: opacity var(--transition-smooth), backdrop-filter var(--transition-smooth);
}

.sidebar-backdrop.open {
  backdrop-filter: blur(4px);
}

.chat-thread:hover,
.chat-thread.active {
  box-shadow: var(--glow-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.yp-row {
  transition: all var(--transition-smooth);
}

.yp-row:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  box-shadow: var(--glow-soft);
  transform: translateX(3px);
}

/* ── Сворачиваемая боковая панель (десктоп) ── */

@media (min-width: 1025px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .sidebar-logo {
    flex-direction: column;
    align-items: center;
    padding: 18px 10px 14px;
  }

  body.sidebar-collapsed .sidebar-logo .logo-badge {
    font-size: 13px;
    text-align: center;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.sidebar-collapsed .logo-sub,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-item span:not(.icon):not(.nav-badge),
  body.sidebar-collapsed .curator-card > div:not(:first-child) {
    display: none;
  }

  body.sidebar-collapsed .logout-button {
    display: inline-flex !important;
    width: 40px;
    height: 40px;
    margin: 8px auto 0;
    padding: 0;
    justify-content: center;
    align-items: center;
    font-size: 0;
    border-radius: 12px;
  }

  body.sidebar-collapsed .logout-button::before {
    content: "⎋";
    font-size: 16px;
    color: var(--muted);
  }

  body.sidebar-collapsed .sidebar-toggle {
    margin: 8px auto 0;
    width: 34px;
    height: 34px;
  }

  body.sidebar-collapsed .sidebar-nav {
    padding: 12px 8px;
  }

  body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px 8px;
    transform: none;
  }

  body.sidebar-collapsed .nav-item::after {
    left: 50%;
    top: auto;
    bottom: 4px;
    width: 0;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 4px;
  }

  body.sidebar-collapsed .nav-item.active::after {
    width: 55%;
    height: 3px;
  }

  body.sidebar-collapsed .nav-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    min-width: 8px;
    height: 8px;
    padding: 0;
    font-size: 0;
    margin-left: 0;
  }

  body.sidebar-collapsed .sidebar-footer {
    padding: 12px 8px;
  }

  body.sidebar-collapsed .curator-card {
    justify-content: center;
  }

  body.sidebar-collapsed .avatar {
    width: 40px;
    height: 40px;
  }
}

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