/* =====================================================================
   RideGo — Design system
   Palette : ink #101826 · vest #FF6A2B · signal #14B87A · canvas #F4F5F7
   Type    : IBM Plex Sans Thai (display) · Sarabun (body) · IBM Plex Mono (data)
   ===================================================================== */

:root {
  --ink:        #101826;
  --ink-soft:   #26303F;
  --vest:       #FF6A2B;
  --vest-dim:   #FFF1EA;
  --signal:     #14B87A;
  --signal-dim: #E6F7F0;
  --danger:     #E5484D;
  --danger-dim: #FDECEC;
  --warn:       #F2A20C;
  --warn-dim:   #FFF6E3;

  --canvas:  #F4F5F7;
  --surface: #FFFFFF;
  --line:    #E5E8EC;
  --muted:   #6B7684;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(16,24,38,.06), 0 1px 3px rgba(16,24,38,.05);
  --shadow-md: 0 4px 16px rgba(16,24,38,.08);
  --shadow-lg: 0 -8px 32px rgba(16,24,38,.14);

  --font-display: "IBM Plex Sans Thai", system-ui, sans-serif;
  --font-body: "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a  { color: var(--ink); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.tiny  { font-size: .74rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.stack  { display: flex; flex-direction: column; gap: 12px; }
.row    { display: flex; align-items: center; gap: 10px; }
.wrap   { flex-wrap: wrap; }

/* --------------------------------------------------------------- shell */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* หน้าที่มีแผนที่: ล็อกความสูงหน้าจอ ไม่ให้ scroll ทั้งหน้า
   แล้วให้แผนที่กินพื้นที่ที่เหลือระหว่าง topbar กับ sheet */
.app.has-map {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
@media (min-width: 900px) {
  body.framed { background: #E8EAEE; }
  body.framed .app { box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(16,24,38,.12); }
}

/* แถบบนต้องเผื่อพื้นที่ให้แถบสถานะ/รอยบากของมือถือ
   ไม่งั้นชื่อและปุ่มจะไปทับกับนาฬิกาและไอคอนแบต จนกดไม่ได้ */
.topbar {
  position: sticky; top: 0; z-index: 800;
  display: flex; align-items: center; gap: 11px;
  padding: 11px calc(14px + var(--safe-r)) 11px calc(14px + var(--safe-l));
  padding-top: calc(11px + var(--safe-t));
  background: var(--ink); color: #fff;
  min-height: calc(58px + var(--safe-t));
}
.topbar h1 {
  font-size: 1.02rem; color: #fff; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar .sub {
  font-size: .73rem; color: #9AA6B6; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar a, .topbar button { color: #fff; }

/* ปุ่มในแถบบน ทำเป็นทรงกลมเล็กเพื่อประหยัดที่และกดง่ายด้วยนิ้วโป้ง */
.top-act {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 12px; cursor: pointer;
  background: #202B3C; color: #fff;
  font-size: 17px; text-decoration: none;
  transition: background .15s;
}
.top-act:active { background: #2C3A4F; }
.top-acts { display: flex; gap: 7px; flex: none; }

.brand-dot {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--vest); display: grid; place-items: center;
  font-size: 17px; flex: none;
}

.page { padding: 16px; flex: 1; }

/* --------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
}
.card + .card { margin-top: 12px; }
.card-flat { background: var(--canvas); border: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------- forms */
label.field { display: block; margin-bottom: 12px; }
label.field > span {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 5px;
}
input[type=text], input[type=tel], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(16,24,38,.08);
}
input:disabled, select:disabled { background: var(--canvas); color: var(--muted); }
textarea { resize: vertical; min-height: 72px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--ink); color: #fff;
  cursor: pointer; text-decoration: none;
  transition: transform .1s ease, opacity .15s, background .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; pointer-events: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 20px; font-size: 1rem; border-radius: var(--r-md); }
.btn-sm { padding: 8px 12px; font-size: .84rem; }
.btn-vest    { background: var(--vest); }
.btn-signal  { background: var(--signal); }
.btn-danger  { background: var(--danger); }
.btn-ghost   { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet   { background: var(--canvas); color: var(--ink-soft); }
:focus-visible { outline: 3px solid var(--vest); outline-offset: 2px; }

/* --------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .74rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--canvas); color: var(--ink-soft);
  white-space: nowrap;
}
.pill-vest   { background: var(--vest-dim);   color: #B6431A; }
.pill-signal { background: var(--signal-dim); color: #0A7A50; }
.pill-warn   { background: var(--warn-dim);   color: #96650A; }
.pill-danger { background: var(--danger-dim); color: #B02A2F; }
.pill-ink    { background: var(--ink); color: #fff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot-live { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

/* --------------------------------------------------------------- map */
/* กล่องแผนที่ต้องกำหนดขนาดจริง ไม่ใช่ height:100% ในกล่อง flex
   เพราะเปอร์เซ็นต์จะคำนวณไม่ได้แล้วยุบเหลือ 0 บนมือถือ */
#map-wrap {
  position: relative;
  flex: 1 1 0%;        /* ไม่แย่งพื้นที่ตามความสูงเนื้อหา ให้แผงด้านล่างได้ที่ก่อน */
  min-height: 110px;
  height: 100%;
}
#map-wrap > .map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #DDE3E8;
}
.map { width: 100%; height: 100%; background: #DDE3E8; }
.leaflet-container { font-family: var(--font-body); background: #DDE3E8; }
.leaflet-container .leaflet-control-attribution { font-size: 9px; }

.map-fab {
  position: absolute; z-index: 500;
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  display: grid; place-items: center; font-size: 18px; cursor: pointer;
  color: var(--ink);
}
.map-fab:active { background: var(--canvas); }

.pin-badge {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #fff; font-size: 13px; font-weight: 700;
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* --------------------------------------------------------------- sheet */
.sheet {
  position: relative; z-index: 700;
  flex: 0 1 auto;      /* ย่อได้เมื่อพื้นที่ไม่พอ แล้วเลื่อนอ่านข้างในแทน */
  min-height: 0;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 8px 16px calc(16px + var(--safe-b));
  /* จำกัดความสูงโดยยังเหลือที่ให้แผนที่อย่างน้อย 110px เสมอ
     ใช้ min() กันไม่ให้แผงสูงเกินจอจนปุ่มด้านล่างถูกตัดหาย */
  max-height: 62vh;
  max-height: min(62dvh, calc(100dvh - 168px - var(--safe-t)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* ตอนมีงานเข้า ให้พื้นที่ sheet มากที่สุดเท่าที่เหลือ เพราะการ์ดงานมีรายละเอียดเยอะ */
.sheet.tall {
  max-height: 80vh;
  max-height: calc(100dvh - 168px - var(--safe-t));
}

/* จอเตี้ยมาก (มือถือแนวนอน) ให้แผนที่เหลือที่หายใจ */
@media (max-height: 560px) { .sheet { max-height: 55dvh; } }
.sheet-grip {
  width: 42px; height: 4px; border-radius: 99px;
  background: #D6DAE0; margin: 6px auto 12px;
}

/* --------------------------------------------------------------- route rail (signature) */
.rail { display: grid; grid-template-columns: 18px 1fr; gap: 0 12px; }
.rail-mark { display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.rail-node {
  width: 11px; height: 11px; border-radius: 50%;
  border: 3px solid var(--signal); background: var(--surface); flex: none;
}
.rail-node.to { border-color: var(--vest); border-radius: 3px; }
.rail-line { flex: 1; width: 2px; background: repeating-linear-gradient(to bottom, var(--line) 0 4px, transparent 4px 8px); min-height: 26px; }
.rail-text { padding-bottom: 14px; }
.rail-text:last-child { padding-bottom: 0; }
.rail-text b { display: block; font-family: var(--font-display); font-size: .93rem; font-weight: 600; }
.rail-text span { font-size: .8rem; color: var(--muted); }

/* --------------------------------------------------------------- vehicle picker */
.vehicles { display: grid; gap: 8px; }
.veh {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 13px; border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: left; width: 100%;
  font: inherit; color: inherit; transition: border-color .15s, background .15s;
}
.veh:hover { border-color: #C9CFD8; }
.veh[aria-pressed=true] { border-color: var(--ink); background: #FAFBFC; }

/* ไอคอนประเภทรถอยู่ในวงกลม ขนาดคงที่ ไม่ให้ข้อความดันจนเบี้ยว */
.veh-ic {
  width: 42px; height: 42px; flex: none; border-radius: 13px;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
  background: var(--canvas); color: var(--ink-soft);
}
/* ส่วนข้อความยืดหยุ่นได้ แต่ต้องยอมหดเพื่อไม่ให้ดันราคาตกบรรทัด */
.veh-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.veh .nm {
  font-family: var(--font-display); font-weight: 600; font-size: .98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.veh-meta {
  font-size: .78rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.veh .price {
  flex: none; white-space: nowrap;
  font-family: var(--font-mono); font-weight: 600; font-size: 1.08rem;
}

/* --------------------------------------------------------------- pickup code (signature) */
.code-tiles { display: flex; gap: 8px; justify-content: center; }
.code-tiles input {
  width: 46px; height: 58px; text-align: center;
  font-family: var(--font-mono); font-size: 1.6rem; font-weight: 600;
  padding: 0; border-radius: var(--r-sm);
}
.code-show {
  display: flex; gap: 7px; justify-content: center; margin: 6px 0 2px;
}
.code-show span {
  width: 44px; height: 56px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600;
  color: var(--ink); background: var(--vest-dim);
  border: 1px dashed #F0B99A; border-radius: var(--r-sm);
}

/* --------------------------------------------------------------- offer card */
.offer {
  border: 1.5px solid var(--ink); border-radius: var(--r-lg);
  padding: 14px; background: var(--surface); box-shadow: var(--shadow-md);
}
.offer + .offer { margin-top: 12px; }
.offer-top {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px dashed var(--line);
}
.offer-fare { font-family: var(--font-mono); font-size: 1.65rem; font-weight: 600; }
.timer-bar { height: 3px; border-radius: 99px; background: var(--canvas); overflow: hidden; margin-bottom: 12px; }
.timer-bar i { display: block; height: 100%; background: var(--vest); transition: width 1s linear; }

/* --------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 14px; }
.stat b { display: block; font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600; line-height: 1.2; }
.stat span { font-size: .78rem; color: var(--muted); }
.stat.accent { border-color: var(--vest); background: var(--vest-dim); }

/* --------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.tbl th {
  font-family: var(--font-display); font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--canvas); white-space: nowrap;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #FAFBFC; }

/* --------------------------------------------------------------- admin shell */
.admin { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; }
.side { background: var(--ink); color: #fff; padding: 18px 14px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.side .nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
.side .nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: #C3CBD6; text-decoration: none; font-size: .9rem; font-weight: 500;
}
.side .nav a:hover { background: #1B2534; color: #fff; }
.side .nav a.on { background: var(--vest); color: #fff; }
.main { padding: 22px 24px 60px; max-width: 1240px; }
.main > header { margin-bottom: 18px; }
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side .nav { flex-direction: row; overflow-x: auto; gap: 6px; }
  .side .nav a { white-space: nowrap; }
  .main { padding: 16px 14px 48px; }
}

/* --------------------------------------------------------------- misc */
.avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  background: var(--canvas); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; color: var(--ink-soft);
  border: 1px solid var(--line); flex: none;
}
.avatar-lg { width: 62px; height: 62px; font-size: 1.2rem; }

.alert { padding: 11px 13px; border-radius: var(--r-sm); font-size: .88rem; margin-bottom: 12px; }
.alert-err  { background: var(--danger-dim); color: #92211F; }
.alert-ok   { background: var(--signal-dim); color: #0A6E48; }
.alert-info { background: #EEF3FB; color: #24457A; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty .em { font-size: 34px; display: block; margin-bottom: 8px; opacity: .6; }

.toast-host { position: fixed; left: 0; right: 0; bottom: calc(16px + var(--safe-b)); z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 999px;
  font-size: .87rem; box-shadow: var(--shadow-md); max-width: 90vw;
  animation: rise .25s ease;
}
@keyframes rise { from { transform: translateY(10px); opacity: 0 } }

.modal-host {
  position: fixed; inset: 0; z-index: 1500; background: rgba(16,24,38,.55);
  display: grid; place-items: end center; padding: 0;
}
.modal {
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 20px 18px calc(20px + var(--safe-b));
  animation: rise .25s ease;
  /* เนื้อหายาว (เช่น รายการเหตุผลรายงานไรเดอร์) ต้องเลื่อนได้
     ไม่งั้นปุ่มยืนยันจะตกขอบจอแล้วกดไม่ได้ */
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* แถบปุ่มที่ต้องเห็นตลอดแม้เลื่อนเนื้อหา */
.modal-actions {
  position: sticky; bottom: calc(-20px - var(--safe-b));
  margin: 14px -18px calc(-20px - var(--safe-b));
  padding: 12px 18px calc(12px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.modal-scroll { max-height: 46dvh; overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 620px) {
  .modal-host { place-items: center; }
  .modal { border-radius: var(--r-lg); }
}

.divider { height: 1px; background: var(--line); margin: 14px 0; }

.progress-steps { display: flex; gap: 4px; margin: 4px 0 14px; }
.progress-steps i { flex: 1; height: 3px; border-radius: 99px; background: var(--line); }
.progress-steps i.on { background: var(--signal); }

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


/* =====================================================================
   ประกาศระงับบัญชี — คลุมทั้งจอ กดอะไรไม่ได้
   ===================================================================== */
.blocker {
  position: fixed; inset: 0; z-index: 5000;
  background: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(32px + var(--safe-t)) 24px calc(32px + var(--safe-b));
  text-align: center; color: #fff;
}
.blocker .mark {
  width: 76px; height: 76px; border-radius: 24px;
  background: var(--danger); display: grid; place-items: center;
  font-size: 38px; margin-bottom: 20px;
}
.blocker h2 { color: #fff; font-size: 1.5rem; margin-bottom: 8px; }
.blocker p { color: #A9B4C2; max-width: 340px; margin: 0 0 6px; }
.blocker .why {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--r-md);
  background: #1B2534; color: #E4E8EE; font-size: .88rem; max-width: 340px;
}
.blocker .foot { margin-top: 26px; font-size: .78rem; color: #6E7B8C; }

/* =====================================================================
   รายการเหตุผล (ยกเลิกงาน / รายงานไรเดอร์)
   ===================================================================== */
.reasons { display: grid; gap: 8px; margin: 14px 0; }
.reason {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left; font: inherit; color: inherit;
  padding: 12px 14px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s, background .15s;
}
.reason:hover { border-color: #C9CFD8; }
.reason[aria-pressed=true] { border-color: var(--ink); background: #FAFBFC; }
.reason .tick {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 11px; color: #fff;
}
.reason[aria-pressed=true] .tick { background: var(--ink); border-color: var(--ink); }

/* นับถอยหลังเวลายกเลิก */
.cancel-window {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 13px; margin-bottom: 12px;
  background: var(--warn-dim); border-radius: var(--r-md);
  font-size: .84rem; color: #7A5307;
}
.cancel-window b { font-family: var(--font-mono); font-size: 1.05rem; }

/* แถบสลับโหมดส่งงานของแอดมิน */
.mode-switch { display: inline-flex; padding: 3px; background: var(--canvas); border-radius: 999px; gap: 3px; }
.mode-switch button {
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .84rem;
  padding: 7px 15px; border-radius: 999px; color: var(--muted);
}
.mode-switch button[aria-pressed=true] { background: var(--ink); color: #fff; }

/* ป้ายจำนวนรายงานใหม่ */
.badge-count {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px;
  padding: 0 6px; border-radius: 999px; background: var(--danger);
  color: #fff; font-size: .7rem; font-weight: 700;
}


/* =====================================================================
   SOS — ขอความช่วยเหลือฉุกเฉิน
   ===================================================================== */
.sos-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 10px; padding: 13px;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  color: #fff; background: var(--danger);
  border: 0; border-radius: var(--r-md); cursor: pointer;
}
.sos-btn:active { transform: scale(.985); }
.sos-btn.sent { background: #7A1418; }

.sos-live {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px; margin-bottom: 12px;
  background: var(--danger-dim); border: 1px solid #F3B9BB;
  border-radius: var(--r-md); font-size: .85rem; color: #8C1F23;
}

/* จอเตือนภัยเต็มหน้า — ปิดเองไม่ได้ ต้องรอแอดมิน */
.siren {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: calc(30px + var(--safe-t)) 22px calc(30px + var(--safe-b));
  text-align: center; color: #fff;
  background: #7A1418;
  animation: siren-flash 1s steps(1) infinite;
}
@keyframes siren-flash { 0%,49% { background:#7A1418 } 50%,100% { background:#C0161C } }
.siren .mark { font-size: 58px; line-height: 1; }
.siren h2 { color: #fff; font-size: 1.55rem; }
.siren p  { color: #FFD9DA; max-width: 340px; margin: 0; }
.siren .who {
  margin-top: 8px; padding: 12px 16px; border-radius: var(--r-md);
  background: rgba(0,0,0,.25); font-size: .88rem; max-width: 340px;
}
.siren .foot { margin-top: 10px; font-size: .78rem; color: #F0AEB0; }

/* แผงแจ้งเตือน SOS ฝั่งแอดมิน */
.sos-panel {
  border: 2px solid var(--danger); border-radius: var(--r-md);
  background: var(--danger-dim); padding: 14px; margin-bottom: 16px;
}
.sos-card {
  background: var(--surface); border: 1px solid #F0B9BB;
  border-radius: var(--r-md); padding: 13px;
}
.sos-card + .sos-card { margin-top: 10px; }
.sos-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sos-contact {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 11px 0;
}
@media (max-width: 520px) { .sos-contact { grid-template-columns: 1fr; } }
.sos-contact > div {
  background: var(--canvas); border-radius: var(--r-sm); padding: 9px 11px;
}

/* =====================================================================
   กล่องตั้งค่าแจ้งเตือนนอกแอป (Web Push)
   ===================================================================== */
.push-box {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  margin-top: 12px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--canvas);
}
.push-box.ok   { background: var(--signal-dim); border-color: #B6E4D0; }
.push-box.warn { background: var(--warn-dim);   border-color: #F2DCA8; }
.push-box .tiny { line-height: 1.35; }

/* =====================================================================
   ส่วนประกอบที่ปรับปรุงรอบล่าสุด
   ===================================================================== */

/* ---- สวิตช์เปิด/ปิดรับงานของไรเดอร์ ----------------------------------
   เดิมเป็นปุ่มเล็กมุมขวา มองข้ามง่ายและกดพลาดบ่อย
   เปลี่ยนเป็นการ์ดเต็มความกว้าง แตะตรงไหนก็ได้ */
.duty {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 15px 16px; margin-bottom: 14px;
  border: 0; border-radius: var(--r-lg); cursor: pointer;
  font: inherit; text-align: left; color: #fff;
  background: var(--ink);
  transition: transform .1s ease;
}
.duty:active { transform: scale(.99); }
.duty.on { background: linear-gradient(135deg, #0E9C68, #14B87A); }
.duty.off { background: #2B3648; }
.duty-icon {
  width: 46px; height: 46px; flex: none; border-radius: 15px;
  display: grid; place-items: center; font-size: 22px;
  background: rgba(255,255,255,.16);
}
.duty-text { flex: 1; min-width: 0; }
.duty-text b {
  display: block; font-family: var(--font-display);
  font-size: 1.12rem; font-weight: 600; line-height: 1.3;
}
.duty-text span { font-size: .8rem; opacity: .8; }
.duty-switch {
  width: 52px; height: 30px; flex: none; border-radius: 99px;
  background: rgba(0,0,0,.28); position: relative; transition: background .2s;
}
.duty-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.duty.on .duty-switch { background: rgba(255,255,255,.35); }
.duty.on .duty-switch::after { transform: translateX(22px); }

/* ---- แถวตัวเลขสรุป ---- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  background: var(--canvas); border-radius: var(--r-md);
  padding: 12px 10px; text-align: center;
}
.tile b {
  display: block; font-family: var(--font-mono);
  font-size: 1.22rem; font-weight: 600; line-height: 1.25;
}
.tile span { font-size: .72rem; color: var(--muted); }
.tile.accent { background: var(--vest-dim); }
.tile.accent b { color: #B6431A; }

/* ---- การ์ดงานที่ยิงเข้ามา ---- */
.offer { border-width: 2px; border-radius: var(--r-xl); padding: 16px; }
.offer-fare { font-size: 1.85rem; letter-spacing: -.02em; }
.timer-bar { height: 5px; margin-bottom: 14px; }
/* ปุ่มรับงานต้องเห็นตลอด ไม่ต้องเลื่อนหา เพราะมีเวลาตัดสินใจจำกัด
   จึงตรึงไว้ที่ก้นการ์ดขณะเลื่อนอ่านรายละเอียด */
.offer-actions {
  display: grid; grid-template-columns: 1fr 1.7fr; gap: 9px;
  position: sticky; bottom: -16px;
  margin: 0 -16px -16px; padding: 12px 16px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.offer-actions .btn { padding: 15px 12px; border-radius: var(--r-md); }

/* ---- แถวข้อมูลแบบป้ายกำกับซ้าย-ค่าขวา ---- */
.kv {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.kv:last-child { border-bottom: 0; }
.kv .k { font-size: .84rem; color: var(--muted); }
.kv .v { font-family: var(--font-mono); font-weight: 600; }
.kv .v.big { font-size: 1.15rem; }

/* ---- ปุ่มหลักที่ต้องเด่นสุดในหน้า ---- */
.btn-hero {
  width: 100%; padding: 17px 20px;
  font-size: 1.05rem; border-radius: var(--r-md);
  box-shadow: 0 4px 14px rgba(255,106,43,.28);
}
.btn-hero.btn-signal { box-shadow: 0 4px 14px rgba(20,184,122,.28); }
.btn-hero:disabled { box-shadow: none; }

/* ---- การ์ดไรเดอร์ที่ลูกค้าเห็น ---- */
.rider-card {
  display: flex; align-items: center; gap: 13px;
  padding: 14px; border-radius: var(--r-lg);
  background: var(--ink); color: #fff; margin-bottom: 12px;
}
.rider-card .avatar { border-color: rgba(255,255,255,.25); }
.rider-card .nm { font-family: var(--font-display); font-weight: 600; font-size: 1.03rem; }
.rider-card .meta { font-size: .8rem; color: #A9B4C2; }
.rider-card .plate {
  display: inline-block; margin-top: 5px; padding: 3px 9px;
  border-radius: 6px; background: #fff; color: var(--ink);
  font-family: var(--font-mono); font-weight: 600; font-size: .84rem;
}
.rider-call {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 20px;
  background: var(--signal); color: #fff; text-decoration: none;
}

/* ---- แถบเวลาที่ไรเดอร์จะถึง ---- */
.eta-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 13px 15px; margin-bottom: 12px;
  border-radius: var(--r-md); background: var(--signal-dim);
}
.eta-bar .lbl { font-size: .82rem; color: #0A6E48; }
.eta-bar .val { font-family: var(--font-mono); font-weight: 600; font-size: 1.35rem; color: #0A7A50; }

/* ---- แถวขั้นตอนการเดินทาง ---- */
.steps { display: flex; gap: 0; margin: 2px 0 16px; }
.steps .st { flex: 1; text-align: center; position: relative; }
.steps .st::before {
  content: ''; position: absolute; top: 9px; left: -50%; right: 50%;
  height: 2px; background: var(--line);
}
.steps .st:first-child::before { display: none; }
.steps .st.done::before { background: var(--signal); }
.steps .st i {
  position: relative; display: block; width: 20px; height: 20px;
  margin: 0 auto 6px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line);
}
.steps .st.done i { background: var(--signal); border-color: var(--signal); }
.steps .st.now i { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-dim); }
.steps .st span { font-size: .68rem; color: var(--muted); }
.steps .st.done span, .steps .st.now span { color: var(--ink); font-weight: 600; }

/* ---- ปุ่มเลือกรถ ให้กดง่ายขึ้นบนมือถือ ---- */
.veh[aria-pressed=true] { border-color: var(--vest); background: var(--vest-dim); }
.veh[aria-pressed=true] .price { color: #B6431A; }
.veh[aria-pressed=true] .veh-ic { background: #fff; }

/* ---- แถบสรุปราคาก่อนยืนยัน ---- */
.fare-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; margin: 12px 0;
  border-radius: var(--r-md); background: var(--canvas);
}
.fare-bar .total { font-family: var(--font-mono); font-size: 1.45rem; font-weight: 600; }

/* ---- ปุ่มแตะได้ขั้นต่ำตามมาตรฐาน accessibility ---- */
.btn, .veh, .reason, .duty, .top-act, .map-fab { min-height: 44px; }


/* ---- แถบปุ่มหลักที่ตรึงไว้ก้นแผง ----------------------------------
   ปุ่มสำคัญ (รับลูกค้า / ปิดงาน / กรอกรหัส) ต้องกดได้ทันที
   ไม่ต้องเลื่อนหา เพราะไรเดอร์มักกดขณะคร่อมรถอยู่ */
.cta {
  position: sticky;
  bottom: calc(-16px - var(--safe-b));
  margin: 12px -16px calc(-16px - var(--safe-b));
  padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.cta .btn + .btn { margin-top: 8px; }
.cta .tiny { margin-top: 7px; }

/* =====================================================================
   ยกระดับหน้าตา: มิติ เงา และการเคลื่อนไหว
   ===================================================================== */

:root {
  --ease: cubic-bezier(.22,.61,.36,1);
  --shadow-xl: 0 18px 44px rgba(16,24,38,.16), 0 3px 10px rgba(16,24,38,.07);
}

/* ไอคอนเส้น ใช้แทนอีโมจิ */
.ic { display: inline-block; vertical-align: -.18em; flex: none; }

/* ---------------------------------------------------------- โหลดข้อมูล */
.skel-wrap { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.skel {
  height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, #ECEFF3 25%, #F6F8FA 37%, #ECEFF3 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skel.tall { height: 56px; border-radius: var(--r-md); }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }

.loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 22px 12px; color: var(--muted); font-size: .88rem;
}
.spin {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--vest);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* แถบความคืบหน้าบาง ๆ ด้านบนขณะระบบทำงานเบื้องหลัง */
.busy-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 3000;
  background: transparent; overflow: hidden;
}
.busy-bar i {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--vest), transparent);
  animation: slide-lr 1.1s ease-in-out infinite;
}
@keyframes slide-lr { 0% { transform: translateX(-100%) } 100% { transform: translateX(350%) } }

/* ------------------------------------------------------- การเคลื่อนไหว */
@keyframes fade-up { from { opacity: 0; transform: translateY(9px) } to { opacity: 1; transform: none } }
@keyframes pop-in  { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: none } }

/* เล่นอนิเมชันเฉพาะตอนเปลี่ยนหน้าจริง ไม่ใช่ทุกครั้งที่ข้อมูลอัปเดต */
#sheet-body.fresh > * { animation: fade-up .28s var(--ease) both; }
.fresh .offer { animation: pop-in .3s var(--ease) both; }
.card { transition: box-shadow .2s var(--ease), transform .2s var(--ease); }

/* เงาไล่ระดับให้แผงล่างดูลอยขึ้นมาจากแผนที่ */
.sheet { box-shadow: 0 -10px 34px rgba(16,24,38,.16); }
.sheet-grip { transition: background .2s; }

/* ปุ่มมีมิติขึ้นเล็กน้อย ไม่ถึงกับนูนจนดูเก่า */
.btn { box-shadow: 0 1px 2px rgba(16,24,38,.08); }
.btn-ghost, .btn-quiet { box-shadow: none; }
.btn:active { transform: translateY(1px) scale(.99); }

.stat, .tile { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.duty { box-shadow: 0 6px 18px rgba(16,24,38,.16); }
.duty.on { box-shadow: 0 8px 22px rgba(20,184,122,.32); }
.duty-icon .ic { width: 24px; height: 24px; }

.rider-card { box-shadow: 0 8px 22px rgba(16,24,38,.2); }
.top-act .ic { width: 19px; height: 19px; }
.map-fab .ic { width: 21px; height: 21px; }
.rider-call .ic { width: 21px; height: 21px; }

/* จุดสถานะเต้นแบบมีวงกระเพื่อม อ่านง่ายกว่าแค่กะพริบ */
.dot-live { position: relative; }
.dot-live::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid currentColor; opacity: .5;
  animation: ripple 1.8s var(--ease) infinite;
}
@keyframes ripple { to { transform: scale(2.1); opacity: 0 } }

/* =====================================================================
   โฆษณาเด้งตอนเปิดแอป
   ===================================================================== */
.ad-host {
  position: fixed; inset: 0; z-index: 4000;
  display: grid; place-items: center;
  padding: calc(24px + var(--safe-t)) 18px calc(24px + var(--safe-b));
  background: rgba(9,14,24,.68);
  opacity: 0; transition: opacity .22s var(--ease);
  backdrop-filter: blur(3px);
}
.ad-host.in { opacity: 1; }

.ad-box {
  position: relative; width: 100%; max-width: 400px;
  border-radius: var(--r-xl); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-xl);
  transform: scale(.94); transition: transform .26s var(--ease);
}
.ad-host.in .ad-box { transform: none; }

.ad-track { position: relative; width: 100%; aspect-ratio: 4 / 5; background: var(--canvas); }
.ad-slide {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transition: opacity .35s var(--ease);
}
.ad-slide.on { opacity: 1; visibility: visible; }
.ad-slide a, .ad-slide > div { display: block; width: 100%; height: 100%; position: relative; }
.ad-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ad-cta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 16px 14px; color: #fff; font-size: .84rem; font-weight: 600;
  background: linear-gradient(to top, rgba(9,14,24,.78), transparent);
}

.ad-close {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgba(9,14,24,.55); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s;
}
.ad-close:hover { background: rgba(9,14,24,.8); }

.ad-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.85); color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.ad-nav.prev { left: 8px; }
.ad-nav.next { right: 8px; }

.ad-dots {
  position: absolute; left: 0; right: 0; bottom: 10px; z-index: 2;
  display: flex; justify-content: center; gap: 6px;
}
.ad-dot {
  width: 7px; height: 7px; border: 0; border-radius: 50%; padding: 0;
  background: rgba(255,255,255,.55); cursor: pointer; transition: width .2s, background .2s;
}
.ad-dot.on { width: 18px; border-radius: 99px; background: #fff; }

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .dot-live::after { animation: none; }
}


/* =====================================================================
   จองล่วงหน้า
   ===================================================================== */
.sched-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  margin: 12px 0 0; padding: 12px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font: inherit; color: inherit; cursor: pointer;
  transition: border-color .15s;
}
.sched-row:hover { border-color: #C9CFD8; }
.sched-row b { display: block; font-family: var(--font-display); font-weight: 600; font-size: .93rem; }
.sched-row .tiny { display: block; }
.sched-ic {
  width: 38px; height: 38px; flex: none; border-radius: 12px;
  display: grid; place-items: center; background: var(--canvas); color: var(--ink-soft);
}

.slot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px; max-height: 34dvh; overflow-y: auto; padding: 2px;
}
.slot {
  padding: 11px 6px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); font: inherit; font-family: var(--font-mono);
  font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s;
}
.slot[aria-pressed=true] { border-color: var(--vest); background: var(--vest-dim); color: #B6431A; }

.sched-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 12px;
  border-radius: var(--r-md); background: var(--vest-dim); color: #8A3814;
}
.sched-banner b { font-family: var(--font-mono); font-size: 1.15rem; }

/* =====================================================================
   แชทระหว่างลูกค้ากับไรเดอร์
   ===================================================================== */
.chat-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; margin-bottom: 8px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font: inherit; font-weight: 600; cursor: pointer;
  position: relative;
}
.chat-btn .badge-count { position: absolute; top: -6px; right: -6px; }

.chat-log {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 38dvh; overflow-y: auto; padding: 4px 2px 8px;
  overscroll-behavior: contain;
}
.msg {
  max-width: 82%; padding: 9px 12px; border-radius: 15px;
  font-size: .9rem; line-height: 1.4; word-break: break-word;
  animation: pop-in .18s var(--ease) both;
}
.msg.me    { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.msg.them  { align-self: flex-start; background: var(--canvas); border-bottom-left-radius: 5px; }
.msg .at { display: block; font-size: .68rem; opacity: .6; margin-top: 3px; }

.chat-presets { display: flex; gap: 7px; overflow-x: auto; padding: 4px 2px 10px; }
.chat-presets button {
  flex: none; padding: 8px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: .84rem; white-space: nowrap;
}
.chat-presets button:active { background: var(--canvas); }

.chat-form { display: flex; gap: 8px; align-items: center; }
.chat-form input { flex: 1; }
.chat-send {
  width: 46px; height: 46px; flex: none; border: 0; border-radius: 14px;
  background: var(--vest); color: #fff; display: grid; place-items: center; cursor: pointer;
}

/* =====================================================================
   ให้คะแนนไรเดอร์
   ===================================================================== */
.stars { display: flex; justify-content: center; gap: 6px; margin: 16px 0 10px; }
.stars button {
  border: 0; background: transparent; cursor: pointer; padding: 4px;
  color: #D8DDE4; transition: transform .12s var(--ease), color .12s;
}
.stars button.on { color: #F5B301; }
.stars button:active { transform: scale(1.18); }
.stars .ic { width: 34px; height: 34px; fill: currentColor; stroke: currentColor; }

.rate-word { text-align: center; font-family: var(--font-display); font-weight: 600; min-height: 24px; }


/* =====================================================================
   กระเป๋าเงินลูกค้า
   ===================================================================== */
.wallet-chip {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin-bottom: 12px; padding: 8px 8px 8px 13px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--canvas); font-size: .86rem; color: var(--ink);
}
.wallet-chip b { font-size: 1rem; }

/* ส่วนยอดเงินกดได้เพื่อเปิดกระเป๋าเงิน แยกจากปุ่มเติมเงินที่อยู่ข้าง ๆ */
.wallet-main {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; padding: 3px 0;
  border: 0; background: transparent; font: inherit; font-size: inherit;
  color: inherit; cursor: pointer;
}

.wallet-hero {
  padding: 18px; border-radius: var(--r-lg); text-align: center;
  background: var(--ink); color: #fff;
}
.wallet-hero b {
  display: block; font-family: var(--font-mono); font-weight: 600;
  font-size: 2.1rem; line-height: 1.2; margin: 4px 0;
}
.wallet-hero .tiny { color: #A9B4C2; }

.qr-box {
  display: grid; place-items: center; padding: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
}
.qr-box canvas { display: block; border-radius: 6px; }


/* บันทึกการยกเลิกในประวัติงานของไรเดอร์ */
.cancel-note {
  margin-top: 9px; padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--danger-dim); color: #96301C;
  font-size: .78rem; line-height: 1.45;
}
.cancel-note b { display: block; font-size: .79rem; }


/* =====================================================================
   สวิตช์รับงานอัตโนมัติ
   ===================================================================== */
.auto-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  margin-bottom: 12px; padding: 11px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font: inherit; color: inherit; cursor: pointer;
  transition: border-color .18s, background .18s;
}
.auto-row.on { border-color: var(--vest); background: var(--vest-dim); }
.auto-row b { display: block; font-family: var(--font-display); font-weight: 600; font-size: .93rem; }
.auto-row .tiny { display: block; color: var(--muted); }
.auto-row.on .tiny { color: #96461F; }

.auto-ic {
  width: 36px; height: 36px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--canvas); color: var(--ink-soft);
}
.auto-row.on .auto-ic { background: #fff; color: var(--vest); }

.switch {
  width: 44px; height: 26px; flex: none; border-radius: 99px;
  background: #CDD4DD; position: relative; transition: background .18s;
}
.switch i {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease);
}
.switch.on { background: var(--vest); }
.switch.on i { transform: translateX(18px); }

/* =====================================================================
   ระบบนำทางในแอป
   ===================================================================== */
/* ปุ่มนำทาง เป็นแบบเส้นขอบบนพื้นขาว ไม่ใช่ปุ่มหลัก
   ต้องระบุพื้นหลังด้วย เพราะ .btn ตั้งพื้นเป็นสีเข้มไว้ ถ้าใส่แต่สีตัวอักษร
   ข้อความจะกลายเป็นสีเข้มบนพื้นเข้มจนมองไม่เห็น */
.btn-nav {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font-weight: 600;
}
.btn-nav:active { background: var(--canvas); }

body.nav-on .sheet { display: none; }
body.nav-on #map-wrap { position: fixed; inset: 0; height: 100dvh; }
body.nav-on .topbar { display: none; }

.nav-host {
  position: fixed; inset: 0; z-index: 1200;
  pointer-events: none;
  display: flex; flex-direction: column;
  padding: calc(10px + var(--safe-t)) 12px calc(12px + var(--safe-b));
}
.nav-host > * { pointer-events: auto; }

.nav-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--ink); color: #fff; box-shadow: var(--shadow-md);
}
.nav-dest { flex: 1; min-width: 0; }
.nav-dest .tiny { color: #A9B4C2; display: block; }
.nav-dest b {
  display: block; font-family: var(--font-display); font-size: 1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-x {
  width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}

.nav-card {
  margin-top: auto; padding: 14px 16px;
  border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-xl);
}
.nav-main { display: flex; align-items: center; gap: 14px; }
.nav-arrow {
  width: 56px; height: 56px; flex: none; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--vest-dim); color: var(--vest);
}
.nav-text { flex: 1; min-width: 0; }
.nav-text b {
  display: block; font-family: var(--font-mono); font-weight: 600;
  font-size: 1.5rem; line-height: 1.15;
}
.nav-text span { display: block; font-size: .9rem; color: var(--ink-soft); }

.nav-next {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: .82rem; color: var(--muted);
}
.nav-foot {
  display: flex; gap: 14px; margin-top: 10px;
  font-size: .82rem; color: var(--muted);
}
.nav-foot b { color: var(--ink); font-family: var(--font-mono); }
.nav-warn { color: #B6431A; }

.nav-tools { display: flex; gap: 8px; margin-top: 10px; }
.nav-btn {
  flex: 1; padding: 11px 8px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.nav-btn[aria-pressed=false] { color: var(--muted); }


/* ตอนนำทาง แผงคำสั่งอยู่ก้นจอ จึงต้องดันข้อความแจ้งเตือนขึ้นไปไม่ให้บังปุ่ม */
body.nav-on .toast-host {
  bottom: auto;
  top: calc(76px + var(--safe-t));
}


/* ปุ่มหยุดเสียงเตือนบนการ์ดงานเข้า */
.hush {
  width: 32px; height: 32px; flex: none; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.hush:active { background: var(--canvas); }


/* =====================================================================
   หน้าเลือกบริการของลูกค้า
   ===================================================================== */
.mode-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px;
}
.mode-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 16px 14px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); font: inherit; color: var(--ink);
  transition: border-color .18s var(--ease), transform .15s var(--ease);
  box-shadow: var(--shadow-sm);
}
.mode-card:hover  { border-color: #C9CFD8; }
.mode-card:active { transform: scale(.985); }
.mode-card b {
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin-top: 4px;
}
.mode-card span:last-child { font-size: .78rem; color: var(--muted); line-height: 1.4; }

.mode-ic {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--vest-dim); color: var(--vest);
}
.mode-card[data-mode="ride"] .mode-ic { background: var(--canvas); color: var(--ink-soft); }


/* =====================================================================
   งานส่งของ
   ===================================================================== */
.kind-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.kind {
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  padding: 14px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font: inherit; color: var(--ink);
}
.kind[aria-pressed=true] { border-color: var(--vest); background: var(--vest-dim); }
.kind b { display: block; font-family: var(--font-display); font-weight: 600; margin-bottom: 2px; }
.kind .tiny { display: block; line-height: 1.45; }
.kind .tick {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--line); display: grid; place-items: center;
  font-size: .7rem; color: transparent; margin-top: 2px;
}
.kind[aria-pressed=true] .tick { background: var(--vest); border-color: var(--vest); color: #fff; }

.parcel-box {
  padding: 13px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--canvas);
}
.parcel-code {
  margin: 10px 0 8px; padding: 12px; border-radius: var(--r-sm);
  background: var(--ink); color: #fff; text-align: center;
}
.parcel-code b {
  display: block; font-family: var(--font-mono); font-weight: 600;
  font-size: 2rem; letter-spacing: .28em; margin: 2px 0 4px;
}
.parcel-code .tiny { color: #A9B4C2; }


/* ปุ่มน้ำหนักลัดและช่องแนบรูปของ */
.chip-row { display: flex; gap: 7px; margin: -6px 0 12px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: .82rem;
}
.chip.on { border-color: var(--vest); background: var(--vest-dim); color: #B6431A; }

.photo-pick { display: flex; align-items: center; gap: 10px; }
.photo-pick img {
  width: 78px; height: 78px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--line);
}


/* =====================================================================
   ปุ่มสไลด์เพื่อยืนยัน ใช้กับการกระทำที่ย้อนกลับไม่ได้
   ===================================================================== */
.slider {
  position: relative; width: 100%; height: 58px;
  border-radius: var(--r-md); overflow: hidden;
  background: var(--ink); color: #fff;
  display: flex; align-items: center;
  user-select: none; -webkit-user-select: none; touch-action: pan-y;
  box-shadow: var(--shadow-md);
}
.slider.signal { background: var(--signal); }
.slider.vest   { background: var(--vest); }

.slider-track {
  position: absolute; left: 0; right: 0; text-align: center;
  font-family: var(--font-display); font-weight: 600; font-size: .96rem;
  pointer-events: none; transition: opacity .12s;
}
.slider-knob {
  position: relative; z-index: 2;
  width: 50px; height: 50px; margin-left: 4px; flex: none;
  border-radius: calc(var(--r-md) - 4px);
  background: #fff; color: var(--ink);
  display: grid; place-items: center; cursor: grab;
  box-shadow: 0 2px 8px rgba(16,24,38,.25);
}
.slider.dragging .slider-knob { cursor: grabbing; }
.slider-done .slider-knob { opacity: .5; }
.slider[disabled] { opacity: .55; }

/* ลูกศรกะพริบเบา ๆ บอกว่าลากได้ */
.slider:not(.dragging):not(.slider-done) .slider-knob svg {
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateX(0) }
  50%      { transform: translateX(3px) }
}
@media (prefers-reduced-motion: reduce) {
  .slider .slider-knob svg { animation: none; }
}


/* รูปของที่ฝากส่ง บนการ์ดงานเข้าของไรเดอร์ */
.offer-parcel {
  display: flex; align-items: center; gap: 11px;
  margin: 10px 0; padding: 10px;
  border-radius: var(--r-sm); background: var(--canvas);
}
.offer-parcel img {
  width: 62px; height: 62px; flex: none; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--line);
}
.offer-nophoto {
  width: 62px; height: 62px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--surface); color: var(--muted);
}
.offer-parcel b {
  display: block; font-size: .88rem; line-height: 1.35;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.offer-parcel .tiny { display: block; margin-top: 2px; }


/* =====================================================================
   รอผู้รับที่จุดส่ง และหลักฐานเมื่อผู้รับไม่มา
   ===================================================================== */
.wait-box {
  padding: 16px; margin-bottom: 12px; text-align: center;
  border-radius: var(--r-lg); background: var(--ink); color: #fff;
}
.wait-box.ready { background: var(--vest); }
.wait-box .eyebrow { color: #A9B4C2; }
.wait-box.ready .eyebrow { color: #FFE2D4; }
.wait-box b {
  display: block; font-size: 2.3rem; font-weight: 600; line-height: 1.15; margin: 4px 0;
}
.wait-box .tiny { color: #A9B4C2; line-height: 1.45; }
.wait-box.ready .tiny { color: #FFE9DF; }

.proof-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 10px 0;
}
.proof-item { position: relative; }
.proof-item img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--line); display: block;
}
.proof-item button {
  position: absolute; top: 4px; right: 4px;
  padding: 3px 8px; border: 0; border-radius: 99px; cursor: pointer;
  background: rgba(16,24,38,.82); color: #fff; font: inherit; font-size: .7rem;
}


/* หลักฐานที่ไรเดอร์ถ่ายไว้ แสดงให้ผู้ส่งดู */
.case-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.case-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  border-radius: var(--r-sm); border: 1px solid var(--line);
}


/* =====================================================================
   หน้าจอโทรด้วยเสียงในแอป
   ===================================================================== */
.call-host {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(16,24,38,.96);
  display: grid; place-items: center;
  padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b));
}
.call-card { width: 100%; max-width: 340px; text-align: center; color: #fff; }
.call-avatar {
  width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #fff;
}
.call-name {
  display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.4rem;
}
.call-status { display: block; margin-top: 6px; font-size: .92rem; color: #A9B4C2; }

.call-actions { display: flex; gap: 16px; justify-content: center; margin-top: 34px; }
.call-btn {
  width: 74px; padding: 0; border: 0; background: transparent;
  color: #fff; font: inherit; cursor: pointer;
}
.call-btn svg { display: block; margin: 0 auto 7px; }
.call-btn span { font-size: .78rem; }
.call-btn::before {
  content: ''; display: block; width: 62px; height: 62px; margin: 0 auto 8px;
  border-radius: 50%; position: absolute;
}
.call-btn > svg {
  width: 62px; height: 62px; padding: 19px; border-radius: 50%;
  background: rgba(255,255,255,.16); box-sizing: border-box;
}
.call-btn.accept > svg { background: var(--signal); }
.call-btn.end    > svg { background: var(--danger); }
.call-btn.mute.on > svg { background: var(--vest); }

.call-fallback {
  display: block; margin-top: 26px; font-size: .84rem;
  color: #A9B4C2; text-decoration: underline;
}

/* รีวิวในโปรไฟล์ไรเดอร์ */
.review {
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.review:last-child { border-bottom: 0; }
.rv-stars { color: var(--vest); letter-spacing: 2px; font-size: .95rem; }
