:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-muted: #eef2f7;
  --surface-subtle: #f5f8fb;

  /* Text */
  --ink: #18202b;
  --text-2: #3d4858;
  --muted: #647083;

  /* Lines */
  --line: #dce2ea;
  --line-strong: #c3ccd8;

  /* Brand */
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e7f4f2;
  --on-accent: #ffffff;

  /* Status — blue / green / amber / red, each: base / strong / soft / border / ink */
  --blue: #2563eb;  --blue-strong: #1d4ed8;  --blue-soft: #eaf1ff;  --blue-border: #bfdbfe;  --blue-ink: #1e3a8a;
  --green: #15803d; --green-strong: #166534; --green-soft: #e9f7ef; --green-border: #bbf7d0; --green-ink: #14532d;
  --amber: #b7791f; --amber-strong: #92600f; --amber-soft: #fff5dc; --amber-border: #fcd34d; --amber-ink: #744210;
  --red: #b42318;   --red-strong: #991b1b;   --red-soft: #fff0ef;   --red-soft2: #fee2e2;    --red-border: #fecaca;  --red-ink: #7f1d1d;

  /* Row tints */
  --warn-row: #fffaf0;
  --danger-row: #fff5f5;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(24, 32, 43, 0.05), 0 2px 6px rgba(24, 32, 43, 0.05);
  --shadow: 0 14px 30px rgba(24, 32, 43, 0.09);
  --shadow-md: 0 14px 30px rgba(24, 32, 43, 0.09);
  --shadow-lg: 0 24px 50px rgba(24, 32, 43, 0.14);

  /* Radius */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Motion + focus */
  --speed: 0.16s ease;
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.30);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(246,247,249,0.94) 320px),
    var(--bg);
}

a { color: var(--blue); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { color: var(--blue-strong); }

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; opacity: 0.62; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.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;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 20;
  transform: translateY(-150%);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-accent);
  padding: 0.55rem 0.8rem;
}
.skip-link:focus { transform: translateY(0); }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid rgba(195, 204, 216, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(24, 32, 43, 0.08);
  padding: 0.7rem 0.8rem;
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: max-content;
  color: var(--ink);
  text-decoration: none;
}
.brand strong { display: block; font-size: 0.98rem; line-height: 1.12; }
.brand small { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 0.08rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
}
.brand-mark svg, .nav-toggle svg, .icon { width: 20px; height: 20px; fill: currentColor; }

.nav-toggle {
  display: none;
  justify-self: end;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}
.nav-link {
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1;
  padding: 0.62rem 0.7rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { background: var(--surface-muted); color: var(--ink); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-strong); }

.topbar-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  min-width: 0;
}
.user-pill {
  max-width: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.84rem;
  padding: 0.42rem 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-shell { padding-top: 2rem; }
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.35rem;
}
.page-header h1 {
  margin: 0.12rem 0 0;
  font-size: clamp(1.75rem, 2.5vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}
.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.page-description {
  max-width: 680px;
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}
.page-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: flex-end; }

.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.4rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.align-start { align-items: start; }
.align-end { align-self: end; }
.mt-4 { margin-top: 1.2rem; }
.mt-5 { margin-top: 1.4rem; }
.no-mt { margin-top: 0; }
.max-form { max-width: 720px; }
.auth-wide { width: min(100%, 760px); }
.auth-xl { width: min(100%, 780px); }

.panel, .stat-card, .action-card, .session-card, .auth-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel { padding: 1rem; }
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.panel-header h2, .section-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}
.panel-header p, .section-note {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.stat-card { padding: 1rem; }
.stat-label { margin: 0; color: var(--muted); font-size: 0.84rem; font-weight: 700; text-transform: uppercase; }
.stat-value { margin: 0.25rem 0 0; font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-foot { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.88rem; }

.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }
.action-card {
  display: block;
  padding: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.action-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 16px 30px rgba(24, 32, 43, 0.11);
  color: var(--ink);
  transform: translateY(-1px);
}
.action-card strong { display: block; font-size: 0.98rem; }
.action-card span { display: block; margin-top: 0.28rem; color: var(--muted); font-size: 0.88rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.72rem 0.8rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}
.data-table th {
  background: var(--surface-muted);
  color: var(--text-2);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-subtle); }
