/* ==========================================================================
   STA Sekolah — Portal Website Sekolah (Light Mode)
   Academic Blue + Gold · Minimalism / Swiss · Plus Jakarta Sans + Fira Code
   Every colour and font is declared once in :root.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Brand: Academic Blue */
  --primary: #1E40AF;
  --primary-deep: #1E3A8A;
  --primary-hover: #1D4ED8;
  --primary-bright: #2563EB;
  --primary-soft: #EFF6FF;
  --primary-soft-hover: #DBEAFE;

  /* Brand: Academic Gold */
  --gold: #B45309;
  --gold-bright: #D97706;
  --gold-soft: #FEF3C7;

  /* Canvas & surfaces */
  --bg: #F4F7FC;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --muted: #E9EFF7;
  --border: #D8E2F0;
  --border-strong: #CBD5E1;

  /* Text */
  --text: #0F172A;
  --heading: #1E3A8A;
  --text-muted: #475569;
  --text-inverse: #FFFFFF;

  /* Semantic: solid / soft surface / text on soft (AA 4.5:1+) */
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --success-text: #166534;
  --warning: #B45309;
  --warning-soft: #FEF3C7;
  --warning-text: #92400E;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --danger-text: #B91C1C;
  --info: #0284C7;
  --info-soft: #E0F2FE;
  --info-text: #0369A1;

  /* Dark stage (camera, toast) & overlays */
  --stage: #0F172A;
  --stage-muted: #CBD5E1;
  --overlay: rgba(15, 23, 42, 0.5);

  /* Type */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Shape & elevation */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 24px 56px rgba(30, 58, 138, 0.18), 0 6px 16px rgba(15, 23, 42, 0.08);
  --shadow-btn: 0 8px 18px rgba(30, 64, 175, 0.26);
  --shadow-btn-hover: 0 12px 24px rgba(30, 64, 175, 0.32);

  /* Alpha-only fade for the login hero grid texture */
  --grid-mask: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.2));
  --speed: 180ms;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  color: var(--primary);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.ui-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease, box-shadow var(--speed) ease, opacity var(--speed) ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: var(--primary-bright);
  color: var(--primary);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-soft:hover:not(:disabled) {
  background: var(--primary-soft-hover);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.btn-danger-soft:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger-soft) 72%, var(--danger));
}

.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--muted);
  color: var(--text);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 7px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease;
}
.icon-btn:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color var(--speed) ease, background-color var(--speed) ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 76px;
}

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

.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert-error {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--surface));
}
.alert-info {
  background: var(--info-soft);
  color: var(--info-text);
  border-color: color-mix(in srgb, var(--info) 35%, var(--surface));
}
.alert-success {
  background: var(--success-soft);
  color: var(--success-text);
  border-color: color-mix(in srgb, var(--success) 35%, var(--surface));
}

/* --------------------------------------------------------------------------
   Login — Portal Website Sekolah
   -------------------------------------------------------------------------- */
.login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--primary) 12%, transparent) 1px, transparent 1.2px);
  background-size: 26px 26px;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: cardEnter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 40px 36px;
  color: var(--text-inverse);
  background: linear-gradient(160deg, var(--primary-deep) 0%, var(--primary) 55%, var(--primary-bright) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

/* Architectural grid texture, fading toward the base of the panel */
.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--text-inverse) 10%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text-inverse) 10%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: var(--grid-mask);
  mask-image: var(--grid-mask);
}

.hero-top {
  position: relative;
}

/* School emblem: white disc with a floating academic gold ring */
.hero-logo-ring {
  position: relative;
  width: 76px;
  height: 76px;
  padding: 4px;
  margin-bottom: 26px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.hero-logo-ring::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-bright);
  pointer-events: none;
}
.hero-logo-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--text-inverse) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--text-inverse) 34%, transparent);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.hero-title {
  margin: 16px 0 8px;
  font-size: 28px;
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}
.hero-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--text-inverse) 85%, transparent);
}

.hero-highlights {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.hero-highlights li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
}
.hl-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text-inverse) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold-bright) 60%, transparent);
  color: var(--gold-soft);
}

