:root {
  --color-primary: #b3202c;
  --color-primary-dark: #7a1620;
  --color-accent: #f2a900;
  --color-navy: #16233f;
  --color-bg: #faf7f2;
  --color-card: #ffffff;
  --color-text: #262220;
  --color-muted: #6b625c;
  --color-border: #e4dcd2;
  --color-success: #1e7a3c;
  --color-success-bg: #e6f4ea;
  --color-danger: #b3202c;
  --color-danger-bg: #fbe9e9;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(22, 35, 63, 0.08);
  --shadow-lg: 0 18px 40px rgba(22, 35, 63, 0.16);
  --max-width: 1080px;
  --font-head: "Kanit", "Noto Sans Thai", system-ui, sans-serif;
  --font-body: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

h1, h2, h3, .brand, .btn {
  font-family: var(--font-head);
}

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

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header / nav */
.site-header {
  background: var(--color-navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

.site-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 720px) {
  .nav-toggle {
    display: block;
  }
  .site-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    padding-bottom: 12px;
  }
  .site-nav.open {
    display: flex;
  }
  .site-header .container {
    flex-wrap: wrap;
  }
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-navy), var(--color-primary-dark));
  color: #fff;
  padding: 48px 0;
}

.hero .container {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-content {
  flex: 1 1 320px;
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 12px;
}

.hero p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 20px;
}