.table-compact th, .table-compact td { padding: 0.52rem 0.62rem; font-size: 0.88rem; }
.audit-table td { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.8rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 750;
  padding: 0.56rem 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-secondary { background: var(--blue); }
.btn-secondary:hover { background: var(--blue-strong); }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--surface-muted); color: var(--ink); }
.btn-danger { background: var(--red); color: var(--on-accent); }
.btn-danger:hover { background: var(--red-strong); color: var(--on-accent); }
.btn-soft-danger { border-color: var(--red-border); background: var(--red-soft); color: var(--red); }
.btn-soft-danger:hover { background: var(--red-soft2); color: var(--red); }
.btn-sm { min-height: 34px; padding: 0.42rem 0.62rem; font-size: 0.84rem; }
.btn-link {
  display: inline;
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 650;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.btn-link:hover { background: transparent; color: var(--blue-strong); }

.form-grid { display: grid; gap: 0.85rem; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 0.28rem; }
.field span, .label-text { color: var(--text-2); font-size: 0.88rem; font-weight: 750; }
.field input, .field textarea, .field select, .search-box {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0.62rem 0.72rem;
}
.field textarea, textarea { min-height: 86px; resize: vertical; }
.help-text { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.84rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem; margin-top: 1rem; }
fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0;
  padding: 1rem;
}
legend { color: var(--ink); font-weight: 800; padding: 0 0.35rem; }

.alert {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
}
.alert p { margin: 0; }
.alert-success { border-left-color: var(--green); background: var(--green-soft); color: var(--green-ink); }
.alert-warning { border-left-color: var(--amber); background: var(--amber-soft); color: var(--amber-ink); }
.alert-danger { border-left-color: var(--red); background: var(--red-soft); color: var(--red-ink); }
.alert-info { border-left-color: var(--blue); background: var(--blue-soft); color: var(--blue-ink); }

.badge, .status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
}
.badge-green, .status-approved, .status-open, .risk-low { border-color: var(--green-border); background: var(--green-soft); color: var(--green); }
.badge-blue, .status-pending { border-color: var(--blue-border); background: var(--blue-soft); color: var(--blue-strong); }
.badge-amber, .risk-medium { border-color: var(--amber-border); background: var(--amber-soft); color: var(--amber); }
.badge-red, .status-rejected, .risk-high, .risk-flag { border-color: var(--red-border); background: var(--red-soft); color: var(--red); }
.risk-none { background: var(--surface-muted); color: var(--muted); }

.meta { color: var(--muted); font-size: 0.84rem; }
.muted { color: var(--muted); }
.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}
.inline-form { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 16px;
}
.auth-card {
  width: min(100%, 460px);
  padding: 1.35rem;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}
.auth-brand h1 { margin: 0; font-size: 1.65rem; line-height: 1.08; }
.auth-brand p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
.auth-side-link {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  margin: 1rem 0;
  padding: 0.75rem 0.85rem;
}
.auth-side-link p { margin: 0.28rem 0 0; color: var(--muted); font-size: 0.88rem; }

.login-shell {
  align-items: stretch;
  isolation: isolate;
  overflow: hidden;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.14) 0 22%, transparent 22% 100%),
    linear-gradient(315deg, rgba(20, 184, 166, 0.12) 0 18%, transparent 18% 100%),
    linear-gradient(180deg, var(--accent-soft) 0%, var(--accent-soft) 100%);
}
.login-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(15, 118, 110, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.72), rgba(0,0,0,0.08));
}
.login-experience {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.76fr);
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 64px));
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(10, 95, 89, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 28px 70px rgba(6, 40, 66, 0.16);
  backdrop-filter: blur(18px);
}
.login-visual {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 2rem;
  min-height: 100%;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(5, 45, 69, 0.96), rgba(8, 73, 70, 0.98) 55%, #0f766e),
    var(--accent);
  color: var(--on-accent);
  padding: 3rem;
}
.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.login-visual::before {
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0 52%, rgba(255,255,255,0.08) 52% 62%, transparent 62%),
    linear-gradient(150deg, transparent 0 72%, rgba(244,125,134,0.22) 72% 78%, transparent 78%);
}
.login-visual::after {
  left: -8%;
  right: -8%;
  bottom: 19%;
  height: 1px;
  background: rgba(255,255,255,0.18);
  transform: rotate(-12deg);
}
.login-visual-copy,
.recognition-board,
.login-proof-grid {
  position: relative;
  z-index: 1;
}
.login-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #d9fffb;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  padding: 0.2rem 0.62rem;
  text-transform: uppercase;
}
.login-visual h1 {
  max-width: 560px;
  margin: 1rem 0 0;
  color: var(--on-accent);
  font-size: 3.35rem;
  line-height: 0.98;
  letter-spacing: 0;
}
.login-visual p {
  max-width: 560px;
  margin: 1rem 0 0;
  color: rgba(239, 253, 251, 0.86);
  font-size: 1.08rem;
}
.recognition-board {
  width: min(100%, 520px);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius);
  background: rgba(2, 22, 34, 0.44);
  box-shadow: 0 24px 60px rgba(0,0,0,0.24);
  overflow: hidden;
}
.recognition-toolbar {
  display: flex;
  gap: 0.38rem;
  border-bottom: 1px solid rgba(255,255,255,0.16);
  padding: 0.72rem;
}
.recognition-toolbar span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.38);
}
.recognition-camera {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 280px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 40, 66, 0.25), rgba(0,0,0,0.28));
  background-size: 28px 28px, 28px 28px, auto;
}
.face-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  border: 1px solid rgba(109, 240, 226, 0.44);
}
.face-frame svg {
  width: 126px;
  height: 126px;
  fill: none;
  stroke: rgba(217, 255, 251, 0.8);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}
.corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: #73f4e8;
}
.corner-tl { top: -1px; left: -1px; border-top: 3px solid; border-left: 3px solid; }
.corner-tr { top: -1px; right: -1px; border-top: 3px solid; border-right: 3px solid; }
.corner-bl { bottom: -1px; left: -1px; border-bottom: 3px solid; border-left: 3px solid; }
.corner-br { bottom: -1px; right: -1px; border-bottom: 3px solid; border-right: 3px solid; }
.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #8cffef, transparent);
  box-shadow: 0 0 18px rgba(140, 255, 239, 0.72);
  animation: login-scan 4.2s ease-in-out infinite;
}
@keyframes login-scan {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(176px); opacity: 1; }
}
.recognition-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(255,255,255,0.16);
  padding: 0.9rem 1rem;
}
.recognition-status strong,
.recognition-status span {
  display: block;
}
.recognition-status strong {
  color: var(--on-accent);
  font-size: 0.95rem;
}
.recognition-status span {
  color: rgba(239, 253, 251, 0.72);
  font-size: 0.82rem;
}
.status-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #5eead4;
  box-shadow: 0 0 0 5px rgba(94, 234, 212, 0.16);
}
.login-proof-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}
.login-proof-grid div {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.09);
  padding: 0.72rem;
}
.login-proof-grid strong,
.login-proof-grid span {
  display: block;
}
.login-proof-grid strong {
  color: #9ef5ec;
  font-size: 0.82rem;
}
.login-proof-grid span {
  margin-top: 0.18rem;
  color: rgba(255,255,255,0.88);
  font-size: 0.9rem;
  font-weight: 750;
}
.login-card {
  display: grid;
  align-content: center;
  width: auto;
  min-height: 100%;
  border: 0;
  border-left: 1px solid rgba(10, 95, 89, 0.12);
  border-radius: 0;
  box-shadow: none;
  padding: 3rem;
}
.login-card-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}
.login-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}
.login-card .eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent-strong);
}
.login-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1.05;
}
.login-card-head p:last-child {
  margin: 0.35rem 0 0;
  color: var(--muted);
}
.quick-access-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--accent-soft), var(--accent-soft));
  color: var(--ink);
  margin: 0 0 1rem;
  padding: 0.82rem 0.9rem;
  text-decoration: none;
}
.quick-access-card:hover {
  border-color: rgba(15, 118, 110, 0.38);
  color: var(--ink);
  background: var(--accent-soft);
}
.quick-access-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
}
.quick-access-card svg,
.input-shell svg,
.password-toggle svg,
.login-submit svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.quick-access-card svg {
  width: 21px;
  height: 21px;
}
.quick-access-card strong,
.quick-access-card small {
  display: block;
}
.quick-access-card strong {
  font-size: 0.94rem;
}
.quick-access-card small {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.quick-access-arrow {
  color: var(--accent);
}
.login-form {
  gap: 1rem;
}
.login-field {
  gap: 0.42rem;
}
.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input-shell:focus-within {
  border-color: rgba(15, 118, 110, 0.74);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}
.input-shell > svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-left: 0.78rem;
}
.login-field input {
  border: 0;
  min-height: 48px;
  background: transparent;
  padding: 0.72rem 0.78rem;
}
.login-field input:focus {
  box-shadow: none;
}
.password-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  margin-right: 0.18rem;
}
.password-toggle:hover,
.password-toggle.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.password-toggle svg {
  width: 20px;
  height: 20px;
}
.login-submit {
  min-height: 50px;
  justify-content: space-between;
  padding-inline: 1rem;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
}
.login-submit svg {
  width: 21px;
  height: 21px;
}
.login-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  margin-top: 1.25rem;
  padding-top: 1rem;
  font-size: 0.9rem;
}
.login-foot a {
  color: var(--accent-strong);
  font-weight: 800;
}

