:root {
  --bg-top: #6dd5fa;
  --bg-bottom: #fef9c3;
  --panel: rgba(255, 255, 255, 0.9);
  --ink: #15314b;
  --muted: #587087;
  --line: rgba(21, 49, 75, 0.12);
  --green: #22c55e;
  --green-deep: #15803d;
  --green-soft: #dcfce7;
  --red: #fb7185;
  --red-deep: #be123c;
  --red-soft: #ffe4e6;
  --yellow: #f59e0b;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --purple-soft: #ede9fe;
  --shadow: 0 24px 60px rgba(37, 99, 235, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background: #f5ead7;
  position: relative;
}

button,
input,
select {
  font: inherit;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 255, 255, 0.7), transparent 11%),
    radial-gradient(circle at 78% 10%, rgba(255, 255, 255, 0.62), transparent 12%),
    radial-gradient(circle at 54% 20%, rgba(255, 255, 255, 0.55), transparent 10%);
}

.page-backdrop {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 244, 226, 0.82), rgba(240, 248, 255, 0.72)),
    linear-gradient(120deg, rgba(255, 255, 255, 0.36), rgba(240, 249, 255, 0.12)),
    url("assets/classroom-background.png") center center / cover no-repeat;
  filter: saturate(1.05);
}

.page-shell {
  position: relative;
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hidden {
  display: none !important;
}

.auth-shell {
  position: relative;
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 42px;
  z-index: 1;
}

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

.auth-panel {
  min-height: 100%;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-divider {
  height: 1px;
  margin: 18px 0 14px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.auth-helper h3 {
  margin: 0;
  font-size: 1.35rem;
}

.helper-copy {
  margin: 6px 0 12px;
  color: var(--muted);
  font-weight: 700;
}

.helper-copy[data-state="error"] {
  color: var(--red-deep);
}

.helper-copy[data-state="success"] {
  color: var(--green-deep);
}

.status-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.status-message[data-state="error"] {
  color: var(--red-deep);
}

.status-message[data-state="success"] {
  color: var(--green-deep);
}

.notice-center {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 28px));
  pointer-events: none;
}

.notice-toast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: start;
  padding: 14px 14px 14px 16px;
  border: 1px solid rgba(31, 45, 61, 0.12);
  border-left: 5px solid var(--green);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(22, 40, 60, 0.16);
  pointer-events: auto;
}

.notice-toast[data-state="error"] {
  border-left-color: var(--red);
}

.notice-toast strong,
.notice-toast span {
  display: block;
}

.notice-toast strong {
  color: var(--ink);
}

.notice-toast span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

.notice-toast button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
}

.school-notice-row {
  border-color: rgba(185, 28, 28, 0.24);
  background: rgba(254, 242, 242, 0.92);
  color: var(--red-deep);
}

.school-notice-row span {
  color: var(--red-deep);
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 40px rgba(22, 40, 60, 0.1);
  backdrop-filter: blur(18px);
}

.view-switcher {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 5px;
  border: 1px solid rgba(31, 45, 61, 0.1);
  border-radius: 18px;
  background: rgba(241, 245, 249, 0.88);
}

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

.class-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
}

.welcome-label {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.nav-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

.nav-button.active {
  background: linear-gradient(180deg, #0ea5a3, #087f83);
  color: white;
  box-shadow: 0 12px 24px rgba(14, 165, 163, 0.2);
}

.view-panel.hidden {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 20px;
}

.student-hero {
  margin-bottom: 18px;
}

.admin-lock {
  margin-bottom: 18px;
}

.hero-copy-wrap,
.hero-scoreboard,
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy-wrap,
.hero-scoreboard {
  padding: 24px;
}

.eyebrow,
.panel-label {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--muted);
}

h1,
h2,
h3,
.student-score strong,
.score-pill strong {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  line-height: 1;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  max-width: 11ch;
}

h2 {
  font-size: 2rem;
}

.hero-copy {
  max-width: 56ch;
  margin: 10px 0 18px;
  font-size: 1.07rem;
  color: var(--muted);
}

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

.compact {
  align-items: end;
}

.selector-stack {
  display: grid;
  gap: 12px;
}

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

.score-pill {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #eef6ff);
  border: 1px solid var(--line);
}

.score-pill span {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
}

.score-pill strong {
  font-size: 2rem;
}

.session-date {
  margin: 16px 0 0;
  color: var(--muted);
}

.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  
}

.panel {
  padding: 22px;
}

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

.panel {
  padding: 22px;
}

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