.hero-logo {
  flex: 0 0 auto;
  width: 140px;
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.15s ease, background 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-navy);
  box-shadow: 0 8px 20px rgba(242, 169, 0, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(242, 169, 0, 0.45);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

/* Outline variant for light backgrounds (form pages, cards) */
.btn-outline-primary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-block {
  width: 100%;
}

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

/* Sections */
section {
  padding: 40px 0;
}

section h2 {
  font-size: 1.5rem;
  margin: 0 0 20px;
  color: var(--color-navy);
  border-left: 6px solid var(--color-primary);
  padding-left: 12px;
}

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid var(--color-border);
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.info-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.info-list .label {
  min-width: 130px;
  font-weight: 700;
  color: var(--color-navy);
}

.badge {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Reward table */
.reward-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.reward-list li {
  display: flex;
  justify-content: space-between;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 16px;
}

/* Bank card */
.bank-card {
  background: var(--color-navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
}

.bank-card .label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

.bank-card .value {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

/* Register choice cards */
.choice-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.choice-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.choice-card h3 {
  color: var(--color-navy);
  margin-top: 0;
}

/* Spacing / text utilities (replace one-off inline styles) */
.mt-sm {
  margin-top: 12px;
}

.mb-md {
  margin-bottom: 20px;
}

.mb-0 {
  margin-bottom: 0;
}

.text-muted {
  color: var(--color-muted);
}

.fw-normal {
  font-weight: 400;
}

/* Forms */
.form-section {
  background: var(--color-card);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  padding: 24px;
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 16px;
}

/* Fieldset grouping inside multi-section forms: reset the browser default
   chrome (border, padding, intrinsic min-width) and match the plain <h3>
   look it replaces so grouped sections don't shift visually. */
.form-fieldset {
  border: none;
  margin: 0 0 24px;
  padding: 0;
  min-width: 0;
}

.form-fieldset legend {
  width: 100%;
  padding: 0;
  margin-bottom: 16px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.17em;
  color: var(--color-text);
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-navy);
  font-size: 0.95rem;
}

.field .hint {
  font-weight: 400;
  color: var(--color-muted);
  font-size: 0.82rem;
}

.required-mark {
  color: var(--color-primary);
  font-weight: 700;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="file"],
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}

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

/* Explicit placeholder color: browser defaults vary in contrast and opacity */
::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

.field-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.field-row-name {
  grid-template-columns: 140px 1fr 1fr;
}

@media (max-width: 560px) {
  .field-row-name {
    grid-template-columns: 1fr;
  }
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Import box (school group) */
.import-box {
  border: 1px solid var(--color-accent);
  background: #fffdf5;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 24px;
}

.import-box h3 {
  margin-top: 0;
  color: var(--color-navy);
}

.import-box p {
  margin: 0;
  color: var(--color-muted);
}

.import-box .btn-row {
  margin-top: 12px;
}

.import-box .btn {
  padding: 10px 18px;
  font-size: 0.95rem;
}

.btn-accent {
  background: var(--color-navy);
  color: #fff;
}

.btn-file {
  background: var(--color-primary);
  color: #fff;
}

/* Compact student grid */
.grid-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.student-grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}

.student-grid thead th {
  background: var(--color-navy);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

.student-grid tbody td {
  padding: 6px 8px;
  border-top: 1px solid var(--color-border);
  vertical-align: middle;
}

.student-grid tbody tr:nth-child(even) {
  background: #fbf8f3;
}

.student-grid .row-index {
  text-align: center;
  color: var(--color-muted);
  font-weight: 700;
  width: 40px;
}

.student-grid input,
.student-grid select {
  padding: 8px 8px;
  font-size: 0.92rem;
  border-radius: 6px;
}

.student-grid .col-prefix {
  width: 110px;
}

.student-grid .col-name {
  min-width: 140px;
}

.student-grid .col-grade {
  width: 130px;
}

.remove-row-btn {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}

/* ---------- Student grid: stacked cards on narrow viewports ----------
   Above 640px the table fits without scrolling (min-width: 640px on
   .student-grid); below it, scrolling a data-entry table sideways per
   row is worse than stacking. Content-driven breakpoint, not a device one. */
@media (max-width: 640px) {
  .grid-wrapper {
    overflow-x: visible;
    border: none;
    border-radius: 0;
    margin-bottom: 16px;
  }

  .student-grid {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .student-grid thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .student-grid tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .student-grid tbody tr.student-row {
    display: flex;
    flex-wrap: wrap;
    align-items: start;
    gap: 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
  }

  .student-grid tbody tr:nth-child(even) {
    background: var(--color-card);
  }

  .student-grid td {
    display: block;
    padding: 0;
    border-top: none;
    min-width: 0;
    flex: 1 1 100%;
  }

  .student-grid td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    color: var(--color-muted);
    margin-bottom: 4px;
  }

  .student-grid .row-index {
    order: 1;
    flex: 1 1 auto;
    width: auto;
    text-align: left;
    align-self: center;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-navy);
  }

  .student-grid .row-index::before {
    content: "นักเรียนคนที่ ";
  }

  .student-grid .col-remove {
    order: 2;
    flex: 0 0 auto;
  }

  .student-grid .col-prefix {
    order: 3;
    flex-basis: 100%;
    width: auto;
  }

  .student-grid .col-firstname {
    order: 4;
    flex-basis: calc(50% - 6px);
  }

  .student-grid .col-lastname {
    order: 5;
    flex-basis: calc(50% - 6px);
  }

  .student-grid .col-grade {
    order: 6;
    flex-basis: 100%;
    width: auto;
  }

  .student-grid input,
  .student-grid select {
    width: 100%;
    padding: 11px 12px;
    font-size: 1rem;
  }
}

.row-count-badge {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.9rem;
  margin-left: 6px;
}

.notice {
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.notice-warning {
  background: #fff4e0;
  border: 1px solid var(--color-accent);
  color: #6b4a00;
}

.notice-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.notice-error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.result-box {
  display: none;
  margin-top: 20px;
}

.result-box.show {
  display: block;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Footer */
.site-footer {
  background: var(--color-navy);
  color: rgba(255, 255, 255, 0.8);
  padding: 28px 0;
  margin-top: 40px;
  font-size: 0.9rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.coordinator-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.step-list {
  padding-left: 20px;
}

.step-list li {
  margin-bottom: 10px;
}

/* =========================================================
   MODERN HOME PAGE
   ========================================================= */

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Section headings */
.home section {
  padding: 56px 0;
}
.section-head {
  margin-bottom: 32px;
}
.eyebrow {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-danger-bg);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.home .section-head h2 {
  border-left: none;
  padding-left: 0;
  margin: 0;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 600;
  color: var(--color-navy);
}

/* ---------- HERO ---------- */
.home .hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(22, 35, 63, 0.72) 0%, rgba(58, 26, 51, 0.68) 55%, rgba(122, 22, 32, 0.72) 100%),
    url("../assets/hero-bg.jpg") center/cover no-repeat;
  padding: 64px 0 44px;
}
.hero-photo-credit {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  z-index: 1;
}
.hero-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-decor .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}
.hero-decor .blob-1 {
  width: 360px;
  height: 360px;
  background: var(--color-accent);
  top: -120px;
  right: -60px;
  opacity: 0.28;
}
.hero-decor .blob-2 {
  width: 300px;
  height: 300px;
  background: var(--color-primary);
  bottom: -80px;
  left: -80px;
  opacity: 0.4;
}
.home .hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
  gap: 32px;
  padding-bottom: 56px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 18px;
}
.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.home .hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  line-height: 1.15;
  margin: 0 0 16px;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero-sub {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  margin: 0 0 26px;
}
.hero-visual {
  display: flex;
  justify-content: center;
}
.logo-halo {
  position: relative;
  display: grid;
  place-items: center;
  padding: 22px;
}
.logo-halo::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 169, 0, 0.35), transparent 65%);
}
.home .hero-logo {
  position: relative;
  width: 210px;
  max-width: 46vw;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.35));
  animation: float 5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* Quick facts */
