/* หน้าเข้าสู่ระบบ + สมัครสมาชิก หน้าบ้าน (2026-11-18) — ใช้ร่วมกัน login.html · register.html */
:root {
  --navy-950: #0b1b4d;
  --navy-900: #12286b;
  --navy-800: #1a3a93;
  --navy: #1b3484;
  --blue: #3462e6;
  --blue-600: #2a52cc;
  --blue-50: #eef3ff;
  --sky: #7fa6ff;
  --ink: #111a33;
  --ink-2: #4a5470;
  --ink-3: #7a839b;
  --line: #e3e8f2;
  --line-2: #d3dbea;
  --paper: #f3f6fc;
  --card: #ffffff;
  --ok: #1f9d60;
  --ok-soft: #e7f6ee;
  --warn: #9a6a00;
  --warn-soft: #fdf6e3;
  --warn-line: #f2e1ad;
  --teal: #12857c;
  --teal-soft: #e5f5f3;
  --amber: #b7791f;
  --amber-soft: #fcf3e2;
  --danger: #c53030;
  --danger-soft: #fdecec;
  --r-field: 14px;
  --r-card: 18px;
  --font: 'Prompt', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── ช่องกรอก ── */
.label { display: block; font-size: 14px; font-weight: 500; color: var(--ink-2); margin: 0 0 8px; }
.label .opt { color: var(--ink-3); font-weight: 400; }
.field {
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-field); background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(52, 98, 230, .12); }
.field.err { border-color: var(--danger); }
.field > .ico { color: var(--ink-3); }
.field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; }
.field input::placeholder { color: #a3abbe; }
.field .eye { display: grid; place-items: center; width: 36px; height: 36px; margin-right: -8px; border: 0; background: none; color: var(--ink-3); border-radius: 10px; }
.field .eye:hover { color: var(--ink-2); background: var(--paper); }
.field .prefix { font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; padding-right: 12px; border-right: 1px solid var(--line); }
.field .prefix small { font-size: 11px; font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.group { margin-bottom: 20px; }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.err-text { font-size: 13px; color: var(--danger); margin-top: 6px; display: none; }
.group.has-err .err-text { display: block; }
.group.has-err .field { border-color: var(--danger); }

/* ── ปุ่ม ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 56px;
  border: 0; border-radius: var(--r-field); background: var(--blue); color: #fff; font-size: 16px; font-weight: 600;
  box-shadow: 0 8px 20px -8px rgba(52, 98, 230, .6); transition: background-color .15s, transform .1s;
}
.btn:hover { background: var(--blue-600); }
.btn:active { transform: scale(.99); }
.btn:disabled { background: #a8b9ea; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn-ghost:hover { background: var(--paper); }
.spin { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--blue); flex: none; cursor: pointer; }
.check a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ── แจ้งเตือนในหน้า ── */
.alert { display: none; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; }
.alert.show { display: flex; }
.alert .ico { margin-top: 1px; }
.alert b { font-weight: 600; display: block; }
.alert.error { background: var(--danger-soft); color: #8f1f1f; }
.alert.warn { background: var(--warn-soft); color: #6b4a00; border: 1px solid var(--warn-line); }
.alert.info { background: var(--blue-50); color: var(--navy-800); }

/* ════════════ หน้าเข้าสู่ระบบ ════════════ */
.lg-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--navy-950); }
.lg-hero {
  position: relative; overflow: hidden; text-align: center; color: #fff;
  padding: calc(48px + env(safe-area-inset-top)) 24px 72px;
  background: radial-gradient(120% 90% at 50% 0%, #2346b4 0%, var(--navy-900) 55%, var(--navy-950) 100%);
}
.lg-hero svg.parcels { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; pointer-events: none; }
.lg-hero > *:not(svg) { position: relative; }
.lg-logo { width: 96px; height: 96px; margin: 0 auto 20px; border-radius: 24px; background: #fff; display: grid; place-items: center; box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .5); }
.lg-logo img { width: 72px; height: 72px; object-fit: contain; }
.lg-name { font-size: 34px; font-weight: 700; letter-spacing: .04em; line-height: 1.1; }
.lg-kicker { margin-top: 8px; font-size: 13px; letter-spacing: .16em; color: #c3d0f5; }
.lg-tag { margin-top: 20px; font-size: 20px; font-weight: 600; }
.lg-tag em { font-style: normal; color: var(--sky); }
.lg-sheet {
  flex: 1; position: relative; margin-top: -32px; background: var(--card);
  border-radius: 28px 28px 0 0; padding: 32px 24px calc(28px + env(safe-area-inset-bottom));
}
.lg-sheet h1 { font-size: 24px; font-weight: 600; }
.lg-sheet .sub { color: var(--ink-3); font-size: 14px; margin: 4px 0 24px; }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 24px; }
.lg-row a { font-size: 14px; font-weight: 500; }
.lg-or { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; color: var(--ink-3); font-size: 13px; }
.lg-or::before, .lg-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.lg-social { display: flex; gap: 12px; }
.lg-social a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border: 1.5px solid var(--line); border-radius: var(--r-field); color: var(--ink); font-weight: 600; text-decoration: none; }
.lg-social a:hover { background: var(--paper); }
.lg-line-badge { display: grid; place-items: center; height: 22px; padding: 0 5px; border-radius: 6px; background: #06c755; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .02em; }
.lg-foot { text-align: center; margin-top: 24px; font-size: 14px; color: var(--ink-2); }
.lg-foot a { font-weight: 600; }

@media (min-width: 720px) {
  .lg-page { align-items: center; justify-content: center; padding: 40px 16px; background: radial-gradient(90% 70% at 50% 0%, #2346b4 0%, var(--navy-900) 50%, var(--navy-950) 100%); }
  .lg-shell { width: 440px; border-radius: 32px; overflow: hidden; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6); position: relative; }
  .lg-hero { padding-top: 48px; background: transparent; }
  .lg-sheet { border-radius: 28px; }
}

/* ════════════ หน้าสมัครสมาชิก ════════════ */
.rg-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--paper); }
.rg-shell { width: 100%; max-width: 520px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; padding: 0 20px; }
.rg-head { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: calc(16px + env(safe-area-inset-top)) 0 12px; }
.rg-bar { display: flex; align-items: center; gap: 16px; }
.rg-back { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); }
.rg-back:hover { background: #fff; border-color: var(--line-2); }
.rg-bar h1 { flex: 1; font-size: 21px; font-weight: 600; }
.rg-step { font-size: 12px; font-weight: 600; color: var(--navy-800); background: #e3eaff; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.rg-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.rg-progress i { height: 4px; border-radius: 4px; background: #dfe5f1; transition: background-color .25s; }
.rg-progress i.on { background: var(--blue); }

.rg-body { flex: 1; padding: 16px 0 24px; }
.rg-title { font-size: 22px; font-weight: 600; }
.rg-sub { color: var(--ink-3); font-size: 14px; margin: 4px 0 20px; }
.rg-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(243, 246, 252, 0), var(--paper) 28%); padding: 20px 0 calc(20px + env(safe-area-inset-bottom)); }
.step { display: none; }
.step.on { display: block; animation: stepIn .25s ease-out; }
@keyframes stepIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .step.on { animation: none; } }

/* การ์ดประเภทบัญชี */
.acct { display: block; position: relative; margin-bottom: 12px; cursor: pointer; }
.acct input { position: absolute; opacity: 0; pointer-events: none; }
.acct-card { display: flex; gap: 14px; padding: 18px 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-card); transition: border-color .15s, box-shadow .15s; }
.acct:hover .acct-card { border-color: var(--line-2); }
.acct input:focus-visible + .acct-card { outline: 2px solid var(--blue); outline-offset: 2px; }
.acct input:checked + .acct-card { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(52, 98, 230, .1); }
.acct-icon { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; }
.acct-icon .ico { width: 24px; height: 24px; }
.acct[data-type="SURVEYOR"] .acct-icon { background: var(--teal-soft); color: var(--teal); }
.acct[data-type="INSPECTOR"] .acct-icon { background: var(--amber-soft); color: var(--amber); }
.acct[data-type="INVESTOR"] .acct-icon { background: #e9eefb; color: var(--navy); }
.acct input:checked + .acct-card .acct-icon { background: var(--navy-950); color: #fff; }
.acct-main { flex: 1; min-width: 0; }
.acct-name { font-size: 17px; font-weight: 600; }
.acct-name small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.acct-desc { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.acct-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.acct-tags span { font-size: 12px; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }
.acct-radio { width: 24px; height: 24px; flex: none; border: 2px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; color: #fff; }
.acct-radio .ico { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.acct input:checked + .acct-card .acct-radio { background: var(--blue); border-color: var(--blue); }
.acct input:checked + .acct-card .acct-radio .ico { opacity: 1; }

.note { display: flex; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: #6b4a00; font-size: 13.5px; margin-top: 8px; }
.note .ico { color: var(--amber); margin-top: 1px; }

/* แถบประเภทที่เลือก */
.picked { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-card); background: var(--navy-950); color: #fff; margin-bottom: 24px; }
.picked .acct-icon { background: rgba(255, 255, 255, .12); color: #fff; width: 44px; height: 44px; }
.picked .k { font-size: 12px; color: #aebbe0; }
.picked .v { font-size: 17px; font-weight: 600; }
.picked .v small { font-weight: 500; color: #cfd8f3; font-size: 15px; }
.picked button { margin-left: auto; border: 0; background: none; color: #c9d6ff; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; padding: 8px; }

/* ความปลอดภัยรหัสผ่าน */
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.pw-meter i { height: 4px; border-radius: 4px; background: #e2e7f0; transition: background-color .2s; }
.pw-label { font-size: 13px; margin-top: 6px; color: var(--ink-3); min-height: 20px; }
.pw-1 i:nth-child(-n+1) { background: var(--danger); }
.pw-2 i:nth-child(-n+2) { background: #d98a1c; }
.pw-3 i:nth-child(-n+3) { background: var(--ok); }
.pw-4 i:nth-child(-n+4) { background: var(--ok); }
.pw-label.l1 { color: var(--danger); }
.pw-label.l2 { color: #a1660f; }
.pw-label.l3, .pw-label.l4 { color: var(--ok); }

/* จังหวัด */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-size: 14px; font-weight: 500; color: var(--ink); }
.chip.on { background: var(--navy-950); border-color: var(--navy-950); color: #fff; }
.chip.on .ico { width: 14px; height: 14px; }
.chip.add { color: var(--ink-2); border-style: dashed; }
.chip:hover:not(.on) { border-color: var(--line-2); }

/* อัปโหลดใบอนุญาต */
.upload { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1.5px dashed var(--line-2); border-radius: var(--r-field); background: var(--card); cursor: pointer; }
.upload:hover { border-color: var(--blue); }
.upload .acct-icon { background: var(--blue-50); color: var(--blue); width: 44px; height: 44px; }
.upload b { display: block; font-weight: 600; font-size: 15px; }
.upload span { font-size: 13px; color: var(--ink-3); }
.upload.done { border-style: solid; border-color: var(--ok); }
.upload.done .acct-icon { background: var(--ok-soft); color: var(--ok); }
.group.has-err .upload { border-color: var(--danger); }

/* หน้าสำเร็จ */
.done-box { text-align: center; padding: 24px 8px 8px; }
.done-mark { width: 80px; height: 80px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.done-mark .ico { width: 40px; height: 40px; stroke-width: 2.25; }
.done-box h2 { font-size: 22px; font-weight: 600; }
.done-box p { color: var(--ink-2); margin-top: 8px; }
.summary { margin-top: 24px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; font-size: 14px; }
.summary div + div { border-top: 1px solid var(--line); }
.summary dt { color: var(--ink-3); }
.summary dd { font-weight: 500; text-align: right; }

/* แผ่นเลือกจังหวัด / นโยบาย */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(11, 27, 77, .45); display: none; align-items: flex-end; justify-content: center; }
.sheet-bg.show { display: flex; }
.sheet { width: 100%; max-width: 520px; max-height: 82vh; display: flex; flex-direction: column; background: var(--card); border-radius: 24px 24px 0 0; padding: 20px 20px calc(16px + env(safe-area-inset-bottom)); animation: sheetUp .25s ease-out; }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h3 { font-size: 18px; font-weight: 600; }
.sheet-head button { border: 0; background: var(--paper); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); }
.sheet .field { height: 48px; margin-bottom: 12px; }
.sheet-list { overflow-y: auto; flex: 1; margin: 0 -8px; }
.sheet-list label { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.sheet-list label:hover { background: var(--paper); }
.sheet-list input { width: 20px; height: 20px; accent-color: var(--blue); }
.sheet-foot { padding-top: 12px; }
.policy { overflow-y: auto; font-size: 14px; color: var(--ink-2); }
.policy h4 { color: var(--ink); font-size: 15px; font-weight: 600; margin: 16px 0 4px; }
.policy h4:first-child { margin-top: 0; }
@media (min-width: 720px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 24px; }
  .rg-head { padding-top: 32px; }
}