.panel-glow {
  background: linear-gradient(180deg, #ffffff 0%, #edfdf3 100%);
}

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

.collapsible-panel {
  transition: padding var(--speed) ease, box-shadow var(--speed) ease;
}

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

.collapsible-panel.is-collapsed {
  padding-bottom: 18px;
}

.collapsible-panel.is-collapsed .panel-header {
  margin-bottom: 0;
}

.collapsible-panel.is-collapsed .panel-body {
  display: none;
}

.collapse-toggle {
  min-width: 68px;
  border: 1px solid rgba(31, 45, 61, 0.12);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(241, 245, 249, 0.92);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.collapse-toggle:hover {
  box-shadow: 0 12px 22px rgba(22, 40, 60, 0.1);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
}

.mini-form,
.category-form,
.custom-point-form {
  display: grid;
  gap: 10px;
}

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

.category-form {
  grid-template-columns: 1.2fr 0.8fr 0.6fr auto;
  margin-bottom: 14px;
}

.custom-point-form {
  grid-template-columns: 1fr 0.55fr 1.2fr auto;
}

.bulk-action-form,
.settings-form,
.communication-form {
  display: grid;
  gap: 10px;
}

.bulk-action-form {
  grid-template-columns: 1fr 0.7fr 1.2fr auto;
}

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

.communication-form {
  grid-template-columns: 1fr 0.7fr 1.2fr auto;
  margin-bottom: 12px;
}

.inline-note {
  color: var(--muted);
  font-weight: 800;
  align-self: center;
}

.mic-status {
  transition: color 160ms ease, transform 160ms ease;
}

.mic-status[data-mode="live"] {
  color: var(--blue);
}

.mic-status[data-mode="error"] {
  color: var(--red-deep);
}

input[type="range"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.toggle-row input {
  width: auto;
}

.selector-label {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.selector-label span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.class-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.class-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
}

.class-chip.active {
  background: var(--blue-soft);
}

.class-chip button,
.chip-remove {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.chip-remove {
  color: var(--red-deep);
}

.chip-actions {
  display: inline-flex;
  gap: 4px;
}

.legend-chip .chip-remove {
  padding: 2px 4px;
  font-size: 0.78rem;
}

.communication-list,
.history-panel,
.analytics-grid,
.summary-strip {
  display: grid;
  gap: 10px;
}

/* Attendance: wider layout */
.attendance-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 3 per row */
  gap: 16px;
  width: 100%;
}

.log-row,
.attendance-row,
.analytics-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px 14px;
}

.attendance-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 92px;
}

.summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 10px;
}

.summary-card strong,
.analytics-card strong {
  display: block;
  margin-top: 4px;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.4rem;
}

.group-card {
  text-align: left;
}

.group-card.drag-over {
  border-color: #2563eb;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.18);
}

.group-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.group-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  font-family: "Baloo 2", sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.2);
}

.group-card .history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.group-member-row {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.group-member-row.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.drag-handle {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.group-count-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.group-count-control input {
  width: 84px;
  min-height: 42px;
}

.analytics-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.history-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.history-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.student-login-badge {
  display: inline-grid;
  gap: 2px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 159, 154, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(231, 248, 245, 0.72);
}

.student-login-badge span,
.student-login-badge small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.student-login-badge strong {
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Nunito", sans-serif;
  font-size: 1rem;
  line-height: 1.2;
}

.history-section {
  display: grid;
  gap: 8px;
  padding-top: 8px;
}

.history-row,
.log-row p,
.log-row small {
  color: var(--muted);
}

.log-row span,
.log-row strong {
  display: block;
}

.primary-button,
.ghost-button,
.danger-button,
.import-label,
.icon-button,
.quick-chip {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.import-label:hover,
.icon-button:hover,
.quick-chip:hover {
  transform: translateY(-1px);
}

.primary-button,
.ghost-button,
.danger-button,
.import-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: white;
}

.ghost-button,
.import-label {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-button {
  background: var(--red-soft);
  color: var(--red-deep);
}

.category-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 168px;
  overflow: auto;
  padding: 2px 4px 2px 0;
  align-content: flex-start;
}

.legend-chip,
.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  font-weight: 800;
}

.legend-chip {
  padding: 6px 8px;
  border: 1px solid var(--line);
  justify-content: space-between;
  font-size: 0.82rem;
  line-height: 1.2;
}

.quick-chip {
  padding: 10px 12px;
  font-size: 0.93rem;
}

.quick-chip.positive,
.legend-chip.positive {
  background: var(--green-soft);
  color: var(--green-deep);
}

.quick-chip.negative,
.legend-chip.negative {
  background: var(--red-soft);
  color: var(--red-deep);
}

.quick-chip.neutral,
.legend-chip.neutral {
  background: #fff7db;
  color: #b45309;
}

.student-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.student-card {
  padding: 16px;
  border-radius: 26px;
  background: linear-gradient(180deg, #ffffff, #f5fbff);
  border: 1px solid var(--line);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.08);
}

.student-card-top {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.workspace-message {
  margin: 0 0 14px;
}

.avatar-wrap {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  padding: 4px;
  background: linear-gradient(180deg, #fde68a, #fca5a5);
}

.avatar {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  font-family: "Baloo 2", sans-serif;
  font-size: 2.6rem;
  color: white;
  background: linear-gradient(180deg, #60a5fa, #7c3aed);
}

.student-heading h3 {
  font-size: 1.5rem;
}

.student-group {
  margin: 2px 0 0;
  color: var(--muted);
}

.remove-button {
  padding: 8px 12px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  color: var(--muted);
}

.student-rule-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.edit-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.student-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #eff6ff, #eefcf6);
}

.student-score span {
  color: var(--muted);
  font-weight: 800;
}

.student-score strong {
  font-size: 2rem;
}

.student-card.selected-card {
  border-color: rgba(37, 99, 235, 0.35);
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(222, 247, 237, 0.98));
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.18);
}

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

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

tr.leaderboard-top {
  background: rgba(220, 252, 231, 0.9);
}

tr.leaderboard-top td {
  color: #166534;
  font-weight: 800;
}

tr.leaderboard-bottom {
  background: rgba(255, 228, 230, 0.92);
}

tr.leaderboard-bottom td {
  color: #9f1239;
  font-weight: 800;
}

.points-positive {
  color: var(--green-deep);
  font-weight: 900;
}

.points-negative {
  color: var(--red-deep);
  font-weight: 900;
}

.attendance-status {
  font-weight: 900;
}

.attendance-status-present {
  color: var(--green-deep);
}

.attendance-status-absent {
  color: var(--red-deep);
}

.attendance-status-late {
  color: var(--yellow);
}

.attendance-status-excused {
  color: var(--blue);
}

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

.group-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  border: 1px solid var(--line);
}