.camera-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 1rem;
  align-items: start;
}
.camera-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.8rem;
}
.camera-preview {
  display: block;
  width: 100%;
  max-height: 62vh;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: #111827;
  object-fit: cover;
  transform: scaleX(-1);
  transform-origin: center;
}
.camera-toolbar { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.8rem; }
.pose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.pose-button.is-done { border-color: var(--green-border); background: var(--green-soft); color: var(--green); }
.progress-text { color: var(--muted); font-size: 0.9rem; margin: 0.7rem 0 0; }
.capture-output {
  display: none;
  border-radius: var(--radius);
  margin-top: 1rem;
  padding: 0.8rem;
  white-space: pre-line;
}
.capture-output.ok { display: block; border: 1px solid var(--green-border); background: var(--green-soft); color: var(--green-ink); }
.capture-output.err { display: block; border: 1px solid var(--red-border); background: var(--red-soft); color: var(--red-ink); }

.session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
}
.session-card h3 { margin: 0; font-size: 1rem; }
.session-card p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.88rem; }
.session-card.open { border-color: var(--green-border); background: var(--accent-soft); }
.session-card.done { background: var(--surface-muted); box-shadow: none; }

.student-list {
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  list-style: none;
  margin: 0;
  padding: 0;
}
.student-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
}
.student-list li:last-child { border-bottom: 0; }
.student-list label { flex: 1; cursor: pointer; }
.sel-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin: 0.6rem 0; }

.review-photo {
  width: 138px;
  height: 104px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  object-fit: cover;
}
.row-warn-med td { background: var(--warn-row); }
.row-warn-high td, .row-warn-sim td { background: var(--danger-row); }

dl.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 0.8rem;
  margin: 0;
}
.detail-list dt { color: var(--muted); font-weight: 750; }
.detail-list dd { margin: 0; }

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto auto;
  }
  .nav-toggle { display: inline-grid; place-items: center; }
  .nav-links {
    display: none;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    padding-top: 0.65rem;
  }
  .nav-links.is-open { display: flex; }
  .topbar-user { grid-column: 1 / -1; justify-content: flex-start; }
  .page-header { align-items: stretch; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .grid-3, .grid-4, .stat-grid, .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camera-layout { grid-template-columns: 1fr; }
  .login-shell {
    align-items: start;
    padding: 18px;
  }
  .login-experience {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .login-visual {
    min-height: 460px;
    padding: 2rem;
  }
  .login-visual h1 {
    font-size: 2.65rem;
  }
  .login-card {
    min-height: 0;
    border-left: 0;
    border-top: 1px solid rgba(10, 95, 89, 0.12);
    padding: 2rem;
  }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 22px, 1180px); padding-top: 11px; }
  .topbar { top: 8px; padding: 0.62rem; }
  .brand small, .user-pill { display: none; }
  .page-shell { padding-top: 1.4rem; }
  .grid-2, .grid-3, .grid-4, .stat-grid, .action-grid, .form-grid-2, .pose-grid { grid-template-columns: 1fr; }
  .panel, .stat-card, .action-card, .session-card, .auth-card { padding: 0.9rem; }
  .session-card { align-items: flex-start; flex-direction: column; }
  .data-table { min-width: 560px; }
  .auth-shell { align-items: start; padding-top: 24px; }
  .login-shell {
    padding: 12px;
  }
  .login-visual {
    min-height: 0;
    gap: 1.2rem;
    padding: 1.15rem;
  }
  .login-visual h1 {
    font-size: 2.15rem;
  }
  .login-visual p {
    font-size: 0.98rem;
  }
  .recognition-board {
    display: none;
  }
  .login-proof-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-card {
    padding: 1rem;
  }
  .login-card-head {
    align-items: flex-start;
  }
  .login-card h2 {
    font-size: 1.65rem;
  }
  .quick-access-card {
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scan-line {
    animation: none;
  }
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.pager-info { margin: 0; color: var(--muted); font-size: 0.88rem; }
.pager-info strong { color: var(--ink); }
.pager-size { display: inline-flex; align-items: center; gap: 0.35rem; }
.pager-size-label { color: var(--muted); font-size: 0.82rem; margin-right: 0.15rem; }
.pager-size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 32px;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 650;
  text-decoration: none;
}
.pager-size-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink);
}
.pager-size-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  cursor: default;
}
.pager-nav { display: inline-flex; align-items: center; gap: 0.5rem; }
.pager-status { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.btn.is-disabled { opacity: 0.45; pointer-events: none; cursor: default; }

@media (max-width: 640px) {
  .pager { flex-direction: column; align-items: stretch; }
  .pager-nav { justify-content: space-between; }
  .pager-size { flex-wrap: wrap; }
}

/* ── Student self-registration (rebuilt) ─────────────────────────── */
.reg-shell { padding: 24px 16px; }
.reg-card { width: min(100%, 940px); padding: 1.5rem; }
.reg-clienterror { margin-bottom: 0.5rem; }

.reg-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 1.4rem;
  align-items: start;
}

