:root {
  --ink: #17332e;
  --muted: #657873;
  --green-950: #093e35;
  --green-800: #0d5c4d;
  --green-700: #17705f;
  --mint-100: #dff4eb;
  --mint-50: #f0faf6;
  --coral: #f37c68;
  --coral-light: #fff0ec;
  --amber: #f3b44d;
  --paper: #fffefb;
  --line: #dce7e2;
  --shadow: 0 16px 45px rgba(22, 73, 61, .12);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: #e9f1ed;
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; background: var(--paper); }

.topbar {
  height: 76px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 254, 251, .93);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(220, 231, 226, .8);
}
.brand, .profile-chip { border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; }
.brand { gap: 10px; font-weight: 700; font-size: 1.32rem; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; }
.brand-mark svg { width: 100%; fill: var(--green-800); }
.brand-mark .cross { fill: white; }
.profile-chip { gap: 10px; text-align: left; padding: 5px; border-radius: 14px; }
.profile-chip:hover { background: var(--mint-50); }
.profile-copy { display: none; line-height: 1.2; }
.profile-copy small, .profile-copy strong { display: block; }
.profile-copy small { color: var(--muted); font-size: .76rem; }
.avatar { border-radius: 50%; display: grid; place-items: center; background: var(--coral-light); color: #a43c2a; font-weight: 700; }
.avatar-small { width: 40px; height: 40px; }

main { padding-bottom: 96px; }
.auth-wrap { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 34px 16px 90px; background: linear-gradient(145deg, var(--mint-50), #fff 48%, var(--coral-light)); }
.auth-card { width: min(480px, 100%); background: white; border: 1px solid var(--line); border-radius: 28px; padding: 26px; box-shadow: var(--shadow); }
.auth-logo { width: 58px; height: 58px; border-radius: 18px; background: var(--green-800); color: white; display: grid; place-items: center; margin-bottom: 18px; }
.auth-logo svg { width: 36px; height: 36px; fill: white; }
.auth-logo { font-size: 0; position: relative; }
.auth-logo:before { content: ""; width: 38px; height: 38px; background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath fill='white' d='M20 34S6 25.6 6 14.9C6 9.8 9.4 6 14.1 6c2.8 0 4.8 1.3 5.9 3.4C21.1 7.3 23.1 6 25.9 6 30.6 6 34 9.8 34 14.9 34 25.6 20 34 20 34Z'/%3E%3Cpath fill='%230d5c4d' d='M18 12h4v6h6v4h-6v6h-4v-6h-6v-4h6z'/%3E%3C/svg%3E"); }
.auth-logo:after { display: none; }
.auth-card h1 { font-size: 2rem; color: var(--ink); margin-bottom: 22px; }
.auth-brand { color: var(--green-800); font-weight: 600; margin-bottom: 4px; }
.auth-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 8px; margin-top: 16px; }
.auth-link { min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--green-800); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.page { animation: enter .35s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }
.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.hero {
  background: var(--green-950);
  color: white;
  border-radius: 0 0 34px 34px;
  overflow: hidden;
  position: relative;
}
.hero:before { content: ""; position: absolute; width: 420px; height: 420px; right: -210px; top: -180px; border-radius: 50%; background: #1a765f; opacity: .55; }
.hero-grid { padding: 48px 0 42px; position: relative; z-index: 1; display: grid; gap: 32px; }
.eyebrow { color: #a7ddca; font-weight: 600; letter-spacing: .04em; display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.eyebrow:before { content: ""; width: 22px; height: 2px; background: var(--coral); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.3rem, 7vw, 4.8rem); line-height: 1.08; letter-spacing: -.045em; max-width: 730px; margin-bottom: 16px; }
.hero-lede { font-size: 1.12rem; color: #d5e9e2; max-width: 610px; margin-bottom: 26px; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { min-height: 52px; border: 0; border-radius: 15px; padding: 0 20px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 9px; transition: .2s ease; text-decoration: none; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--coral); color: white; box-shadow: 0 10px 24px rgba(243,124,104,.26); }
.btn-secondary { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.26); color: white; }
.btn-green { background: var(--green-800); color: white; }
.btn-ghost { background: var(--mint-50); color: var(--green-800); }
.btn-block { width: 100%; }

.trust-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.14); border-radius: 18px; overflow: hidden; }
.hero-visual { position: relative; display: grid; gap: 12px; }
.hero-photo { width: 100%; height: 250px; object-fit: cover; object-position: 68% center; border-radius: 24px; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 18px 38px rgba(3,30,24,.28); }
.trust-item { background: rgba(255,255,255,.07); padding: 16px 10px; text-align: center; }
.trust-item strong { display: block; font-size: 1.15rem; color: white; }
.trust-item span { color: #bcd8cf; font-size: .78rem; }

.quick-card { margin-top: -18px; position: relative; z-index: 3; background: white; box-shadow: var(--shadow); border-radius: var(--radius); padding: 22px; }
.service-area { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; padding: 16px; color: var(--green-950); font-weight: 600; }
.service-area > span:first-child { color: var(--muted); font-weight: 500; }
.area-pill { background: var(--mint-100); color: var(--green-800); border-radius: 999px; padding: 6px 13px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { font-size: 1.65rem; margin-bottom: 2px; letter-spacing: -.03em; }
.section-head p { color: var(--muted); margin: 0; }
.text-btn { border: 0; background: transparent; color: var(--green-700); font-weight: 600; cursor: pointer; padding: 7px; }
.journey-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.journey-step { padding: 16px; border: 1px solid var(--line); background: #fbfdfc; border-radius: 17px; min-height: 116px; }
.step-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--mint-100); color: var(--green-800); display: grid; place-items: center; margin-bottom: 12px; font-weight: 700; }
.journey-step strong { display: block; margin-bottom: 2px; }
.journey-step span { color: var(--muted); font-size: .88rem; }

.section { padding: 46px 0; }
.section-soft { background: var(--mint-50); margin-top: 46px; }
.care-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; }
.price-card { background: var(--coral-light); border: 1px solid #f6cdc4; border-radius: var(--radius); padding: 22px; display: grid; gap: 18px; }
.price-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.price-option { background: white; border-radius: 17px; padding: 16px; border: 1px solid rgba(243,124,104,.28); }
.price-option span, .price-option strong { display: block; }
.price-option span { color: var(--muted); }
.price-option strong { font: 800 1.55rem/1.2 Manrope, sans-serif; color: var(--green-950); margin-top: 3px; }
.travel-note { background: var(--green-950); color: white; border-radius: 17px; padding: 16px 18px; }
.travel-note strong { display: block; font-size: 1.06rem; }
.travel-note span { color: #c8dfd7; font-size: .9rem; }
.care-main { padding: 22px; }
.care-person { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.photo-avatar { width: 62px; height: 62px; border-radius: 20px; background: linear-gradient(145deg, #ffd9cf, #f39c88); display: grid; place-items: center; font-size: 1.4rem; font-weight: 700; color: #7b2d20; }
.care-person h3 { margin: 0 0 2px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--green-700); background: var(--mint-100); border-radius: 999px; padding: 5px 10px; font-size: .82rem; font-weight: 600; }
.status-pill:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #23a77f; box-shadow: 0 0 0 3px rgba(35,167,127,.13); }
.progress-line { height: 8px; background: #edf2ef; border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress-line > span { display: block; width: 52%; height: 100%; border-radius: inherit; background: var(--coral); }
.progress-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; }
.care-side { background: var(--green-950); color: white; padding: 22px; }
.care-side p { color: #bcd8cf; }
.care-side .btn { margin-top: 8px; }

.feature-grid { display: grid; gap: 14px; }
.feature { border: 1px solid var(--line); border-radius: 20px; padding: 20px; }
.feature-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--coral-light); color: #b84e3c; margin-bottom: 16px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); margin: 0; }

.bottom-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: 76px; background: rgba(255,254,251,.96); backdrop-filter: blur(18px); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-item { border: 0; background: transparent; color: #71817c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .76rem; cursor: pointer; }
.nav-item.active { color: var(--green-800); font-weight: 600; }
.nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.inner-page { padding: 26px 0 40px; }
.page-title { margin-bottom: 24px; }
.page-title h1 { color: var(--ink); font-size: clamp(2rem, 6vw, 3.5rem); margin-bottom: 4px; }
.page-title p { color: var(--muted); }
.list-card { border: 1px solid var(--line); border-radius: 22px; padding: 20px; margin-bottom: 14px; background: white; }
.booking-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.booking-top h3 { margin-bottom: 2px; }
.booking-meta { color: var(--muted); margin: 0; }
.booking-route { margin: 18px 0; display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.route-track { display: flex; flex-direction: column; align-items: center; }
.route-dot { width: 10px; height: 10px; border: 2px solid var(--green-700); border-radius: 50%; }
.route-stem { flex: 1; width: 2px; background: var(--line); min-height: 32px; }
.route-copy strong, .route-copy span { display: block; }
.route-copy span { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.empty-state { text-align: center; padding: 50px 24px; border: 1px dashed #bfd2ca; border-radius: var(--radius); background: var(--mint-50); }
.empty-icon { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 50%; margin: 0 auto 18px; background: var(--mint-100); color: var(--green-700); font-size: 1.6rem; }

.family-grid { display: grid; gap: 14px; }
.family-member { display: flex; align-items: center; gap: 14px; }
.family-member .avatar { width: 52px; height: 52px; flex: 0 0 auto; }
.family-member h3 { margin: 0; }
.family-member p { margin: 0; color: var(--muted); }
.spacer { flex: 1; }
.icon-button { border: 1px solid var(--line); background: white; border-radius: 12px; width: 42px; height: 42px; cursor: pointer; }

.profile-hero { background: var(--green-950); border-radius: var(--radius); padding: 26px; color: white; display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.profile-hero .avatar { width: 70px; height: 70px; font-size: 1.3rem; }
.profile-hero h2 { margin-bottom: 1px; }
.profile-hero p { color: #bcd8cf; margin: 0; }
.setting-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; display: flex; align-items: center; gap: 14px; padding: 17px 2px; cursor: pointer; text-align: left; }
.setting-row:last-child { border-bottom: 0; }
.setting-row .label-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--mint-50); display: grid; place-items: center; color: var(--green-700); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(6, 30, 25, .6); z-index: 70; display: flex; align-items: end; justify-content: center; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 28px 28px 0 0; padding: 22px 20px 28px; animation: rise .3s ease-out; }
@keyframes rise { from { transform: translateY(30px); opacity: .7; } }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 20px; }
.modal-head h2 { margin-bottom: 2px; font-size: 1.6rem; }
.modal-head p { color: var(--muted); margin: 0; }
.close-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: white; font-size: 1.4rem; cursor: pointer; flex: 0 0 auto; }
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 24px; }
.stepper span { height: 5px; border-radius: 99px; background: #e4ece8; }
.stepper span.active { background: var(--coral); }
.form-grid { display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 7px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #cbdad4; border-radius: 14px; background: white; min-height: 52px; padding: 13px 14px; color: var(--ink); outline: none; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(23,112,95,.1); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--green-700) 50%), linear-gradient(135deg, var(--green-700) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { border: 1px solid var(--line); border-radius: 16px; padding: 15px; cursor: pointer; background: white; }
.choice input { position: absolute; opacity: 0; }
.choice:has(input:checked) { border-color: var(--green-700); background: var(--mint-50); box-shadow: inset 0 0 0 1px var(--green-700); }
.choice strong, .choice span { display: block; }
.choice span { color: var(--muted); font-size: .84rem; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.form-actions .btn { flex: 1; }
.summary-box { background: var(--mint-50); border: 1px solid #cce4da; padding: 18px; border-radius: 18px; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #dbece5; }
.summary-row:last-child { border: 0; }
.summary-row span { color: var(--muted); }
.price { font-family: Manrope, sans-serif; font-size: 1.3rem; font-weight: 800; }
.disclaimer { font-size: .82rem; color: var(--muted); margin: 12px 0 0; }
.map-calculator { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: white; }
.map-tools { padding: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.map-tools strong { width: 100%; }
.pin-btn { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 8px 13px; cursor: pointer; font-weight: 600; }
.pin-btn.active { background: var(--green-800); color: white; border-color: var(--green-800); }
#distance-map { height: 280px; background: #e6efeb; }
.map-result { margin: 0; padding: 14px 16px; background: var(--mint-50); color: var(--green-950); font-weight: 600; border-top: 1px solid var(--line); }
.map-result.pending { color: var(--muted); font-weight: 500; }
.map-fallback { padding: 14px; border-top: 1px solid var(--line); }
.map-fallback label { display: block; color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.map-fallback input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cbdad4; border-radius: 12px; }
.payment-panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.payment-panel input[type="file"] { width: 100%; border: 1px dashed #aac9bd; border-radius: 14px; padding: 16px; background: var(--mint-50); }
.verify-note { display: flex; gap: 9px; align-items: flex-start; margin-top: 10px; color: var(--muted); font-size: .86rem; }
.verify-note b { color: var(--green-700); }
.leaflet-control-attribution { font-size: 10px; }
.success-mark { width: 76px; height: 76px; margin: 8px auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--mint-100); color: var(--green-700); font-size: 2rem; }
.center { text-align: center; }

.tracker-hero { background: var(--green-950); color: white; padding: 26px; border-radius: var(--radius); margin-bottom: 16px; }
.tracker-hero p { color: #bcd8cf; }
.carer-bar { background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.13); border-radius: 18px; padding: 14px; display: flex; align-items: center; gap: 12px; }
.carer-bar .avatar { background: var(--coral); color: white; width: 48px; height: 48px; }
.carer-bar strong, .carer-bar span { display: block; }
.carer-bar span { color: #bcd8cf; font-size: .86rem; }
.timeline { position: relative; padding-left: 35px; }
.timeline:before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 16px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 22px; }
.timeline-dot { position: absolute; left: -35px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: white; border: 2px solid var(--line); display: grid; place-items: center; font-size: .72rem; }
.timeline-item.done .timeline-dot { background: var(--green-700); border-color: var(--green-700); color: white; }
.timeline-item.active .timeline-dot { background: var(--coral); border-color: var(--coral); color: white; box-shadow: 0 0 0 5px var(--coral-light); }
.timeline-item h3 { margin-bottom: 1px; font-size: 1rem; }
.timeline-item p { color: var(--muted); margin: 0; font-size: .9rem; }
.timeline-item small { color: var(--green-700); font-weight: 600; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 92px; transform: translateX(-50%); background: var(--ink); color: white; padding: 12px 18px; border-radius: 13px; box-shadow: var(--shadow); min-width: 220px; text-align: center; animation: toast-in .25s ease; }
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }

@media (min-width: 720px) {
  .app-shell { width: min(1280px, calc(100% - 32px)); margin: 18px auto; min-height: calc(100vh - 36px); border-radius: 30px; overflow: clip; box-shadow: 0 18px 60px rgba(33,78,68,.12); }
  .topbar { position: relative; padding: 0 42px; }
  .profile-copy { display: block; }
  .hero { border-radius: 0; }
  .hero-grid { grid-template-columns: 1fr 300px; align-items: end; padding: 64px 0 58px; }
  .hero-photo { height: 330px; }
  .quick-card { margin-top: -24px; padding: 28px; }
  .service-area { justify-content: flex-start; padding: 18px 0 4px; }
  .journey-grid { grid-template-columns: repeat(4, 1fr); }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .care-card { grid-template-columns: 1.45fr .75fr; }
  .price-card { grid-template-columns: 1.1fr 1fr; align-items: center; }
  .family-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-backdrop { align-items: center; padding: 28px; }
  .modal { max-width: 660px; border-radius: 28px; padding: 28px; }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .bottom-nav { left: 50%; right: auto; width: min(560px, calc(100% - 40px)); transform: translateX(-50%); bottom: 18px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
  main { padding-bottom: 110px; }
}

@media (min-width: 1100px) {
  .container { width: min(1120px, calc(100% - 80px)); }
  .hero-grid { grid-template-columns: 1fr 350px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition: none !important; }
}
