:root {
  --bg: #07111f;
  --panel: rgba(11, 22, 38, 0.88);
  --panel-2: rgba(17, 30, 51, 0.95);
  --card: rgba(15, 24, 40, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(79, 209, 255, 0.28);
  --text: #f5f7fb;
  --muted: #9aa8bf;
  --cyan: #44d9ff;
  --cyan-2: #22b8ff;
  --violet: #7c5cff;
  --success: #33d17a;
  --warning: #ffb84d;
  --danger: #ff6b81;
  --danger-2: #ff4d67;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(68, 217, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(124, 92, 255, 0.12), transparent 26%),
    linear-gradient(180deg, #06101b 0%, #07111f 50%, #050c16 100%);
  color: var(--text);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(154, 168, 191, 0.7);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(68, 217, 255, 0.08);
}

textarea {
  resize: vertical;
}

.main-content {
  padding: 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
}

.page-description {
  margin: 14px 0 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.75;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 0.25s ease;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  color: #04101d;
  box-shadow: 0 12px 35px rgba(34, 184, 255, 0.22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: rgba(255, 107, 129, 0.12);
  color: #ffb8c5;
  border-color: rgba(255, 107, 129, 0.28);
}

.btn-danger:hover {
  background: rgba(255, 107, 129, 0.18);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-top-width: 2px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.stats-grid .stat-card:nth-child(1) { border-top-color: var(--cyan); }
.stats-grid .stat-card:nth-child(2) { border-top-color: var(--success); }
.stats-grid .stat-card:nth-child(3) { border-top-color: var(--danger); }
.stats-grid .stat-card:nth-child(4) { border-top-color: var(--warning); }

.stats-grid .stat-card:nth-child(1) .stat-value { color: var(--cyan); }
.stats-grid .stat-card:nth-child(2) .stat-value { color: var(--success); }
.stats-grid .stat-card:nth-child(3) .stat-value { color: var(--danger); }
.stats-grid .stat-card:nth-child(4) .stat-value { color: var(--warning); }

.stat-label {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) auto;
  gap: 16px;
  margin-bottom: 22px;
  align-items: center;
}

.search-box input {
  min-width: 0;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-actions select,
.toolbar-actions button {
  min-width: 180px;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

.panel-label {
  margin: 0 0 10px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

.section-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.admin-table thead th {
  text-align: left;
  padding: 16px 18px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
}

.admin-table tbody td {
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: background 0.15s ease;
}

.admin-table tbody tr:hover {
  background: rgba(68, 217, 255, 0.04);
}

.admin-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--cyan);
}

.table-loading {
  text-align: center;
  color: var(--muted);
  padding: 34px !important;
}

.student-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.student-main strong {
  font-size: 1rem;
  font-weight: 700;
}

.student-main small {
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--active {
  background: rgba(51, 209, 122, 0.12);
  color: #8df3b8;
  border: 1px solid rgba(51, 209, 122, 0.2);
}

.badge--active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #33d17a;
  box-shadow: 0 0 6px rgba(51, 209, 122, 0.7);
  flex-shrink: 0;
}

.badge--inactive {
  background: rgba(255, 107, 129, 0.12);
  color: #ffb2c0;
  border: 1px solid rgba(255, 107, 129, 0.2);
}

.badge--inactive::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff6b81;
  flex-shrink: 0;
}

.badge--none {
  background: rgba(255, 184, 77, 0.12);
  color: #ffd38c;
  border: 1px solid rgba(255, 184, 77, 0.2);
}

.badge--none::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffb84d;
  flex-shrink: 0;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.btn-small.btn-danger {
  background: rgba(255, 107, 129, 0.12);
  border-color: rgba(255, 107, 129, 0.25);
  color: #ffb2c0;
}

.btn-small.btn-danger:hover {
  background: rgba(255, 107, 129, 0.18);
}

.empty-state {
  margin-top: 18px;
  padding: 28px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.hidden {
  display: none !important;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 15, 0.72);
  backdrop-filter: blur(8px);
}

.modal__panel {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, rgba(68, 217, 255, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(17, 30, 51, 0.98) 0%, rgba(10, 18, 31, 0.99) 100%);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  padding: 24px;
}

.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.modal__head h2 {
  margin: 0;
  font-size: 1.4rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.field--full {
  grid-column: 1 / -1;
}

.form-message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 600;
}

.form-message.info,
.form-message.success {
  background: rgba(51, 209, 122, 0.12);
  color: #8df3b8;
  border: 1px solid rgba(51, 209, 122, 0.2);
}

.form-message.error {
  background: rgba(255, 107, 129, 0.12);
  color: #ffb2c0;
  border: 1px solid rgba(255, 107, 129, 0.2);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1400;
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(10, 18, 31, 0.96);
  color: var(--text);
  border: 1px solid rgba(68, 217, 255, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.24s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .main-content {
    padding: 20px;
  }

  .page-header,
  .section-head,
  .modal__head {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal__actions,
  .header-actions,
  .toolbar-actions,
  .row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-table {
    min-width: 760px;
  }
}

@media (max-width: 620px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 12px;
  }

  .modal__panel {
    width: 100%;
    padding: 18px;
    border-radius: 18px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}