:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --teal: #0f766e;
  --amber: #b45309;
  --rose: #be123c;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.12);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  min-height: 100vh;
  background: #dce8f7;
}

.login-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(rgba(17, 24, 39, 0.16), rgba(17, 24, 39, 0.18)),
    url("https://images.unsplash.com/photo-1588072432836-e10032774350?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.media-layer {
  width: min(760px, 82vw);
  padding: 28px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.classroom-scene {
  overflow: hidden;
  background: #152238;
  border-radius: 8px;
}

.scene-topbar {
  display: flex;
  gap: 8px;
  padding: 14px;
  background: #0f172a;
}

.scene-topbar span {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: #94a3b8;
}

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

.student-tile {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #243451;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.student-tile strong {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #3b82f6;
}

.student-tile.active {
  outline: 3px solid #22c55e;
}

.board-preview {
  align-items: stretch;
  padding: 24px;
  background: #f8fafc;
}

.board-preview span {
  display: block;
  height: 10px;
  margin: 10px 0;
  border-radius: 99px;
  background: #2563eb;
}

.board-preview span:nth-child(2) {
  width: 70%;
  background: #0f766e;
}

.board-preview span:nth-child(3) {
  width: 48%;
  background: #b45309;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
  padding: clamp(28px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.92);
}

.brand-mark,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.brand-mark h1,
.brand-mark p {
  margin: 0;
}

.brand-mark h1 {
  font-size: 2.5rem;
  letter-spacing: 0;
}

.brand-mark p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.login-form,
.modal-form {
  display: grid;
  gap: 16px;
}

.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-mode .active {
  color: #fff;
  background: var(--primary);
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--rose);
  font-weight: 700;
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px;
  background: #101827;
  color: #fff;
}

.sidebar-brand {
  font-size: 1.1rem;
  font-weight: 800;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-btn,
.icon-btn,
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.nav-item {
  justify-content: flex-start;
  padding: 0 14px;
  color: #cbd5e1;
  background: transparent;
}

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

.primary-btn {
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn,
.ghost-btn {
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface-soft);
}

.ghost-btn {
  margin-top: auto;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
}

.small {
  min-height: 38px;
}

.compact {
  justify-content: flex-start;
}

.icon-btn {
  width: 42px;
  padding: 0;
  color: var(--ink);
  background: var(--surface-soft);
}

.icon-btn.active {
  color: #fff;
  background: var(--teal);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h2,
.topbar p {
  margin: 0;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.current-user {
  min-width: 140px;
  display: grid;
  justify-items: end;
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(22px, 4vw, 34px);
  margin-bottom: 20px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(105deg, rgba(15, 23, 42, 0.94), rgba(37, 99, 235, 0.78)),
    url("https://images.unsplash.com/photo-1531482615713-2afd69097998?auto=format&fit=crop&w=1400&q=80") center/cover;
  box-shadow: var(--shadow);
}

.hero-band h3,
.hero-band p {
  margin: 0;
}

.hero-band h3 {
  margin: 8px 0;
  font-size: clamp(1.7rem, 4vw, 3.1rem);
  letter-spacing: 0;
}

.hero-band p {
  max-width: 690px;
  line-height: 1.55;
  color: #dbeafe;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.metric-card,
.panel,
.activity-card,
.team-card,
.post-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.metric-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.content-grid,
.split-layout,
.classroom-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.split-layout {
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
}

.classroom-layout {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.68fr);
}

.panel {
  padding: 18px;
}

.panel.wide {
  min-width: 0;
}

.panel-header,
.modal-header,
.meeting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h3,
.modal-header h3,
.meeting-header h3 {
  margin: 0;
}

.composer {
  resize: vertical;
  min-height: 92px;
}

.post-list,
.stack-list,
.team-list,
.activity-list,
.gradebook {
  display: grid;
  gap: 12px;
}

.post-card,
.team-card,
.activity-card,
.member-row,
.grade-row {
  padding: 14px;
}

.post-card p,
.team-card p,
.activity-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.post-meta,
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #0f172a;
  background: #dbeafe;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge.teal {
  background: #ccfbf1;
}

.badge.amber {
  background: #fef3c7;
}

.team-card {
  text-align: left;
  width: 100%;
}

.team-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.team-detail {
  display: grid;
  gap: 16px;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.member-row,
.grade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.activity-card {
  display: grid;
  gap: 12px;
}

.activity-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.answer-panel {
  display: grid;
  gap: 12px;
}

.answer-question {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.video-stage,
.whiteboard-panel {
  padding: 18px;
  background: #111827;
  border-radius: 8px;
  color: #fff;
}

.whiteboard-panel {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.meeting-controls,
.board-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-tools select,
.board-tools input[type="text"] {
  min-height: 38px;
  padding: 8px 10px;
}

.board-tools input[type="text"] {
  width: min(170px, 32vw);
}

.entry-requests {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.entry-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.classroom-alert {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #fde68a;
  background: rgba(180, 83, 9, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.28);
  font-weight: 700;
  line-height: 1.4;
}

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

.participant {
  min-height: 190px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #1f2937, #334155);
}

.participant video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.participant:nth-child(2n) {
  background: linear-gradient(135deg, #134e4a, #1e3a8a);
}

.participant .avatar {
  width: 72px;
  height: 72px;
  font-size: 1.2rem;
}

.participant span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 7px 9px;
  border-radius: 8px;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  font-weight: 800;
}

.participant.offline {
  opacity: 0.68;
}

canvas {
  width: 100%;
  aspect-ratio: 5 / 3;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(#eef2f7 1px, transparent 1px),
    linear-gradient(90deg, #eef2f7 1px, transparent 1px),
    #ffffff;
  background-size: 26px 26px;
  touch-action: none;
}

.secure-assessment {
  user-select: none;
  -webkit-user-select: none;
}

.secure-assessment textarea,
.secure-assessment input {
  user-select: text;
  -webkit-user-select: text;
}

.option-list {
  display: grid;
  gap: 8px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
}

dialog {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

#activityDialog {
  width: min(760px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal-form {
  padding: 20px;
}

.modal-form.large {
  width: min(760px, calc(100vw - 28px));
}

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

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.book-frame {
  width: 100%;
  height: min(72vh, 760px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-label {
  margin-bottom: 10px;
  max-width: 360px;
}

.student-admin-panel {
  margin-top: 18px;
}

.student-team-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.student-team-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-weight: 800;
}

.student-team-pill button {
  width: 22px;
  height: 22px;
  min-height: 22px;
}

svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 1020px) {
  .login-shell,
  .app-shell,
  .content-grid,
  .split-layout,
  .classroom-layout {
    grid-template-columns: 1fr;
  }

  .login-media {
    min-height: 42vh;
  }

  .app-shell {
    padding-bottom: 78px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 10px;
  }

  .sidebar-brand,
  .ghost-btn span {
    display: none;
  }

  .main-nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    min-width: 74px;
    justify-content: center;
    padding: 0 10px;
  }

  .nav-item span {
    display: none;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .hero-band,
  .activity-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .hero-actions {
    justify-content: space-between;
  }

  .current-user {
    justify-items: start;
  }

  .metrics-grid,
  .form-grid,
  .participant-grid {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 24px;
  }

  .brand-mark h1 {
    font-size: 2rem;
  }
}