.group-chip strong {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.6rem;
}

.event-feed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.event-item {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f9fbff);
}

.event-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.event-badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.badge-positive {
  background: var(--green-soft);
  color: var(--green-deep);
}

.badge-negative {
  background: var(--red-soft);
  color: var(--red-deep);
}

.badge-neutral {
  background: #fff7db;
  color: #b45309;
}

.event-meta,
.event-note,
.empty-state {
  margin: 6px 0 0;
  color: var(--muted);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
}

.site-footer {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0 0 24px;
}

.site-footer p {
  margin: 0;
  padding: 16px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 14px 30px rgba(21, 49, 75, 0.08);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  backdrop-filter: blur(8px);
}

@media (max-width: 960px) {
  .auth-grid,
  .topbar,
  .hero,
  .app-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    padding-top: 16px;
  }

  .auth-shell,
  .site-footer {
    width: min(100% - 16px, 100%);
  }

  .hero-copy-wrap,
  .hero-scoreboard,
  .panel,
  .student-card {
    border-radius: 22px;
  }

  .inline-form,
  .score-grid,
  .mini-form,
  .category-form,
  .custom-point-form,
  .bulk-action-form,
  .communication-form {
    grid-template-columns: 1fr;
  }

  .student-card-top {
    grid-template-columns: auto 1fr;
  }

  .student-rule-bar {
    grid-template-columns: 1fr;
  }

  .remove-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1024px) {
  .attendance-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .attendance-list {
    grid-template-columns: 1fr;
  }
}

/* TCMS v2.0 interface layer */
:root {
  --bg-top: #f7fbff;
  --bg-bottom: #fff8ec;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --ink: #15283b;
  --muted: #607184;
  --line: rgba(31, 45, 61, 0.12);
  --green: #16a34a;
  --green-deep: #137c3a;
  --green-soft: #e4f8ec;
  --red: #ef5d68;
  --red-deep: #b42335;
  --red-soft: #ffe7ea;
  --yellow: #f2aa2e;
  --blue: #2563eb;
  --blue-soft: #e6f0ff;
  --purple-soft: #f0eafe;
  --aqua: #0ea5a3;
  --coral: #f9735b;
  --shadow: 0 22px 60px rgba(22, 40, 60, 0.13);
  --shadow-soft: 0 12px 32px rgba(22, 40, 60, 0.09);
  --radius: 18px;
  --radius-sm: 12px;
  --speed: 180ms;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #f7fbff;
  line-height: 1.45;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(232, 248, 246, 0.72) 46%, rgba(255, 241, 224, 0.78)),
    url("assets/classroom-background.png") center / cover no-repeat;
  transform: scale(1.02);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 40, 59, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 40, 59, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 74%);
  z-index: -1;
}

.sky,
.page-backdrop {
  opacity: 0;
}

.page-shell,
.auth-shell,
.site-footer {
  z-index: 1;
}

.page-shell {
  width: min(1380px, calc(100% - 32px));
  padding: 22px 0 44px;
}

.auth-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 78px);
  display: grid;
  align-content: center;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.topbar h1,
.auth-hero h1 {
  max-width: none;
  letter-spacing: 0;
}

.auth-hero {
  margin-bottom: 18px;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.auth-grid {
  gap: 16px;
}

.hero {
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 16px;
}

.hero-copy-wrap,
.hero-scoreboard,
.panel,
.auth-panel {
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.74);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy-wrap {
  position: relative;
  overflow: hidden;
  border-left: 5px solid var(--aqua);
}

.hero-copy-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(48%, 340px);
  height: 5px;
  background: linear-gradient(90deg, var(--aqua), var(--yellow), var(--coral));
}

.hero-scoreboard {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(233, 248, 246, 0.86)),
    var(--panel-strong);
}

.panel {
  padding: 20px;
}

.panel-glow {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(230, 248, 239, 0.9)),
    var(--panel);
}

.panel-header {
  align-items: flex-start;
}

.eyebrow,
.panel-label {
  letter-spacing: 0.08em;
  color: #607184;
}

h1 {
  font-size: clamp(2.2rem, 4.2vw, 4.6rem);
}

h2 {
  font-size: clamp(1.5rem, 2.4vw, 2.05rem);
}

h3 {
  font-size: 1.18rem;
}

.hero-copy {
  color: #526579;
  font-weight: 700;
}

input,
select {
  min-height: 46px;
  border-radius: var(--radius-sm);
  border-color: rgba(31, 45, 61, 0.14);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  outline: none;
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease, transform var(--speed) ease;
}

input:hover,
select:hover {
  border-color: rgba(14, 165, 163, 0.34);
}

input:focus,
select:focus,
button:focus-visible,
.import-label:focus-visible {
  border-color: rgba(14, 165, 163, 0.75);
  box-shadow: 0 0 0 4px rgba(14, 165, 163, 0.14);
}

.primary-button,
.ghost-button,
.danger-button,
.import-label,
.nav-button,
.icon-button,
.quick-chip,
#shareClassBtn {
  min-height: 42px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 18px rgba(21, 40, 59, 0.08);
  transition:
    transform var(--speed) ease,
    box-shadow var(--speed) ease,
    background-color var(--speed) ease,
    border-color var(--speed) ease,
    opacity var(--speed) ease;
}

.primary-button,
.nav-button.active {
  background: linear-gradient(180deg, #0ea5a3, #087f83);
  color: #fff;
  box-shadow: 0 14px 26px rgba(14, 165, 163, 0.24);
}

.primary-button:hover,
.nav-button.active:hover {
  box-shadow: 0 18px 34px rgba(14, 165, 163, 0.28);
}

.ghost-button,
.import-label,
.nav-button,
.icon-button,
#shareClassBtn {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(31, 45, 61, 0.13);
}