/* Capture column */
.reg-capture { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.reg-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 64vh;
  border-radius: 14px;
  overflow: hidden;
  background: #0b1220;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
@media (min-width: 720px) { .reg-stage { aspect-ratio: 4 / 3; } }
.reg-video { width: 100%; height: 100%; object-fit: cover; display: block; }

.reg-stage[data-state="loading"]::after,
.reg-stage[data-state="error"]::after {
  content: "Starting camera…";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #cbd5e1; font-size: 0.92rem; text-align: center; padding: 1rem;
  background: #0b1220;
}
.reg-stage[data-state="error"]::after { content: "Camera unavailable — upload photos instead"; color: #fca5a5; }
.reg-stage[data-state="live"] .reg-video { opacity: 1; }

/* Face guide ring + directional arrow overlay */
.reg-guide {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.reg-ring {
  width: min(62%, 280px); aspect-ratio: 3 / 4;
  border: 2.5px dashed rgba(255, 255, 255, 0.55);
  border-radius: 48% 48% 46% 46% / 60% 60% 40% 40%;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.reg-stage.has-face .reg-ring {
  border-color: #34d399;
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}
.reg-arrow {
  position: absolute;
  font-size: 2.4rem; line-height: 1; font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  animation: regNudge 1.4s ease-in-out infinite;
}
@keyframes regNudge { 0%,100% { transform: translateY(0); opacity: 0.65; } 50% { transform: translateY(-6px); opacity: 1; } }

.reg-facebadge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(16, 185, 129, 0.92); color: var(--on-accent);
  font-size: 0.72rem; font-weight: 800;
  padding: 0.2rem 0.5rem; border-radius: 999px;
}

.reg-flash { position: absolute; inset: 0; background: var(--surface); opacity: 0; pointer-events: none; }
.reg-flash.is-on { animation: regFlash 0.45s ease-out; }
@keyframes regFlash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

/* Controls row */
.reg-controls { display: flex; gap: 0.5rem; }
.reg-shoot { flex: 1; min-height: 48px; font-size: 1rem; }
.reg-icon-btn { min-height: 48px; width: 48px; padding: 0; flex: 0 0 auto; }
.reg-icon-btn.is-pulse { animation: regPulse 1.3s ease-in-out infinite; }
@keyframes regPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(15,118,110,0.0); } 50% { box-shadow: 0 0 0 4px rgba(15,118,110,0.18); } }

.reg-status { color: var(--muted); font-size: 0.9rem; margin: 0; min-height: 1.2em; }

/* Thumbnails */
.reg-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; list-style: none; margin: 0.2rem 0 0; padding: 0; }
.reg-thumb { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; cursor: pointer; }
.reg-thumb-img {
  position: relative;
  width: 100%; aspect-ratio: 1 / 1;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-muted) center/cover no-repeat;
  display: grid; place-items: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.reg-thumb-ph { font-size: 1.3rem; color: var(--muted); }
.reg-thumb.is-done .reg-thumb-ph { display: none; }
.reg-thumb.is-done .reg-thumb-img { border-color: var(--green); }
.reg-thumb.is-done .reg-thumb-img::after {
  content: "✓"; position: absolute; right: 4px; bottom: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--green); color: var(--on-accent);
  font-size: 0.72rem; font-weight: 800; display: grid; place-items: center;
}
.reg-thumb.is-active .reg-thumb-img { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,0.18); }
.reg-thumb-label { font-size: 0.74rem; color: var(--muted); font-weight: 700; }

/* Details column */
.reg-details { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.reg-progress { display: flex; flex-direction: column; gap: 0.35rem; }
.reg-progress-bar { height: 8px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.reg-progress-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #34d399); transition: width 0.3s ease; }
.reg-progress-text { font-size: 0.82rem; color: var(--muted); font-weight: 700; }

/* Password field */
.reg-pw { position: relative; display: block; }
.reg-pw input { width: 100%; padding-right: 3.6rem; }
.reg-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--blue);
  font-size: 0.82rem; font-weight: 700; cursor: pointer; padding: 0.3rem 0.4rem;
}
.reg-strength { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.1rem; }
.reg-strength-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.reg-strength-bar i { display: block; height: 100%; width: 0; transition: width 0.25s ease, background 0.25s ease; background: var(--red); }
.reg-strength-bar i[data-level="2"] { background: var(--amber); }
.reg-strength-bar i[data-level="3"] { background: #65a30d; }
.reg-strength-bar i[data-level="4"] { background: var(--green); }
.reg-strength-label { font-size: 0.76rem; font-weight: 700; color: var(--muted); min-width: 64px; }
.reg-fieldnote { color: var(--red); }
.field input.is-invalid { border-color: var(--red); }

/* Submit + spinner */
.reg-submit { position: relative; min-height: 46px; }
.reg-spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.45); border-top-color: var(--on-accent); animation: regSpin 0.7s linear infinite; }
.reg-submit.is-loading .reg-spinner { display: inline-block; }
@keyframes regSpin { to { transform: rotate(360deg); } }

