.admin-back {
  color: var(--cyan-bright);
  font-size: 12px;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.admin-main {
  max-width: 1080px;
  padding: 48px 0 80px;
}

.admin-card {
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11, 31, 51, 0.96), rgba(5, 16, 29, 0.98));
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.admin-card h1,
.admin-card h2,
.admin-toolbar h1 {
  margin: 4px 0 10px;
}

.admin-card > p,
.credential-heading p {
  color: var(--muted);
}

#admin-login-card {
  max-width: 520px;
  margin-right: auto;
  margin-left: auto;
}

#teacher-first-login-card {
  max-width: 620px;
  margin-right: auto;
  margin-left: auto;
}

#admin-login-form,
.create-class-grid,
.account-grid,
.teacher-grid,
.first-login-grid,
.teacher-password-grid {
  display: grid;
  gap: 14px;
}

#admin-login-form label,
.create-class-grid label,
.account-grid label,
.teacher-grid label,
.first-login-grid label,
.teacher-password-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#admin-login-form input,
.create-class-grid input,
.account-grid input,
.teacher-grid input,
.teacher-grid select,
.first-login-grid input,
.teacher-password-grid input {
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(1, 8, 16, 0.72);
  border-radius: 8px;
}

.admin-toolbar,
.credential-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.create-class-grid {
  grid-template-columns: 2fr 1fr 1.5fr auto;
  align-items: end;
}

.account-grid {
  grid-template-columns: 1fr 1fr 1fr auto;
  align-items: end;
}

.teacher-grid {
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.teacher-grid .primary-action {
  grid-column: 1 / -1;
  justify-self: start;
}

.first-login-grid {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.teacher-password-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

.password-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.signed-in-role {
  margin: 0;
  padding: 10px 14px;
  color: #d9fff4;
  border: 1px solid rgba(92, 255, 199, 0.55);
  background: rgba(21, 115, 88, 0.24);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.signed-in-role::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: #5cffc7;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(92, 255, 199, 0.8);
  content: "";
}

.session-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.one-time-secret {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 123, 58, 0.7);
  color: var(--text);
  background: rgba(255, 123, 58, 0.09);
  border-radius: 9px;
}

.one-time-secret code {
  display: inline-block;
  margin-left: 8px;
  color: var(--cyan-bright);
  font-size: 14px;
}

.teacher-list {
  display: grid;
  margin-top: 18px;
  gap: 10px;
}

.teacher-item {
  display: block;
  align-items: start;
  gap: 18px;
  padding: 14px;
  border: 1px solid rgba(76, 209, 236, 0.18);
  background: rgba(2, 10, 21, 0.58);
  border-radius: 9px;
}

.teacher-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.teacher-summary-row > div:first-child,
.teacher-grid label,
.teacher-access-editor label {
  min-width: 0;
}

.teacher-item h3,
.teacher-item p {
  margin: 0;
}

.teacher-item p {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.teacher-settings-toggle {
  flex: 0 0 auto;
  white-space: nowrap;
}

.teacher-settings-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(76, 209, 236, 0.16);
}

.teacher-settings-panel[hidden] {
  display: none;
}

.teacher-access-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  align-items: end;
}

.teacher-access-editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.teacher-access-editor input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0 9px;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(1, 8, 16, 0.72);
  border-radius: 7px;
}

.teacher-access-editor select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0 9px;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(1, 8, 16, 0.72);
  border-radius: 7px;
}

.teacher-access-editor > button {
  grid-column: 1 / -1;
  justify-self: start;
  white-space: nowrap;
}

.teacher-email-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
  align-items: end;
}

.teacher-email-editor label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.teacher-email-editor input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0 9px;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(1, 8, 16, 0.72);
  border-radius: 7px;
}

.teacher-grid input,
.teacher-grid select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.class-actions button {
  white-space: nowrap;
}

.quota-summary {
  margin: 0 0 16px;
  color: var(--cyan-bright) !important;
  font-size: 13px;
  font-weight: 700;
}

.danger-action {
  border-color: rgba(255, 111, 97, 0.65) !important;
  color: #ffb0a8 !important;
}

.credential-heading > div:last-child {
  display: flex;
  gap: 8px;
}