.login-card {
  width: 100%;
  background: var(--surface);
  padding: 40px 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-header {
  display: flex;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 26px;
}
.login-accent-bar {
  width: 4px;
  border-radius: 2px;
  background: var(--primary);
  flex-shrink: 0;
}
.login-form-header h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
}
.login-form-header p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-left-icon {
  position: absolute;
  left: 12px;
  display: inline-flex;
  color: var(--text-muted);
  pointer-events: none;
}
.input-left-icon .ui-icon {
  width: 17px;
  height: 17px;
}
.input-icon-wrap input {
  padding-left: 40px;
  padding-right: 44px;
  background: var(--surface-alt);
}
.input-icon-wrap input:focus {
  background: var(--surface);
}
.pw-toggle-btn {
  position: absolute;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--speed) ease, background-color var(--speed) ease;
}
.pw-toggle-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.api-settings {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.api-settings summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.login-cta {
  height: 46px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: var(--shadow-btn);
  transition: background-color var(--speed) ease, box-shadow var(--speed) ease, transform var(--speed) ease;
}
.login-cta:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-hover);
}

.login-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.login-footer-secure {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--primary);
}
.login-footer-secure .ui-icon {
  width: 14px;
  height: 14px;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   App Shell — Sidebar
   -------------------------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 264px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

/* Crest header: navy band, logo ringed in academic gold */
.sidebar-header {
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--primary-deep);
  color: var(--text-inverse);
}
.sidebar-logo-wrap {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  padding: 3px;
  border-radius: 50%;
  border: 2px solid var(--gold-bright);
  background: color-mix(in srgb, var(--text-inverse) 14%, transparent);
}
.sidebar-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
  background: var(--surface);
  display: block;
}
.sidebar-title-wrap {
  flex: 1;
  min-width: 0;
}
.sidebar-school {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-inverse);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-role {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: color-mix(in srgb, var(--text-inverse) 78%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-header .icon-btn {
  background: transparent;
  border-color: color-mix(in srgb, var(--text-inverse) 34%, transparent);
  color: var(--text-inverse);
}
.sidebar-header .icon-btn:hover {
  background: color-mix(in srgb, var(--text-inverse) 14%, transparent);
  border-color: var(--text-inverse);
  color: var(--text-inverse);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  padding: 14px 10px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--speed) ease, color var(--speed) ease, box-shadow var(--speed) ease;
}
.nav-item:hover {
  background: var(--surface-alt);
  color: var(--primary);
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-item.active:hover {
  background: var(--primary-soft-hover);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nav-link .ui-icon {
  color: var(--text-muted);
  transition: color var(--speed) ease;
}
.nav-item:hover .ui-icon,
.nav-item.active .ui-icon {
  color: var(--primary);
}
.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-hover);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}
.user-meta {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-sub {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer-actions {
  display: flex;
  gap: 6px;
}
.sidebar-footer-actions .btn {
  flex: 1;
  min-width: 0;
  padding-inline: 8px;
}

/* --------------------------------------------------------------------------
   App Shell — Topbar & content
   -------------------------------------------------------------------------- */
.main-wrap {
  margin-left: 264px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 24px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.page-heading {
  min-width: 0;
}
.page-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-subtitle {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.date-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.api-badge {
  display: inline-block;
  max-width: 280px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 24px 40px;
}

/* --------------------------------------------------------------------------
   Cards & KPIs
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card + .card {
  margin-top: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-title {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--heading);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
/* Swiss top rule in Academic Blue */
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--primary);
}
.stat-card.accent {
  border-color: color-mix(in srgb, var(--gold) 38%, var(--surface));
  background: linear-gradient(165deg, color-mix(in srgb, var(--gold-soft) 48%, var(--surface)), var(--surface) 72%);
}
.stat-card.accent::before {
  background: var(--gold-bright);
}
.stat-card.accent .stat-value {
  color: var(--gold);
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.kpi-head .ui-icon {
  color: var(--primary);
}
.stat-card.accent .kpi-head .ui-icon {
  color: var(--gold);
}

.stat-label {
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-muted);
}
.stat-value {
  margin-top: 6px;
  min-width: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
/* Medium KPI figure (currency, long labels); overrides .stat-value when both are set */
.stat-value-md {
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Toolbar & Tables
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.toolbar-filters input,
.toolbar-filters select {
  width: auto;
  min-width: 150px;
}
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
/* Capped heights turn on vertical scrolling so the sticky header does its job */
.table-scroll-sm {
  max-height: 320px;
}
.table-scroll-md {
  max-height: 520px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 150ms ease;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--muted) 55%, var(--surface));
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* --------------------------------------------------------------------------
   Badges & Tabs
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-green { background: var(--success-soft); color: var(--success-text); }
.badge-red { background: var(--danger-soft); color: var(--danger-text); }
.badge-yellow { background: var(--warning-soft); color: var(--warning-text); }
.badge-blue { background: var(--info-soft); color: var(--info-text); }
.badge-gray { background: var(--muted); color: var(--text-muted); }
.badge-btn {
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background-color var(--speed) ease, border-color var(--speed) ease;
}
.badge-blue.badge-btn:hover {
  background: var(--primary-soft-hover);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}
.badge-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  padding: 8px 14px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--speed) ease, background-color var(--speed) ease, border-color var(--speed) ease;
}
.tab-btn:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Upload & progress
   -------------------------------------------------------------------------- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color var(--speed) ease, background-color var(--speed) ease;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.progress-bar-wrap {
  width: 100%;
  height: 10px;
  margin: 10px 0;
  background: var(--muted);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  animation: fadeIn 0.18s ease-out;
}
.modal-box {
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-box.modal-lg {
  max-width: 960px;
}
.modal-header {
  padding: 12px 12px 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  max-width: 380px;
  padding: 11px 15px;
  border-radius: 10px;
  border-left: 3px solid var(--info);
  background: var(--stage);
  color: var(--text-inverse);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.22s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state {
  padding: 36px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.mobile-only {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--overlay);
}

/* --------------------------------------------------------------------------
   Face Recognition stage
   -------------------------------------------------------------------------- */
.face-kiosk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.face-controls-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.face-video-wrap {
  position: relative;
  width: 100%;
  min-height: 340px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--stage);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-inverse) 8%, transparent);
}
.face-video-compact {
  min-height: 240px;
  max-width: 420px;
}
.face-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.face-video-wrap canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.face-guide-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}
.face-guide-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.face-guide-vignette {
  fill: color-mix(in srgb, var(--stage) 44%, transparent);
}
.face-guide-shape {
  fill: none;
  stroke: color-mix(in srgb, var(--text-inverse) 72%, transparent);
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--speed) ease, opacity var(--speed) ease;
}
.face-guide-corners {
  fill: none;
  stroke: color-mix(in srgb, var(--text-inverse) 92%, transparent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--speed) ease;
}
.face-guide-overlay.is-matched .face-guide-shape {
  stroke: color-mix(in srgb, var(--success) 88%, var(--text-inverse));
  stroke-dasharray: none;
}
.face-guide-overlay.is-matched .face-guide-corners {
  stroke: var(--success);
}
.face-guide-overlay.is-align .face-guide-shape {
  stroke: var(--gold-bright);
  stroke-dasharray: 5 4;
}
.face-guide-overlay.is-align .face-guide-corners {
  stroke: var(--gold-bright);
}
.face-guide-overlay.is-align .face-guide-pill {
  background: color-mix(in srgb, var(--warning-text) 92%, var(--stage));
  border-color: color-mix(in srgb, var(--gold-bright) 80%, var(--text-inverse));
}
.face-guide-overlay.is-unknown .face-guide-shape {
  stroke: color-mix(in srgb, var(--danger) 85%, var(--text-inverse));
}
.face-guide-overlay.is-unknown .face-guide-corners {
  stroke: var(--danger);
}
.face-guide-pill {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stage) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--text-inverse) 22%, transparent);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease;
}
.face-guide-overlay.is-matched .face-guide-pill {
  background: color-mix(in srgb, var(--success-text) 92%, var(--stage));
  border-color: color-mix(in srgb, var(--success) 75%, var(--text-inverse));
}
.face-guide-overlay.is-unknown .face-guide-pill {
  background: color-mix(in srgb, var(--danger-text) 92%, var(--stage));
  border-color: color-mix(in srgb, var(--danger) 75%, var(--text-inverse));
}
.face-video-compact .face-guide-pill {
  bottom: 8px;
  padding: 4px 10px;
  font-size: 11.5px;
}
.face-video-placeholder {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--stage-muted);
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--primary-deep) 60%, var(--stage)), var(--stage) 78%);
  font-size: 13.5px;
  line-height: 1.55;
}
.face-video-placeholder .ui-icon {
  width: 40px;
  height: 40px;
  color: var(--gold-bright);
}

