/* =========================================================
   แบบสอบถามวางแผนประกัน — โทนสีเดียวทั้งระบบ อ่านง่าย คอนทราสต์สูง
   สีหลัก: น้ำเงิน #0d5c9e | สุขภาพ: ชมพูเข้ม | ชีวิต: ม่วง | สะสมทรัพย์: เขียว
   ทุกสีผ่านเกณฑ์ WCAG AA (ตัวอักษรขาวบนพื้นสี ≥ 4.5:1)
   ========================================================= */
:root {
  --primary: #0d5c9e;
  --primary-dark: #08406f;
  --primary-soft: #e3f0ff;
  --text: #14213d;
  --text-2: #33415c;
  --bg: #f2f6fb;
  --card: #ffffff;
  --line: #b9c7da;
  --focus: #ffb703;
  --success: #157a3c;
  --danger: #b42318;
  --health: #c8285f;  --health-soft: #ffe4ee;
  --life: #5b3cc4;    --life-soft: #ede7ff;
  --saving: #157a3c;  --saving-soft: #dff5e6;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(20, 33, 61, .08);
  --fs: 18px;
}
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
html.fs-1 { --fs: 21px; }
html.fs-2 { --fs: 24px; }
html.fs--1 { --fs: 16px; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Sarabun', 'Noto Sans Thai', 'Thonburi', 'Leelawadee UI', system-ui, sans-serif;
  font-size: 1rem; line-height: 1.7;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { line-height: 1.35; color: var(--text); margin: .2em 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.12rem; }
a { color: var(--primary); text-underline-offset: 3px; }
small { font-size: .85em; }
.muted { color: var(--text-2); }
.center { text-align: center; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- แถบหัว ---------- */
.topbar { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(0,0,0,.15); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.brand small { display: block; font-weight: 400; font-size: .78rem; opacity: .95; }
.brand .cute-icon { flex: none; background: #fff; border-radius: 50%; }
.tools { display: flex; align-items: center; gap: 8px; }
.fontsize { display: flex; background: rgba(255,255,255,.15); border-radius: 12px; padding: 3px; }
.fontsize button { background: none; border: 0; color: #fff; font: inherit; font-weight: 700; min-width: 40px; min-height: 40px; border-radius: 9px; cursor: pointer; }
.fontsize button:hover, .fontsize button.on { background: #fff; color: var(--primary); }
.btn-qr { background: #fff; color: var(--primary); min-height: 44px; padding: 6px 12px; }
.adminnav { max-width: 1100px; margin: 0 auto; display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.adminnav a { color: #fff; text-decoration: none; padding: 8px 14px; border-radius: 999px; white-space: nowrap; font-weight: 600; background: rgba(255,255,255,.12); }
.adminnav a.on { background: #fff; color: var(--primary); }
.adminnav a.logout { margin-left: auto; background: rgba(0,0,0,.2); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px 120px; }
.is-public .wrap { max-width: 780px; }
.foot { text-align: center; color: var(--text-2); padding: 10px 16px 30px; font-size: .9rem; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
  min-height: 48px; padding: 10px 20px; border-radius: 14px; border: 2px solid transparent;
  transition: transform .12s, box-shadow .12s, background .12s; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #0f5c2d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); border-color: #b8d4f3; }
.btn-lg { min-height: 56px; padding: 12px 26px; font-size: 1.08rem; border-radius: 16px; }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.center { justify-content: center; margin-top: 24px; }

/* ---------- การ์ดและฟอร์ม ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; margin-bottom: 18px; border: 1px solid #dde6f1; }
.sec-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--primary-dark); }
.badge { background: var(--primary); color: #fff; font-size: .82rem; padding: 3px 12px; border-radius: 999px; font-weight: 700; }
.sub { margin-top: 22px; color: var(--primary-dark); border-top: 2px dashed #d3deeb; padding-top: 16px; }
.lead { background: var(--primary-soft); padding: 12px 14px; border-radius: 12px; color: var(--text); }
.field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .field .label, .reveal > label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--text); padding: 0; }
.req { color: var(--danger); }
.hint { color: var(--text-2); font-size: .9rem; margin: 6px 0 0; }
.field-err { color: var(--danger); font-weight: 700; margin: 6px 0 0; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=url], input[type=search], input[type=password], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 52px;
  -webkit-appearance: none; appearance: none;
}
input[type=date] { min-height: 52px; display: block; }
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); outline: 3px solid rgba(13,92,158,.25); outline-offset: 0; }
input.invalid, textarea.invalid { border-color: var(--danger); background: #fff6f5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ปุ่มตัวเลือก (radio / checkbox แบบปุ่ม) */
.choices { display: grid; gap: 10px; }
.choices.cols-2 { grid-template-columns: repeat(2, 1fr); }
.choices.cols-3 { grid-template-columns: repeat(3, 1fr); }
.choices.cols-1 { grid-template-columns: 1fr; }
.choice { position: relative; display: block; cursor: pointer; margin: 0; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: flex; align-items: center; gap: 10px; min-height: 56px; height: 100%;
  padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff;
  font-weight: 600; color: var(--text); transition: all .12s; line-height: 1.35;
}
.choice span::before {
  content: ''; flex: none; width: 24px; height: 24px; border: 2px solid #6b7c96; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: 15px; color: #fff; font-weight: 900;
}
.choice input[type=checkbox] + span::before { border-radius: 7px; }
.choice:hover span { border-color: var(--primary); background: #f6faff; }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); box-shadow: 0 0 0 1px var(--primary) inset; }
.choice input:checked + span::before { content: '✓'; background: var(--primary); border-color: var(--primary); }
.choice input:focus-visible + span { outline: 4px solid var(--focus); outline-offset: 2px; }

.reveal { margin-top: 12px; }
.reveal[hidden] { display: none; }
.sub-input { margin: 8px 0 4px 18px; padding-left: 14px; border-left: 4px solid var(--primary-soft); }
.choice-wrap + .choice-wrap { margin-top: 0; }

/* จำนวน +/- */
.stepper { display: flex; align-items: stretch; max-width: 260px; }
.stepper input { text-align: center; border-radius: 0; font-size: 1.2rem; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.btn-step { flex: none; width: 60px; font: inherit; font-size: 1.6rem; font-weight: 700; border: 2px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; }
.btn-step:first-child { border-radius: 12px 0 0 12px; }
.btn-step:last-child { border-radius: 0 12px 12px 0; }

/* บุตร */
.kids { display: grid; gap: 10px; margin-bottom: 10px; }
.kid-row { display: grid; grid-template-columns: auto 1fr 2fr auto; gap: 10px; align-items: end; background: #f7fafd; border: 2px solid #dde6f1; border-radius: 14px; padding: 10px 12px; }
.kid-row label { font-weight: 600; font-size: .92rem; display: block; }
.kid-no { font-weight: 700; color: var(--primary-dark); align-self: center; }
.btn-x { width: 48px; height: 52px; border-radius: 12px; border: 2px solid #f1c3bf; background: #fff; color: var(--danger); font-size: 1.1rem; cursor: pointer; }

/* BMI */
.bmi:empty { display: none; }
.bmi { background: var(--saving-soft); border-radius: 12px; padding: 10px 14px; font-weight: 700; color: #0f5c2d; }

/* จัดลำดับเป้าหมาย */
.rank-list { display: grid; gap: 10px; margin-bottom: 12px; }
.rank-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  font: inherit; color: var(--text); background: #fff; border: 2px solid var(--line); border-radius: 16px;
  padding: 12px 14px; min-height: 64px; cursor: pointer; transition: all .12s;
}
.rank-item:hover { border-color: var(--primary); }
.rank-no {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  border: 2px dashed #8a9ab3; font-weight: 800; font-size: 1.2rem; color: #fff;
}
.rank-text strong { display: block; line-height: 1.35; }
.rank-text small { display: block; color: var(--text-2); font-size: .88rem; line-height: 1.45; }
.rank-item[aria-pressed=true] { border-color: var(--primary); background: var(--primary-soft); }
.rank-item[aria-pressed=true] .rank-no { background: var(--primary); border: 2px solid var(--primary); }
.rank-item[data-rank="1"] .rank-no { background: #b45309; border-color: #b45309; }

/* ---------- Wizard ---------- */
.steps { position: sticky; top: 64px; z-index: 10; background: var(--bg); padding: 8px 0 6px; margin: 0 -4px 10px; }
.steps ol { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 0; padding: 0 4px; }
.step-tab {
  width: 100%; font: inherit; cursor: pointer; border: 2px solid var(--line); background: #fff; color: var(--text-2);
  border-radius: 14px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 64px;
}
.step-no { display: none; }
.step-ico { font-size: 1.3rem; line-height: 1.2; }
.step-name { font-size: .78rem; font-weight: 700; line-height: 1.2; text-align: center; }
.step-tab.done { border-color: #9cc6ea; background: #f2f8ff; color: var(--primary-dark); }
.step-tab.active { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(13,92,158,.3); }
.progress { height: 8px; background: #d6e1ee; border-radius: 99px; margin: 10px 4px 0; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width .3s; }
.step-status { margin: 4px 4px 0; font-weight: 700; color: var(--primary-dark); font-size: .92rem; }
.wizard-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: rgba(255,255,255,.97);
  border-top: 1px solid #d3deeb; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; justify-content: center; box-shadow: 0 -4px 14px rgba(20,33,61,.08);
}
.wizard-nav .btn { flex: 1; max-width: 360px; }
.js-wizard .sec { display: none; }
.js-wizard .sec.on { display: block; animation: fadeUp .25s ease; }
.sticky-save { position: sticky; bottom: 0; background: rgba(242,246,251,.97); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid #d3deeb; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 6px 4px 14px; }
.hero h1 { color: var(--primary-dark); font-size: 1.7rem; margin-bottom: .2em; }
.hero p { margin: 0; color: var(--text-2); }
.hero-icons { display: flex; justify-content: center; gap: 10px; margin-bottom: 4px; }
.hero-icons .cute-icon:nth-child(2) { transform: translateY(-8px); }
.tag { display: inline-block; padding: 2px 12px; border-radius: 999px; font-weight: 700; color: #fff; margin: 4px 2px; font-size: .92rem; }
.tag-health { background: var(--health); } .tag-life { background: var(--life); } .tag-saving { background: var(--saving); }

/* ---------- ผลลัพธ์ ---------- */
.thanks { text-align: center; }
.thanks h1 { color: var(--primary-dark); }
.result-hero { text-align: center; border-radius: 24px; padding: 22px 16px; margin: 12px 0 18px; color: #fff; }
.result-hero.type-health { background: linear-gradient(160deg, #d9366e, var(--health)); }
.result-hero.type-life { background: linear-gradient(160deg, #6d4bd8, var(--life)); }
.result-hero.type-saving { background: linear-gradient(160deg, #1f9150, var(--saving)); }
.result-hero .cute-icon { background: #fff; border-radius: 50%; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.result-kicker { margin: 10px 0 0; font-weight: 600; font-size: 1.05rem; }
.result-title { color: #fff; font-size: 2rem; margin: 0; }
.result-desc { margin: 4px auto 0; max-width: 520px; }
.bounce { animation: bounce 1.6s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .bounce, .js-wizard .sec.on { animation: none; } }

.type-cards { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
.is-admin aside .type-cards { grid-template-columns: 1fr; }
.type-card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border-top: 8px solid; }
.type-card header { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.type-card h3 { margin: 2px 0; }
.type-card.type-health { border-color: var(--health); } .type-card.type-health h3 { color: var(--health); }
.type-card.type-life { border-color: var(--life); }     .type-card.type-life h3 { color: var(--life); }
.type-card.type-saving { border-color: var(--saving); } .type-card.type-saving h3 { color: var(--saving); }
.rank-pill { font-size: .8rem; font-weight: 700; background: #eef2f7; color: var(--text); padding: 1px 10px; border-radius: 999px; }
.level { display: inline-block; font-size: .85rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.lv-high { background: #157a3c; color: #fff; } .lv-mid { background: #a05a00; color: #fff; } .lv-low { background: #e6ebf2; color: var(--text); }
.meter { height: 14px; background: #e6ebf2; border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; }
.type-health .meter span { background: var(--health); } .type-life .meter span { background: var(--life); } .type-saving .meter span { background: var(--saving); }
.meter-num { margin: 4px 0 6px; font-size: .92rem; }
.reasons { margin: 0; padding-left: 1.2em; font-size: .95rem; }
.reasons li { margin-bottom: 4px; }
.tips { margin-top: 18px; background: #fffaeb; border-color: #f6d98a; }
.tips ul { margin: 0; padding-left: 1.2em; }
.disclaimer { color: var(--text-2); font-size: .9rem; text-align: center; margin-top: 16px; }

/* ---------- แจ้งเตือน ---------- */
.alert { border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; border: 2px solid; }
.alert ul { margin: 6px 0 0; padding-left: 1.2em; font-weight: 400; }
.alert-success { background: #e8f7ee; border-color: #8fd1a8; color: #0f5c2d; }
.alert-error { background: #fdecea; border-color: #f1a9a1; color: #8a1c12; }

/* ---------- Modal QR ---------- */
.modal { position: fixed; inset: 0; background: rgba(10,20,40,.6); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 22px; padding: 22px; width: min(420px, 100%); text-align: center; }
.qr-box { display: inline-block; background: #fff; padding: 14px; border-radius: 16px; border: 3px solid var(--primary-soft); }
.qr-box img, .qr-box canvas { display: block; width: 240px !important; height: 240px !important; }
.qr-url { word-break: break-all; color: var(--text-2); font-size: .88rem; }
.modal .btn-row { justify-content: center; }
.qr-poster { text-align: center; margin: 22px auto; padding: 22px; border: 3px dashed var(--primary); border-radius: 22px; max-width: 460px; }
.qr-poster h2 { color: var(--primary-dark); }
.qr-poster .qr-box img, .qr-poster .qr-box canvas { width: 280px !important; height: 280px !important; }

/* ---------- Admin ---------- */
.login-card { max-width: 460px; margin: 20px auto; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 60px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 50px; border: 0; background: none; font-size: 1.2rem; cursor: pointer; border-radius: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 16px; padding: 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); border: 3px solid transparent; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-weight: 600; }
.stat .cute-icon { margin-bottom: 4px; }
.stat-n { font-size: 1.8rem; font-weight: 800; line-height: 1.1; color: var(--primary-dark); }
.stat.type-health .stat-n { color: var(--health); } .stat.type-life .stat-n { color: var(--life); } .stat.type-saving .stat-n { color: var(--saving); }
.stat.on { border-color: var(--primary); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; }
.toolbar input[type=search] { flex: 1 1 260px; }
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid #e3e9f1; }
.tbl th { background: var(--primary); color: #fff; font-weight: 700; white-space: nowrap; }
.tbl tbody tr:nth-child(even) { background: #f7fafd; }
.tbl .actions { white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 700; color: #fff; background: #6b7c96; font-size: .9rem; white-space: nowrap; }
.pill.type-health { background: var(--health); } .pill.type-life { background: var(--life); } .pill.type-saving { background: var(--saving); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; font-weight: 700; }
.page-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.view-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.view-grid aside { position: sticky; top: 130px; }
.dl { margin: 0; }
.dl-row { display: grid; grid-template-columns: 200px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #d3deeb; }
.dl-row:last-child { border-bottom: 0; }
.dl dt { font-weight: 700; color: var(--text-2); }
.dl dd { margin: 0; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding: 6px 0; }
.goal-ol { margin: 0; padding-left: 1.4em; }
.goal-ol li { padding: 4px 0; }

/* ---------- มือถือ (Android / iOS) ---------- */
@media (max-width: 760px) {
  h1 { font-size: 1.4rem; }
  .brand span { font-size: .95rem; }
  .btn-qr span { display: none; }
  .btn-qr { padding: 6px 10px; }
  .fontsize button { min-width: 36px; }
  .grid-2 { grid-template-columns: 1fr; }
  .choices.cols-3 { grid-template-columns: 1fr; }
  .choices.cols-2 { grid-template-columns: 1fr 1fr; }
  .kid-row { grid-template-columns: 1fr 1fr; }
  .kid-row .kid-no { grid-column: 1 / -1; }
  .kid-row label:nth-of-type(2) { grid-column: 1 / -1; }
  .kid-row .btn-x { grid-column: 1 / -1; width: 100%; height: 44px; }
  .type-cards { grid-template-columns: 1fr; }
  .step-name { font-size: .68rem; }
  .step-ico { font-size: 1.15rem; }
  .steps { top: 60px; }
  .step-tab { min-height: 56px; padding: 4px 2px; border-radius: 12px; }
  .hide-sm { display: none; }
  .hero-icons .cute-icon { width: 62px; height: 62px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .view-grid { grid-template-columns: 1fr; }
  .view-grid aside { position: static; }
  .dl-row { grid-template-columns: 1fr; gap: 0; }
  .adminnav a.logout { margin-left: 0; }
  .card { padding: 18px 14px; }
  /* ตารางเป็นการ์ดบนมือถือ */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-bottom: 6px solid var(--bg); padding: 8px 0; }
  .tbl td { border: 0; padding: 6px 14px; display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
  .tbl td::before { content: attr(data-label); font-weight: 700; color: var(--text-2); }
  .tbl td.actions { display: flex; }
  .tbl td.actions::before { display: none; }
  .sticky-save .btn { flex: 1; }
}
@media (max-width: 380px) {
  .brand span { display: none; }
  .choices.cols-2 { grid-template-columns: 1fr; }
}

/* ---------- พิมพ์ ---------- */
@media print {
  .topbar, .foot, .wizard-nav, .no-print, .page-head, .btn, .sticky-save, .steps { display: none !important; }
  body { background: #fff; font-size: 14px; }
  .card, .type-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .result-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bounce { animation: none; }
  .is-admin .qr-page > :not(.qr-poster) { display: none; }
}
@media (max-width: 760px) { .tbl td > * { justify-self: start; } }

/* วันเกิด พ.ศ. (3 ช่องเลือก) */
.bd-group { display: grid; grid-template-columns: 1fr 2fr 1.4fr; gap: 8px; }
.bd-group select {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%230d5c9e' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 34px; font-weight: 600; cursor: pointer;
}
.bd-group select.invalid { border-color: var(--danger); background-color: #fff6f5; }
@media (max-width: 380px) { .bd-group { grid-template-columns: 1fr 1fr; } .bd-group select#bd_month { grid-column: 1 / -1; order: -1; } }

/* ---------- ตัวแทนผู้สอบถามข้อมูล ---------- */
.agent-box { background: #fff8e6; border: 2px solid #f3d17a; border-radius: 16px; padding: 14px 16px 4px; margin: 6px 0 20px; }
.agent-title { margin: 0 0 10px; font-size: 1.05rem; color: #7a4b00; }
.agent-box select, .agent-filter, #qrAgent {
  width: 100%; font: inherit; font-weight: 600; color: var(--text); min-height: 52px; padding: 10px 40px 10px 14px;
  border: 2px solid var(--line); border-radius: 12px; -webkit-appearance: none; appearance: none; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%230d5c9e' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
}
.agent-filter { width: auto; flex: 0 1 260px; }
.agent-card { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.agent-card > div { display: flex; flex-direction: column; gap: 2px; line-height: 1.4; }
.agent-card strong { font-size: 1.1rem; color: var(--text); }
.agent-card small { color: var(--text-2); }
.agent-phone { font-weight: 600; color: var(--primary-dark); }
.agent-avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; background: #b45309; color: #fff; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; }
.agent-card-result, .agent-inline { background: #fff8e6; border: 2px solid #f3d17a; border-radius: 16px; padding: 12px 16px; }
.agent-card-result { max-width: 520px; margin: 0 auto 14px; }
.agent-card-result .btn { align-self: flex-start; margin-top: 6px; }
.agent-inline { margin-bottom: 16px; }
.qr-agent { font-size: 1.05rem; margin: 12px 0 0; }
.pill.role-admin { background: var(--life); } .pill.role-staff { background: var(--primary); } .pill.role-agent { background: #b45309; }
@media (max-width: 760px) { .agent-filter { flex: 1 1 100%; width: 100%; } }
