:root {
  --red: #EC2E37; --red-dk: #C81E28; --cream: #FFF5F1; --ink: #3a2420; --soft: #9a6b60; --line: #F6D5CC; --tint: #F8DCD3;
  --pend: #F7A6A0; --pale: #FBF3F0; --blush: #FFF0EC; --new: #FF8A5B;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 17px/1.5 'Prompt', 'Noto Sans Thai', system-ui, sans-serif; }
#app { max-width: 520px; margin: 0 auto; padding-bottom: 40px; min-height: 100vh; }
a { color: var(--red); }
.muted { color: var(--soft); }
.small { font-size: 14px; }
.top { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.top img { height: 34px; display: block; }
.top .sm { height: 28px; }
.pill { font-size: 14px; background: #fff; border-radius: 99px; padding: 5px 12px; color: var(--red); border: 1px solid var(--line); white-space: nowrap; }
.pill.off { color: var(--soft); }
.back { font-size: 15px; color: var(--soft); display: inline-flex; align-items: center; gap: 4px; background: #fff; border-radius: 99px; padding: 7px 14px;
  border: 1px solid var(--line); text-decoration: none; }
.card { background: #fff; border-radius: 22px; padding: 16px; margin: 0 14px 14px; border: 1px solid var(--line); }
.hero { text-align: center; padding: 22px 16px; }
.num { font-size: 68px; font-weight: 600; color: var(--red); line-height: 1.05; font-variant-numeric: tabular-nums; }
.btn { display: flex; gap: 8px; justify-content: center; align-items: center; background: var(--red); color: #fff; border-radius: 99px; padding: 14px; min-height: 52px;
  font: inherit; font-size: 18px; font-weight: 500; border: 0; width: 100%; cursor: pointer; text-decoration: none; transition: transform .15s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.ghost { background: #fff; color: var(--red); border: 1.5px solid var(--line); }
.btn .cnt-in { background: #fff; color: var(--red); border-radius: 99px; padding: 0 9px; font-size: 14px; }
.sec { font-size: 13px; color: var(--red); font-weight: 500; letter-spacing: .3px; }
h1 { font-size: 21px; font-weight: 600; margin: 0 0 2px; line-height: 1.35; }
h3 { margin: 2px 0 10px; font-size: 19px; font-weight: 600; }
.q { font-size: 17px; font-weight: 500; margin: 16px 0 8px; }
.q i, .req { color: var(--red); font-style: normal; }
.hint { font-size: 13px; color: var(--soft); font-weight: 400; }
input, textarea, select { width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 17px; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--red); }
select { appearance: none; -webkit-appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a6b60' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 38px; }
.err { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(236, 46, 55, .15); }
.err-msg { color: var(--red); font-size: 14px; margin-top: 6px; }
.notice { border-radius: 16px; padding: 12px 14px; margin: 0 14px 14px; font-size: 16px; background: var(--blush); color: var(--red-dk); display: flex; gap: 8px; align-items: flex-start; }
.notice.grey { background: #f3efee; color: var(--soft); }
.notice i { font-size: 20px; margin-top: 1px; }
.loading { text-align: center; color: var(--soft); padding: 80px 20px; }
.loading::before { content: ''; display: block; width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid var(--tint); border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { font-size: 13px; color: var(--soft); text-align: center; margin-top: 8px; }
.av { width: 44px; height: 44px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; font-size: 17px; }
.mini { width: 32px; height: 32px; font-size: 13px; }

/* แดชบอร์ด: อันดับกอง */
.rank { padding: 4px 18px 10px; }
.rrow { margin: 13px 0; cursor: pointer; transition: opacity .4s; }
.rrow:active { opacity: .7; }
.rh { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 6px; }
.rh .nm { display: flex; align-items: center; min-width: 0; }
.rh .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rh .go { color: var(--soft); font-size: 16px; margin-left: 2px; }
.rk { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-size: 12px; margin-right: 8px; background: var(--tint); color: var(--red); flex: none; }
.top3 .rk { background: var(--red); color: #fff; }
.zero { opacity: .45; }
.zero .rk { background: #eee; color: #aaa; }
.bar { height: 12px; background: var(--tint); border-radius: 99px; overflow: hidden; display: flex; }
.bar > div { height: 100%; width: 0; transition: width 1.4s cubic-bezier(.2, .8, .2, 1); }
.bar .a { background: var(--red); }
.bar .p { background: var(--pend); }
.bar .n { background: var(--new); }
.lg { display: flex; gap: 14px; font-size: 13px; color: var(--soft); margin-top: 4px; flex-wrap: wrap; }
.lg i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }
.empty { text-align: center; padding: 18px 10px 4px; color: var(--soft); }
.empty b { color: var(--red); font-weight: 500; }

/* แผ่นล่าง (bottom sheet) */
#dim { position: fixed; inset: 0; background: rgba(58, 36, 32, .35); z-index: 20; opacity: 0; transition: opacity .25s; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 520px; height: 86vh; height: 86dvh; background: var(--cream); border-radius: 26px 26px 0 0;
  z-index: 21; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.sheet-on #dim { opacity: 1; }
.sheet-on #sheet { transform: none; }
.grab { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 10px auto 4px; flex: none; }
.sh-head { display: flex; align-items: center; gap: 10px; padding: 6px 16px 12px; min-height: 56px; flex: none; }
.sh-head h2 { margin: 0; font-size: 21px; font-weight: 600; flex: 1; line-height: 1.3; }
.icb { width: 42px; height: 42px; border-radius: 50%; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 20px;
  color: var(--ink); cursor: pointer; flex: none; padding: 0; }
.icb.red { color: var(--red); }
.sbox { flex: 1; display: none; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--red); border-radius: 99px; padding: 8px 14px; }
.sbox input { border: 0; padding: 0; font-size: 16px; flex: 1; min-width: 0; background: transparent; box-shadow: none; }
.searching h2, .searching #sbtn { display: none; }
.searching .sbox { display: flex; }
.sh-body { flex: 1; overflow-y: auto; padding-bottom: 30px; -webkit-overflow-scrolling: touch; }
.stat { display: flex; gap: 8px; padding: 0 16px 12px; }
.stat div { flex: 1; background: #fff; border-radius: 16px; padding: 10px 12px; border: 1px solid var(--line); }
.stat b { font-size: 26px; display: block; line-height: 1.1; font-weight: 600; }
.stat .ok b { color: var(--red); }
.stat span { font-size: 13px; color: var(--soft); }
.acc { margin: 0 14px 8px; background: #fff; border-radius: 16px; border: 1px solid var(--line); overflow: hidden; }
.acc-h { display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; font-size: 16px; }
.acc-h .nm { flex: 1; font-weight: 500; }
.acc-h .ct { font-size: 14px; color: var(--red); background: var(--blush); border-radius: 99px; padding: 2px 10px; }
.acc-h .ti-chevron-down { transition: transform .25s; color: var(--soft); }
.acc.open .ti-chevron-down { transform: rotate(180deg); }
.acc-b { display: none; }
.acc.open .acc-b { display: block; }
.pp { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid #FBEAE4; font-size: 15px; }
.pp .ti-circle-check-filled { color: var(--red); margin-left: auto; font-size: 20px; flex: none; }
.res { margin: 0 14px 10px; background: #fff; border-radius: 18px; padding: 14px; border: 1px solid var(--line); }
.res-h { display: flex; gap: 12px; align-items: center; }
.stt { margin-top: 12px; display: flex; align-items: center; gap: 8px; border-radius: 12px; padding: 10px 12px; font-weight: 500; font-size: 15.5px; background: var(--blush); color: var(--red); }
.stt.ok { background: var(--red); color: #fff; }
.stt.contact { background: #f3efee; color: var(--soft); font-weight: 400; }

/* ใบสมัคร */
.hits { margin-top: 8px; }
.hit { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; cursor: pointer; }
.hit:hover, .hit:active { background: var(--pale); }
.me { display: flex; gap: 12px; align-items: center; background: var(--blush); border-radius: 16px; padding: 12px; margin-top: 10px; }
.me .x { margin-left: auto; color: var(--soft); font-size: 14px; cursor: pointer; white-space: nowrap; background: none; border: 0; font: inherit; }
.lk { color: var(--red); font-size: 15px; margin-top: 12px; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; background: none; border: 0; font-family: inherit; padding: 4px 0; }
.li, .tl { cursor: pointer; user-select: none; -webkit-user-select: none; transition: all .18s ease; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 8px 0; border-radius: 16px; background: var(--pale); font-size: 16px; border: 0; width: 100%; text-align: left; font-family: inherit; color: inherit; }
.li .ic { width: 38px; height: 38px; border-radius: 12px; background: #fff; color: var(--red); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; transition: all .18s; }
.li .tx { flex: 1; line-height: 1.35; }
.ck { width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none;
  transform: scale(0); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.on .ck { transform: scale(1); }
.li.on { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(236, 46, 55, .28); }
.li.on .ic { background: rgba(255, 255, 255, .2); color: #fff; }
.li.on .ck { background: #fff; color: var(--red); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tl { position: relative; background: var(--pale); border-radius: 18px; padding: 16px 12px 14px; font-size: 15px; font-weight: 500; display: flex; flex-direction: column; gap: 8px;
  border: 2px solid transparent; text-align: left; font-family: inherit; color: inherit; }
.tl > i { font-size: 26px; color: var(--red); }
.tl .ck { position: absolute; top: 10px; right: 10px; }
.tl.on { background: #fff; border-color: var(--red); box-shadow: 0 6px 16px rgba(236, 46, 55, .18); }
.li:active, .tl:active, .cf:active { transform: scale(.97); }
.group.err { border-radius: 18px; box-shadow: 0 0 0 3px rgba(236, 46, 55, .25); }
.cf { border: 2px solid var(--line); border-radius: 18px; padding: 14px; margin: 10px 0; cursor: pointer; transition: all .2s; user-select: none; -webkit-user-select: none; }
.cf p { margin: 0 0 12px; font-size: 16px; line-height: 1.6; }
.cf .ans { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 99px; padding: 11px; font-size: 17px; background: var(--pale); transition: all .2s; }
.cf .ans em { font-style: normal; font-weight: 600; color: var(--red); font-size: 21px; }
.cf .bx { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; color: transparent; }
.cf.on { border-color: var(--red); box-shadow: 0 6px 16px rgba(236, 46, 55, .15); }
.cf.on .ans { background: var(--red); color: #fff; }
.cf.on .ans em { color: #fff; }
.cf.on .bx { background: #fff; border-color: #fff; color: var(--red); }
.cf.err { border-color: var(--red); }
.steps { padding: 6px 4px; text-align: left; }
.st { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.st:last-child { padding-bottom: 0; }
.st:not(:last-child)::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 2px; background: var(--line); }
.st.done:not(:last-child)::before { background: var(--red); }
.sd { width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 19px; background: #fff; border: 2px solid var(--line); color: var(--soft); }
.done .sd { background: var(--red); border-color: var(--red); color: #fff; }
.wait .sd { background: var(--blush); border-color: var(--red); color: var(--red); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(236, 46, 55, .35); } 70% { box-shadow: 0 0 0 12px rgba(236, 46, 55, 0); } 100% { box-shadow: 0 0 0 0 rgba(236, 46, 55, 0); } }
.st b { font-size: 17px; font-weight: 500; display: block; margin-top: 5px; }
.st small { font-size: 14px; color: var(--soft); }
.wait b { color: var(--red); }

/* หน้ากอง */
.drow { margin: 14px 0; transition: opacity .3s; }
.drh { display: flex; justify-content: space-between; gap: 8px; font-size: 15.5px; margin-bottom: 6px; }
.drh b { font-size: 16px; font-weight: 600; }
.sbar { height: 14px; }
.sumline { font-size: 14.5px; margin-top: 4px; }
.sumline .ok { color: var(--red); }
.sumline .nn { color: #b9a9a5; }
.btns { padding: 0 14px; display: grid; gap: 10px; }

/* หน้าพิจารณา */
.who { display: flex; align-items: center; gap: 10px; margin: 0 14px 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; font-size: 15px; }
.who > i { font-size: 22px; color: var(--red); }
.who button { margin-left: auto; color: var(--red); font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; padding: 4px; }
.tabs { display: flex; margin: 0 14px 10px; background: #fff; border-radius: 99px; padding: 4px; border: 1px solid var(--line); }
.tab { flex: 1; text-align: center; padding: 9px 0; border-radius: 99px; font-size: 14.5px; cursor: pointer; border: 0; background: none; font-family: inherit; color: inherit; }
.tab.on { background: var(--red); color: #fff; font-weight: 500; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 8px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: 14px; cursor: pointer; font-family: inherit; color: inherit; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ap { background: #fff; border-radius: 20px; margin: 0 14px 12px; padding: 14px; border: 1px solid var(--line); transition: opacity .3s; }
.ap-h { display: flex; gap: 12px; align-items: center; }
.ap-h .nm { font-weight: 500; font-size: 16.5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; background: var(--pale); border-radius: 99px; padding: 3px 10px; margin: 8px 4px 0 0; }
.tag i { color: var(--red); }
.tag.typed { background: #FFF6D6; color: #8a6400; }
.why { font-size: 15px; background: var(--cream); border-radius: 12px; padding: 9px 12px; margin-top: 10px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ct2 { display: flex; gap: 8px; margin-top: 10px; }
.ct2 a { flex: 1; display: flex; gap: 6px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; padding: 9px; font-size: 14.5px; color: var(--ink);
  text-decoration: none; min-width: 0; overflow: hidden; white-space: nowrap; }
.ct2 .ti-brand-line { color: #06C755; font-size: 18px; }
.ct2 .ti-phone { color: var(--red); font-size: 18px; }
.dec { display: flex; gap: 8px; margin-top: 12px; }
.dec button { flex: 1; border-radius: 99px; padding: 12px; min-height: 48px; font: inherit; font-size: 16px; font-weight: 500; cursor: pointer; display: flex; gap: 6px; justify-content: center; align-items: center; }
.yes { background: var(--red); color: #fff; border: 0; }
.no { background: #fff; color: var(--soft); border: 1.5px solid var(--line); }
.by { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 14px; border-radius: 12px; padding: 9px 12px; background: var(--blush); color: var(--red); }
.by.rej { background: #f3efee; color: var(--soft); }
.by span { flex: 1; }
.by button { font: inherit; font-size: 13px; color: var(--soft); background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 4px; }

/* modal / toast */
#modal { position: fixed; inset: 0; background: rgba(58, 36, 32, .4); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
#modal .box { background: var(--cream); width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 20px 18px 28px; animation: up .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
#modal h3 { margin-top: 0; }
#modal .row2 { display: flex; gap: 10px; margin-top: 14px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 16px;
  opacity: 0; transition: all .25s; z-index: 60; max-width: 90vw; text-align: center; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red-dk); }

input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