.face-result-banner {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 13.5px;
  line-height: 1.5;
}
.face-result-banner.success {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 40%, var(--surface));
  border-left-color: var(--success);
  color: var(--success-text);
}
.face-result-banner.error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--surface));
  border-left-color: var(--danger);
  color: var(--danger-text);
}
.face-result-banner.info {
  background: var(--info-soft);
  border-color: color-mix(in srgb, var(--info) 40%, var(--surface));
  border-left-color: var(--info);
  color: var(--info-text);
}

.face-feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
}
.face-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  transition: background-color var(--speed) ease, border-color var(--speed) ease;
}
.face-feed-item:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   Semantic utilities (shared by view modules)
   -------------------------------------------------------------------------- */
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: 4px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.ml-xs { margin-left: 4px; }

.text-strong { font-weight: 700; }
.text-semibold { font-weight: 600; }
.text-right { text-align: right; }
.text-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.text-danger { color: var(--danger-text); }
.text-success { color: var(--success-text); }

.flex-row {
  display: flex;
  align-items: center;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.form-group-end { justify-content: flex-end; }

.check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Toolbar search & year inputs. Selectors must out-rank input[type=…] (0,1,1)
   and .toolbar-filters input (0,1,1). */
.toolbar-filters .input-search {
  min-width: 220px;
}
input.input-year,
.toolbar-filters .input-year {
  width: 96px;
  min-width: 96px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.toolbar-filters .input-code {
  width: 110px;
  min-width: 110px;
}
input.input-readonly {
  background: var(--surface-alt);
  cursor: not-allowed;
}

/* School avatar: size driven by --avatar-size (see STA.ui.schoolAvatarHtml) */
.school-avatar {
  display: block;
  flex-shrink: 0;
  width: var(--avatar-size, 40px);
  height: var(--avatar-size, 40px);
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface);
}
.school-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: calc(var(--avatar-size, 40px) * 0.3);
  font-weight: 700;
  line-height: 1;
}