.danger-button {
  background: #fff0f1;
  border: 1px solid rgba(180, 35, 53, 0.18);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
  box-shadow: none;
}

.class-pill,
.class-chip,
.legend-chip,
.quick-chip,
.score-pill,
.summary-card,
.analytics-card,
.event-item,
.student-card,
.log-row,
.attendance-row,
.group-chip,
.empty-state {
  border-radius: var(--radius-sm);
}

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

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

.score-pill,
.summary-card,
.analytics-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
  border-color: rgba(31, 45, 61, 0.1);
}

.score-pill {
  position: relative;
  overflow: hidden;
}

.score-pill::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--aqua), var(--yellow));
}

.score-pill strong,
.student-score strong,
.analytics-card strong,
.group-chip strong {
  color: #102335;
}

.app-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.toolbar {
  align-items: center;
}

.inline-form,
.mini-form,
.category-form,
.custom-point-form,
.bulk-action-form,
.communication-form,
.share-class-strip {
  align-items: center;
}

.promotion-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.share-class-strip {
  display: grid;
  grid-template-columns: auto minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid rgba(31, 45, 61, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(239, 250, 249, 0.78);
}

.share-class-strip h3 {
  white-space: nowrap;
}

.incident-form {
  grid-template-columns: 1fr 0.9fr 1.1fr auto;
}

.student-cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.student-card,
.event-item,
.analytics-card,
.attendance-row,
.log-row {
  transform: translateY(0);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease;
}

.student-card:hover,
.event-item:hover,
.analytics-card:hover,
.attendance-row:hover,
.log-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(22, 40, 60, 0.12);
  border-color: rgba(14, 165, 163, 0.22);
}

.student-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 252, 251, 0.94));
}

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

.avatar-wrap {
  border-radius: 16px;
  background: linear-gradient(135deg, #f7c948, #f9735b, #0ea5a3);
}

.avatar {
  border-radius: 13px;
  background: linear-gradient(160deg, #0ea5a3, #2563eb);
}

.student-score {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #e7f8f5, #fff4df);
}

.student-card.selected-card {
  border-color: rgba(14, 165, 163, 0.5);
  background: linear-gradient(180deg, rgba(231, 248, 245, 0.98), rgba(255, 246, 231, 0.96));
}

.student-rule-bar,
.card-actions {
  align-items: center;
}

.quick-student-actions,
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
}

.quick-student-actions {
  margin-top: 12px;
}

.quick-student-action,
.quick-attendance-action,
.quick-group-action,
.quick-action-grid button {
  border: 1px solid rgba(31, 45, 61, 0.12);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease;
}

.quick-student-action:hover,
.quick-attendance-action:hover,
.quick-group-action:hover,
.quick-action-grid button:hover,
.quick-action-grid button.active {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(22, 40, 60, 0.1);
}

.quick-student-action.positive,
.quick-group-action.positive {
  color: var(--green-deep);
  background: var(--green-soft);
}

.quick-student-action.negative,
.quick-attendance-action.negative,
.quick-group-action.negative {
  color: var(--red-deep);
  background: var(--red-soft);
}

.quick-attendance-action.warning,
.quick-action-grid button.active {
  color: #92400e;
  background: #fff7db;
}

.card-actions {
  grid-column: 2;
  margin-top: 8px;
}

.icon-button {
  padding: 10px 12px;
  font-weight: 900;
}

.remove-button {
  color: var(--red-deep);
}

.class-list {
  gap: 8px;
}

.class-chip {
  padding: 6px 8px 6px 10px;
  background: rgba(255, 255, 255, 0.9);
}

.class-chip.active {
  background: #e7f8f5;
  border-color: rgba(14, 165, 163, 0.28);
}

.event-feed,
.analytics-grid,
.communication-list,
.history-panel {
  gap: 12px;
}

.attendance-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.attendance-row {
  min-height: 78px;
}

.group-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(160deg, #0ea5a3, #2563eb);
}

.group-card.drag-over {
  border-color: rgba(14, 165, 163, 0.68);
  background: linear-gradient(180deg, rgba(231, 248, 245, 0.98), rgba(255, 255, 255, 0.96));
  box-shadow: 0 20px 40px rgba(14, 165, 163, 0.18);
}

.group-member-row {
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(248, 251, 255, 0.82);
}

.drag-handle {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(14, 165, 163, 0.1);
  color: #087f83;
}

.challenge-row {
  gap: 10px;
}

.challenge-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.challenge-meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(16, 35, 53, 0.08);
  overflow: hidden;
}

.challenge-meter span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5a3, #2563eb);
}

.trend-card strong {
  font-size: 1.2rem;
}

.trend-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.trend-positive {
  border-color: rgba(22, 163, 74, 0.26);
  background: linear-gradient(180deg, rgba(228, 248, 236, 0.95), rgba(255, 255, 255, 0.95));
}

.trend-negative {
  border-color: rgba(180, 35, 53, 0.26);
  background: linear-gradient(180deg, rgba(255, 231, 234, 0.96), rgba(255, 255, 255, 0.95));
}

.trend-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(180deg, rgba(255, 247, 219, 0.96), rgba(255, 255, 255, 0.95));
}

.trend-neutral {
  border-color: rgba(242, 170, 46, 0.24);
  background: linear-gradient(180deg, rgba(255, 244, 224, 0.95), rgba(255, 255, 255, 0.95));
}

.pulse-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