/* Responsive: single column on phones */
@media (max-width: 720px) {
  .reg-grid { grid-template-columns: 1fr; gap: 1.1rem; }
  .reg-card { padding: 1.1rem; }
  .reg-shell { padding: 14px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .reg-arrow, .reg-icon-btn.is-pulse, .reg-spinner { animation: none; }
}

/* Admin "new student" reuses the registration capture layout inside a panel */
.reg-panel { padding: 1.25rem; }
@media (max-width: 720px) { .reg-panel { padding: 1rem; } }

/* Login: remember-me row */
.login-remember {
  display: flex; align-items: center; gap: 0.55rem;
  margin: 0.1rem 0 0.2rem; color: var(--ink); font-size: 0.92rem; cursor: pointer;
  user-select: none;
}
.login-remember input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; }
.login-remember span { font-weight: 600; }

/* ── Reusable filter bar for admin tables ────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.filter-bar .field { gap: 0.25rem; margin: 0; }
.filter-bar .field > span { font-size: 0.74rem; font-weight: 800; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.02em; }
.filter-bar .field input, .filter-bar .field select { min-height: 38px; padding: 0.42rem 0.6rem; font-size: 0.9rem; }
.filter-grow { flex: 1 1 220px; min-width: 150px; }
.filter-sm { flex: 0 0 auto; }
.filter-actions { display: flex; gap: 0.4rem; margin-left: auto; }
.filter-actions .btn { min-height: 38px; }
.filter-note { margin: -0.3rem 0 0.8rem; color: var(--muted); font-size: 0.86rem; }
.filter-note a { font-weight: 700; }
@media (max-width: 640px) {
  .filter-actions { margin-left: 0; width: 100%; }
  .filter-actions .btn { flex: 1; }
  .filter-grow { flex-basis: 100%; }
}

/* ════════════════════════════════════════════════════════════════
   Design-system refinement pass — same palette, login page untouched.
   New non-color tokens + tasteful polish on shared admin components.
   ════════════════════════════════════════════════════════════════ */
:root {
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(24, 32, 43, 0.05), 0 2px 6px rgba(24, 32, 43, 0.05);
  --shadow-md: 0 12px 28px rgba(24, 32, 43, 0.08);
  --shadow-lg: 0 20px 44px rgba(24, 32, 43, 0.12);
  --speed: 0.16s ease;
}

/* Cards & panels — softer default elevation, rounder corners (NOT .auth-card) */
.panel, .stat-card, .action-card, .session-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.panel { padding: 1.25rem; }

/* Stat cards — subtle brand accent bar + accent figure */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.stat-value { color: var(--accent-strong); }

/* Action cards — clearer affordance + brand-coloured title on hover */
.action-card { border-radius: var(--radius-lg); transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed); }
.action-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.action-card:hover strong { color: var(--accent-strong); }

