:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --page: #f6f7fb;
  /* Solid page background fixes the "column" */
  --card-bg: #ffffff;
  --radius: 16px;
  --transition: 0.25s ease;
}

/* Reset & base */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;
  /* centers the card */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);
  /* solid white, no frosted blur */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field {
  position: relative;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover {
  color: var(--primary);
}

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--primary-dark);
}

.btn:active {
  transform: translateY(1px);
}

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error {
  color: #d52731;
}

.success {
  color: #269f53;
}

/* ---------- Logout button ---------- */
/* Tiny logout icon (top-left of the page) */
.logout-icon {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 1000;
}

.logout-icon i {
  font-size: 14px;
  /* slightly larger than before */
  line-height: 1;
}

.logout-icon:hover {
  background: var(--primary-dark);
}

.logout-icon:active {
  transform: translateY(1px);
}



/* ---------- Add Person FAB (bottom-left) ---------- */
.fab-addperson {
  position: fixed;
  bottom: 14px;
  left: 12px;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.18);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 1000;
  /* above page content */
}

.fab-addperson i {
  font-size: 18px;
  line-height: 1;
}

.fab-addperson:hover {
  background: var(--primary-dark);
}

.fab-addperson:active {
  transform: translateY(1px);
}

/* ---------- Modal (popup) ---------- */
.modal-overlay {
  display: none;
  /* hidden by default */
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1100;
  /* above FAB and logout icon */
  place-items: center;
  /* use with display:grid when open */
}

.modal-overlay.show {
  display: grid;
}

.modal {
  width: min(520px, 92vw);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.18);
  animation: modal-in 0.18s ease both;
  overflow: hidden;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #eef2f7;
}

.modal-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  margin: 0;
}

.modal-header h2 i {
  font-size: 18px;
}

.modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #6b7280;
  font-size: 20px;
  line-height: 1;
  padding: 6px;
  border-radius: 10px;
}

.modal-close:hover {
  color: #111827;
  background: #f3f4f6;
}

.modal-body {
  padding: 18px;
  color: #374151;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid #eef2f7;
}

/* Buttons inside modal */
.modal-footer .btn {
  width: auto;
  /* override global .btn full width */
  padding: 10px 16px;
  border-radius: 10px;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d1d5db;
}


/* ---------- Form + Suggestions in Modal ---------- */
.form-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.form-row label {
  font-size: 0.92rem;
  color: #374151;
}

.input {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  font-size: 0.98rem;
  background: #fff;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* suggestion dropdown (IMPROVED) */
.suggest-box {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  z-index: 1300;
  /* sits above the next input */
  background: #ffffff;
  /* solid background: no see-through */
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.18);
  overflow: hidden;
  /* clip rounded corners */
  max-height: 280px;
  /* scroll if there are many results */
  overflow-y: auto;
  pointer-events: auto;
}

.suggest-box.open {
  display: block;
}

.suggest-item,
.suggest-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  font-size: 0.95rem;
  border: 0;
  /* remove per-row borders */
  background: transparent;
  /* parent provides the white bg */
  cursor: pointer;
}

.suggest-item+.suggest-item {
  border-top: 1px solid #f0f2f6;
  /* subtle separators */
}

.suggest-item .left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.suggest-item .right small {
  color: #6b7280;
  white-space: nowrap;
}

.suggest-item:hover,
.suggest-item:focus-visible {
  background: #eff6ff;
  /* clearer hover highlight */
}

.suggest-item:active {
  background: #dbeafe;
  /* pressed state */
}

.suggest-empty {
  color: #6b7280;
  cursor: default;
}

/* ---------- FAB Menu (bottom-right) ---------- */
.fab-menu-btn {
  position: fixed;
  bottom: 14px;
  right: 12px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.18);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 2000;
  /* ↑ keep FAB above any overlay */
}

.fab-menu-btn i {
  font-size: 18px;
  line-height: 1;
}

.fab-menu-btn:hover {
  background: var(--primary-dark);
}

.fab-menu-btn:active {
  transform: translateY(1px);
}

/* click-outside overlay */
.fab-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
  /* no blocking when hidden */
  z-index: 1300;
  /* below popover, below FAB */
}

.fab-menu-overlay.show {
  display: block;
  pointer-events: auto;
  /* catches outside clicks only when open */
}


/* popover menu */
.fab-menu-popover {
  position: fixed;
  bottom: 74px;
  right: 12px;
  width: min(260px, 86vw);
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.18);
  transform-origin: bottom right;
  transform: translateY(6px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
  z-index: 1400;
  /* above overlay, below FAB */
}

