/**
 * นายวัลลภ  กอวชิรพันธ์
 * โรงเรียนคงคาราม จังหวัดเพชรบุรี
 * ผู้พัฒนาระบบโปรแกรม
 * สงวนสิทธิ์ให้โรงเรียนมัธยมวัดดอนตูมใช้งานได้
 */
@font-face {
  font-family: 'TH Sarabun New';
  src: local('TH Sarabun New'), local('THSarabunNew'), local('Sarabun');
  font-weight: 400;
  font-style: normal;
}

:root {
  /* สีประจำโรงเรียน: ฟ้า–แดง */
  --blue: #1565C0;
  --blue-dark: #0D47A1;
  --blue-deep: #0A3D91;
  --blue-soft: #E3F2FD;
  --red: #C62828;
  --red-dark: #B71C1C;
  --red-soft: #FFEBEE;
  --accent: #C62828;
  --accent-dark: #B71C1C;
  /* aliases (เดิมเคยเป็นม่วง–เหลือง) */
  --purple: var(--blue);
  --purple-dark: var(--blue-dark);
  --purple-deep: var(--blue-deep);
  --yellow: var(--red);
  --yellow-dark: var(--red-dark);
  --yellow-soft: var(--blue-soft);
  --green: #2E7D32;
  --green-dark: #1B5E20;
  --orange: #EF6C00;
  --orange-dark: #E65100;
  --teal: #00897B;
  --teal-dark: #00695C;
  --slate: #546E7A;
  --slate-dark: #455A64;
  --indigo: #3949AB;
  --indigo-dark: #283593;
  --bg: #f5f9fc;
  --card: #ffffff;
  --border: #c5d6e8;
  --text: #1a2a3a;
  --muted: #5a6f82;
  --pink: #E53935;
  --shadow: 0 2px 12px rgba(13, 71, 161, 0.12);
  --sidebar-w: 280px;
  /* ขนาดตัวอักษรแบบ care2569 (Sarabun + อ่านง่าย) — html 18px */
  --fs-base: 18px;
  --fs-xs: 0.78rem;   /* ~14px */
  --fs-sm: 0.89rem;   /* ~16px */
  --fs-md: 1rem;      /* 18px */
  --fs-lg: 1.11rem;   /* ~20px */
  --fs-xl: 1.22rem;   /* ~22px */
  --fs-2xl: 1.33rem;  /* ~24px */
  --fs-3xl: 1.56rem;  /* ~28px */
  --fs-4xl: 1.78rem;  /* ~32px */
}