/* School logo uploader */
.logo-uploader {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-alt);
}
.logo-preview-img {
  width: 68px;
  height: 68px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Fixed thumbnail inside table cells */
.media-cell {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--muted);
}

.guide-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

/* Alert that sits between stacked blocks */
.alert-block {
  margin-bottom: 14px;
}

/* --------------------------------------------------------------------------
   Self Reference-Photo Status & Authenticated Admin Kiosk Scanner
   -------------------------------------------------------------------------- */
.self-enrolled-box {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--success) 38%, var(--surface));
  background: linear-gradient(155deg, color-mix(in srgb, var(--success-soft) 68%, var(--surface)), var(--surface) 74%);
}
.self-enrolled-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--success);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}
.self-enrolled-content {
  min-width: 0;
  flex: 1;
}
.self-enrolled-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--success-text);
}
.self-enrolled-desc {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.self-enrolled-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.kiosk-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 26%, var(--surface));
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.kiosk-security-badge .ui-icon {
  color: var(--primary);
}

.kiosk-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.kiosk-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
}
.kiosk-status-pill.is-ready {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 38%, var(--surface));
  color: var(--success-text);
}
.kiosk-status-pill.is-loading {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--surface));
  color: var(--primary);
}
.kiosk-status-pill.is-warning {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 35%, var(--surface));
  color: var(--warning-text);
}
.kiosk-status-pill.is-paused {
  background: var(--muted);
  border-color: var(--border-strong);
  color: var(--text-muted);
}