.fab-menu-popover.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.fab-menu-header {
  padding: 10px 12px 6px;
  font-size: 0.88rem;
  color: #6b7280;
  border-bottom: 1px solid #f2f4f8;
}

.fab-menu-list {
  list-style: none;
  margin: 0;
  padding: 8px;
}

.fab-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  font-size: 0.96rem;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
}

.fab-menu-item .left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111827;
}

.fab-menu-item .right {
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
}

.fab-menu-item i {
  line-height: 1;
}

.fab-menu-item:hover,
.fab-menu-item:focus-visible {
  background: #eff6ff;
}

.fab-menu-item:active {
  background: #dbeafe;
}


/* ---------- Larger modal + two-column form grid ---------- */
.modal.modal-lg {
  width: min(860px, 96vw);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row.full {
  grid-column: 1 / -1;
}

@media (max-width: 680px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}


/* ----- Better modal layout ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  /* toggled by .show */
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* breathing room around dialog */
  background: rgba(17, 24, 39, .48);
  /* dim backdrop */
  backdrop-filter: blur(2px);
  z-index: 9999;
}

.modal-overlay.show {
  display: flex;
}

.modal.modal-lg {
  width: min(980px, 96vw);
  max-height: calc(100vh - 48px);
  /* never exceed viewport */
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, .08),
    0 6px 6px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  /* header / body / footer */
  overflow: hidden;
  /* clip rounded corners */
}

/* sticky header/footer, scrollable body */
.modal-header,
.modal-footer {
  position: sticky;
  background: #fff;
  z-index: 2;
}

.modal-header {
  top: 0;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.modal-footer {
  bottom: 0;
  border-top: 1px solid rgba(0, 0, 0, .08);
}

.modal-header {
  padding: 14px 18px;
}

.modal-body {
  padding: 16px 18px 96px;
  overflow: auto;
}

.modal-footer {
  padding: 12px 18px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
}

/* subtle fade at bottom of scroll area to hint more content */


/* two-column grid, collapses on small screens */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-row.full {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .modal.modal-lg {
    width: 96vw;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* inputs + labels */
.form-row label {
  display: block;
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}

.input:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, .15);
}

/* buttons */
.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
}

.btn.btn-secondary {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.btn:not(.btn-secondary) {
  background: #111827;
  color: #fff;
}

/* make suggestion box behave inside modal */
.form-row {
  position: relative;
}

.suggest-box {
  position: absolute;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  z-index: 3;
  /* above inputs, below header */
}

.suggest-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  width: 100%;
}

.suggest-item:hover {
  background: #f9fafb;
}

/* prevent page behind the modal from scrolling */
body.no-scroll {
  overflow: hidden;
}


/* === Aesthetic upgrade pack =========================================== */
:root {
  --brand-1: #4f46e5;
  /* indigo-600 */
  --brand-2: #06b6d4;
  /* cyan-500  */
  --ink-1: #0f172a;
  /* slate-900 */
  --muted: #6b7280;
  /* gray-500  */
}

/* Gradient header + airy footer */
.modal-header {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff;
  border-bottom: none;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .15);
}

.modal-header h2 {
  color: #fff;
  letter-spacing: .2px;
}

.modal-header h2 i {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}

.modal-close {
  color: rgba(255, 255, 255, .92);
}

.modal-close:hover {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.modal-footer {
  backdrop-filter: blur(4px);
  background: linear-gradient(to bottom, rgba(255, 255, 255, .8), #fff);
  box-shadow: 0 -6px 16px rgba(0, 0, 0, .06);
}

/* Put Clear at bottom-left; others stay on the right */
.modal-footer #clearPersonBtn {
  margin-right: auto;
}


/* Primary button: soft gradient + subtle lift */
.modal-footer .btn:not(.btn-secondary) {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  border: none;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .26);
  font-weight: 700;
}

.modal-footer .btn:not(.btn-secondary):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.modal-footer .btn:not(.btn-secondary):active {
  transform: translateY(0);
}

/* Section titles (dividers) */
.section-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .92rem;
  font-weight: 700;
  color: var(--ink-1);
  margin: 2px 0 2px;
  position: relative;
}

.section-title i {
  color: var(--brand-1);
}

.section-title:after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(to right, rgba(2, 6, 23, .12), rgba(2, 6, 23, 0));
}

/* Carded rows (optional – soft contrast) */
.form-row {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 10px 12px;
}

.form-row.full {
  padding: 10px 12px;
}

.form-row label {
  margin-bottom: 4px;
  color: #334155;
}

/* Inputs */
.input {
  background: #f9fafb;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.input:hover {
  background: #fff;
}