/* Tables — rounded container, tokenised header, smoother hover */
.table-wrap { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.data-table th { background: var(--surface-muted); color: var(--text-2); }
.data-table tbody tr { transition: background var(--speed); }
.data-table tbody tr:hover td { background: var(--surface-muted); }

/* Badges & status pills — fully rounded for a cleaner read */
.badge, .status-badge { border-radius: var(--radius-pill); }

/* Buttons — interaction states (resting look unchanged, so login stays intact) */
.btn { transition: background var(--speed), border-color var(--speed), color var(--speed), transform var(--speed), box-shadow var(--speed); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

/* Section headers — clearer separation */
.page-header { border-bottom: 1px solid var(--line); padding-bottom: 1.1rem; }

/* Form inputs inside panels — gentle hover (scoped, so login is unaffected) */
.panel .field input:hover, .panel .field select:hover, .panel .field textarea:hover,
.filter-bar .field input:hover, .filter-bar .field select:hover {
  border-color: var(--line-strong);
}

/* Empty states — a touch more room */
.empty-state { padding: 1.4rem 1rem; }

/* Pager controls — pill buttons to match the refreshed system */
.pager-size-btn { border-radius: var(--radius-pill); }

/* ════════════════════════════════════════════════════════════════
   THEME SYSTEM — dark palette + full restyle layer
   ════════════════════════════════════════════════════════════════ */

/* extra surface token used by the restyled topbar */
:root { --topbar-bg: rgba(255, 255, 255, 0.85); }

/* ---- Dark palette ------------------------------------------------ */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1217;
  --surface: #161c24;
  --surface-2: #1b232d;
  --surface-muted: #1f2832;
  --surface-subtle: #1a212a;
  --topbar-bg: rgba(20, 26, 33, 0.82);

  --ink: #e8edf4;
  --text-2: #b6c0cd;
  --muted: #8a97a8;

  --line: #2a323d;
  --line-strong: #3b4552;

  --accent: #2dd4bf;
  --accent-strong: #99f6e4;
  --accent-soft: #14302d;
  --on-accent: #04231f;

  --blue: #60a5fa;  --blue-strong: #93c5fd;  --blue-soft: #16233a;  --blue-border: #31507f;  --blue-ink: #cfe0ff;
  --green: #34d399; --green-strong: #6ee7b7; --green-soft: #102a1d; --green-border: #1f5236; --green-ink: #a7f3cf;
  --amber: #e0b341; --amber-strong: #f3cf6b; --amber-soft: #2c2410; --amber-border: #5b4a1c; --amber-ink: #ffe2a0;
  --red: #f98a82;   --red-strong: #f87171;   --red-soft: #2a1414;   --red-soft2: #3a1c1c;    --red-border: #6e3232;  --red-ink: #ffc4c0;

  --warn-row: #221d10;
  --danger-row: #241313;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 28px 60px rgba(0, 0, 0, 0.6);
  --focus: 0 0 0 3px rgba(94, 234, 212, 0.35);
}

/* Dark structural overrides for surfaces still painted with rgba-white */
[data-theme="dark"] body {
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.05), transparent 320px), var(--bg);
}
[data-theme="dark"] .empty-state { background: var(--surface-subtle); }
[data-theme="dark"] .login-experience {
  background: rgba(20, 26, 33, 0.82);
  border-color: rgba(94, 234, 212, 0.16);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .login-card { border-left-color: var(--line); }
[data-theme="dark"] .login-shell {
  background:
    radial-gradient(1100px 560px at 82% -12%, rgba(45, 212, 191, 0.10), transparent 60%),
    linear-gradient(180deg, #0c1014, #0e1217);
}
[data-theme="dark"] .login-shell::before {
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.04));
}
/* the login showcase panel stays dark in both themes → keep its text light */
[data-theme="dark"] .login-visual,
[data-theme="dark"] .login-visual h1,
[data-theme="dark"] .recognition-status strong { color: #effdfb; }

/* ---- Full restyle layer (light + dark, token-driven) ------------- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Topbar — token background so it themes correctly */
.topbar {
  background: var(--topbar-bg);
  border-color: var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Cards & panels — rounder, lighter resting shadow */
.panel, .stat-card, .action-card, .session-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.panel { padding: 1.25rem; }
.panel-header h2, .section-title { font-size: 1.12rem; font-weight: 800; letter-spacing: -0.01em; }

/* Headings — tighter, bolder, with a divider */
.page-header { border-bottom: 1px solid var(--line); padding-bottom: 1.1rem; }
.page-header h1 { font-weight: 850; letter-spacing: -0.02em; }

/* Stat cards — brand accent bar + accent figure */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 3px; background: var(--accent); }
.stat-value { color: var(--accent-strong); font-size: 2.1rem; letter-spacing: -0.02em; }

/* Action cards — stronger hover affordance */
.action-card { border-radius: var(--radius-lg); transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed); }
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.action-card:hover strong { color: var(--accent-strong); }

/* Buttons — crisper, with depth + interaction states */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 750;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: background var(--speed), color var(--speed), border-color var(--speed), transform var(--speed), box-shadow var(--speed);
}
.btn:not(.btn-ghost):not(.btn-link):hover { box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: 0.55; box-shadow: none; transform: none; }

