/* TG95 · The Great 95 — สีและตัวอักษรหลักของเว็บ */
:root {
  --navy: #0B1D3F;
  --navy-2: #1C2F5E;
  --navy-line: #2A3D6B;
  --gold: #C4A062;
  --gold-text: #7C5A1E;
  --gold-soft: #E8D3A6;
  --ivory: #F6F2E8;
  --paper: #FCFCF8;
  --white: #FFFFFF;
  --line: #E6DFCF;
  --line-2: #EFE9DC;
  --border: #D5CCB8;
  --ink: #16203A;
  --muted: #525B6E;
  --on-navy: #E9E4D6;
  --on-navy-muted: #BFC6D6;
  --ok-bg: #E7EFE6; --ok: #2F5A34;
  --warn-bg: #F6E7E2; --warn: #8A3320;
  --serif: "Noto Serif Thai", Georgia, serif;
  --sans: "IBM Plex Sans Thai", system-ui, sans-serif;
  --r: 14px;
  --wrap: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); }
a:hover { color: var(--navy-2); }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); margin: 0; line-height: 1.3; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1 1 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 13px; letter-spacing: .12em; color: var(--gold-text); font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ปุ่ม */
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer; background: none;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-primary svg { color: var(--gold); }
.btn-outline { border-color: var(--navy); color: var(--navy); background: var(--white); }
.btn-soft { border-color: var(--border); color: var(--navy); background: var(--white); font-weight: 500; font-size: 15px; min-height: 44px; }
.btn-danger { border-color: #E3C2B8; color: var(--warn); background: var(--white); font-weight: 500; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: wait; }

/* ส่วนหัว */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.logo { width: 104px; height: 52px; object-fit: cover; object-position: center 42%; }
.nav { display: none; gap: 32px; align-items: center; }
.nav a { text-decoration: none; }

/* Hero */
.hero { padding: 28px 0 32px; }
.hero .wrap { display: flex; flex-direction: column; gap: 20px; }
.hero h1 { font-size: 34px; font-weight: 700; }
.tagline-en { font-family: var(--serif); font-style: italic; color: var(--gold-text); }
.hero p.lead { font-size: 16px; line-height: 1.7; color: var(--muted); }
.hero-img { width: 100%; aspect-ratio: 5/4; object-fit: cover; border-radius: 16px; border: 1px solid var(--line); }
.hero-cta { display: flex; gap: 12px; margin-top: 20px; }
.hero-cta .btn { min-height: 52px; padding: 0 22px 0 28px; }
.hero-cta .btn svg { transition: transform .2s; }
.hero-cta .btn:hover svg { transform: translateY(3px); }

/* ตัวเลขสรุป */
.stats-card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 10px 26px rgba(11,29,63,.06); }
.stats-head { padding: 12px 16px; background: var(--navy); color: #fff; display: flex; flex-direction: column; gap: 2px; }
.stats-head b { font-weight: 600; font-size: 15px; }
.stats-head span { font-size: 12px; color: var(--gold-soft); }
.stats-grid { padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.stat-label { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.35; color: var(--muted); }
.stat-label svg { width: 26px; height: 26px; flex-shrink: 0; color: var(--gold-text); }
.stat-label b { display: block; color: var(--ink); font-weight: 600; }
.stat-num { font-family: var(--serif); color: var(--navy); display: flex; align-items: baseline; gap: 4px; }
.stat-num strong { font-size: 30px; line-height: 1; }
.stat-num span { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stat.feature { grid-column: span 2; background: var(--navy); border: none; flex-direction: row; justify-content: space-between; align-items: center; }
.stat.feature .stat-label { color: var(--on-navy-muted); }
.stat.feature .stat-label b { color: #fff; }
.stat.feature .stat-label svg { color: var(--gold); }
.stat.feature .stat-num strong, .stat.feature .stat-num span { color: var(--gold); font-family: var(--serif); }

/* ส่วนต่าง ๆ */
.section { padding: 48px 0 0; }
.section-alt { margin-top: 48px; padding: 40px 0; background: var(--ivory); }
.section-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.section-head h2 { font-size: 26px; font-weight: 700; }

/* หัวหน้าทีม */
.leader { background: var(--white); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.leader-photo { position: relative; background: #FAFAFA; }
.leader-photo img { width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: center top; }
.mdrt-badge { position: absolute; left: 16px; bottom: 16px; padding: 10px 14px; border-radius: 12px; background: var(--gold); color: var(--navy); }
.mdrt-badge b { display: block; font-family: var(--serif); font-size: 20px; letter-spacing: .06em; }
.mdrt-badge span { font-size: 13px; font-weight: 600; }
.leader-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.leader-name { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--navy); }

/* การ์ดตัวแทน */
.agent-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.agent-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.agent-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(11,29,63,.08); color: var(--ink); }
.agent-card .ph { position: relative; background: #FAFAFA; }
.agent-card .ph img { width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: center top; }
.agent-card .ph .initials { aspect-ratio: 4/5; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 40px; color: var(--gold-text); background: var(--ivory); }
.chip-mdrt { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 6px; background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.agent-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.agent-card .nm { font-size: 15px; font-weight: 600; color: var(--navy); line-height: 1.4; }
.agent-card .meta { font-size: 12px; color: var(--muted); }
/* ป้ายผู้แนะนำการลงทุน — ใช้กรอบน้ำเงินให้ต่างจาก badge คุณวุฒิสีทอง */
.tag-ic { align-self: flex-start; display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--navy); color: var(--navy); font-size: 12px; font-weight: 600; line-height: 1.5; }

/* ตัวกรอง + แบบประกัน */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pill { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--white); color: var(--navy); font-size: 14px; cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.product-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.product { padding: 16px; border-radius: var(--r); background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; justify-content: space-between; }
.product .cat { font-size: 12px; font-weight: 600; color: var(--gold-text); }
.product .nm { font-size: 17px; font-weight: 600; color: var(--navy); }
.product .ds { font-size: 14px; color: var(--muted); line-height: 1.5; }
.product .btn { align-self: flex-start; }
.fine { margin-top: 16px; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* ขั้นตอนการดูแล */
.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.step-no { width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; border: 1.5px solid var(--gold); color: var(--gold-text); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 17px; }
.step b { display: block; color: var(--navy); font-size: 16px; }
.step p { font-size: 14px; color: var(--muted); }

/* แกลเลอรี 1:1 */
.carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.carousel figure { margin: 0; flex: 0 0 78%; scroll-snap-align: start; position: relative; }
.carousel img, .tile img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--r); background: var(--ivory); }
.carousel figcaption { position: absolute; left: 10px; top: 10px; padding: 3px 8px; border-radius: 6px; background: rgba(11,29,63,.8); color: #fff; font-size: 12px; }
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; }
.tile button.x { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border-radius: 18px; border: none; background: rgba(11,29,63,.78); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tile .flag { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 6px; font-size: 11px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.empty { padding: 24px; border-radius: var(--r); background: var(--ivory); border: 1px dashed #C9BC9E; color: var(--gold-text); text-align: center; font-size: 14px; }

/* CTA + footer */
.cta { margin-top: 40px; padding: 24px 20px; border-radius: 20px; background: var(--ivory); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.cta h2 { font-size: 22px; }
.cta .btns { display: flex; flex-direction: column; gap: 10px; }
.site-footer { margin-top: 48px; padding: 32px 0 120px; background: var(--navy); color: var(--on-navy-muted); }
.site-footer .wrap { display: flex; flex-direction: column; gap: 12px; }
.site-footer .brand { font-family: var(--serif); font-size: 22px; font-weight: 700; color: #fff; letter-spacing: .04em; }
.site-footer .th { color: var(--gold); font-size: 14px; }
.site-footer p { font-size: 12px; line-height: 1.7; }
.site-footer a { color: #fff; font-size: 13px; }

/* แถบติดต่อติดล่างจอ (มือถือ) */
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(11,29,63,.08); display: flex; gap: 10px; }
.sticky-cta .btn-primary { flex: 1; }
.sticky-cta .btn-outline { min-width: 52px; padding: 0 14px; }

/* หน้าโปรไฟล์ */
.p-hero { position: relative; background: #FAFAFA; }
.p-hero img { width: 100%; max-height: 520px; aspect-ratio: 4/5; object-fit: cover; object-position: center top; }
.p-card { margin: -48px 16px 0; position: relative; padding: 20px; border-radius: 20px; background: var(--white); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(11,29,63,.08); display: flex; flex-direction: column; gap: 14px; }
.p-card h1 { font-size: 26px; font-weight: 700; }
.mdrt-bar { padding: 12px 14px; border-radius: 12px; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mdrt-bar b { font-family: var(--serif); font-size: 22px; letter-spacing: .06em; }
.mdrt-years { display: flex; gap: 4px; flex-wrap: wrap; }
.mdrt-years span { padding: 3px 6px; border-radius: 6px; background: var(--navy); color: var(--gold-soft); font-size: 12px; font-weight: 600; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; color: var(--navy); text-align: right; }
.p-section { padding: 32px 0 0; display: flex; flex-direction: column; gap: 12px; }
.p-section h2 { font-size: 20px; }
.bio { font-size: 15px; line-height: 1.75; color: var(--muted); white-space: pre-line; }
.timeline { display: flex; flex-direction: column; padding-left: 6px; }
.tl { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 14px; }
.tl-dot { width: 12px; height: 12px; margin-top: 5px; border-radius: 6px; background: var(--gold); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--gold); }
.tl-line { flex: 1; width: 1px; background: var(--line); }
.tl-body { padding-bottom: 20px; }
.tl-body small { display: block; font-size: 13px; font-weight: 600; color: var(--gold-text); }
.tl-body b { color: var(--navy); font-weight: 600; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { padding: 8px 14px; border-radius: 18px; background: var(--ivory); border: 1px solid var(--line); font-size: 14px; color: var(--navy); }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--ivory); }
.tabs button { min-height: 44px; border: none; border-radius: 9px; background: transparent; color: var(--navy); font-size: 15px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--navy); color: #fff; font-weight: 600; }

/* ฟอร์ม (หลังบ้าน) */
.app-header { height: 60px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.app-header b { font-family: var(--serif); font-size: 18px; }
.app-header a, .app-header button { color: var(--gold-soft); font-size: 14px; background: none; border: none; min-height: 44px; cursor: pointer; text-decoration: none; }
.app-body { background: var(--ivory); min-height: 100vh; }
.app-main { max-width: 640px; margin: 0 auto; padding: 16px 16px 140px; display: flex; flex-direction: column; gap: 14px; }
.panel { padding: 18px; border-radius: 16px; background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.panel h2 { font-family: var(--sans); font-size: 16px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select { min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--white); font-size: 15px; color: var(--ink); width: 100%; }
.field textarea { resize: vertical; min-height: 110px; }
.field input[readonly] { background: var(--ivory); color: var(--muted); border-color: var(--line); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { min-height: 44px; display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--ink); }
.check input { width: 20px; height: 20px; accent-color: var(--navy); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-gold { min-height: 36px; padding: 0 6px 0 12px; border-radius: 8px; background: var(--gold); color: var(--navy); display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; }
.chip-gold button { width: 30px; height: 30px; border: none; background: none; color: var(--navy); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.list-item { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list-item .grow { display: flex; flex-direction: column; min-width: 0; }
.list-item small { color: var(--gold-text); font-weight: 600; font-size: 12px; }
.dropzone { min-height: 120px; border-radius: 14px; border: 1.5px dashed var(--gold); background: var(--paper); color: var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-align: center; padding: 12px; }
.dropzone svg { color: var(--gold-text); }
.dropzone b { font-size: 15px; }
.warn-note { font-size: 13px; line-height: 1.5; color: var(--gold-text); }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); }
.savebar .inner { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.savebar .btn { width: 100%; }
.savebar .hint { text-align: center; font-size: 12px; }

/* หน้า login */
.login { min-height: 100vh; max-width: 420px; margin: 0 auto; padding: 56px 24px 32px; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.login .logo-big { width: 240px; height: 240px; object-fit: cover; }
.btn-google { width: 100%; min-height: 56px; border-radius: 12px; background: var(--white); border: 1px solid var(--border); color: var(--ink); font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; }
.note { width: 100%; padding: 14px 16px; border-radius: 12px; background: var(--ivory); font-size: 13px; line-height: 1.6; color: var(--muted); text-align: left; }
.note.error { background: var(--warn-bg); color: var(--warn); }

/* Admin */
.admin { display: flex; min-height: 100vh; background: var(--ivory); }
.admin-side { width: 240px; flex-shrink: 0; padding: 24px 14px; background: var(--navy); display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.admin-side .brand { padding: 0 12px 20px; font-family: var(--serif); font-size: 22px; font-weight: 700; color: #fff; }
.admin-side .brand span { font-family: var(--sans); font-size: 12px; color: var(--gold); letter-spacing: .1em; }
.admin-side button { min-height: 44px; padding: 0 12px; border-radius: 10px; border: none; background: none; color: #D5DAE6; text-align: left; font-size: 15px; cursor: pointer; }
.admin-side button[aria-pressed="true"] { background: var(--navy-2); color: #fff; font-weight: 600; }
.admin-side .spacer { flex: 1; }
.admin-main { flex: 1; min-width: 0; padding: 28px 32px 80px; display: flex; flex-direction: column; gap: 20px; }
.admin-main h1 { font-size: 28px; }
.table { background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: auto; }
.table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 16px; background: var(--paper); color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.avatar { width: 40px; height: 40px; border-radius: 20px; object-fit: cover; object-position: center top; background: #FAFAFA; }
.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--warn-bg); color: var(--warn); }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.admin-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.admin-media .m { background: var(--white); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.admin-media .m img { aspect-ratio: 1/1; object-fit: cover; width: 100%; }
.admin-media .m .b { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }

/* Modal / toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(11,29,63,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--white); border-radius: 18px; padding: 20px; max-width: 560px; width: 100%; max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-title { font-family: var(--sans); font-size: 17px; font-weight: 600; }
.crop-view { position: relative; overflow: hidden; border-radius: 12px; background: var(--ink); touch-action: none; cursor: grab; align-self: center; }
.crop-view img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; }
.crop-zoom { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.crop-zoom input { flex: 1; accent-color: var(--navy); }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 200; padding: 12px 18px; border-radius: 12px; background: var(--navy); color: #fff; font-size: 14px; transition: .2s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--warn); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ===== เดสก์ท็อป ===== */
@media (min-width: 900px) {
  .wrap { padding: 0 32px; }
  .site-header .wrap { height: 84px; }
  .logo { width: 140px; height: 70px; }
  .nav { display: flex; }
  .hero { padding: 64px 0; }
  .hero .wrap { flex-direction: row; align-items: center; gap: 64px; }
  .hero .text { width: 46%; flex-shrink: 0; display: flex; flex-direction: column; gap: 18px; }
  .hero h1 { font-size: 60px; }
  .hero .tagline-en { font-size: 20px; }
  .hero p.lead { font-size: 18px; }
  .hero-cta { margin-top: 8px; }
  .hero-img { flex: 1; min-width: 0; }
  .stats-head { flex-direction: row; align-items: center; gap: 18px; padding: 0; background: none; }
  .stats-head b { background: var(--navy); height: 48px; padding: 0 32px 0 28px; display: flex; align-items: center; font-size: 17px; border-bottom-right-radius: 20px; }
  .stats-head span { color: var(--gold-text); font-size: 14px; font-weight: 500; }
  .stats-grid { padding: 28px 12px 30px; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
  .stat, .stat.feature { background: none; border: none; border-radius: 0; padding: 4px 20px; align-items: center; text-align: center; flex-direction: column; gap: 14px; grid-column: auto; }
  .stat, .stat.feature { border-left: 1px solid var(--line-2); }
  .stat-label, .stat.feature .stat-label { font-size: 13px; text-align: left; align-items: center; min-height: 44px; color: var(--muted); }
  .stat.feature .stat-label b { color: var(--ink); }
  .stat-label svg, .stat.feature .stat-label svg { width: 34px; height: 34px; color: var(--gold-text); }
  .stat-num strong, .stat.feature .stat-num strong { font-size: 46px; color: var(--navy); }
  .stat.feature .stat-num span { color: var(--navy); font-family: var(--serif); font-size: 20px; }
  .stat-num span { font-size: 14px; }
  .stat[data-k="insured"] { order: 1; }
  .stat[data-k="policies"] { order: 2; }
  .stat[data-k="agents"] { order: 3; }
  .stat[data-k="sumAssured"] { order: 4; }
  .stat[data-k="claims"] { order: 5; }
  .stat[data-k="insured"] { border-left: none; }
  .section { padding-top: 96px; }
  .section-alt { margin-top: 96px; padding: 80px 0; }
  .section-head h2 { font-size: 40px; }
  .section-head { margin-bottom: 28px; }
  .leader { flex-direction: row; align-items: center; gap: 56px; border: none; background: none; overflow: visible; }
  .leader-photo { width: 440px; flex-shrink: 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); }
  .leader-body { padding: 0; gap: 18px; }
  .leader-name { font-size: 26px; }
  .agent-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .product { padding: 22px; }
  .steps { flex-direction: row; gap: 32px; }
  .step { flex: 1; flex-direction: column; border-bottom: none; border-top: 1px solid var(--gold); padding-top: 20px; }
  .step-no { border: none; width: auto; height: auto; justify-content: flex-start; font-size: 34px; }
  .step b { font-size: 19px; }
  .step p { font-size: 16px; }
  .carousel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; overflow: visible; }
  .carousel figure { flex: none; }
  .cta { margin-top: 96px; padding: 48px 56px; flex-direction: row; justify-content: space-between; align-items: center; }
  .cta h2 { font-size: 34px; }
  .cta .btns { flex-direction: row; }
  .site-footer { margin-top: 96px; padding: 56px 0; }
  .site-footer .wrap { flex-direction: row; justify-content: space-between; gap: 64px; }
  .site-footer p { max-width: 640px; font-size: 13px; }
  .sticky-cta { display: none; }

  .profile-layout { display: flex; gap: 56px; align-items: flex-start; padding-top: 48px; }
  .profile-aside { width: 400px; flex-shrink: 0; position: sticky; top: 108px; }
  .p-hero { border-radius: 20px 20px 0 0; overflow: hidden; }
  .p-card { margin: 0; border-radius: 0 0 20px 20px; box-shadow: none; }
  .profile-main { flex: 1; min-width: 0; }
  .profile-main .p-section:first-child { padding-top: 0; }
  .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .tabs { display: inline-grid; grid-template-columns: repeat(3, auto); }
  .tabs button { padding: 0 24px; }
}
@media (max-width: 899px) {
  /* หน้าที่ไม่มีแถบปุ่มติดล่างจอ ไม่ต้องเว้นที่ท้าย footer */
  .site-footer.no-sticky { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .profile-wrap { padding: 0; }
  .profile-main { padding: 0 16px; }
  .admin { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; padding: 10px; }
  .admin-side .brand, .admin-side .spacer { display: none; }
  .admin-side button { white-space: nowrap; }
  .admin-main { padding: 16px 12px 60px; }
  .cards3 { grid-template-columns: 1fr; }
}

/* ดูรูปเต็มจอ */
.tile img, .carousel img { cursor: zoom-in; }
.tile button.tile-open, .carousel button.tile-open { display: block; width: 100%; padding: 0; border: none; background: none; cursor: zoom-in; border-radius: var(--r); }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(8, 16, 34, .97); display: flex; flex-direction: column; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; color: #fff; font-size: 14px; }
.lb-actions { display: flex; gap: 6px; }
.lb-btn, .lb-nav { width: 44px; height: 44px; border-radius: 22px; border: none; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lb-btn:hover, .lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-stage { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 0 8px; touch-action: pan-x pan-y pinch-zoom; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; cursor: zoom-in; }
.lb-stage.zoomed { display: block; }
.lb-stage.zoomed img { max-width: none; max-height: none; width: 200%; cursor: zoom-out; margin: 0 auto; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-cap { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); color: #E9E4D6; font-size: 14px; text-align: center; min-height: 20px; }
.lb-cap a { color: var(--gold-soft); margin-left: 8px; }
@media (min-width: 900px) {
  .lb-stage { padding: 0 72px; }
  .lb-stage.zoomed img { width: 140%; }
  .profile-main .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ลิงก์เมนูบนมือถือ (เมนูหลักซ่อนบนจอเล็ก) */
.nav-mobile { min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; display: inline-flex; align-items: center; font-size: 14px; font-weight: 600; text-decoration: none; background: var(--white); }
.nav-mobile-wrap { display: inline-flex; gap: 8px; }
.nav a[aria-current="page"] { color: var(--gold-text); font-weight: 600; }

/* ===== หน้าโรงพยาบาล ===== */
.hosp-page { padding-top: 24px; }
.hosp-head h1 { font-size: 30px; font-weight: 700; }
.hosp-layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "search" "map" "list"; gap: 12px; }
.hosp-search { grid-area: search; display: flex; flex-direction: column; gap: 6px; }
.hosp-search .hint:empty { display: none; }
.hosp-side { grid-area: list; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.hosp-tools { display: flex; gap: 8px; }
.hosp-credit { margin-top: 12px; }
.hosp-tools input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--white); font-size: 16px; }
.hosp-tools .btn { flex-shrink: 0; padding: 0 14px; }
.hosp-tools .btn svg { color: var(--gold-text); }
.hosp-list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.hosp-list li + li { border-top: 1px solid var(--line-2); }
.hosp-list button { width: 100%; min-height: 52px; padding: 10px 14px; border: none; background: none; text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.hosp-list button:hover { background: var(--paper); }
.hosp-list .nm { font-size: 15px; font-weight: 500; color: var(--navy); line-height: 1.4; }
.hosp-map { grid-area: map; height: 55vh; min-height: 360px; border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; z-index: 0; background: var(--ivory); }
.hosp-map .leaflet-popup-content-wrapper { border-radius: 12px; }
.hosp-map .leaflet-popup-content { margin: 14px 16px; font-family: var(--sans); }
.hosp-pop { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.hosp-pop b { font-size: 15px; color: var(--navy); line-height: 1.4; }
.hosp-pop .btn-primary { margin-top: 4px; color: #fff; }
.hosp-pin svg { display: block; overflow: visible; filter: drop-shadow(0 2px 3px rgba(11,29,63,.35)); transform-origin: 50% 100%; transition: transform .15s; }
.hosp-pin .pin-body { fill: var(--navy); stroke: #fff; stroke-width: 1.5; }
.hosp-pin .pin-cross { fill: #fff; }
.hosp-pin:hover svg { transform: scale(1.1); }
/* หมุดที่กำลังเปิดดู */
.hosp-pin.active svg { transform: scale(1.25); }
.hosp-pin.active .pin-body { fill: var(--gold); stroke: var(--navy); }
.hosp-pin.active .pin-cross { fill: var(--navy); }
.hosp-cluster span { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--navy); color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 0 0 5px rgba(196,160,98,.45); }
@media (min-width: 900px) {
  .nav-mobile { display: none; }
  .hosp-page { padding-top: 48px; }
  .hosp-head h1 { font-size: 40px; }
  .hosp-layout { grid-template-columns: 380px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "search map" "list map"; column-gap: 16px; row-gap: 10px; height: calc(100vh - 220px); min-height: 520px; }
  .hosp-side { overflow: hidden; }
  .hosp-list { flex: 1; min-height: 0; overflow-y: auto; }
  .hosp-map { height: auto; min-height: 0; }
}
/* ปุ่มเลือกสไตล์แผนที่ */
.map-style { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--white); box-shadow: 0 2px 10px rgba(11,29,63,.18); font-family: var(--sans); }
.map-style button { min-height: 34px; padding: 0 10px; border: none; border-radius: 8px; background: none; color: var(--navy); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.map-style button:hover { background: var(--ivory); }
.map-style button[aria-pressed="true"] { background: var(--navy); color: #fff; }
/* แถบชวนใช้ตำแหน่ง (แสดงเฉพาะคนที่ยังไม่เคยอนุญาต) */
.near-banner { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--navy); color: #fff; }
.near-banner > svg { flex-shrink: 0; color: var(--gold); }
.near-banner .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.near-banner b { font-size: 15px; font-weight: 600; }
.near-banner .grow span { font-size: 12px; color: var(--on-navy-muted); }
.near-banner .btn { flex-shrink: 0; min-height: 40px; padding: 0 18px; background: var(--gold); color: var(--navy); }
.near-banner .btn:hover { background: var(--gold-soft); }

/* หน้าเครือข่ายโรงพยาบาล (/network) */
.net-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.net-filters select { min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--white); font-size: 15px; font-family: inherit; min-width: 0; }
.net-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.net-checks label { display: flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.net-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--navy); }
.net-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(11,29,63,.3); }
.net-dot { background: none; border: none; }
.net-dot span { display: block; width: 100%; height: 100%; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(11,29,63,.5); }
.net-dot.active span { box-shadow: 0 0 0 3px var(--gold), 0 1px 4px rgba(11,29,63,.5); }
.hosp-pop .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.hosp-pop .tag { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #fbe3e1; color: var(--navy); }
.hosp-pop .tag.ok { background: #dcf3e4; }
.hosp-pop .sv { font-size: 13px; line-height: 1.5; }
.hosp-list .nomap { font-size: 12px; color: #b3261e; }

/* หน้าเครือข่ายโรงพยาบาล: แผนที่ใหญ่ขึ้น ตัวกรองพับเก็บ ปุ่มบนแผนที่ */
.net-page { padding-top: 14px; }
.net-page .hosp-head { margin-bottom: 8px; }
.net-page .hosp-head h1 { font-size: 26px; }
.net-page .hosp-head .eyebrow { display: none; }
.net-layout .hosp-map { height: 72vh; min-height: 420px; }
.hosp-tools .fcount { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 99px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; }
.net-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.net-panel[hidden] { display: none; }
.mini-reset { align-self: flex-start; min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--white); color: var(--navy); font-size: 13px; font-weight: 600; cursor: pointer; }
.map-legend { background: rgba(255,255,255,.92); padding: 6px 10px; border-radius: 8px; box-shadow: 0 2px 8px rgba(11,29,63,.18); max-width: 70vw; }
.map-acts { display: flex; flex-direction: column; border-radius: 8px; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.4); overflow: hidden; }
.map-acts button { width: 34px; height: 34px; border: 0; background: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.map-acts button + button { border-top: 1px solid #ccc; }
.map-acts button:hover { background: #f4f4f4; }
.tiles-gray { filter: grayscale(1) brightness(1.08) contrast(.82); }
.hosp-map.map-full { position: fixed !important; inset: 0; z-index: 3000; width: 100% !important; height: 100% !important; min-height: 0; border-radius: 0; border: 0; }
body.net-full { overflow: hidden; }
@media (min-width: 900px) {
  .net-page { padding-top: 20px; }
  .net-page .hosp-head h1 { font-size: 30px; }
  .net-layout { grid-template-columns: 360px minmax(0, 1fr); height: calc(100vh - 150px); min-height: 560px; }
  .net-layout .hosp-map { height: auto; min-height: 0; }
  .net-layout .hosp-tools { flex-wrap: wrap; }
  .net-layout .hosp-tools input { flex: 1 1 100%; }
  .net-layout .hosp-tools .btn { flex: 1; }
}

/* ข้อความสถานะบนแผนที่ (เช่น กำลังหาตำแหน่ง) */
.map-toast { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 1000; max-width: 86%; padding: 8px 16px; border-radius: 999px; background: rgba(11,29,63,.92); color: #fff; font-size: 14px; line-height: 1.4; text-align: center; pointer-events: none; }
.map-toast[hidden] { display: none; }

/* ตัวกรองบนแผนที่: ปุ่มบนแผนที่ + แผงลอย */
.map-filter button { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.4); color: var(--navy); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.map-filter button:hover { background: #f4f4f4; }
.map-filter .fcount { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--navy); color: #fff; font-size: 12px; }
.map-filter .fcount[hidden] { display: none; }
.hosp-map > .net-panel { position: absolute; z-index: 1100; top: 12px; left: 12px; right: 12px; max-height: calc(100% - 24px); overflow: auto; box-shadow: 0 6px 24px rgba(11,29,63,.3); }
.net-panel-head { display: flex; align-items: center; justify-content: space-between; }
.net-panel-head b { font-size: 16px; color: var(--navy); }
.net-panel-head button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--ivory); color: var(--navy); font-size: 16px; cursor: pointer; }
@media (min-width: 900px) {
  .hosp-map > .net-panel { left: 60px; right: auto; width: 340px; }
}

/* ปุ่มบนแผนที่แบบทรงกลม: ใกล้ฉัน (ไอคอนตำแหน่งปัจจุบัน + ป้ายข้อความ) / เต็มจอ / ตัวกรอง */
.map-acts { flex-direction: column; align-items: flex-start; gap: 8px; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
.map-pill, .map-acts .map-pill, .map-filter .map-pill { display: flex; align-items: center; justify-content: center; gap: 8px; width: auto; height: 40px; min-height: 40px; padding: 0 16px 0 12px; border: 0; border-radius: 999px; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); color: var(--navy); font-family: var(--sans); font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap; }
.map-acts .map-pill + .map-pill { border: 0; }
.map-pill:hover { background: #f4f4f4; }
.map-acts .map-round { width: 40px; padding: 0; font-size: 19px; }
.map-acts .map-near { color: #2563EB; }
.map-acts .map-near.located { background: #2563EB; color: #fff; }
.map-acts .map-near.busy { opacity: .85; }
.map-acts .map-near.busy svg { animation: netpulse 1s ease-in-out infinite; }
@keyframes netpulse { 50% { opacity: .3; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .map-acts .map-near.busy svg { animation: none; } }

/* จัดตำแหน่งปุ่มบนแผนที่: ใกล้ฉัน+ตัวกรอง = ขวาบน · เต็มจอ = ขวาล่าง · รูปแบบแผนที่ = ซ้ายล่าง (กดแล้วเมนูแตกออก) */
.map-acts { align-items: flex-end; }
.map-pill.map-round { width: 40px; padding: 0; font-size: 19px; }
.map-toast { top: 12px; bottom: auto; max-width: calc(100% - 200px); border-radius: 14px; }
.map-layers { position: relative; }
.layers-menu { position: absolute; left: 0; bottom: 48px; min-width: 176px; display: flex; flex-direction: column; padding: 6px; border-radius: 14px; background: #fff; box-shadow: 0 4px 18px rgba(11,29,63,.3); z-index: 1200; }
.layers-menu[hidden] { display: none; }
.layers-menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--navy); font-family: var(--sans); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.layers-menu button:hover { background: #f4f4f4; }
.layers-menu button[aria-pressed="true"] { background: var(--ivory); }
.layers-menu button[aria-pressed="true"]::after { content: "✓"; margin-left: auto; }
.layers-menu .sw { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(11,29,63,.3); }
@media (min-width: 900px) {
  .hosp-map > .net-panel { left: auto; right: 150px; }
  .map-toast { max-width: 50%; }
}

/* มือถือ: แผนที่ขึ้นก่อน แล้วค่อยช่องค้นหาและรายชื่อ · หัวข้อตัวเล็กลง */
.net-page .hosp-head h1 { font-size: 20px; line-height: 1.3; }
.net-page .hosp-head .muted { font-size: 13px; }
@media (max-width: 899px) {
  .net-layout { grid-template-areas: "map" "search" "list"; }
}
@media (min-width: 900px) {
  .net-page .hosp-head h1 { font-size: 26px; }
  .net-page .hosp-head .muted { font-size: 14px; }
}