.credential-list {
  display: grid;
  margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.credential-item,
.class-item {
  padding: 14px;
  border: 1px solid rgba(76, 209, 236, 0.18);
  background: rgba(2, 10, 21, 0.58);
  border-radius: 9px;
}

.credential-item strong,
.credential-item code {
  display: block;
}

.credential-item code {
  margin-top: 5px;
  color: var(--cyan-bright);
}

.class-list {
  display: grid;
  margin-top: 18px;
  gap: 10px;
}

.class-batch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(76, 209, 236, 0.18);
  background: rgba(2, 10, 21, 0.42);
  border-radius: 9px;
}

.class-batch-toolbar button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: rgba(76, 209, 236, 0.08);
  border-radius: 7px;
  cursor: pointer;
}

.class-batch-toolbar button:disabled,
.class-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.batch-select-all,
.class-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.batch-select-all input,
.class-select input {
  width: 17px;
  height: 17px;
  accent-color: var(--cyan-bright);
}

.batch-class-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--cyan-bright);
  font-size: 13px;
}

.class-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
}

.class-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.class-summary > div {
  min-width: 0;
}

.class-item h3,
.class-item p {
  margin: 0;
}

.class-item p {
  color: var(--muted);
  font-size: 12px;
}

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

.teacher-settings-panel > .class-actions {
  margin-top: 14px;
}

.class-actions button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: rgba(76, 209, 236, 0.08);
  border-radius: 7px;
  cursor: pointer;
}

.chairman-welcome {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 119, 75, 0.22), transparent 32%),
    radial-gradient(circle at 80% 24%, rgba(84, 231, 198, 0.24), transparent 34%),
    rgba(1, 8, 18, 0.96);
  backdrop-filter: blur(10px);
}

.chairman-welcome-glow,
.chairman-welcome-glow::before,
.chairman-welcome-glow::after {
  position: absolute;
  width: 10px;
  height: 10px;
  content: "";
  border-radius: 999px;
  background: #65f3d1;
  box-shadow:
    70px 90px #ff8158,
    -110px 150px #5ce9ff,
    170px -80px #ffe180,
    -210px -110px #ff8158,
    260px 120px #65f3d1,
    -300px 40px #ffe180;
  animation: chairman-sparkle 2.4s ease-in-out infinite alternate;
}

.chairman-welcome-glow::before {
  transform: rotate(45deg) scale(0.75);
}

.chairman-welcome-glow::after {
  transform: rotate(90deg) scale(0.55);
}

.chairman-welcome-card {
  position: relative;
  width: min(620px, 100%);
  padding: 52px 34px 38px;
  text-align: center;
  border: 1px solid rgba(101, 243, 209, 0.62);
  background: linear-gradient(145deg, rgba(12, 39, 59, 0.98), rgba(4, 16, 29, 0.99));
  border-radius: 24px;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    0 0 56px rgba(84, 231, 198, 0.13);
  animation: chairman-card-in 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.chairman-welcome-kicker {
  margin: 0 0 14px;
  color: #65f3d1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.chairman-welcome-card h2 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(42px, 8vw, 76px);
  line-height: 1;
  letter-spacing: 0.06em;
  text-shadow: 0 0 30px rgba(92, 233, 255, 0.28);
}

.chairman-welcome-name {
  margin: 24px 0 10px;
  color: #ffe6a3;
  font-size: clamp(24px, 4.5vw, 38px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.chairman-welcome-message {
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: 16px;
}

.chairman-welcome-card .primary-action {
  min-width: 180px;
}

@keyframes chairman-card-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chairman-sparkle {
  from {
    opacity: 0.45;
    transform: scale(0.85) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1.1) rotate(8deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chairman-welcome-card,
  .chairman-welcome-glow {
    animation: none;
  }
}

@media print {
  .site-header,
  .admin-toolbar,
  .admin-card:not(#credential-card),
  .credential-heading button {
    display: none !important;
  }

  body,
  #credential-card {
    color: #000;
    background: #fff;
    box-shadow: none;
  }

  .credential-item {
    color: #000;
    border-color: #777;
    break-inside: avoid;
  }

  .credential-item code {
    color: #000;
  }
}

@media (max-width: 820px) {
  .create-class-grid {
    grid-template-columns: 1fr;
  }

  .account-grid,
  .teacher-grid,
  .first-login-grid,
  .teacher-password-grid,
  .teacher-access-editor {
    grid-template-columns: 1fr;
  }

  .teacher-email-editor {
    grid-template-columns: 1fr;
  }

  .teacher-grid .primary-action {
    grid-column: auto;
  }

  .credential-heading,
  .class-item,
  .teacher-item {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .teacher-summary-row {
    align-items: flex-start;
  }
}