.quick-facts {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.fact {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 16px 18px;
  backdrop-filter: blur(8px);
}
.fact-icon {
  font-size: 1.7rem;
  line-height: 1;
}
.fact-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}
.fact-value {
  font-family: var(--font-head);
  font-weight: 600;
  color: #fff;
  font-size: 1.02rem;
}
.home > .container:first-of-type {
  padding-top: 44px;
}

/* ---------- Feature cards ---------- */
.feature-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.feature-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-accent);
}
.feature-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  margin-bottom: 16px;
}
.feature-icon svg {
  width: 28px;
  height: 28px;
}
.feature-card h3 {
  margin: 0 0 8px;
  color: var(--color-navy);
  font-weight: 600;
}
.feature-card p {
  margin: 0;
  color: var(--color-muted);
}

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--color-accent), var(--color-border));
}
.timeline-item {
  position: relative;
  display: flex;
  gap: 20px;
  padding-left: 4px;
  margin-bottom: 18px;
}
.timeline-dot {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  box-shadow: 0 0 0 5px var(--color-bg);
  z-index: 1;
}
.timeline-card {
  flex: 1;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.timeline-item.highlight .timeline-dot {
  background: linear-gradient(135deg, var(--color-accent), #d98f00);
}
.timeline-item.highlight .timeline-card {
  border-color: var(--color-accent);
  background: #fffdf5;
}
.timeline-label {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--color-navy);
  margin-bottom: 2px;
}
.timeline-date {
  color: var(--color-text);
}
.timeline-extra {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  color: var(--color-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.timeline-pin {
  flex: 0 0 auto;
  line-height: 1.5;
}
.venue-primary {
  color: var(--color-navy);
  font-weight: 600;
}
.venue-secondary {
  color: var(--color-muted);
}

/* ---------- Payment ---------- */
.pay-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  align-items: start;
}
.pay-info {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.price-tag {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.price-amount {
  font-family: var(--font-head);
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}
.price-unit {
  font-family: var(--font-head);
  font-weight: 500;
  color: var(--color-muted);
}
.home .bank-card {
  position: relative;
  background: linear-gradient(135deg, #1c2c4d, var(--color-navy));
  overflow: hidden;
}
.bank-chip {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-accent), #d98f00);
  color: var(--color-navy);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.3rem;
}
.account-number {
  letter-spacing: 0.04em;
}

/* ---------- Choice cards ---------- */
.home .choice-card {
  position: relative;
  display: block;
  text-align: left;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.home .choice-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}
.choice-num {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--color-accent);
  margin-bottom: 6px;
}
.home .choice-card h3 {
  margin: 0 0 8px;
}
.home .choice-card p {
  color: var(--color-muted);
  margin: 0 0 16px;
}
.choice-cta {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--color-primary);
}

/* ---------- Rewards ---------- */
.reward-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 20px;
}
.reward-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--color-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.reward-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.reward-card.gold { border-top-color: #f2b900; }
.reward-card.silver { border-top-color: #b8c0cc; }
.reward-card.bronze { border-top-color: #cd7f4a; }
.reward-card.merit { border-top-color: var(--color-primary); }
.reward-medal {
  font-size: 2.2rem;
  line-height: 1;
}
.reward-rank {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--color-navy);
}
.reward-amount {
  color: var(--color-muted);
  font-size: 0.92rem;
}

/* ---------- Coordinators ---------- */
.coordinator-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.coordinator-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.coordinator-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-accent);
}
.coordinator-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--color-danger-bg);
  color: var(--color-primary);
}
.coordinator-avatar svg {
  width: 22px;
  height: 22px;
}
.coordinator-name {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--color-navy);
}
.coordinator-phone {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.contact-group-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 24px 0 12px;
}
.contact-group-title:first-of-type {
  margin-top: 4px;
}

