/* NuadPros — design tokens
   jade = ใบเตย/หยก (แบรนด์), brass = ทองเหลือง (ราคา/ดาวเท่านั้น), base = ขาวสะอาด */
:root {
  --jade-900: #133A31;
  --jade-800: #174A3E;
  --jade-700: #1F5A4B;
  --jade-500: #3E7F6D;
  --jade-100: #DCEAE5;
  --jade-50: #EFF5F2;
  --brass: #9C7A43;
  --brass-50: #F6F0E4;
  --ink: #1A2320;
  --ink-2: #44514C;
  --mute: #6E7B76;
  --line: #E3E9E6;
  --base: #FFFFFF;
  --soft: #F7F9F8;
  --sos: #C2362F;
  --sos-50: #FBECEA;
  --ok: #2E7D4F;
  --warn: #A86B12;
  --warn-50: #FBF2E2;
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 22px;
  --shadow: 0 1px 2px rgba(19, 58, 49, .06), 0 8px 24px rgba(19, 58, 49, .07);
  --font: 'Anuphan', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--base); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; } h4 { font-size: .98rem; }
p { margin: 0 0 .6em; }
a { color: var(--jade-700); }
img { max-width: 100%; display: block; }
svg[aria-hidden="true"] { width: 20px; height: 20px; flex-shrink: 0; }
.cust-rep svg { width: 22px; height: 22px; }
.panel.row > svg { width: 24px; height: 24px; color: var(--jade-700); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--jade-500); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--mute); }
.small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.num { font-variant-numeric: tabular-nums; }
.price { color: var(--brass); font-weight: 600; font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--jade-700); }
.logo svg { width: 28px; height: 28px; }
.logo b { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--jade-900); }
.logo i { font-style: normal; font-weight: 500; font-size: .8rem; color: var(--jade-700); background: var(--jade-50); padding: 2px 8px; border-radius: 99px; }

/* buttons */
.btn { appearance: none; border: 1px solid transparent; border-radius: 12px; padding: 12px 18px; font-weight: 600; font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: background .15s, transform .08s; min-height: 46px; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--jade-700); color: #fff; }
.btn.primary:hover { background: var(--jade-800); }
.btn.ghost { background: var(--base); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--soft); }
.btn.soft { background: var(--jade-50); color: var(--jade-800); }
.btn.danger { background: var(--sos); color: #fff; }
.btn.warn { background: var(--warn-50); color: var(--warn); }
.btn.link { background: none; border: none; color: var(--jade-700); padding: 6px 4px; min-height: 0; font-weight: 500; }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 1.08rem; border-radius: 16px; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }

/* forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .9rem; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.field > span em { color: var(--sos); font-style: normal; }
.field .hint { font-size: .8rem; color: var(--mute); margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--base); border-radius: var(--r-s); padding: 11px 13px; font-size: 1rem; min-height: 46px; transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--jade-500); box-shadow: 0 0 0 3px var(--jade-100); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; font-size: .93rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--jade-700); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button, .chip { border: 1px solid var(--line); background: var(--base); padding: 8px 14px; border-radius: 99px; cursor: pointer; font-size: .92rem; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--jade-700); border-color: var(--jade-700); color: #fff; }
.seg button:disabled { opacity: .38; cursor: not-allowed; text-decoration: line-through; }
.sub-seg { margin-top: 10px; padding: 10px 0 0 14px; border-left: 2px solid var(--jade-100); }
.sub-seg button { font-size: .88rem; padding: 7px 12px; }
.tcount { color: var(--mute); font-weight: 400; font-size: .85em; }
.chip { cursor: default; padding: 3px 10px; font-size: .8rem; background: var(--jade-50); border-color: transparent; color: var(--jade-800); }

/* toasts & sheets */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--jade-900); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: .94rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 9999; max-width: min(92vw, 420px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--sos); }
.sheet-wrap { position: fixed; inset: 0; background: rgba(19, 30, 27, .42); display: flex; align-items: flex-end; justify-content: center; z-index: 1000; opacity: 0; transition: opacity .2s; }
.sheet-wrap.open { opacity: 1; }
.sheet { position: relative; background: var(--base); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: var(--r-l) var(--r-l) 0 0; padding: 22px 20px calc(18px + var(--safe-b)); transform: translateY(24px); transition: transform .22s ease-out; }
.sheet.wide { max-width: 760px; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-title { padding-right: 36px; margin-bottom: 12px; }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--soft); font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink-2); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: var(--r-l); } }

