:root {
  --st-bg: #f4f6fb;
  --st-surface: #ffffff;
  --st-border: #e4e8f1;
  --st-text: #1c2333;
  --st-text-muted: #6b7488;
  --st-primary: #0f766e;
  --st-primary-dark: #0c5d56;
  --st-radius: 12px;
  --st-sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--st-bg);
  color: var(--st-text);
}

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

/* ── auth page (matches the user portal's sign-in design) ─────── */

:root {
  --navy: #07105f;
  --navy-mid: #091580;
  --navy-light: #1f3fb7;
  --gold: #ffcc00;
  --gold-soft: #fff0a0;
  --white: #ffffff;
  --muted: #5a6882;
  --border-soft: rgba(9, 21, 128, 0.10);
  --success: #15803d;
  --success-bg: #dcfce7;
  --info: #0369a1;
  --info-bg: #e0f2fe;
  --danger-bg: #fee2e2;
}

body.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--navy);
  overflow-x: hidden;
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
body.auth-page::before {
  content: "";
  position: fixed; inset: 0; z-index: 0;
  background: url('/up-images/background.png') no-repeat center center / cover;
  filter: blur(5px) saturate(0.75) brightness(0.7);
  transform: scale(1.06);
}
body.auth-page::after {
  content: "";
  position: fixed; inset: 0; z-index: 1;
  background: linear-gradient(160deg, rgba(7,16,95,.82) 0%, rgba(9,21,128,.70) 45%, rgba(20,40,160,.60) 100%);
}

.auth-shell {
  position: relative; z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 44px;
  width: 100%;
}

.auth-card {
  background: rgba(255,255,255,.97);
  border-radius: 22px;
  box-shadow: 0 32px 80px rgba(5,12,60,.50), 0 0 0 1px rgba(255,255,255,.18), inset 0 1px 0 rgba(255,255,255,.9);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  animation: cardRise .45s cubic-bezier(.22,1,.36,1) both;
}
@keyframes cardRise {
  from { opacity: 0; transform: translateY(28px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1836c8 60%, #2545d8 100%);
  padding: 32px 36px 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom: 4px solid var(--gold);
}
.auth-hero::before {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.05); top: -80px; right: -60px; pointer-events: none;
}
.auth-hero::after {
  content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,204,0,.07); bottom: -50px; left: -30px; pointer-events: none;
}

.auth-logo-ring {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 8px rgba(255,204,0,.18), 0 12px 32px rgba(5,12,60,.45);
  overflow: hidden;
  margin: 0 auto 16px;
  animation: logoPop .55s .25s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes logoPop {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: scale(1); }
}
.auth-logo-ring img { width: 78%; height: 78%; object-fit: contain; }
.auth-logo-ring .logo-fallback { font-size: 2rem; color: var(--navy); }

.auth-school-full {
  position: relative; z-index: 1;
  font-size: .82rem; color: rgba(255,255,255,.78);
  letter-spacing: .05em; text-transform: uppercase; font-weight: 600;
  margin-bottom: 6px;
}
.auth-portal-badge {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,204,0,.18);
  border: 1px solid rgba(255,204,0,.4);
  color: var(--gold-soft);
  font-size: .76rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 4px 14px; border-radius: 99px; margin-top: 8px;
}
.auth-portal-badge i { font-size: .7rem; }

