:root {
  color-scheme: light;
  --bg: #f4efe7;
  --bg-2: #fbf8f2;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #17202b;
  --muted: #667085;
  --border: rgba(23, 32, 43, 0.12);
  --accent: #0f766e;
  --accent-2: #b45309;
  --accent-3: #2563eb;
  --danger: #b42318;
  --success: #15803d;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 30%),
    linear-gradient(180deg, #fffdf8 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

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

.page-shell,
.auth-page {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 22px;
  align-items: center;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-hero,
.panel,
.page-header,
.profile-card,
.stat-card {
  padding: 22px;
}

.auth-hero h1,
.page-header h1 {
  margin: 12px 0 12px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.05em;
  max-width: 13ch;
}

.lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: 1rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.panel,
.page-header,
.profile-card,
.stat-card {
  border-radius: var(--radius-lg);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span,
.label {
  color: var(--muted);
  font-size: 0.92rem;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.action-row,
.admin-toolbar,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

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

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent-3), #1d4ed8);
  color: #fff;
  box-shadow: 0 14px 24px rgba(37, 99, 235, 0.22);
}

.button.secondary {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-3);
  border-color: rgba(37, 99, 235, 0.14);
}

.button.ghost {
  background: rgba(15, 23, 42, 0.04);
  border-color: var(--border);
}

.button.tiny {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.message,
.loading {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.message.error {
  border-color: rgba(180, 35, 24, 0.2);
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.message.success {
  border-color: rgba(21, 128, 61, 0.2);
  background: rgba(21, 128, 61, 0.08);
  color: var(--success);
}

.message.info,
.loading {
  border-color: rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-3);
}

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

.stat-card span,
.profile-grid .label {
  display: block;
  margin-bottom: 8px;
}

.stat-card strong,
.profile-grid strong {
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

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

.side-stack {
  display: grid;
  gap: 18px;
}

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

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
}

.list-copy {
  display: grid;
  gap: 4px;
}

.list-copy strong {
  font-size: 1rem;
}

.list-copy span,
.list-actions small,
.history-meta small {
  color: var(--muted);
}

.list-actions,
.history-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-3);
  font-size: 0.86rem;
  font-weight: 700;
}

.status-tag--active {
  background: rgba(21, 128, 61, 0.08);
  color: var(--success);
}

.empty-state {
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
}

.board-scroller,
.seat-board-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 8px;
}

.blackboard {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #102a43, #234e52);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.seat-board {
  min-width: 1040px;
  display: grid;
  gap: 10px;
}

.seat-row {
  display: grid;
  grid-template-columns:
    46px
    minmax(110px, 1fr)
    minmax(110px, 1fr)
    40px
    minmax(110px, 1fr)
    minmax(110px, 1fr)
    40px
    minmax(110px, 1fr)
    minmax(110px, 1fr)
    40px
    minmax(110px, 1fr)
    minmax(110px, 1fr);
  gap: 10px;
  min-width: 1040px;
}

.seat-row--header .seat-cell {
  min-height: 34px;
}

.seat-cell {
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 10px;
  background: rgba(255, 255, 255, 0.86);
}

button.seat-cell {
  display: grid;
  gap: 4px;
  text-align: left;
  min-height: 106px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

button.seat-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.seat-cell--header {
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.04);
  color: var(--muted);
  font-weight: 800;
}

.seat-cell--aisle {
  background: transparent;
  border: none;
  box-shadow: none;
  min-width: 40px;
  padding: 0;
}

.seat-cell--missing {
  background: rgba(107, 114, 128, 0.1);
  color: var(--muted);
}

.seat-cell--empty {
  background: rgba(255, 255, 255, 0.86);
}

.seat-cell--occupied {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.16);
}

.seat-cell--selected {
  outline: 3px solid rgba(245, 158, 11, 0.35);
}

.seat-cell--violation {
  border-color: rgba(180, 35, 24, 0.45);
  box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.18);
}

.seat-cell .seat-tag {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  font-size: 0.78rem;
  font-weight: 800;
}

.seat-cell strong {
  font-size: 0.98rem;
  line-height: 1.4;
}

.seat-cell small {
  color: var(--muted);
}

.swap-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
}

@media (max-width: 1120px) {
  .auth-page,
  .admin-grid,
  .student-grid,
  .stats-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .seat-board {
    min-width: 1040px;
  }
}

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

  .action-row,
  .admin-toolbar,
  .header-actions,
  .swap-panel,
  .list-item {
    flex-direction: column;
    align-items: stretch;
  }

  .seat-board {
    min-width: 1040px;
  }
}