/* stars */
.stars { color: #D9DEDC; letter-spacing: 1px; white-space: nowrap; }
.stars .st.on { color: var(--brass); }
.stars .st.half { background: linear-gradient(90deg, var(--brass) 50%, #D9DEDC 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.star-input { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.si-stars button { border: none; background: none; font-size: 1.7rem; color: #D9DEDC; cursor: pointer; padding: 0 2px; line-height: 1; }
.si-stars button.on { color: var(--brass); }

/* mobile app shell */
.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--base); }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.main { flex: 1; padding: 18px 18px calc(96px + var(--safe-b)); }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; display: flex; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b)); z-index: 60; }
.tabbar button { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: .74rem; color: var(--mute); cursor: pointer; border-radius: 10px; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--jade-700); font-weight: 600; }
.section { margin-top: 26px; }
.section > h3 { margin-bottom: 10px; }
.panel { background: var(--soft); border-radius: var(--r-m); padding: 16px; }
.panel.jade { background: var(--jade-50); }
.panel.warn { background: var(--warn-50); color: #6B4709; }
.panel.sos { background: var(--sos-50); color: #7A1E19; }
.list { border-top: 1px solid var(--line); }
.list > * { border-bottom: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.kv span:first-child { color: var(--mute); }
.kv.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 12px; font-weight: 600; font-size: 1.1rem; }
.empty { text-align: center; padding: 38px 10px; color: var(--mute); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--jade-50); color: var(--jade-800); white-space: nowrap; }
.badge.gray { background: #EEF0EF; color: var(--ink-2); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.err { background: var(--sos-50); color: var(--sos); }
.badge.ok { background: #E6F3EB; color: var(--ok); }
.badge.dot::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }

/* KPI สัญญาณไฟ */
.kpib { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.6; vertical-align: middle; }
.kpib i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.kpib small { font-weight: 400; opacity: .85; }
.kpib-green { background: #E6F3EB; color: #23683F; } .kpib-green i { background: #2E9A5A; }
.kpib-yellow { background: #FCF1D6; color: #7A5600; } .kpib-yellow i { background: #E0A800; }
.kpib-red { background: var(--sos-50); color: #9B231D; } .kpib-red i { background: var(--sos); }
.kpi-card { border-radius: var(--r-m); padding: 16px; border: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.kpi-card .lamp { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.kpi-card.green .lamp { background: #2E9A5A; } .kpi-card.yellow .lamp { background: #E0A800; } .kpi-card.red .lamp { background: var(--sos); }
.kpi-card.yellow { background: #FFFBEF; border-color: #F1DFA6; } .kpi-card.red { background: var(--sos-50); border-color: #F0C7C3; }
.kpi-rules { font-size: .84rem; color: var(--ink-2); padding-left: 18px; margin: 8px 0 0; }
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 14px; padding: 4px; margin-top: 16px; }
.mode-toggle button { border: none; background: none; padding: 10px 6px; border-radius: 11px; font-weight: 600; color: var(--mute); cursor: pointer; }
.mode-toggle button[aria-pressed="true"] { background: var(--base); color: var(--jade-800); box-shadow: 0 1px 3px rgba(19,58,49,.12); }
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.day-strip button { flex-shrink: 0; border: 1px solid var(--line); background: var(--base); border-radius: 12px; padding: 8px 12px; text-align: center; cursor: pointer; min-width: 64px; line-height: 1.25; }
.day-strip button b { display: block; font-size: 1.05rem; }
.day-strip button small { color: var(--mute); font-size: .74rem; }
.day-strip button[aria-pressed="true"] { background: var(--jade-700); border-color: var(--jade-700); color: #fff; }
.day-strip button[aria-pressed="true"] small { color: #D5E8E1; }
.time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.time-grid button { border: 1px solid var(--line); background: var(--base); border-radius: 10px; padding: 8px 4px; cursor: pointer; font-variant-numeric: tabular-nums; line-height: 1.2; }
.time-grid button small { display: block; font-size: .7rem; color: var(--mute); }
.time-grid button[aria-pressed="true"] { background: var(--jade-700); border-color: var(--jade-700); color: #fff; }
.time-grid button[aria-pressed="true"] small { color: #D5E8E1; }
.booking-card { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--base); border-radius: var(--r-m); padding: 12px 14px; cursor: pointer; }
.booking-card .when { min-width: 62px; text-align: center; border-right: 1px solid var(--line); padding-right: 12px; line-height: 1.2; }
.booking-card .when b { display: block; font-size: 1.15rem; color: var(--jade-800); font-variant-numeric: tabular-nums; }
.booking-card .when small { font-size: .74rem; color: var(--mute); }
.slot-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }

/* arch portrait — ซุ้มโค้งแบบไทย เป็นเอกลักษณ์ของแบรนด์ */
.arch { border-radius: 999px 999px 14px 14px; overflow: hidden; background: var(--jade-50); aspect-ratio: 3 / 4; position: relative; flex-shrink: 0; }
.arch img { width: 100%; height: 100%; object-fit: cover; }
.arch .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--jade-500); font-size: 1.6rem; font-weight: 600; }
.avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--jade-50); flex-shrink: 0; display: grid; place-items: center; color: var(--jade-700); font-weight: 600; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* therapist cards (customer) */
.t-list { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; }
.t-card { text-align: left; border: none; background: none; padding: 0; cursor: pointer; }
.t-card .arch { width: 100%; }
.t-card.off .arch img { filter: grayscale(.85) opacity(.7); }
.t-card h4 { margin-top: 10px; }
.t-card .meta { font-size: .82rem; color: var(--mute); }
.t-card .tot { margin-top: 4px; font-size: .95rem; }
.t-card .status-dot { position: absolute; left: 10px; bottom: 10px; background: rgba(255, 255, 255, .94); border-radius: 99px; padding: 2px 9px; font-size: .74rem; font-weight: 600; color: var(--ok); }
.t-card.off .status-dot { color: var(--mute); }

.hero-c { padding: 4px 0 8px; }
.hero-c h1 { font-size: 1.6rem; font-weight: 600; }
.loc-btn { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--base); border-radius: var(--r-m); padding: 12px 14px; cursor: pointer; margin-top: 14px; }
.loc-btn svg { width: 22px; height: 22px; color: var(--jade-700); flex-shrink: 0; }
.auto-match { display: flex; gap: 14px; align-items: center; width: 100%; border: none; text-align: left; cursor: pointer; background: var(--jade-700); color: #fff; border-radius: var(--r-m); padding: 16px; margin-top: 16px; }
.auto-match b { display: block; font-size: 1.02rem; }
.auto-match span { font-size: .86rem; opacity: .85; }
.auto-match svg { width: 34px; height: 34px; flex-shrink: 0; }

/* map */
.map { height: 240px; border-radius: var(--r-m); overflow: hidden; background: var(--jade-50); z-index: 1; }
.map.tall { height: 46vh; min-height: 260px; }
.pin span { display: block; width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.pin-home span { background: var(--jade-700); }
.pin-me span { background: var(--brass); }
.pin-sos span { background: var(--sos); }
.leaflet-container { font-family: var(--font); }

/* status timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 30px; color: var(--mute); }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--base); }
.timeline li::after { content: ''; position: absolute; left: 12px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--ink-2); }
.timeline li.done::before { background: var(--jade-700); border-color: var(--jade-700); }
.timeline li.now { color: var(--ink); font-weight: 600; }
.timeline li.now::before { border-color: var(--jade-700); box-shadow: 0 0 0 5px var(--jade-100); }

/* chat */
.chat { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.chat-list { height: 240px; overflow-y: auto; padding: 12px; background: var(--soft); display: flex; flex-direction: column; gap: 8px; }
.chat-form { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--line); background: var(--base); }
.chat-form .input { min-height: 40px; padding: 8px 12px; }
.msg { max-width: 82%; }
.msg .bubble { padding: 9px 13px; border-radius: 16px; background: var(--base); border: 1px solid var(--line); word-wrap: break-word; }
.msg.me { align-self: flex-end; }
.msg.me .bubble { background: var(--jade-700); color: #fff; border-color: var(--jade-700); border-bottom-right-radius: 5px; }
.msg.them .bubble { border-bottom-left-radius: 5px; }
.msg-meta { font-size: .7rem; color: var(--mute); margin-top: 2px; padding: 0 4px; }
.msg.me .msg-meta { text-align: right; }
.msg.sys { align-self: center; max-width: 100%; font-size: .8rem; color: var(--jade-800); background: var(--jade-50); padding: 4px 12px; border-radius: 99px; }

/* banner for arrival etc */
.banner { border-radius: var(--r-m); padding: 16px; display: flex; gap: 14px; align-items: center; }
.banner.arrive { background: var(--jade-700); color: #fff; animation: pop .45s ease-out; }
.banner svg { width: 34px; height: 34px; flex-shrink: 0; }
@keyframes pop { from { transform: scale(.94); opacity: .3; } to { transform: none; opacity: 1; } }

/* therapist radar — ช่วงเวลาเด่นเพียงจุดเดียวของแอป */
.radar { position: relative; width: 230px; height: 230px; margin: 18px auto 8px; display: grid; place-items: center; }
.radar .core { width: 112px; height: 112px; border-radius: 50%; background: var(--jade-700); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-weight: 600; z-index: 2; box-shadow: 0 10px 30px rgba(31, 90, 75, .35); }
.radar .core small { display: block; font-weight: 400; font-size: .74rem; opacity: .8; }
.radar .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--jade-500); opacity: 0; animation: ripple 3s ease-out infinite; }
.radar .ring:nth-child(2) { animation-delay: 1s; }
.radar .ring:nth-child(3) { animation-delay: 2s; }
.radar.compact { width: 120px; height: 120px; margin: 0 auto; }
.radar.compact .core { width: 76px; height: 76px; font-size: .78rem; }
.radar.compact .core small { display: none; }
@keyframes ripple { from { transform: scale(.45); opacity: .7; } to { transform: scale(1); opacity: 0; } }
.go-btn { width: 200px; height: 200px; border-radius: 50%; margin: 22px auto 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: none; cursor: pointer; background: var(--jade-700); color: #fff; font-size: 1.25rem; font-weight: 600; box-shadow: 0 0 0 10px var(--jade-50), 0 14px 34px rgba(31, 90, 75, .3); text-align: center; line-height: 1.3; }
.go-btn small { display: block; font-size: .8rem; font-weight: 400; opacity: .85; }
.go-btn:active { transform: scale(.98); }

.offer { border: 2px solid var(--jade-700); border-radius: var(--r-l); padding: 18px; background: var(--base); box-shadow: var(--shadow); animation: slideUp .3s ease-out; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.offer .big { font-size: 2.3rem; font-weight: 700; color: var(--jade-900); line-height: 1.1; font-variant-numeric: tabular-nums; }
.offer .tag-direct { background: var(--brass-50); color: var(--brass); }
.cust-rep { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-s); background: var(--soft); margin-top: 12px; font-size: .9rem; }
.cust-rep.warn { background: var(--sos-50); color: #7A1E19; }
.cust-rep.good { background: #E9F4EE; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; }

.sos-btn { position: relative; overflow: hidden; width: 100%; border: none; border-radius: 18px; background: var(--sos); color: #fff; font-size: 1.2rem; font-weight: 700; padding: 18px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.sos-btn small { display: block; font-weight: 400; font-size: .82rem; opacity: .9; }
.sos-btn .hold-fill { position: absolute; inset: 0; background: rgba(0, 0, 0, .22); transform-origin: left; transform: scaleX(0); }
.sos-btn span { position: relative; }

.qr-box { display: grid; place-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: #fff; }
.qr-box svg, .qr-box img { width: 230px; height: auto; }
.slip-preview { max-height: 220px; border-radius: var(--r-s); border: 1px solid var(--line); margin: 10px auto 0; }

/* upload tiles (apply) */
.upl { display: flex; gap: 14px; align-items: center; border: 1.5px dashed var(--line); border-radius: var(--r-m); padding: 12px; cursor: pointer; background: var(--base); width: 100%; text-align: left; }
.upl:hover { border-color: var(--jade-500); }
.upl.done { border-style: solid; border-color: var(--jade-100); background: var(--jade-50); }
.upl .thumb { width: 64px; height: 64px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; color: var(--jade-700); }
.upl .thumb img { width: 100%; height: 100%; object-fit: cover; }
.upl .thumb svg { width: 26px; height: 26px; }
.upl b { display: block; font-weight: 600; }
.upl small { color: var(--mute); }
.upl-actions { display: flex; gap: 8px; margin-top: 8px; }

/* apply page */
.apply-wrap { max-width: 680px; margin: 0 auto; padding: 0 20px 60px; }
.apply-hero { padding: 34px 0 22px; border-bottom: 1px solid var(--line); }
.apply-hero h1 { font-size: 2rem; margin-top: 18px; max-width: 18ch; }
.apply-hero p { color: var(--ink-2); max-width: 56ch; margin-top: 10px; }
.steps { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; counter-reset: st; }
.steps li { counter-increment: st; display: flex; gap: 12px; align-items: baseline; color: var(--ink-2); font-size: .93rem; }
.steps li::before { content: counter(st); font-weight: 700; color: var(--jade-700); min-width: 1.2em; }
.fs { border: none; padding: 0; margin: 30px 0 0; }
.fs legend { font-size: 1.2rem; font-weight: 600; margin-bottom: 4px; padding: 0; }
.fs > p { color: var(--mute); font-size: .9rem; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.consent-text { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-s); padding: 14px 16px; font-size: .86rem; color: var(--ink-2); background: var(--soft); }
.consent-text h4 { margin: 10px 0 4px; font-size: .9rem; color: var(--ink); }
.consent-text ul { margin: 4px 0; padding-left: 20px; }
.success { text-align: center; padding: 60px 10px; }
.success .seal { width: 84px; height: 84px; border-radius: 50%; background: var(--jade-700); color: #fff; display: grid; place-items: center; margin: 0 auto 18px; }
.success .seal svg { width: 40px; height: 40px; }
.ref { font-size: 1.6rem; font-weight: 700; letter-spacing: .04em; color: var(--jade-900); }

/* auth screens */
.auth { max-width: 420px; margin: 0 auto; padding: 48px 22px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.auth h1 { margin: 26px 0 6px; font-size: 1.6rem; }
.auth .lead { color: var(--mute); margin-bottom: 24px; }
.auth .switch { margin-top: 18px; text-align: center; font-size: .94rem; }

/* ADMIN */
.app-admin { background: var(--soft); }
.adm { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.adm-side { background: var(--jade-900); color: #DCE8E3; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.adm-side .logo { color: #9FD3C1; margin: 0 8px 26px; }
.adm-side .logo b { color: #fff; }
.adm-side .logo i { background: rgba(255, 255, 255, .1); color: #CFE6DD; }
.adm-nav { display: flex; flex-direction: column; gap: 2px; }
.adm-nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: none; background: none; color: inherit; border-radius: 10px; cursor: pointer; text-align: left; font-size: .95rem; }
.adm-nav button svg { width: 20px; height: 20px; opacity: .85; }
.adm-nav button:hover { background: rgba(255, 255, 255, .06); }
.adm-nav button[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; }
.adm-nav .cnt { margin-left: auto; background: var(--brass); color: #fff; font-size: .72rem; border-radius: 99px; padding: 1px 8px; font-weight: 700; }
.adm-nav .cnt.red { background: var(--sos); }
.adm-side .foot { margin-top: auto; font-size: .82rem; opacity: .75; padding: 0 8px; }
.adm-main { padding: 26px 30px 60px; min-width: 0; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.adm-head h1 { font-size: 1.55rem; }
.box { background: var(--base); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; }
.box + .box { margin-top: 16px; }
.dash-grid > .box { margin-top: 0; }
.box h3 { margin-bottom: 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-m); background: var(--base); overflow: hidden; }
.kpi { padding: 18px 20px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: none; }
.kpi .v { font-size: 1.75rem; font-weight: 700; color: var(--jade-900); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.kpi .v.money { color: var(--jade-700); }
.kpi .l { font-size: .88rem; color: var(--mute); }
.kpi .s { font-size: .8rem; color: var(--mute); margin-top: 2px; }
.kpis.sub { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 14px; }
.kpis.sub .kpi { padding: 12px 16px; }
.kpis.sub .v { font-size: 1.25rem; }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-top: 16px; }
.chart-wrap { position: relative; height: 260px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 500; color: var(--mute); font-size: .82rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--soft); }
.tbl .r { text-align: right; }
.tbl-wrap { overflow-x: auto; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 280px; min-height: 40px; padding: 8px 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 10px 14px; cursor: pointer; color: var(--mute); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--jade-800); border-color: var(--jade-700); font-weight: 600; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc { border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: var(--soft); text-decoration: none; color: inherit; }
.doc .im { height: 130px; display: grid; place-items: center; background: #fff; }
.doc .im img { width: 100%; height: 100%; object-fit: cover; }
.doc .cap { padding: 8px 10px; font-size: .82rem; }
.detail-head { display: flex; gap: 18px; align-items: flex-start; }
.detail-head .arch { width: 110px; }
.cred { border: 1px solid var(--jade-100); background: var(--jade-50); border-radius: var(--r-m); padding: 16px; }
.cred .kv b { font-size: 1.15rem; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.sos-alert { position: fixed; inset: 0; z-index: 2000; background: rgba(120, 18, 14, .55); display: grid; place-items: center; padding: 20px; }
.sos-card { background: var(--base); border-radius: var(--r-l); padding: 24px; width: min(560px, 100%); border-top: 8px solid var(--sos); animation: pop .3s ease-out; max-height: 92vh; overflow: auto; }
.sos-card h2 { color: var(--sos); }
.sos-card .call { font-size: 1.5rem; font-weight: 700; }
.score-bars .sb { display: grid; grid-template-columns: 110px 1fr 34px; gap: 10px; align-items: center; font-size: .88rem; padding: 3px 0; }
.score-bars .bar { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.score-bars .bar i { display: block; height: 100%; background: var(--brass); border-radius: 99px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
pre.code { background: var(--jade-900); color: #E3F1EB; padding: 14px; border-radius: var(--r-s); font-size: .78rem; max-height: 260px; overflow: auto; white-space: pre; }
.mobile-nav { display: none; }

@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: none; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .kpis.sub { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .adm { grid-template-columns: 1fr; }
  .adm-side { display: none; }
  .mobile-nav { display: flex; overflow-x: auto; gap: 4px; background: var(--jade-900); padding: 10px; position: sticky; top: 0; z-index: 40; }
  .mobile-nav button { flex-shrink: 0; border: none; background: rgba(255, 255, 255, .08); color: #fff; border-radius: 99px; padding: 7px 13px; font-size: .86rem; }
  .mobile-nav button[aria-current="page"] { background: #fff; color: var(--jade-900); font-weight: 600; }
  .adm-main { padding: 18px 14px 50px; }
  .detail-head { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------- แอปมือถือ (PWA): ติดตั้ง + แจ้งเตือน */
.install-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--jade-100); background: var(--jade-50); border-radius: var(--r-m); margin-top: 14px; text-align: left; }
.install-card img { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; }
.install-card b { display: block; color: var(--jade-900); }
.install-card p { margin: 2px 0 10px; font-size: .88rem; color: var(--ink-2); line-height: 1.45; }
.push-nudge { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--brass-50); color: #5C461F; }
.push-nudge > span:first-child svg { width: 24px; height: 24px; color: var(--brass); display: block; }
.push-nudge b { display: block; font-size: .95rem; }
.push-nudge small { display: block; font-size: .8rem; line-height: 1.4; color: #7A6235; }
.push-box h3 { margin-bottom: 6px; }
.howto { margin: 4px 0 10px; padding-left: 22px; }
.howto li { margin: 7px 0; line-height: 1.55; padding-left: 2px; }
.howto li::marker { color: var(--jade-700); font-weight: 700; }
.ico-inline { width: 1.15em; height: 1.15em; vertical-align: -0.2em; color: #0A84FF; }
.install-help { text-align: left; }
.install-ico { width: 56px; height: 56px; border-radius: 14px; display: block; margin-bottom: 8px; }
.install-page { max-width: 560px; margin: 0 auto; padding: 22px 20px calc(40px + var(--safe-b)); }
.install-page h1 { margin: 22px 0 6px; font-size: 1.55rem; }
.install-page .lead { color: var(--mute); margin: 0; }
.app-tile { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-m); }
.app-tile img { border-radius: 16px; flex-shrink: 0; }
.app-tile h2 { font-size: 1.15rem; }
.app-tile p { margin: 4px 0 10px; }
.how { border-top: 1px solid var(--line); padding: 12px 0; }
.how summary { font-weight: 600; cursor: pointer; padding: 4px 0; }
.how[open] summary { margin-bottom: 6px; }
/* เปิดจากไอคอน (standalone): เว้นขอบจอโค้ง/รอยบากด้านข้างเมื่อหมุนจอ */
@media (display-mode: standalone) {
  .topbar, .main { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  body { overscroll-behavior-y: none; }
}
/* แอดมินบนมือถือ: ไม่ให้ตาราง/โค้ด/เมนูดันความกว้างจนเลื่อนข้าง */
.adm > div { min-width: 0; }
pre.code { max-width: 100%; overflow-x: auto; }

/* เมนูพิเศษรายคน (แอดมิน > ตั้งค่า) */
.sp-people { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.sp-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 10px; }
.sp-tools .input { flex: 1 1 260px; min-width: 0; }
.sp-list { max-height: 460px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--base); }
.sp-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.sp-row:first-child { border-top: 0; }
.sp-row .avatar { width: 40px; height: 40px; flex-shrink: 0; }
.sp-row.off .avatar { opacity: .55; }
.sp-who { min-width: 0; }
.sp-who .num + .num { margin-left: 8px; }
.sp-empty { padding: 16px 14px; margin: 0; }
.sw { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex-shrink: 0; user-select: none; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-track { width: 46px; height: 26px; border-radius: 99px; background: #CDD5D1; position: relative; transition: background .18s ease; }
.sw-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .18s ease; }
.sw input:checked + .sw-track { background: var(--jade-700); }
.sw input:checked + .sw-track::after { transform: translateX(20px); }
.sw input:focus-visible + .sw-track { outline: 3px solid var(--jade-100); outline-offset: 2px; }
.sw input:disabled + .sw-track { opacity: .5; }
.sw-txt { font-size: .86rem; min-width: 3.2em; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .sw-track, .sw-track::after { transition: none; } }
@media (max-width: 520px) { .sp-row { padding: 10px; gap: 10px; } .sw-txt { display: none; } }

/* ส่งลูกค้าให้พนักงาน (แอดมินจองให้ ลูกค้าชำระค่าบริการล่วงหน้า) */
.disp { border: 2px solid var(--jade-700); border-radius: var(--r-l); padding: 16px; margin-bottom: 18px; background: var(--base); display: grid; gap: 12px; }
.disp h4 { margin: 0 0 8px; }
.disp-money { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; background: var(--jade-50); border-radius: var(--r-m); padding: 10px 12px; }
.disp-money > div { display: grid; gap: 2px; align-content: start; }
.disp-money .badge { justify-self: start; }
.disp-money b { font-size: 1.15rem; }
.disp-cands { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-m); }
.dc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.dc:first-child { border-top: 0; }
.dc.cur { background: var(--brass-50); }
.dc .avatar { width: 40px; height: 40px; flex-shrink: 0; }
.dc .grow { min-width: 0; }
.dc-n { width: 4.6em; flex-shrink: 0; font-size: .8rem; color: var(--ink-2); }
.disp-next { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px; }
.disp-next pre.code, .disp-msg pre.code { white-space: pre-wrap; margin: 10px 0; }
.avatar.lg { width: 72px; height: 72px; flex-shrink: 0; }
.disp-msg summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.disp-msg[open] summary { margin-bottom: 4px; }
.bk-trow { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-top: 1px solid var(--line); border-radius: var(--r-s); }
.bk-trow.pick { background: var(--jade-50); }
.bk-trow.bak { background: var(--brass-50); }
.bk-bbtn { flex-shrink: 0; min-width: 5.4em; }
.pend-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 2px; font: inherit; color: inherit; cursor: pointer; }
.pend-row:first-child { border-top: 0; }
.pend-row:hover { background: var(--soft); }
.pend-row:focus-visible { outline: 3px solid var(--jade-100); outline-offset: 2px; }
.offer.dispatch { border-color: var(--brass); }
@media (max-width: 520px) { .dc-n { width: 3.6em; } .bk-trow { flex-wrap: wrap; } .bk-bbtn { margin-left: 50px; } }