#lessonTimerDisplay {
  font-size: 2rem;
  font-family: "Baloo 2", sans-serif;
  color: #102335;
}

.celebration-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.celebration-tag {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(14, 165, 163, 0.25);
  color: #0f3b44;
  font-weight: 800;
  animation: celebration-pop 1200ms ease both;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 3px;
  animation: confetti-drop 1200ms ease-in forwards;
}

@keyframes confetti-drop {
  from {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  to {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0;
  }
}

@keyframes celebration-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

table {
  border-spacing: 0;
  border-collapse: separate;
}

th {
  background: rgba(247, 251, 255, 0.92);
}

td,
th {
  border-bottom-color: rgba(31, 45, 61, 0.09);
}

tbody tr {
  transition: background-color var(--speed) ease;
}

tbody tr:hover {
  background: rgba(231, 248, 245, 0.55);
}

.event-badge {
  border-radius: 999px;
}

.empty-state {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(31, 45, 61, 0.14);
}

.site-footer p {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.74);
}

@media (prefers-reduced-motion: no-preference) {
  .auth-hero,
  .auth-panel,
  .hero-copy-wrap,
  .hero-scoreboard,
  .panel {
    animation: tcms-rise 420ms ease both;
  }

  .panel:nth-child(2n) {
    animation-delay: 45ms;
  }

  .panel:nth-child(3n) {
    animation-delay: 90ms;
  }
}

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

@media (max-width: 1100px) {
  .score-grid,
  .hero-scoreboard .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .share-class-strip {
    grid-template-columns: 1fr 1fr;
  }

  .share-class-strip h3,
  .share-class-strip button {
    grid-column: auto;
  }
}

@media (max-width: 960px) {
  .topbar {
    position: static;
  }

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

@media (max-width: 720px) {
  .page-shell,
  .auth-shell,
  .site-footer {
    width: min(100% - 18px, 100%);
  }

  .topbar,
  .auth-hero,
  .hero-copy-wrap,
  .hero-scoreboard,
  .panel,
  .auth-panel {
    border-radius: 16px;
  }

  .panel-header,
  .topbar-actions,
  .hero-actions,
  .toolbar {
    align-items: stretch;
  }

  .view-switcher,
  .topbar-actions,
  .toolbar {
    width: 100%;
  }

  .view-switcher > *,
  .toolbar > *,
  .toolbar button,
  .toolbar .import-label {
    flex: 1 1 auto;
  }

  .score-grid,
  .hero-scoreboard .score-grid,
  .share-class-strip,
  .promotion-form,
  .category-form,
  .custom-point-form,
  .bulk-action-form,
  .communication-form {
    grid-template-columns: 1fr;
  }

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

.card-actions {
    grid-column: 1 / -1;
  }
}

.school-admin-view {
  background:
    linear-gradient(180deg, rgba(244, 248, 252, 0.96), rgba(255, 255, 255, 0.98));
}

.school-admin-workspace > .hero {
  border: 1px solid rgba(17, 34, 64, 0.1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 252, 0.95) 48%, rgba(255, 250, 238, 0.9));
  box-shadow: 0 22px 55px rgba(18, 34, 52, 0.12);
}

.school-admin-workspace > .hero .eyebrow {
  color: #0f766e;
}

.school-admin-workspace .panel {
  border-color: rgba(17, 34, 64, 0.1);
  box-shadow: 0 16px 34px rgba(18, 34, 52, 0.08);
}

.school-admin-workspace #schoolStatusPanel .history-row:first-child:not(.school-notice-row),
.school-admin-workspace #schoolAdminSummary .history-row:first-child:not(.school-notice-row) {
  background:
    linear-gradient(135deg, rgba(14, 165, 163, 0.12), rgba(242, 170, 46, 0.12));
  border-color: rgba(14, 165, 163, 0.16);
}

.school-admin-inspector {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 0.8fr) minmax(280px, 1.1fr);
  gap: 14px;
  align-items: end;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid rgba(17, 34, 64, 0.12);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 248, 247, 0.94));
}

.school-admin-inspector h3 {
  margin: 2px 0 4px;
}

.school-admin-inspector .helper-copy {
  margin: 0;
  color: #526579;
  font-weight: 700;
}

.school-admin-lens-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.school-admin-lens-stats article {
  min-height: 66px;
  padding: 10px;
  border: 1px solid rgba(17, 34, 64, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
}

.school-admin-lens-stats span {
  display: block;
  color: #5b6d7f;
  font-size: 0.78rem;
  font-weight: 800;
}

.school-admin-lens-stats strong {
  display: block;
  margin-top: 4px;
  color: #102335;
  font-size: 1.35rem;
}

.archived-class-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(31, 45, 61, 0.1);
}

.archived-class-panel .history-row {
  background: rgba(248, 251, 255, 0.86);
}

.assignment-filter-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(240px, 360px);
  gap: 12px;
  align-items: end;
}

.assignment-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.assignment-card {
  display: grid;
  gap: 10px;
  min-height: 126px;
  padding: 14px;
  border: 1px solid rgba(17, 34, 64, 0.1);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.94));
}

.assignment-card-detail {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 82px;
}

.assignment-card strong,
.assignment-card span,
.assignment-card small {
  display: block;
}

.assignment-card strong {
  color: #102335;
}

.assignment-card span,
.assignment-card small {
  color: #526579;
  font-weight: 700;
}

.assignment-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.assignment-chip-list span {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(14, 165, 163, 0.1);
  color: #0f766e;
  font-size: 0.8rem;
}