/* ---------- Line contact card ---------- */
/* สีเขียว #06C755 เป็นสีแบรนด์จริงของ Line ใช้เฉพาะจุดนี้จุดเดียว — ไม่ใช่สีในพาเลตหลักของเว็บ
   เหมือนกับ "฿" chip สีทองของ .bank-card แต่เปลี่ยนเป็นสีเขียว Line เพราะเป็นบริการภายนอกจริง */
.line-contact-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  background: linear-gradient(135deg, rgba(6, 199, 85, 0.07), rgba(6, 199, 85, 0.01));
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 22px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.line-chip {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #06c755;
  color: #fff;
}
.line-chip svg {
  width: 22px;
  height: 22px;
}
.line-qr-frame {
  flex: 0 0 auto;
  background: #fff;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}
.line-qr-img {
  display: block;
  width: 100px;
  height: 100px;
  border-radius: 6px;
}
.line-contact-body {
  padding-right: 48px;
}
.line-contact-title {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--color-navy);
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.line-contact-sub {
  color: var(--color-muted);
  font-size: 0.95rem;
  max-width: 480px;
}
@media (max-width: 560px) {
  .line-contact-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }
  .line-contact-body {
    padding-right: 0;
  }
  .line-contact-sub {
    max-width: none;
  }
  .line-chip {
    position: static;
    margin-bottom: 4px;
  }
}

/* ---------- CTA band ---------- */
.cta-band {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  padding: 48px 0;
  text-align: center;
  margin-top: 20px;
}
.cta-band h2 {
  color: #fff;
  font-weight: 600;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  margin: 0 0 22px;
}

/* ---------- Home responsive ---------- */
@media (max-width: 860px) {
  .home .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    padding-bottom: 40px;
  }
  .hero-content .btn-row {
    justify-content: center;
  }
  .hero-visual {
    order: -1;
  }
  .home .hero-logo {
    width: 150px;
  }
  .pay-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .quick-facts {
    grid-template-columns: 1fr;
  }
  .home section {
    padding: 40px 0;
  }
}

/* =========================================================
   STATS PAGE
   ========================================================= */

.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 24px 0;
}

.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--color-primary);
  line-height: 1.2;
}

.stat-label {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.stats-section-title {
  margin: 32px 0 16px;
}

.stats-section-title:first-child {
  margin-top: 0;
}

/* Charts */
.chart-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 20px;
}

.chart-card {
  margin-bottom: 20px;
}

.chart-card h3 {
  margin: 0 0 16px;
  color: var(--color-navy);
  font-weight: 600;
  font-size: 1.05rem;
}

.chart-card canvas {
  max-height: 320px;
}

/* legend ที่วาดเองด้วย HTML แทน legend ในตัวของ Chart.js — กันไม่ให้ซ้อนทับกับ
   ไอคอน/ชื่อสาขาที่วาดเองใต้แกน x ของกราฟคะแนนแยกสาขา */
.chart-legend-manual {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--color-navy);
}

.chart-legend-manual span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-swatch {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: #b3202c;
}

.chart-legend-swatch.chart-legend-dash {
  background: repeating-linear-gradient(to right, #6b625c 0, #6b625c 5px, transparent 5px, transparent 9px);
}


/* Score summary row */
.score-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  text-align: center;
}

.score-summary > div {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 10px;
}

.score-value {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--color-navy);
}

.score-label {
  display: block;
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-top: 2px;
}

/* =========================================================
   STATUS BADGE (หน้าตรวจสอบสถานะการสมัครสอบ)
   ========================================================= */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 16px;
}

.status-badge-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.status-badge.pending {
  background: #fff4e0;
  border: 1px solid var(--color-accent);
  color: #6b4a00;
}