.kiosk-stage-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kiosk-stage-summary {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--surface));
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kiosk-live-clock {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--heading);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.kiosk-last-notif {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  max-width: min(340px, calc(100% - 24px));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  border: 1px solid var(--border);
  border-left-width: 4px;
  box-shadow: var(--shadow-md);
  color: var(--text);
  pointer-events: none;
  animation: kioskNotifIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.kiosk-last-notif.is-success {
  border-left-color: var(--success);
}
.kiosk-last-notif.is-info {
  border-left-color: var(--info);
}
.kiosk-last-notif.is-error {
  border-left-color: var(--danger);
}
.kiosk-last-notif-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  background: var(--success);
}
.kiosk-last-notif.is-info .kiosk-last-notif-icon {
  background: var(--info);
}
.kiosk-last-notif.is-error .kiosk-last-notif-icon {
  background: var(--danger);
}
.kiosk-last-notif-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.kiosk-last-notif-name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kiosk-last-notif-status {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kiosk-last-notif.is-success .kiosk-last-notif-status {
  color: var(--success-text);
}
.kiosk-last-notif.is-info .kiosk-last-notif-status {
  color: var(--info-text);
}
.kiosk-last-notif.is-error .kiosk-last-notif-status {
  color: var(--danger-text);
}

@keyframes kioskNotifIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kiosk-flash-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid var(--border);
  border-left-width: 6px;
  box-shadow: var(--shadow-lg);
  color: var(--text);
  animation: kioskFlashIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.kiosk-flash-overlay.is-success {
  border-left-color: var(--success);
}
.kiosk-flash-overlay.is-info {
  border-left-color: var(--info);
}
.kiosk-flash-overlay.is-error {
  border-left-color: var(--danger);
}
.kiosk-flash-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  background: var(--success);
}
.kiosk-flash-overlay.is-info .kiosk-flash-icon {
  background: var(--info);
}
.kiosk-flash-overlay.is-error .kiosk-flash-icon {
  background: var(--danger);
}
.kiosk-flash-body {
  min-width: 0;
  flex: 1;
}
.kiosk-flash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.kiosk-flash-conf {
  color: var(--text-muted);
  font-weight: 600;
}
.kiosk-flash-name {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--heading);
  overflow-wrap: break-word;
}
.kiosk-flash-sub {
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.kiosk-flash-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kiosk-flash-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
}
.kiosk-flash-msg {
  font-size: 12.5px;
  color: var(--text-muted);
}

@keyframes kioskFlashIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#kiosk-stage-card:fullscreen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 24px;
  background: var(--bg);
  border: none;
  border-radius: 0;
  overflow: hidden;
}
#kiosk-stage-card:fullscreen .face-controls-bar,
#kiosk-stage-card:fullscreen #kiosk-result-banner {
  display: none;
}
#kiosk-stage-card:fullscreen .face-video-wrap {
  flex: 1;
  min-height: 0;
  aspect-ratio: auto;
}
#kiosk-stage-card:fullscreen .kiosk-stage-summary {
  font-size: 14px;
  padding: 6px 14px;
}
#kiosk-stage-card:fullscreen .kiosk-live-clock {
  font-size: 18px;
  padding: 6px 14px;
}
#kiosk-stage-card:fullscreen .kiosk-last-notif {
  top: 18px;
  right: 18px;
  max-width: 420px;
  padding: 10px 14px;
}
#kiosk-stage-card:fullscreen .kiosk-last-notif-name {
  font-size: 15px;
}
#kiosk-stage-card:fullscreen .kiosk-last-notif-status {
  font-size: 13px;
}
#kiosk-stage-card:fullscreen .kiosk-flash-overlay {
  left: 24px;
  right: 24px;
  bottom: 24px;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 24px;
  gap: 18px;
  box-shadow: var(--shadow-lg);
}
#kiosk-stage-card:fullscreen .kiosk-flash-icon {
  width: 60px;
  height: 60px;
}
#kiosk-stage-card:fullscreen .kiosk-flash-name {
  font-size: 24px;
}
#kiosk-stage-card:fullscreen .kiosk-flash-sub {
  font-size: 15px;
}
#kiosk-stage-card:fullscreen .face-guide-pill {
  bottom: 18px;
  padding: 7px 16px;
  font-size: 13.5px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .mobile-only {
    display: inline-flex;
  }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .face-kiosk-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: 460px;
  }
  .login-hero {
    padding: 26px 24px;
    gap: 16px;
  }
  .hero-logo-ring {
    width: 60px;
    height: 60px;
    margin-bottom: 18px;
  }
  .hero-title {
    font-size: 22px;
  }
  .hero-highlights {
    display: none;
  }
  .login-card {
    padding: 26px 24px 22px;
  }
}