@media (max-width: 920px) {
  .school-admin-inspector {
    grid-template-columns: 1fr;
  }

  .assignment-filter-row,
  .assignment-card-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .school-admin-lens-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.topbar {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 42px rgba(22, 40, 60, 0.12);
}

.topbar .view-switcher,
.auth-login-switcher {
  padding: 5px;
  gap: 6px;
  border: 1px solid rgba(31, 45, 61, 0.1);
  border-radius: 18px;
  background: rgba(241, 245, 249, 0.9);
}

.topbar .nav-button,
.auth-login-switcher .nav-button {
  border-radius: 14px;
  background: transparent;
}

.topbar .nav-button.active,
.auth-login-switcher .nav-button.active {
  background: linear-gradient(180deg, #0ea5a3, #087f83);
  box-shadow: 0 12px 24px rgba(14, 165, 163, 0.22);
}

@media (max-width: 720px) {
  .notice-center {
    top: 10px;
    right: 9px;
    width: calc(100vw - 18px);
  }

  .notice-toast {
    grid-template-columns: 1fr;
  }

  .notice-toast button {
    justify-self: start;
    padding: 0;
  }
}

@media (max-width: 980px) {
  .incident-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .quick-student-actions,
  .quick-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.collapsible-panel.is-collapsed .panel-body {
  display: none;
}

.collapsible-panel.is-collapsed .panel-header {
  margin-bottom: 0;
}

.collapse-toggle {
  flex: 0 0 auto;
  border: 1px solid rgba(31, 45, 61, 0.12);
  border-radius: 12px;
  padding: 9px 12px;
  background: rgba(241, 245, 249, 0.94);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

@media (max-width: 720px) {
  .collapse-toggle {
    width: 100%;
  }
}

/* Interface refresh: visual polish only, no workflow changes. */
:root {
  --ink: #112033;
  --muted: #5c6c7e;
  --line: rgba(17, 32, 51, 0.1);
  --panel: rgba(255, 255, 255, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --aqua: #0f9f9a;
  --blue: #2563eb;
  --coral: #f9735b;
  --yellow: #f2aa2e;
  --green: #20b15a;
  --green-deep: #14783e;
  --green-soft: #e4f8ec;
  --red: #ef5f75;
  --red-deep: #b42335;
  --red-soft: #ffe7ea;
  --blue-soft: #e6f0ff;
  --shadow: 0 20px 56px rgba(17, 32, 51, 0.12);
  --shadow-soft: 0 10px 28px rgba(17, 32, 51, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

body {
  font-family: "Plus Jakarta Sans", "Nunito", sans-serif;
  color: var(--ink);
  background: #eef7f6;
}

body::before {
  background:
    linear-gradient(135deg, rgba(244, 252, 251, 0.95), rgba(230, 240, 255, 0.72) 42%, rgba(255, 246, 232, 0.84)),
    url("assets/classroom-background.png") center / cover no-repeat;
  filter: saturate(1.08) contrast(1.02);
}

body::after {
  background-image:
    linear-gradient(rgba(17, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 32, 51, 0.035) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.46), transparent 70%);
}

.page-shell {
  width: min(1420px, calc(100% - 32px));
}

.topbar {
  top: 10px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 252, 251, 0.84));
  border-color: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 46px rgba(17, 32, 51, 0.13);
}

.topbar h1,
.auth-hero h1,
h2,
h3,
.score-pill strong,
.student-score strong,
.analytics-card strong {
  font-family: "Plus Jakarta Sans", "Nunito", sans-serif;
  line-height: 1.08;
}

.topbar h1 {
  font-size: clamp(1.55rem, 2vw, 2.2rem);
}

.eyebrow,
.panel-label {
  letter-spacing: 0.05em;
  color: #687789;
}

.view-switcher {
  border-radius: 14px;
  background: rgba(229, 238, 246, 0.9);
}

.nav-button {
  min-height: 40px;
  border-radius: 10px;
}

.nav-button.active,
.primary-button {
  background: linear-gradient(180deg, #10aaa4, #087f83);
  box-shadow: 0 13px 26px rgba(8, 127, 131, 0.22);
}

.hero {
  gap: 14px;
  margin-bottom: 16px;
}

.hero-copy-wrap,
.hero-scoreboard,
.panel,
.auth-panel,
.auth-hero {
  border-radius: 16px;
  border-color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 252, 0.86));
  box-shadow: var(--shadow);
}

.hero-copy-wrap {
  border-left: 0;
}

.hero-copy-wrap::after {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #10aaa4, #2563eb, #f2aa2e, #f9735b);
}

.hero-scoreboard {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(231, 248, 245, 0.86));
}

.panel {
  padding: 18px;
}

.panel-header {
  gap: 12px;
  margin-bottom: 14px;
}

h2 {
  font-size: clamp(1.25rem, 1.55vw, 1.75rem);
}

h3 {
  font-size: 1.05rem;
}

.hero-copy {
  color: #526376;
  font-size: 1rem;
}

input,
select {
  border-radius: 10px;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.96);
}

.primary-button,
.ghost-button,
.danger-button,
.import-label,
.icon-button,
.collapse-toggle,
.quick-student-action,
.quick-attendance-action,
.quick-group-action {
  border-radius: 10px;
}

.ghost-button,
.import-label,
.icon-button,
.collapse-toggle {
  background: rgba(255, 255, 255, 0.92);
}

.ghost-button:hover,
.import-label:hover,
.icon-button:hover,
.collapse-toggle:hover {
  border-color: rgba(15, 159, 154, 0.28);
  box-shadow: 0 12px 24px rgba(17, 32, 51, 0.1);
}

.app-grid {
  gap: 14px;
}

.score-pill,
.summary-card,
.analytics-card,
.event-item,
.student-card,
.log-row,
.attendance-row,
.history-row {
  border-radius: 12px;
  border-color: rgba(17, 32, 51, 0.09);
}

.score-pill {
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 255, 0.94));
}