.status-badge.complete {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.status-badge.incomplete {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.status-badge.unknown {
  background: #f1efe8;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

/* =========================================================
   MATCH PICKER (ชื่อซ้ำกันหลายคนตอนค้นหา)
   ========================================================= */

.picker-hint {
  margin: 0 0 14px;
  color: var(--color-muted);
}

.match-picker {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.match-picker-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.match-picker-btn:hover,
.match-picker-btn:focus-visible {
  border-color: var(--color-primary);
  background: #fff;
}

/* ชื่อ-นามสกุลคือตัวบอกความแตกต่างหลักเมื่อค้นหาแล้วเจอชื่อซ้ำ (หรือคนละคนที่ชื่อ/นามสกุลใกล้กัน)
   จึงให้เป็นบรรทัดนำ ส่วนโรงเรียน/ชั้น/เวลาสมัครเป็นข้อมูลรองด้านล่าง */
.match-picker-name {
  font-weight: 700;
  color: var(--color-navy);
  font-size: 1rem;
}

.match-picker-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.match-picker-school,
.match-picker-grade {
  color: var(--color-muted);
}

.match-picker-grade::before {
  content: "•";
  margin-right: 10px;
  color: var(--color-border);
}

.match-picker-timestamp {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.match-picker-timestamp::before {
  content: "•";
  margin-right: 10px;
  color: var(--color-border);
}

/* =========================================================
   STATUS PAGE — two-column layout + legend + result card
   ========================================================= */

.status-page-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 800px) {
  .status-page-grid {
    grid-template-columns: 1fr;
  }
}

.status-legend h3 {
  margin: 0 0 16px;
  color: var(--color-navy);
}

.status-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.status-legend-list li {
  display: grid;
  gap: 6px;
}

.status-legend-list p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.status-result-name {
  margin: 0 0 10px;
  color: var(--color-navy);
}

.status-result-meta {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.98rem;
}

.status-result-footer {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* =========================================================
   SEAT NUMBER RESULT CARD
   ========================================================= */

.result-box.accent-left {
  border-left: 5px solid var(--color-primary);
}

.grade-pill {
  display: inline-block;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-navy);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.status-result-school {
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
}

.seat-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.seat-stat {
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.seat-stat-label {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.seat-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.seat-stat.blue {
  background: #e8edfb;
}

.seat-stat.blue .seat-stat-value {
  color: var(--color-navy);
}

.seat-stat.red {
  background: var(--color-danger-bg);
}

.seat-stat.red .seat-stat-value {
  color: var(--color-primary);
}

.seat-stat.green {
  background: var(--color-success-bg);
}

.seat-stat.green .seat-stat-value {
  color: var(--color-success);
}

/* =========================================================
   RESULTS PAGE — score card + comparison stats card
   ========================================================= */

.results-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .results-info-grid {
    grid-template-columns: 1fr;
  }
}

.results-info-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.results-info-label {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.results-info-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-navy);
}

.results-info-box-meta {
  text-align: left;
  color: var(--color-navy);
  font-weight: 600;
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

.results-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .results-bottom-grid {
    grid-template-columns: 1fr;
  }
}

.results-score-card {
  background: var(--color-success-bg);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.results-score-item {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.results-score-label {
  font-size: 0.85rem;
  color: var(--color-success);
  font-weight: 700;
  margin-bottom: 4px;
}

.results-score-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-navy);
}

.results-score-value-small {
  font-size: 1.1rem;
}

.results-score-sub {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.results-stat-card {
  border: 2px solid #b3a4e8;
  border-radius: 14px;
  padding: 18px;
}

.results-stat-title {
  text-align: center;
  font-weight: 700;
  color: #5b4b9e;
  margin-bottom: 12px;
}

.results-toggle-row {
  display: flex;
  gap: 6px;
  background: var(--color-bg);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 14px;
}

.results-toggle-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.results-toggle-btn.active {
  background: var(--color-navy);
  color: #fff;
}

.results-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.results-stat-box {
  background: #f3eefc;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.results-stat-label {
  font-size: 0.82rem;
  color: #5b4b9e;
  margin-bottom: 4px;
}

.results-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-navy);
}

.results-stat-note {
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: var(--color-muted);
  text-align: center;
}

.results-stat-empty {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  text-align: center;
}
