:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --danger: #ef4444;
  --danger-dark: #dc2626;

  --bg: #eef2f7;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe3ee;

  --radius: 10px;

  --shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
  --shadow-hover: 0 12px 28px rgba(15, 23, 42, 0.11);
}

* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* LOGIN */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

/* FORMS */

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #ffffff;
  color: var(--text);
}

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

/* BUTTONS */

button,
.btn {
  width: 100%;
  margin-top: 18px;
  padding: 11px 15px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  transition: 0.18s ease;
}

button:hover,
.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button:disabled,
.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-small {
  width: auto;
  margin: 0;
  padding: 9px 14px;
  font-size: 13px;
}

.btn-danger {
  background: var(--danger);
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.18);
}

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

#loginMessage {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
}

/* APP SHELL + SIDEBAR */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
  background: var(--bg);
}

.sidebar {
  background: #0f172a;
  color: #ffffff;
  padding: 18px 14px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
}

.brand h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.brand span {
  font-size: 12px;
  color: #94a3b8;
}

.side-nav {
  display: grid;
  gap: 3px;
  margin-top: 10px;
}

.nav-item {
  width: 100%;
  margin: 0;
  padding: 11px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  box-shadow: none;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}

.nav-item:hover {
  background: rgba(37, 99, 235, 0.22);
  color: #ffffff;
}

.nav-item.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

/* DASHBOARD */

.dashboard {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0;
  font-size: 25px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.topbar button {
  width: auto;
  margin: 0;
  padding: 10px 16px;
  background: var(--danger);
}

.topbar button:hover {
  background: var(--danger-dark);
}

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

.dash-card {
  border-radius: 9px;
  padding: 12px 13px;
  min-height: 82px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.045);
}

.dash-card:nth-child(1) {
  background: linear-gradient(135deg, #ffffff, #eff6ff);
}

.dash-card:nth-child(2) {
  background: linear-gradient(135deg, #ffffff, #ecfdf5);
}

.dash-card:nth-child(3) {
  background: linear-gradient(135deg, #ffffff, #fff7ed);
}

.dash-card:nth-child(4) {
  background: linear-gradient(135deg, #ffffff, #f5f3ff);
}

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.card-icon {
  display: none;
}

.card-label {
  font-size: 10.5px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

.card-number {
  font-size: 22px;
  font-weight: 850;
  color: #0f172a;
}

.card-meta {
  margin-top: 5px;
  font-size: 12px;
  color: #64748b;
}

.dashboard-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

/* CARDS + TABLES */

.section-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.section-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 17px;
}

.section-card p {
  margin: 10px 0;
  color: #475569;
  font-size: 14px;
}

.action-btn {
  width: 100%;
  margin-top: 10px;
  text-align: left;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}

.action-btn:hover {
  background: #eff6ff;
  color: #2563eb;
  transform: none;
}

.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 900;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  text-transform: uppercase;
}

tr:hover td {
  background: #f8fafc;
}

.table-btn {
  width: auto;
  margin: 0 4px 0 0;
  padding: 6px 10px;
  font-size: 12px;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}

.table-btn:hover {
  background: #eff6ff;
  color: #2563eb;
  transform: none;
}

/* TOOLBAR */

.module-toolbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.module-toolbar h3 {
  margin: 0;
  font-size: 18px;
}

.module-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.student-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.student-controls input {
  width: 220px;
}

.student-controls select {
  width: 90px;
}

.pagination {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.pagination span {
  font-size: 13px;
  color: #64748b;
}

/* FORMS */

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

.form-section-title {
  margin: 24px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 900;
  color: #334155;
  text-transform: uppercase;
}

.photo-box {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 18px;
  align-items: center;
}

.photo-preview {
  width: 110px;
  height: 145px;
  border-radius: 8px;
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 12px;
  text-align: center;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

/* STUDENT PROFILE */

.student-profile {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}

.profile-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  height: fit-content;
}

.profile-photo {
  width: 130px;
  height: 160px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  margin: auto;
  margin-bottom: 20px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 12px;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform .2s ease;
}

.profile-photo img:hover {
  transform: scale(1.03);
}

/* PHOTO VIEWER */

.photo-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 30px;
}

.photo-viewer-box {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.photo-viewer-box img {
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.photo-viewer-close {
  position: absolute;
  top: -45px;
  right: 0;
  width: auto;
  margin: 0;
  padding: 8px 14px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
}