.score-pill::before {
  width: 3px;
}

.score-pill strong {
  font-size: 1.7rem;
}

.student-card {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(245, 252, 251, 0.95));
  box-shadow: 0 12px 28px rgba(17, 32, 51, 0.08);
}

.student-card:hover,
.analytics-card:hover,
.attendance-row:hover,
.log-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(17, 32, 51, 0.12);
}

.student-card-top {
  gap: 10px;
}

.avatar-wrap {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.avatar {
  border-radius: 11px;
  font-size: 2rem;
}

.student-heading h3 {
  font-size: 1.12rem;
  line-height: 1.15;
}

.student-group,
.inline-note,
.helper-copy {
  color: var(--muted);
}

.student-score {
  background: linear-gradient(135deg, #e7f8f5, #fff7e5);
}

.quick-student-actions {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.quick-student-action,
.quick-attendance-action,
.quick-group-action {
  min-height: 38px;
  padding: 8px 9px;
}

.share-class-strip,
.school-admin-inspector,
.archived-class-panel {
  border-radius: 12px;
}

.table-wrap {
  border-radius: 12px;
  overflow: auto;
}

table {
  border-spacing: 0;
}

thead th {
  background: rgba(231, 248, 245, 0.78);
}

tbody tr:hover {
  background: rgba(244, 250, 255, 0.9);
}

.notice-toast {
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(17, 32, 51, 0.16);
}

.site-footer {
  color: #64748b;
}

@media (max-width: 960px) {
  .topbar {
    position: sticky;
  }
}

@media (max-width: 720px) {
  .page-shell,
  .auth-shell,
  .site-footer {
    width: min(100% - 18px, 100%);
  }

  .topbar {
    top: 6px;
    padding: 12px;
  }

  .panel,
  .hero-copy-wrap,
  .hero-scoreboard {
    padding: 14px;
  }

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

/* Homepage refresh: same login/register flow, more distinctive first screen. */
.auth-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 74px);
  align-content: center;
  gap: 18px;
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: 18px auto auto 50%;
  width: min(760px, 82vw);
  height: min(760px, 82vw);
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, rgba(15, 159, 154, 0.2), transparent 34%),
    radial-gradient(circle at 70% 62%, rgba(37, 99, 235, 0.18), transparent 36%),
    radial-gradient(circle at 44% 78%, rgba(242, 170, 46, 0.18), transparent 34%);
  filter: blur(8px);
  pointer-events: none;
  z-index: -1;
}

.auth-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 22px;
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 249, 247, 0.9) 48%, rgba(255, 248, 234, 0.9));
  box-shadow: 0 24px 70px rgba(17, 32, 51, 0.15);
}

.auth-hero::before {
  content: "Live class control";
  justify-self: end;
  align-self: start;
  padding: 10px 12px;
  border: 1px solid rgba(15, 159, 154, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 12px 28px rgba(17, 32, 51, 0.08);
}

.auth-hero::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: 0;
  width: min(420px, 44%);
  height: 5px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, #10aaa4, #2563eb, #f2aa2e, #f9735b);
}

.auth-hero .eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(15, 159, 154, 0.1);
  color: #0f766e;
}

.auth-hero h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 6vw, 5.6rem);
  line-height: 0.95;
}

.auth-hero .hero-copy {
  max-width: 64ch;
  margin-bottom: 0;
  color: #4f6073;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
}

.auth-grid {
  grid-template-columns: minmax(320px, 0.94fr) minmax(280px, 0.7fr);
  align-items: stretch;
  gap: 16px;
}

.auth-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 2.4vw, 28px);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(246, 252, 251, 0.88));
  box-shadow: 0 18px 52px rgba(17, 32, 51, 0.12);
}

.auth-panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #10aaa4, #2563eb);
  opacity: 0.86;
}

.auth-panel:nth-child(2)::after {
  background: linear-gradient(90deg, #f2aa2e, #f9735b);
}

.auth-panel .panel-header {
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(17, 32, 51, 0.08);
}

.auth-panel h2 {
  font-size: clamp(1.3rem, 2.1vw, 1.9rem);
}

.auth-login-switcher {
  margin: 14px 0;
}

.auth-login-switcher .nav-button {
  flex: 1 1 auto;
}

.auth-form input {
  min-height: 48px;
  border-color: rgba(17, 32, 51, 0.12);
  background: rgba(255, 255, 255, 0.98);
}

.auth-form .primary-button,
.auth-form .ghost-button,
.auth-panel > .primary-button {
  min-height: 48px;
}

.auth-divider {
  margin: 20px 0 16px;
}

.auth-helper {
  padding: 14px;
  border-radius: 14px;
  background: rgba(241, 245, 249, 0.74);
}

.auth-helper .helper-copy {
  margin-bottom: 0;
}

#authMessage {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 10px;
}

@media (max-width: 880px) {
  .auth-hero {
    grid-template-columns: 1fr;
  }

  .auth-hero::before {
    justify-self: start;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    width: min(100% - 18px, 100%);
    padding-top: 18px;
  }

  .auth-hero,
  .auth-panel {
    border-radius: 16px;
  }

  .auth-hero h1 {
    font-size: clamp(2.35rem, 15vw, 3.7rem);
  }

  .auth-login-switcher {
    grid-template-columns: 1fr;
  }
}

/* Login page refinement: compact, professional, and app-focused. */
.auth-shell {
  width: min(1040px, calc(100% - 36px));
  min-height: calc(100vh - 56px);
  padding: 24px 0 30px;
  align-content: center;
}