@media (max-width: 768px) {
  .date-pill {
    display: none;
  }
  .api-badge {
    max-width: 132px;
  }
  .topbar {
    padding: 10px 16px;
  }
  .main-content {
    padding: 18px 16px 32px;
  }
}

/* Onboarding setup guide on Admin Dashboard */
.setup-guide-card {
  padding: 0;
  overflow: hidden;
}
.setup-guide-details {
  width: 100%;
}
.setup-guide-summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-alt);
  border-bottom: 1px solid transparent;
  transition: background-color var(--speed) ease, border-color var(--speed) ease;
}
.setup-guide-summary::-webkit-details-marker {
  display: none;
}
.setup-guide-summary:hover {
  background: var(--primary-soft);
}
.setup-guide-details[open] .setup-guide-summary {
  border-bottom-color: var(--border);
}
.setup-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.setup-guide-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}
.setup-steps-list {
  display: flex;
  flex-direction: column;
  padding: 8px 20px 18px;
}
.setup-step-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.setup-step-item:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}
.setup-step-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border-strong);
}
.setup-step-item.is-done .setup-step-num {
  background: var(--success-soft);
  color: var(--success-text);
  border-color: var(--success);
}
.setup-step-body {
  flex: 1;
  min-width: 0;
}
.setup-step-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.setup-step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.setup-step-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.setup-step-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.setup-example-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--heading);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.setup-csv-headers {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 12px;
  word-break: break-all;
  color: var(--text);
}

@media (max-width: 820px) {
  .setup-step-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .setup-step-actions {
    width: 100%;
  }
}

/* Face approval thumbnails, preview modal, and self-portal states */
.alert-warning {
  background: var(--warning-soft);
  border-color: var(--gold-bright);
  color: var(--warning-text);
}
.text-warning {
  color: var(--warning-text);
}
.face-pending-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.face-status-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.face-sample-thumb-btn {
  padding: 0;
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  transition: border-color var(--speed) ease, transform var(--speed) ease;
}
.face-sample-thumb-btn:hover {
  border-color: var(--primary);
  transform: scale(1.04);
}
.face-sample-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.face-sample-thumb-btn .face-sample-thumb {
  width: 100%;
  height: 100%;
  border-radius: 0;
}
.self-enrolled-box.is-pending {
  background: var(--warning-soft);
  border-color: var(--gold-bright);
}
.self-enrolled-box.is-pending .self-enrolled-icon {
  background: var(--gold-bright);
  color: var(--text-inverse);
}
.self-enrolled-box.is-rejected {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.self-enrolled-box.is-rejected .self-enrolled-icon {
  background: var(--danger);
  color: var(--text-inverse);
}
.self-face-photo-btn {
  position: relative;
  flex-shrink: 0;
  width: 104px;
  height: 104px;
  padding: 0;
  border: 3px solid var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-alt);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}
.self-face-photo-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.self-face-photo-sm {
  width: 72px;
  height: 72px;
  border-radius: 12px;
}
.self-face-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.self-face-photo-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  background: color-mix(in srgb, var(--stage) 72%, transparent);
  color: var(--text-inverse);
}
.self-current-photo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.self-captured-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.self-captured-strip .face-sample-thumb {
  width: 56px;
  height: 56px;
  border: 2px solid var(--success);
}
.face-preview-modal-wrap {
  display: flex;
  justify-content: center;
}
.face-preview-modal-img {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-md);
}
.face-preview-modal-empty {
  width: 220px;
  height: 160px;
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  background: var(--surface-alt);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
}
.face-preview-modal-meta {
  text-align: center;
}

@media (max-width: 640px) {
  .kiosk-last-notif {
    top: 8px;
    right: 8px;
    padding: 6px 10px;
  }
  .kiosk-flash-overlay {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 12px 14px;
    gap: 12px;
  }
  .kiosk-flash-icon {
    width: 42px;
    height: 42px;
  }
  .kiosk-flash-name {
    font-size: 16.5px;
  }
  .self-enrolled-box {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .login-page {
    padding: 16px;
  }
  .hero-subtitle {
    display: none;
  }
  .modal-backdrop {
    padding: 12px;
  }
  .toast-root {
    left: 18px;
  }
  .toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