/* Form controls — token surface + accent focus ring */
.field input, .field textarea, .field select, .search-box {
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--speed), box-shadow var(--speed);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus, .field textarea:focus,
.search-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Tables — rounded shell, tokenised header, smooth hover */
.table-wrap { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.data-table th { background: var(--surface-muted); color: var(--text-2); letter-spacing: 0.03em; }
.data-table tbody tr { transition: background var(--speed); }
.data-table tbody tr:hover td { background: var(--surface-muted); }

/* Pills */
.badge, .status-badge { border-radius: var(--radius-pill); }
.pager-size-btn { border-radius: var(--radius-pill); }

/* Empty state — themed surface */
.empty-state { background: var(--surface-subtle); padding: 1.4rem 1rem; }

/* ---- Theme toggle button ---------------------------------------- */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  transition: background var(--speed), color var(--speed), border-color var(--speed);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-muted); }
.theme-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-floating {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}
.theme-toggle .icon-sun { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Login uses a wrapping .input-shell for focus — keep the inner input ringless */
.login-field input:focus { box-shadow: none; border-color: transparent; }

/* ════════════════════════════════════════════════════════════════
   Messaging — group chat + student↔admin support threads
   ════════════════════════════════════════════════════════════════ */
.nav-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  margin-left: 0.3rem; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--on-accent); font-size: 0.7rem; font-weight: 800; line-height: 1;
}
.status-closed { border-color: var(--line-strong); background: var(--surface-muted); color: var(--muted); }

.chat-subhead { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; }

.chat-shell { display: flex; flex-direction: column; gap: 0.85rem; padding: 1rem; }
.chat-log {
  display: flex; flex-direction: column; gap: 0.7rem;
  height: min(60vh, 560px); overflow-y: auto; padding: 0.4rem;
}
.chat-empty, .chat-closed { color: var(--muted); text-align: center; padding: 1.2rem; font-size: 0.92rem; margin: 0; }

.chat-msg { display: flex; flex-direction: column; gap: 0.22rem; max-width: 80%; align-self: flex-start; }
.chat-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.chat-meta { display: flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; color: var(--muted); padding: 0 0.2rem; }
.chat-who { font-weight: 800; color: var(--text-2); }
.chat-tag { border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; font-size: 0.66rem; padding: 0.05rem 0.42rem; }
.chat-time { font-variant-numeric: tabular-nums; }
.chat-bubble {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface-muted); color: var(--ink);
  padding: 0.55rem 0.8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.chat-msg.is-mine .chat-bubble { background: var(--accent); border-color: transparent; color: var(--on-accent); border-bottom-right-radius: var(--radius-sm); }
.chat-msg:not(.is-mine) .chat-bubble { border-bottom-left-radius: var(--radius-sm); }
.chat-msg.is-admin:not(.is-mine) .chat-bubble { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

.chat-composer { display: flex; gap: 0.5rem; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 0.85rem; }
.chat-composer textarea {
  flex: 1; min-height: 44px; max-height: 160px; resize: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); padding: 0.6rem 0.75rem;
}
.chat-composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.chat-composer .btn { min-height: 44px; }

.thread-list { display: flex; flex-direction: column; gap: 0.5rem; }
.thread-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 0.7rem 0.85rem; text-decoration: none; color: var(--ink);
  transition: border-color var(--speed), background var(--speed), transform var(--speed);
}
.thread-item:hover { border-color: var(--line-strong); background: var(--surface-muted); transform: translateY(-1px); color: var(--ink); }
.thread-item.has-unread { border-left: 3px solid var(--accent); }
.thread-main { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.thread-main strong { font-size: 0.96rem; }
.thread-snippet { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52ch; }
.thread-side { display: flex; align-items: center; gap: 0.45rem; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.thread-time { font-size: 0.78rem; }
.unread-pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font-size: 0.72rem; font-weight: 800; }

@media (max-width: 640px) {
  .chat-msg { max-width: 92%; }
  .thread-snippet { max-width: 38ch; }
}

/* ════════════════════════════════════════════════════════════════
   Header fix — the nav now has up to 7 items; collapse it into a
   menu below 1200px and tidy the desktop spacing so it never overflows.
   ════════════════════════════════════════════════════════════════ */
.topbar { gap: 0.75rem; }
.nav-links { gap: 0.12rem; }
.nav-link { padding: 0.52rem 0.6rem; font-size: 0.9rem; }
.user-pill { max-width: 170px; }
.topbar-user { gap: 0.45rem; }

@media (max-width: 1200px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
  }
  .brand { order: 0; margin-right: auto; }   /* keep brand left, push actions right */
  .topbar-user { order: 1; min-width: 0; }
  .nav-toggle {
    order: 2;
    display: inline-grid;
    place-items: center;
  }
  .nav-links {
    order: 3;
    flex-basis: 100%;
    display: none;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.15rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
  }
  .nav-links.is-open { display: flex; }
  .nav-link { padding: 0.55rem 0.75rem; font-size: 0.95rem; }
}

@media (max-width: 520px) {
  .topbar { padding: 0.6rem 0.7rem; }
  .brand small { display: none; }
}

/* The [hidden] attribute must always win over component display rules
   (nav unread badge, password-strength meter, inline field notes, etc.) */
[hidden] { display: none !important; }