.auth-shell::before {
  inset: 50% auto auto 50%;
  width: min(580px, 70vw);
  height: min(580px, 70vw);
  opacity: 0.72;
  transform: translate(-50%, -50%);
}

.auth-hero {
  display: block;
  margin-bottom: 14px;
  padding: 22px 24px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 250, 248, 0.92));
  box-shadow: 0 18px 46px rgba(17, 32, 51, 0.12);
}

.auth-hero::before {
  content: none;
}

.auth-hero::after {
  right: 24px;
  width: 220px;
  max-width: calc(100% - 48px);
  height: 4px;
}

.auth-hero .eyebrow {
  margin-bottom: 10px;
  padding: 7px 10px;
  font-size: 0.72rem;
}

.auth-hero h1 {
  max-width: none;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.auth-hero .hero-copy {
  max-width: 720px;
  margin-top: 10px;
  color: #546579;
  font-size: 0.98rem;
  line-height: 1.55;
}

.auth-grid {
  grid-template-columns: minmax(340px, 1fr) minmax(280px, 0.78fr);
  gap: 14px;
}

.auth-panel {
  padding: 22px;
  border-radius: 16px;
  box-shadow: 0 16px 42px rgba(17, 32, 51, 0.1);
}

.auth-panel h2 {
  font-size: clamp(1.2rem, 1.7vw, 1.55rem);
}

.auth-panel .panel-header {
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.auth-login-switcher {
  margin: 12px 0;
  border-radius: 12px;
}

.auth-login-switcher .nav-button {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

.auth-form {
  gap: 10px;
}

.auth-form input {
  min-height: 44px;
  padding: 11px 12px;
}

.auth-form .primary-button,
.auth-form .ghost-button,
.auth-panel > .primary-button {
  min-height: 44px;
}

.auth-helper {
  padding: 12px;
}

.auth-helper h3 {
  font-size: 1.05rem;
}

.auth-divider {
  margin: 16px 0 12px;
}

@media (max-width: 820px) {
  .auth-shell {
    width: min(100% - 24px, 100%);
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .auth-hero {
    padding: 18px;
  }

  .auth-hero h1 {
    font-size: clamp(1.85rem, 10vw, 2.55rem);
  }

  .auth-panel {
    padding: 18px;
  }
}

/* Sweeter glass login finish. */
body:has(#authScreen:not(.hidden))::before {
  background:
    linear-gradient(135deg, rgba(246, 252, 255, 0.88), rgba(226, 248, 244, 0.74) 42%, rgba(255, 242, 230, 0.82)),
    url("assets/classroom-background.png") center / cover no-repeat;
  filter: saturate(1.12) contrast(1.03);
}

body:has(#authScreen:not(.hidden))::after {
  background:
    linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)),
    linear-gradient(rgba(17, 32, 51, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 32, 51, 0.028) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}

.auth-shell {
  perspective: 1200px;
}

.auth-shell::before {
  background:
    radial-gradient(circle at 30% 28%, rgba(15, 159, 154, 0.28), transparent 34%),
    radial-gradient(circle at 72% 60%, rgba(37, 99, 235, 0.2), transparent 34%),
    radial-gradient(circle at 44% 78%, rgba(249, 115, 91, 0.16), transparent 34%),
    radial-gradient(circle at 58% 36%, rgba(242, 170, 46, 0.14), transparent 28%);
  filter: blur(18px);
  opacity: 0.95;
}

.auth-hero,
.auth-panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.38)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(232, 248, 245, 0.26));
  box-shadow:
    0 24px 70px rgba(17, 32, 51, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(24px) saturate(1.22);
}

.auth-hero {
  border-radius: 22px;
}

.auth-hero .eyebrow,
.auth-login-switcher,
.auth-helper {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 24px rgba(17, 32, 51, 0.07);
  backdrop-filter: blur(14px);
}

.auth-hero .eyebrow {
  color: #087f83;
}

.auth-hero h1 {
  color: #102035;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.auth-hero .hero-copy {
  max-width: 680px;
  color: #485a70;
}

.auth-hero::after,
.auth-panel::after {
  background: linear-gradient(90deg, #10aaa4, #7dd3fc, #f2aa2e, #f9735b);
  box-shadow: 0 0 22px rgba(15, 159, 154, 0.34);
}

.auth-panel {
  border-radius: 20px;
}

.auth-panel:hover {
  transform: translateY(-2px);
  box-shadow:
    0 28px 76px rgba(17, 32, 51, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    inset 0 -1px 0 rgba(255, 255, 255, 0.36);
}

.auth-panel .panel-header {
  border-bottom-color: rgba(255, 255, 255, 0.58);
}

.auth-form input {
  border-color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 8px 20px rgba(17, 32, 51, 0.05);
}

.auth-form input:focus {
  background: rgba(255, 255, 255, 0.92);
}

.auth-login-switcher .nav-button {
  box-shadow: none;
}

.auth-login-switcher .nav-button.active,
.auth-form .primary-button,
.auth-panel > .primary-button {
  background:
    linear-gradient(180deg, rgba(22, 189, 181, 0.98), rgba(8, 127, 131, 0.98));
  box-shadow:
    0 16px 30px rgba(8, 127, 131, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.auth-form .ghost-button {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.72);
}

.auth-divider {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), rgba(15, 159, 154, 0.18), transparent);
}

@media (max-width: 560px) {
  .auth-hero,
  .auth-panel {
    border-radius: 18px;
    backdrop-filter: blur(18px) saturate(1.16);
  }
}