.auth-body { padding: 30px 36px 28px; }
.auth-body .auth-title { font-size: 1.25rem; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.auth-body .auth-subtitle { font-size: .85rem; color: var(--muted); margin-bottom: 22px; }
.auth-body .switch-link { margin-top: 18px; font-size: .875rem; color: var(--muted); text-align: center; }
.auth-body .switch-link a { font-weight: 700; color: var(--navy-light); }

.form-grid { display: grid; gap: 14px; }
.field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: .875rem; font-weight: 600; color: var(--st-text);
}
.field input {
  padding: 10px 13px;
  border: 1.5px solid var(--border-soft);
  border-radius: 6px;
  background: var(--st-bg);
  color: var(--st-text);
  font-size: .9rem;
  outline: none;
  width: 100%;
  transition: border-color .22s ease, box-shadow .22s ease;
}
.field input:focus { border-color: var(--navy-light); box-shadow: 0 0 0 3px rgba(31,63,183,.12); background: var(--white); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 6px; font-size: .9rem; font-weight: 700;
  cursor: pointer; border: none; line-height: 1; text-decoration: none;
  transition: background .22s ease, transform .22s ease, box-shadow .22s ease;
}
.btn-primary { background: var(--navy-mid); color: var(--white); width: 100%; padding: 12px; font-size: .95rem; margin-top: 6px; }
.btn-primary:hover { background: var(--navy-light); box-shadow: 0 2px 8px rgba(5,12,60,.08); transform: translateY(-1px); }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 15px; border-radius: 6px; font-size: .875rem; margin-bottom: 16px; }
.alert-error { background: var(--danger-bg); color: #dc2626; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert i { margin-top: 1px; flex-shrink: 0; }

@media (max-width: 480px) {
  .auth-body { padding: 24px 24px 22px; }
  .auth-hero { padding: 26px 24px 22px; }
  .auth-logo-ring { width: 72px; height: 72px; }
}

/* ── forms (dashboard pages) ──────────────────────────────────── */

.st-form { display: flex; flex-direction: column; gap: 16px; }
.st-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--st-text-muted); }
.st-field input, .st-field select {
  font: inherit;
  font-weight: 400;
  color: var(--st-text);
  padding: 10px 12px;
  border: 1px solid var(--st-border);
  border-radius: 9px;
  background: #fbfcfe;
}
.st-field input:focus, .st-field select:focus {
  outline: none;
  border-color: var(--st-primary);
  background: #fff;
}

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
}
.st-btn-primary { background: var(--st-primary); color: #fff; }
.st-btn-primary:hover { background: var(--st-primary-dark); }
.st-btn-secondary { background: #eef0f7; color: var(--st-text); }
.st-btn-secondary:hover { background: #e3e6f2; }

.st-link-btn {
  background: none;
  border: none;
  color: var(--st-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
}

.st-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 16px;
}
.st-alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.st-alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── app shell ──────────────────────────────────────────────── */

.st-app { display: flex; min-height: 100vh; }

.st-sidebar {
  width: var(--st-sidebar-w);
  flex-shrink: 0;
  background: #0c2321;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.st-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 24px; }
.st-sidebar-brand img { width: 34px; height: 34px; object-fit: contain; }
.st-brand-fallback { font-size: 22px; color: #ffcc00; }
.st-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.st-brand-title { font-weight: 800; font-size: 15px; }
.st-brand-sub { font-size: 11px; opacity: 0.65; }

.st-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.st-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 9px;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  font-weight: 600;
}
.st-nav-link i { width: 18px; text-align: center; }
.st-nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.st-nav-link.active { background: #0f766e; color: #fff; }

.st-sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 14px; }
.st-staff-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: 0.85; padding: 0 12px 10px; }
.st-logout-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.75); }
.st-logout-link:hover { background: rgba(255,255,255,0.06); color: #fff; }

.st-main { flex: 1; padding: 26px 32px 40px; max-width: 100%; overflow-x: hidden; }

.st-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.st-topbar h1 { margin: 0; font-size: 22px; }

/* ── cards / stats / tables ─────────────────────────────────── */

.st-card { background: var(--st-surface); border: 1px solid var(--st-border); border-radius: var(--st-radius); padding: 20px; margin-bottom: 20px; }
.st-card-title { font-weight: 700; font-size: 15px; margin-bottom: 14px; }

.st-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.st-stat-card { background: var(--st-surface); border: 1px solid var(--st-border); border-radius: var(--st-radius); padding: 18px; display: flex; align-items: center; gap: 14px; }
.st-stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.st-stat-body { display: flex; flex-direction: column; }
.st-stat-value { font-size: 22px; font-weight: 800; }
.st-stat-label { font-size: 12px; color: var(--st-text-muted); }

.st-chart-wrap { max-height: 260px; }

.st-table-scroll { overflow-x: auto; }
.st-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.st-table th, .st-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--st-border); white-space: nowrap; }
.st-table th { color: var(--st-text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.st-empty-row { text-align: center; color: var(--st-text-muted); padding: 24px; }

.st-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: capitalize; }
.st-badge-admin { background: #ede9fe; color: #6d28d9; }
.st-badge-staff { background: #fef3c7; color: #b45309; }
.st-badge-student { background: #dbeafe; color: #1d4ed8; }
.st-badge-online { background: #dcfce7; color: #16a34a; }
.st-badge-offline { background: #fee2e2; color: #dc2626; }

.st-search-row, .st-filter-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.st-search-input { flex: 1; min-width: 220px; padding: 10px 12px; border: 1px solid var(--st-border); border-radius: 9px; font: inherit; }

@media (max-width: 760px) {
  .st-sidebar { position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%); transition: transform .2s; }
  .st-main { padding: 20px; }
}
