/* สไตล์ระบบรับสมัครอบรม ALL EV Service — ใช้โทนเดียวกับเว็บหน้าร้าน allevservice.app (amber บน navy, Noto Sans Thai) */
:root {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --input-line: #cbd5e1;
  --brand: #f59e0b;
  --brand-dark: #b45309;
  --brand-ink: #1c1917;
  --primary: #0f172a;
  --primary-ink: #ffffff;
  --hero: #0f172a;
  --hero-2: #1e293b;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --bg-alt: #0f172a; --card: #162032; --text: #e2e8f0; --muted: #94a3b8; --line: #253349; --input-line: #334155;
    --brand-dark: #fbbf24; --primary: #f59e0b; --primary-ink: #0f172a; --hero: #0b1220; --hero-2: #162032; --danger: #f87171; --ok: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --bg-alt: #0f172a; --card: #162032; --text: #e2e8f0; --muted: #94a3b8; --line: #253349; --input-line: #334155;
  --brand-dark: #fbbf24; --primary: #f59e0b; --primary-ink: #0f172a; --hero: #0b1220; --hero-2: #162032; --danger: #f87171; --ok: #4ade80;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Noto Sans Thai", "Sarabun", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  font-size: 16px; line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; width: 100%; }
.narrow { max-width: 640px; }
.ok { color: var(--ok); }
.danger-text { color: var(--danger); }

/* ---------- แถบบน / ท้ายหน้า ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; }
.logo-img { display: block; width: auto; height: 48px; }
.logo span { font-size: .95rem; color: var(--muted); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-img { filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); } }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { padding: 8px 10px; border-radius: 8px; text-decoration: none; font-weight: 500; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--bg-alt); }
.footer { border-top: 1px solid var(--line); padding: 28px 0; margin-top: 40px; }
.footer .wrap { display: grid; gap: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
@media (min-width: 760px) { .footer .wrap { grid-template-columns: 1fr auto; align-items: center; } }

/* ---------- ฮีโร่ ---------- */
.hero { background: radial-gradient(900px 400px at 85% -10%, rgba(245, 158, 11, .28), transparent 60%), linear-gradient(160deg, var(--hero), var(--hero-2)); color: #fff; padding: 40px 0 36px; }
.hero .eyebrow { display: inline-block; font-size: .85rem; font-weight: 600; letter-spacing: .04em; color: var(--brand); text-transform: uppercase; margin-bottom: 8px; }
.hero .lead { font-size: 1.05rem; color: rgba(255, 255, 255, .78); max-width: 42rem; margin: 12px 0 0; }
.hero .stats { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 560px; }
.hero .stats li { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 12px; }
.hero .stats strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.hero .stats span { font-size: .85rem; color: rgba(255, 255, 255, .75); }
.hero-img { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); }
.hero-img img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero-grid { display: grid; gap: 24px; }
@media (min-width: 860px) { .hero { padding: 56px 0 48px; } .hero-grid { grid-template-columns: 1.2fr 1fr; align-items: center; gap: 40px; } }

/* ---------- ส่วนทั่วไป ---------- */
.section { padding: 32px 0; }
.section-head { margin-bottom: 16px; }
.section-head p { color: var(--muted); margin: 4px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h2, .card h3 { margin-bottom: 10px; }
.grid { display: grid; gap: 14px; }
.cohort-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cohort { display: flex; flex-direction: column; gap: 8px; }
.cohort .when { font-size: 1.15rem; font-weight: 800; }
.cohort .seats { display: flex; align-items: center; gap: 8px; }
.cohort .price { font-size: 1.3rem; font-weight: 800; }
.cohort .price small { font-weight: 500; color: var(--muted); font-size: .85rem; }
.cohort .price del { color: var(--muted); font-weight: 400; font-size: .95rem; margin-left: 6px; }
.cohort .actions { margin-top: auto; padding-top: 6px; }
.meter { flex: 1; height: 8px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand); }
.meter.full span { background: var(--danger); }
.course-card { display: grid; gap: 14px; padding: 0; overflow: hidden; }
.course-card img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 5 / 4; }
.course-card > div { padding: 0 18px 18px; }
.course-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .92rem; margin: 6px 0 10px; }
@media (min-width: 600px) { .course-card { grid-template-columns: 40% 1fr; align-items: start; } .course-card > div { padding: 18px 18px 18px 0; } }
.topics { margin: 0; padding-left: 1.2rem; }
.topics li { margin-bottom: 4px; }
.prose { white-space: pre-line; }