.input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, .18);
}

/* Textarea look */
.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.35;
}

/* Prefix icons for certain rows */
.with-prefix {
  position: relative;
}

.with-prefix .prefix {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-2px);
  color: #9ca3af;
  pointer-events: none;
}

.with-prefix .input {
  padding-left: 36px;
}

/* Hint text (optional small helper) */
.form-hint {
  font-size: .78rem;
  color: #6b7280;
  margin-top: 6px;
}

/* Polished scrollbar in the modal body (only) */
.modal-body::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 20px;
  border: 3px solid #fff;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

/* === Main app list === */
body.authed { display:block; place-items: initial; }

.app-shell { width:min(1200px, 96vw); margin: 28px auto; }

.app-bar {
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; margin-bottom:12px;
}
.app-bar h1 { font-size:1.25rem; margin:0; }
.app-bar .actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;            /* allow wrapping instead of squishing */
}

/* Cap lớp dropdown sizing (keep it compact like the search box) */
#caplopFilter.caplop-select{
  width: 260px;       /* desktop width */
  flex: 0 0 260px;    /* don't let flex stretch it */
}

/* On small screens let it grow to full row width */
@media (max-width: 720px){
  #caplopFilter.caplop-select{
    width: 100%;
    flex: 1 1 100%;
  }
}


.input.search { width: 320px; }