* { box-sizing: border-box; }
html {
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Sarabun', 'TH Sarabun New', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(198, 40, 40, 0.12), transparent 42%),
    radial-gradient(circle at bottom left, rgba(21, 101, 192, 0.14), transparent 45%),
    linear-gradient(180deg, #eef5fb 0%, var(--bg) 40%, #fff5f5 100%);
  min-height: 100vh;
}
h1 { font-size: var(--fs-3xl); line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h2 { font-size: var(--fs-2xl); line-height: 1.3; margin: 0 0 .5em; font-weight: 700; }
h3 { font-size: var(--fs-xl); line-height: 1.35; margin: 0 0 .45em; font-weight: 700; }
h4, h5 { font-size: var(--fs-lg); line-height: 1.4; margin: 0 0 .4em; font-weight: 700; }
p { margin: 0 0 1em; }
small, .text-sm { font-size: var(--fs-sm); }
p, li, td, th, label, input, select, textarea, button, a {
  font-size: inherit;
}

a { color: var(--blue-dark); text-decoration: none; }
img { max-width: 100%; }

/* ===== Layout shell ===== */
body.has-sidebar {
  display: block;
  min-height: 100vh;
}
.app-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.has-sidebar .app-main {
  margin-left: var(--sidebar-w);
  transition: margin-left .25s ease;
}
body.no-sidebar .app-main {
  margin-left: 0;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0D47A1 0%, #1565C0 55%, #1976D2 100%);
  color: #fff;
  box-shadow: 4px 0 24px rgba(13, 71, 161, 0.28);
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.15);
  background: linear-gradient(90deg, rgba(198,40,40,.22), transparent);
}
.sidebar-brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 3px;
  box-shadow: 0 0 0 2px var(--red);
  flex-shrink: 0;
}
.sidebar-brand strong {
  display: block;
  font-size: var(--fs-md);
  line-height: 1.3;
  font-weight: 700;
}
.sidebar-brand span {
  display: block;
  font-size: var(--fs-sm);
  opacity: .9;
  margin-top: 2px;
}
.sidebar-user {
  padding: 14px 16px;
  background: rgba(0,0,0,.15);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-user-name {
  font-weight: 700;
  font-size: var(--fs-md);
}
.sidebar-user-role {
  font-size: var(--fs-sm);
  opacity: .9;
  color: #ffcdd2;
  margin-top: 2px;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 20px;
}
.nav-section {
  font-size: var(--fs-xs);
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .7;
  padding: 14px 12px 6px;
  font-weight: 700;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  color: #fff !important;
  font-weight: 600;
  font-size: var(--fs-md);
  transition: background .15s ease, transform .15s ease;
}
.nav-link:hover {
  background: rgba(255,255,255,.14);
}
.nav-link.active {
  background: var(--red);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(198, 40, 40, 0.4);
}
.nav-ico {
  width: 1.4em;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-foot {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.12);
}
.nav-link.logout {
  color: #ffcdd2 !important;
}
.nav-link.logout:hover {
  background: rgba(211, 47, 47, .35);
  color: #fff !important;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 40, 80, .45);
  z-index: 90;
}

/* ===== Topbar ===== */
.topbar {
  background: linear-gradient(120deg, #0D47A1, #1565C0 55%, #C62828);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
body.has-sidebar .topbar-inner {
  max-width: none;
}
.menu-toggle {
  display: none;
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: var(--fs-xl);
  cursor: pointer;
  flex-shrink: 0;
}
.page-heading {
  font-size: var(--fs-lg);
  font-weight: 700;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #fff;
}
.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
  box-shadow: 0 0 0 2px var(--red);
}
.brand strong { display: block; font-size: var(--fs-lg); line-height: 1.25; font-weight: 700; }
.brand span { display: block; font-size: var(--fs-sm); opacity: .95; }
.topbar-user {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.topbar-user-name {
  font-weight: 600;
  opacity: .95;
}

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 16px 40px;
  flex: 1;
}
body.has-sidebar .container {
  max-width: none;
}

.footer {
  text-align: center;
  padding: 18px 16px 22px;
  background: linear-gradient(90deg, #0D47A1 0%, #1565C0 45%, #C62828 100%);
  border-top: 3px solid #C62828;
}
.footer-visits {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0 auto 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.footer-visits-label,
.footer-visits-unit {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.02em;
}
.footer-visits-digits {
  display: inline-flex;
  gap: 3px;
}
.footer-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  height: 1.7em;
  padding: 0 2px;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0D47A1;
  background: linear-gradient(180deg, #ffffff 0%, #E3F2FD 100%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  box-shadow:
    inset 0 -2px 0 rgba(13, 71, 161, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.18);
  line-height: 1;
}
.footer-dev {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
@media (max-width: 480px) {
  .footer-visits {
    border-radius: 14px;
    gap: 6px 8px;
  }
  .footer-digit {
    font-size: 14px;
    min-width: 1.25em;
    height: 1.6em;
  }
}

/* ===== Point cut modal ===== */
body.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(13, 71, 161, 0.45);
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none !important; }
.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(13, 71, 161, 0.3);
  border-top: 5px solid var(--blue);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, #e3f2fd, #ffebee);
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  margin: 0;
  font-size: var(--fs-xl);
  color: var(--blue-dark);
}
.modal-close {
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--blue-dark);
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.modal-close:hover { background: rgba(21, 101, 192, 0.1); }
.modal-body { padding: 16px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: #f5f9fc;
}

@media (max-width: 960px) {
  body.has-sidebar .app-main {
    margin-left: 0;
  }
  .sidebar {
    transform: translateX(-105%);
    transition: transform .25s ease;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  body.sidebar-open .sidebar-backdrop {
    display: block;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .topbar-user-name {
    display: none;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.stat .num { font-size: var(--fs-3xl); font-weight: 700; color: var(--blue-dark); }
.stat .label { color: var(--muted); font-size: var(--fs-sm); }

/* Admin dashboard stat cards */
.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}
.dash-title {
  margin: 0;
  font-size: var(--fs-2xl);
  color: var(--blue-dark);
}
.dash-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-md);
}
.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.dash-stats-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.dash-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 16px;
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: 0 8px 20px rgba(13, 71, 161, 0.12);
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 108px;
  position: relative;
  overflow: hidden;
}
.dash-card::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.dash-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(13, 71, 161, 0.2);
}
.dash-card-ico {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.2);
  font-size: 1.55rem;
  flex-shrink: 0;
  z-index: 1;
}
.dash-card-body { z-index: 1; min-width: 0; }
.dash-card-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.dash-card-label {
  margin-top: 4px;
  font-size: var(--fs-sm);
  font-weight: 600;
  opacity: .95;
  line-height: 1.3;
}
.dash-card-blue { background: linear-gradient(135deg, #1976D2 0%, #0D47A1 100%); }
.dash-card-navy { background: linear-gradient(135deg, #1565C0 0%, #0A3D91 100%); }
.dash-card-orange { background: linear-gradient(135deg, #FB8C00 0%, #EF6C00 100%); }
.dash-card-teal { background: linear-gradient(135deg, #26A69A 0%, #00897B 100%); }
.dash-card-red { background: linear-gradient(135deg, #E53935 0%, #C62828 100%); }
.dash-card-green { background: linear-gradient(135deg, #43A047 0%, #2E7D32 100%); }

@media (max-width: 1200px) {
  .dash-stats, .dash-stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .dash-stats, .dash-stats-6 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .dash-stats, .dash-stats-6 { grid-template-columns: 1fr; }
}

.badge-ok,
.badge-warn {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 700;
}
.badge-ok { background: #e8f5e9; color: #2e7d32; }
.badge-warn { background: #ffebee; color: #c62828; }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: var(--fs-md);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.4;
}
.btn-sm { padding: 7px 12px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
/* แต่ละประเภทปุ่ม = สีไม่ซ้ำ */
.btn-success { background: var(--green); color: #fff; }          /* บันทึก / เพิ่ม / Excel */
.btn-success:hover { background: var(--green-dark); color: #fff; }
.btn-primary { background: var(--blue); color: #fff; }            /* ค้นหา / ดู / เข้าแถว / รายงาน */
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }              /* ลบ / ตัดคะแนน */
.btn-danger:hover { background: var(--red-dark); color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }          /* มาสาย / PDF มาสาย */
.btn-warning:hover { background: var(--orange-dark); color: #fff; }
.btn-info { background: var(--teal); color: #fff; }               /* พิมพ์ / Print / นำเข้า */
.btn-info:hover { background: var(--teal-dark); color: #fff; }
.btn-dark { background: var(--indigo); color: #fff; }             /* คู่มือ / ประวัติ */
.btn-dark:hover { background: var(--indigo-dark); color: #fff; }
.btn-secondary { background: var(--slate); color: #fff; }         /* ดาวน์โหลด / ยกเลิก / กลับ / ดู */
.btn-secondary:hover { background: var(--slate-dark); color: #fff; }
.btn-outline {
  background: var(--blue-soft);
  border: 1px solid var(--blue);
  color: var(--blue-dark);
}
.btn-outline:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-outline-dark {
  background: #CFD8DC;
  border: 1px solid #90A4AE;
  color: #37474F;
}
.btn-outline-dark:hover {
  background: var(--slate);
  border-color: var(--slate-dark);
  color: #fff;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
label { display: block; margin-bottom: 4px; font-weight: 600; color: #37474f; }
input, select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1.5;
  background: #fff;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: var(--fs-md);
}
table.data th, table.data td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}
table.data th { background: linear-gradient(90deg, #e3f2fd, #ffebee); color: var(--blue-dark); }

/* สรุปรายห้อง — กึ่งกลางทุกคอลัมน์ รวมจำนวนนักเรียน */
table.data.room-summary th,
table.data.room-summary td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
table.data.room-summary .num-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
table.data.room-summary .asm-present { color: #2e7d32; }
table.data.room-summary .asm-absent { color: #c62828; }
table.data.room-summary .asm-leave { color: #00897b; }
table.data.room-summary .asm-late { color: #ef6c00; }
table.data.room-summary .asm-activity { color: #1565c0; }
table.data.room-summary td:last-child {
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}
.dt-container {
  font-family: inherit;
}
.dt-container .dt-length select,
.dt-container .dt-search input {
  width: auto;
  min-width: 80px;
  display: inline-block;
}
.dt-container .dt-search input {
  min-width: 180px;
  margin-left: 8px;
}
.dt-container .dt-info,
.dt-container .dt-search,
.dt-container .dt-length {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 8px;
}
.dt-container .dt-paging .dt-paging-button {
  border-radius: 8px !important;
  border: 1px solid var(--border) !important;
  background: #fff !important;
  color: var(--blue-dark) !important;
  padding: 4px 10px !important;
  margin: 0 2px !important;
}
.dt-container .dt-paging .dt-paging-button.current {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  color: #fff !important;
}
.dt-container .dt-paging .dt-paging-button:hover:not(.current):not(.disabled) {
  background: var(--blue-soft) !important;
}
.dt-container table.data.dataTable th,
.dt-container table.data.dataTable td {
  border: 1px solid var(--border);
}
.dt-container table.data.dataTable thead th {
  background: linear-gradient(90deg, #e3f2fd, #ffebee);
  color: var(--blue-dark);
  white-space: nowrap;
}


.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-weight: 600;
}
.alert-danger { background: #ffebee; color: #b71c1c; border: 1px solid #ffcdd2; }
.alert-success { background: #e3f2fd; color: #0D47A1; border: 1px solid #90caf9; }
.alert-info { background: #e3f2fd; color: #0d47a1; border: 1px solid #bbdefb; }

.login-wrap {
  max-width: 480px;
  margin: 40px auto;
  border-top: 5px solid var(--blue);
  box-shadow: 0 8px 24px rgba(13, 71, 161, 0.15);
}
.login-wrap h1 {
  text-align: center;
  color: var(--blue-dark);
  margin: 0 0 8px;
  font-size: var(--fs-3xl);
}
.login-wrap .sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 18px;
  font-size: var(--fs-md);
}
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.tabs button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--blue-soft);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  cursor: pointer;
}
.tabs button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.hint {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 10px;
}

/* Assembly hybrid UI */
.asm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.asm-actions .btn { min-height: 44px; font-size: var(--fs-md); }
.asm-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.asm-count { font-weight: 700; margin: 8px 0; font-size: var(--fs-md); }
.check-all-box {
  text-align: center;
  margin: 12px 0 16px;
}
.check-square {
  width: 52px;
  height: 52px;
  border: 3px solid var(--red);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  cursor: pointer;
  font-size: var(--fs-2xl);
  color: var(--red);
}
.check-square.on {
  background: #e3f2fd;
  border-color: var(--blue);
  color: var(--blue);
}
.student-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.st-card {
  border: 1px solid #90caf9;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  text-align: center;
}
.st-card .label-top { font-weight: 700; margin-bottom: 4px; font-size: var(--fs-md); }
.st-card select {
  margin: 6px 0;
  text-align: center;
  font-size: var(--fs-sm);
}
.st-card .status-bar {
  background: #9e9e9e;
  color: #fff;
  border-radius: 4px;
  padding: 4px 0;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: var(--fs-sm);
  transition: background .15s ease, color .15s ease;
}
.st-card .photo {
  width: 128px;
  height: 160px;
  margin: 4px auto;
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #eceff1;
}
.st-card .name { font-weight: 700; margin-top: 4px; line-height: 1.3; font-size: var(--fs-sm); }
.st-card .numbox {
  background: #eceff1;
  border-radius: 4px;
  padding: 4px;
  margin: 4px 0 0;
  font-size: var(--fs-sm);
}
.save-fab {
  position: sticky;
  bottom: 10px;
  z-index: 30;
  margin-top: 16px;
}

@media (max-width: 520px) {
  .student-grid { grid-template-columns: 1fr 1fr; }
  .asm-actions { grid-template-columns: 1fr; }
}

/* SweetAlert — standard web scale */
.swal2-popup {
  font-family: 'Sarabun', 'TH Sarabun New', system-ui, sans-serif !important;
  font-size: 1.05rem !important;
}
.swal2-title { font-size: 1.35rem !important; }
.swal2-html-container { font-size: 1.05rem !important; }
.swal2-confirm, .swal2-cancel { font-size: 1rem !important; }

@media (min-width: 900px) {
  .student-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