/* ---------- แกลเลอรี ---------- */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
.gallery a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; transition: transform .25s ease; }
.gallery a:hover img { transform: scale(1.03); }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(4, 1fr); gap: 12px; } .course-card .gallery { gap: 8px; } }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.lg { min-height: 50px; padding: 10px 24px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; padding: 4px 8px; }

/* ---------- ฟอร์ม ---------- */
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
label .opt { font-weight: 400; color: var(--muted); }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--input-line); border-radius: 10px; background: var(--card); color: var(--text);
}
input[type="checkbox"], input[type="radio"] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--brand-dark); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.field { margin-bottom: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .row-3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; margin-bottom: 8px; }
.check input { flex: none; margin-top: 3px; }
.error { color: var(--danger); font-size: .9rem; min-height: 1.4em; margin: 6px 0; }
.help { color: var(--muted); font-size: .85rem; margin: 2px 0 0; }
.attendee { position: relative; border: 1px dashed var(--input-line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: var(--bg-alt); }
.attendee h3 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin: 14px 0 8px; }
.summary { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.summary .total { font-size: 1.2rem; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.inline { display: flex; gap: 8px; align-items: flex-end; }
.inline > * { flex: 1; }
.inline .btn { flex: none; }

/* ---------- ป้าย / ตาราง / แจ้งเตือน ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, var(--card)); color: var(--c); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-alt); font-weight: 600; color: var(--muted); font-size: .85rem; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg-alt); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ok); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 200; box-shadow: var(--shadow); max-width: 90vw; }
.toast.bad { background: var(--danger); }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.timeline li small { grid-column: 1 / -1; color: var(--muted); }
.app-no { font-size: 1.7rem; font-weight: 800; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.status-hero { text-align: center; padding: 20px 16px; }
.qr-box { text-align: center; }
.qr-box img, .qr-box canvas { width: min(280px, 80vw); height: auto; border-radius: 12px; background: #fff; padding: 10px; border: 1px solid var(--line); }
.qr-box .amount { font-size: 1.8rem; font-weight: 800; }
.upload { border: 2px dashed var(--input-line); border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; background: var(--bg-alt); }
.upload:hover { border-color: var(--brand); }
.upload img { max-width: 100%; max-height: 320px; border-radius: 8px; margin-top: 10px; }
.notice { border-left: 4px solid var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.notice.bad { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--card)); }
.notice.good { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--card)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.steps .n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 800; margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---------- หลังบ้าน ---------- */
.login-wrap { max-width: 400px; margin: 10vh auto 0; padding: 16px; }
.admin-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--hero); color: #fff; }
.admin-top .logo-img { height: 38px; }
.admin-top .who { margin-left: auto; font-size: .9rem; color: rgba(255, 255, 255, .8); }
.admin-top .btn { min-height: 36px; padding: 4px 12px; }
.admin-nav { display: flex; gap: 2px; padding: 6px 8px 0; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--line); }
.admin-nav button { min-height: 42px; padding: 6px 12px; border: 0; border-bottom: 3px solid transparent; background: none; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.admin-nav button.active { color: var(--text); border-bottom-color: var(--brand); }
.admin-nav button b { margin-left: 4px; color: var(--danger); }
.page { padding: 14px 12px 40px; max-width: 1400px; margin: 0 auto; width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; flex: 1; }
.toolbar .spacer { flex: 1; }
.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat span { font-size: .85rem; color: var(--muted); }
.two-col { display: grid; gap: 14px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } }
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: var(--bg); width: 100%; max-width: 820px; max-height: 94vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.modal-head h2 { flex: 1; font-size: 1.15rem; }
@media (min-width: 700px) { .modal-bg { align-items: center; padding: 16px; } .modal { border-radius: 16px; } }
.slip-review { display: grid; gap: 14px; }
.slip-review img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: var(--bg-alt); }
@media (min-width: 800px) { .slip-review { grid-template-columns: 1fr 1fr; } }
.checkin-table td label { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.tag { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 6px; background: var(--bg-alt); color: var(--muted); }
.print-only { display: none; }
@media print {
  .topbar, .footer, .btn, .admin-top, .admin-nav, .toolbar { display: none !important; }
  body { background: #fff; color: #000; }
  .print-only { display: block; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:hover { transform: none; } }