.table-wrap {
  background:#fff; border:1px solid #eef2f7; border-radius:12px;
  overflow:auto; box-shadow:0 8px 24px rgba(0,0,0,.06);
}
.table { width:100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding:10px 12px; border-bottom:1px solid #f0f2f6; text-align:left; white-space:nowrap; }
.table thead th { background:#f8fafc; font-weight:700; position:sticky; top:0; z-index:1; }
.table tbody tr:hover { background:#fafafa; }

.pager {
  display:flex; align-items:center; gap:10px; justify-content:flex-end;
  margin-top:10px;
}

/* Make sure modal body never hides the bottom rows */
.modal-body { padding-bottom: 96px; }


/* ---------- Nicer list styles ---------- */
.app-shell { max-width: 1200px; margin: 40px auto; padding: 0 16px; }
.app-bar{
  display:flex;
  align-items:center;
  justify-content:flex-start; /* align filters to the left */
  gap:12px;
  margin-bottom:12px;
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:8px;
}

.input.search {
  height: 42px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0 14px;
  background: #fff;
}

.table-wrap {
  background:#fff;
  border-radius:16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.07);
  padding: 8px;
}

.table {
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size:14px;
}

.table th, .table td { padding:12px 14px; }
.table thead th {
  position: sticky;
  top: 0;
  background:#f8fafc;
  border-bottom: 1px solid #e5e7eb;
  font-weight:600;
}

.table tbody tr:nth-child(odd) { background:#fcfdff; }
.table tbody tr:hover { background:#f1f5f9; }

.btn { border-radius: 12px; }
.btn.btn-secondary { background:#eef2ff; color:#1f2937; }


/* --- Cards layout for students --- */
.cards{
  display:grid;
  grid-template-columns: 1fr;  /* one big card per line */
  gap:16px;
  margin-top:12px;
}

.card-student{
  background:#fff;
  border-radius:14px;
  padding:16px 16px 12px;
  box-shadow:0 1px 2px rgba(0,0,0,.05),0 8px 24px rgba(0,0,0,.06);
}

.cs-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:10px;
}
.cs-name{ font-weight:600; font-size:1.05rem; }
.cs-email{ color:#6b7280; font-size:.9rem; }

.cs-badges{ display:flex; gap:6px; flex-wrap:wrap; }
.badge{
  display:inline-block; padding:3px 8px; border-radius:999px;
  background:#111827; color:#fff; font-size:.75rem; line-height:1.2;
}
.badge.muted{ background:#e5e7eb; color:#111827; }

.cs-grid{ display:grid; grid-template-columns:1fr; gap:12px; }
.cs-grid section{
  background:#f8fafc;
  border:1px solid #eef2f7;
  border-radius:12px;
  padding:12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.cs-grid h4{ font-size:.85rem; font-weight:600; color:#374151; margin:0 0 6px 0; }

.kv{ display:flex; gap:12px; padding:4px 0; }
.kv .k{ width:160px; color:#6b7280; }
.kv .v{ flex:1; color:#111827; white-space:pre-wrap; word-break:break-word; }

@media (min-width: 860px){ .cs-grid{ grid-template-columns: 1fr 1fr; } }

.empty{ color:#6b7280; padding:12px; }
.error{ color:#b91c1c; padding:12px; background:#fff; border-radius:12px; }


/* === Readability for key–value rows ===================== */
.cs-grid section .kv{
  padding:8px 12px;
  border:1px solid #eef2f7;
  border-radius:10px;
  transition: background .15s ease, border-color .15s ease;
}
.cs-grid section .kv:nth-of-type(odd){ background:#fcfdff; }
.cs-grid section .kv:nth-of-type(even){ background:#f9fafb; }
.cs-grid section .kv:hover{ background:#eff6ff; border-color:#dbeafe; }

/* stronger labels + softer placeholder for empty values */
.kv .k{ width:200px; color:#334155; font-weight:600; }

.kv .v{ color:#111827; }
.kv .v.empty{ color:#9ca3af; font-style:italic; }

/* accent the left edge by row type (class added by JS) */
.kv.row-status{ border-left:3px solid rgba(245,158,11,.55); }
.kv.row-phone { border-left:3px solid rgba(16,185,129,.55); }
.kv.row-link  { border-left:3px solid rgba(14,165,233,.55); }
.kv.row-meta  { border-left:3px solid rgba(148,163,184,.55); }


/* make section headers more visible */
.cs-grid h4{
  display:flex; align-items:center; gap:8px;
  margin:0 0 10px 0;
  padding:8px 12px;
  font-size:.8rem; font-weight:800; letter-spacing:.4px; text-transform:uppercase;
  color:#0f172a;
  background: linear-gradient(90deg, rgba(79,70,229,.12), rgba(6,182,212,.06));
  border:1px solid #e5e7eb;
  border-radius:10px;
}
.cs-grid h4 i{ opacity:.85; }



/* === Label chips, value pills, and better link styling === */
.kv { align-items: center; gap: 12px; }

/* label chip */
.kv .k.k-chip{
  background:transparent;
  color:#334155;
  font-weight:600;
  padding:0;
  border-radius:0;
}


/* clickable links in values */
.kv .v a{
  color:#0ea5e9;
  font-weight:600;
  text-decoration:none;
  word-break:break-word;
}
.kv .v a:hover{ text-decoration:underline; }

/* value pills */
.kv .pill{
  display:inline; padding:0; border-radius:0; background:transparent;
  font-weight:600; line-height:1.2;
}
.kv .pill-num  { color:#0f766e; border-bottom:2px solid rgba(45,212,191,.25); }
.kv .pill-date { color:#b45309; border-bottom:2px solid rgba(251,191,36,.28); }
.kv .pill-phone{ color:#166534; border-bottom:2px solid rgba(134,239,172,.30); }


/* keep empties visually lighter */
.kv .v .empty{ color:#9ca3af; font-style:italic; }


/* --- Card action buttons (hover reveal) --- */
.card-student { position: relative; overflow: hidden; }

.cs-actions {
  position: absolute;
  left: 12px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.card-student:hover .cs-actions,
.card-student:focus-within .cs-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cs-action {
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  padding: 8px 10px;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(2,6,23,.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .06s ease, background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.cs-action i { font-size: 14px; line-height: 1; }

.cs-action:hover {
  background: #fff;
  box-shadow: 0 10px 22px rgba(2,6,23,.12);
  transform: translateY(-1px);
}
.cs-action:active { transform: translateY(0); }

.cs-action.danger {
  border-color: rgba(220,38,38,.22);
  color: #b91c1c;
  background: rgba(254,242,242,.85);
}
.cs-action.danger:hover {
  background: #fff1f2;
  box-shadow: 0 10px 22px rgba(244,63,94,.20);
}

/* screen-reader-only label helper */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}


/* ===== Global overlay loader ===== */
.gl-overlay {
  position: fixed;
  inset: 0;
  display: none;              /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(17, 24, 39, 0.45); /* slate-900 @45% */
  backdrop-filter: blur(2px);
}
.gl-overlay.show { display: flex; }

.gl-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #fff;
  color: #111827;             /* slate-900 */
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
  font-weight: 500;
}

.gl-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.12);
  border-top-color: currentColor;
  animation: glspin .8s linear infinite;
}
@keyframes glspin {
  to { transform: rotate(360deg); }
}

.gl-text {
  font-size: 15px;
  line-height: 1.2;
}



/* Danger button style (used in confirm modal) */
.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

/* Global loader overlay (matches your JS show/hide) */
.gl-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.gl-overlay.show { display: flex; }

.gl-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  min-width: 260px;
  display: grid; gap: 12px; place-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  font-family: inherit;
}

.gl-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: rgba(0,0,0,0.6);
  border-radius: 50%;
  animation: glspin 0.9s linear infinite;
}
@keyframes glspin { to { transform: rotate(360deg); } }

.gl-text {
  font-size: 14px;
  color: #111827;
}


/* === Skeleton loading for student list === */
.skl {
  display: inline-block;
  border-radius: 8px;
  background: linear-gradient(90deg, #f2f4f8 25%, #e9edf3 37%, #f2f4f8 63%);
  background-size: 400% 100%;
  animation: sklShimmer 1.2s ease-in-out infinite;
}
@keyframes sklShimmer { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }

.skeleton .cs-head .skl-line { height: 14px; }
.skeleton .kv { align-items: center; }
.skl-pill { border-radius: 9999px; height: 22px; display: inline-block; }


/* === Skeleton loading for student list === */
.skl {
  display: inline-block;
  border-radius: 8px;
  background: linear-gradient(90deg, #f2f4f8 25%, #e9edf3 37%, #f2f4f8 63%);
  background-size: 400% 100%;
  animation: sklShimmer 1.2s ease-in-out infinite;
}
@keyframes sklShimmer {
  0% { background-position: 100% 0 }
  100% { background-position: -100% 0 }
}
.skeleton .cs-head .skl-line { height: 14px; }
.skeleton .kv { align-items: center; }
.skl-pill { border-radius: 9999px; height: 22px; display: inline-block; }


/* Toggle Switch Styles */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.toggle-wrapper:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.toggle-wrapper.active {
  background: #eff6ff;
  border-color: #3b82f6;
}

.toggle-label {
  font-size: 0.92rem;
  color: #334155;
  font-weight: 500;
  transition: color 0.2s ease;
}

.toggle-wrapper.active .toggle-label {
  color: #1e40af;
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  transition: background 0.3s ease;
  cursor: pointer;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-wrapper.active .toggle-switch {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.toggle-wrapper.active .toggle-switch::after {
  transform: translateX(20px);
  box-shadow: 0 2px 6px rgba(37,99,235,0.4);
}

.toggle-wrapper input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* === Pretty toggle for "HV sắp thi" === */
/* === Chip-style toggle: HV sắp thi ===================================== */
.switch.switch-chip{
  --on: linear-gradient(135deg, var(--brand-1, #4f46e5), var(--brand-2, #06b6d4));
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border:1px solid #e5e7eb;
  border-radius:9999px;
  background:#fff;
  box-shadow:0 1px 0 rgba(255,255,255,.9) inset;
  transition:background .15s ease, border-color .15s ease, box-shadow .15s ease;
  flex-shrink:0;             /* don't get squished */
  white-space:nowrap;        /* keep label on one line */
  min-width:max-content;     /* natural width */
}
.switch.switch-chip:hover{ background:#f8fafc; border-color:#d1d5db; }
.switch.switch-chip:focus-within{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(13,110,253,.12);
}

.switch.switch-chip input{
  position:absolute;
  opacity:0;
  width:0;
  height:0;
}

.switch.switch-chip .slider{
  position:relative;
  width:44px;
  height:24px;
  border-radius:9999px;
  background:#e5e7eb;
  transition:background .2s ease;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.05);
}
.switch.switch-chip .slider::after{
  content:"";
  position:absolute;
  top:3px; left:3px;
  width:18px; height:18px;
  background:#fff;
  border-radius:9999px;
  box-shadow:0 1px 3px rgba(0,0,0,.2);
  transition:transform .2s ease;
}

.switch.switch-chip input:checked + .slider{
  background:var(--on);
}
.switch.switch-chip input:checked + .slider::after{
  transform:translateX(20px);
}

.switch.switch-chip .switch-label{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:.92rem;
  color:#334155;
  font-weight:500;
}
.switch.switch-chip .switch-label i{ opacity:.9; }
.switch.switch-chip input:checked + .slider + .switch-label{
  color:#0f172a;
  font-weight:600;
}


/* Page heading above the filters */
.page-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin: 8px 0 6px;
}
.page-title{
  margin:0;
  font-size:1.35rem;
  font-weight:800;
  letter-spacing:.2px;
  color:#0f172a;
}


/* === Count badge (results) === */
.count-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 12px;
  border-radius:9999px;
  background: linear-gradient(135deg, var(--brand-1, #4f46e5), var(--brand-2, #06b6d4));
  color:#fff;
  font-weight:700;
  font-size:0.92rem;
  box-shadow:0 4px 12px rgba(0,0,0,.10);
  user-select:none;
  white-space:nowrap;
}
.count-badge i{ opacity:.9; }
.count-badge .count{ font-variant-numeric: tabular-nums; }
