/* ── Top bar ───────────────────────────────── */
.topbar {
  background: var(--brand);
  color: #fff;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 4px solid var(--gold);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand img { height: 40px; width: 40px; object-fit: contain; filter: brightness(0) invert(1); }
.topbar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-brand-text .school { font-size: 0.7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.topbar-brand-text .page-title { font-size: 1.05rem; font-weight: 700; }
.topbar-right { display: flex; gap: 12px; align-items: center; }

.btn-light {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  padding: 8px 18px;
  font-size: 0.85rem;
}

/* ── Body layout ───────────────────────────── */
.page { padding: 28px 32px; }
@media(max-width:640px) { .page { padding: 16px; } .topbar { padding: 0 16px; } }

/* ── Stats row ─────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
}
.stat-card .num  { font-size: 2rem; font-weight: 700; color: var(--brand); line-height: 1; }
.stat-card .lbl  { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

/* ── Toolbar ───────────────────────────────── */
.toolbar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap input {
  padding-left: 38px;
}
.search-wrap .icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted); font-size: 1rem; pointer-events: none;
}

/* ── Table ─────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 8px rgba(0,0,0,.07);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f7f9fc; }
tbody td { padding: 12px 16px; font-size: 0.88rem; vertical-align: middle; }
.no-data { text-align: center; padding: 48px; color: var(--muted); }

.badge-count {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  padding: 1px 8px;
  color: var(--muted);
}

/* ── Detail modal ──────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 640px; width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.modal-header {
  position: sticky; top: 0;
  background: var(--brand);
  color: #fff;
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
  background: rgba(255,255,255,.2);
  border: none; color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer; font-size: 1rem; line-height: 1;
}
.modal-body { padding: 24px; }
.modal-section { margin-bottom: 20px; }
.modal-section h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.modal-row {
  display: flex; gap: 8px;
  font-size: 0.88rem; margin-bottom: 6px;
}
.modal-row .k { font-weight: 600; min-width: 130px; color: var(--brand); }
.modal-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Login overlay ─────────────────────────── */
.login-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.login-overlay.hidden { display: none; }
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 32px rgba(0,0,0,.14);
  width: 100%; max-width: 400px;
  padding: 40px 36px;
  text-align: center;
}
.login-card img { width: 80px; height: 80px; object-fit: contain; margin-bottom: 12px; }
.login-card .school-name {
  font-size: 0.8rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px;
}
.login-card h2 { font-size: 1.3rem; color: var(--brand); margin-bottom: 8px; }
.login-card .login-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 28px; }
.login-divider {
  width: 40px; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
  border-radius: 2px; margin: 0 auto 28px;
}
.login-field { margin-bottom: 16px; text-align: left; }
.login-field label { display: block; font-size: 0.83rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.login-error { color: var(--danger); font-size: 0.83rem; margin-bottom: 14px; min-height: 18px; }

.btn-login {
  width: 100%; padding: 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: opacity .2s;
}
.btn-login:hover { opacity: .88; }
.btn-login:disabled { opacity: .55; cursor: not-allowed; }

/* ── Edit form fields ──────────────────────── */
.edit-field { margin-bottom: 14px; }
.edit-field label { display: block; font-size: 0.83rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.edit-field input, .edit-field select, .edit-field textarea {
  font-size: 0.88rem;
}
.row-2-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Empty state ───────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; }
.empty-state .icon { font-size: 3rem; color: var(--border); margin-bottom: 12px; }
.empty-state p { color: var(--muted); font-size: 0.95rem; }
.empty-state a { color: var(--accent); text-decoration: none; font-weight: 600; }
