/* Trang đặt xe kiểu ứng dụng gọi xe: bản đồ toàn màn hình + bảng thao tác
   Điện thoại: bảng trượt từ đáy · Desktop ≥1024px: bảng nổi bên trái */
body.dx { height: 100dvh; overflow: hidden; padding: 0; background: #E8EEF6; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: .9rem; }

/* ---------- Thanh trên ---------- */
.dx-top {
  position: fixed; z-index: 1100; top: 0; left: 0; right: 0; height: 56px;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.dx-back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; text-decoration: none; color: var(--ink); font-size: 1.3rem; }
.dx-back:hover { background: var(--bg-soft); }
.dx-top .brand__mark { width: 34px; height: 34px; font-size: 1.1rem; }
.dx-top .brand__text { font-size: 1.05rem; }
.dx-call { margin-left: auto; }
.dx-call span { display: none; }

/* ---------- Bản đồ ---------- */
.dx-map-wrap { position: fixed; top: 56px; left: 0; right: 0; bottom: 0; }
.dx-map { position: absolute; inset: 0; background: #E8EEF6; }
.leaflet-control-attribution { font-size: 10px; }
.dx-pin { position: absolute; z-index: 600; left: 50%; top: var(--pin-y, 50%); transform: translate(-50%, -100%); pointer-events: none; display: flex; flex-direction: column; align-items: center; }
.dx-pin .mk { transition: transform .15s; }
.dx-pin.is-moving .mk { transform: translateY(-10px); }
.dx-pin__dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: rgba(15, 23, 42, .45); }
.dx-fab {
  position: absolute; z-index: 600; right: 12px; bottom: calc(var(--sheet-h, 0px) + 12px);
  width: 46px; height: 46px; border: 0; border-radius: 50%; background: #fff; color: var(--blue);
  font-size: 1.35rem; box-shadow: 0 6px 16px rgba(0, 0, 0, .2); cursor: pointer; transition: bottom .2s;
}
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563EB; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, .2); }
.mk--sm { width: 26px; height: 26px; font-size: .75rem; border-width: 2px; flex: none; }
.mk--sm::after { display: none; }

/* ---------- Bảng thao tác (điện thoại) ---------- */
.dx-sheet {
  position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
  max-height: min(72dvh, 640px); overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, .25);
  transition: max-height .25s ease;
}
.dx-sheet.is-min { max-height: 118px; overflow: hidden; }
.dx-handle { display: block; width: 100%; height: 22px; border: 0; background: none; cursor: pointer; }
.dx-handle span { display: block; width: 44px; height: 5px; margin: 0 auto; border-radius: 3px; background: #D5DBE5; }
.dx-h { font-size: 1.25rem; font-weight: 800; margin: 2px 0 14px; }
.dx-sub { margin: 14px 0 6px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Ô điểm đón / điểm đến */
.dx-route { display: grid; grid-template-columns: 18px minmax(0, 1fr) 40px; gap: 10px; align-items: center; padding: 10px 10px 10px 12px; border-radius: 16px; background: var(--bg-soft); }
.dx-line { display: flex; flex-direction: column; align-items: center; height: 72px; padding: 14px 0; }
.dx-line i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dx-line i.a { background: var(--ok); box-shadow: 0 0 0 3px #DCFCE7; }
.dx-line i.b { background: var(--err); border-radius: 3px; box-shadow: 0 0 0 3px #FEE2E2; }
.dx-line b { flex: 1; width: 2px; margin: 3px 0; background: repeating-linear-gradient(var(--muted) 0 3px, transparent 3px 6px); }
.dx-inputs { display: grid; gap: 6px; min-width: 0; }
.dx-in { position: relative; display: block; }
.dx-in input {
  width: 100%; min-width: 0; height: 44px; padding: 0 36px 0 12px; border: 1.5px solid transparent; border-radius: 12px;
  background: #fff; font-size: 16px; font-weight: 500;
}
.dx-in input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(11, 61, 145, .12); }
.dx-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--bg-soft); color: var(--muted); font-size: .8rem; cursor: pointer; }
.dx-swap { width: 40px; height: 40px; border: 1.5px solid var(--line); border-radius: 50%; background: #fff; color: var(--blue); font-size: 1.15rem; cursor: pointer; }

.dx-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.dx-act { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; font-size: .9rem; cursor: pointer; }
.dx-act:hover { border-color: var(--blue); color: var(--blue); }
.dx-act span { color: var(--blue); }

.dx-list { list-style: none; margin: 4px 0 0; padding: 0; }
.dx-list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 10px; }
.dx-list li:hover, .dx-list li.on { background: var(--blue-50); }
.dx-list li:last-child { border-bottom: 0; }
.dx-list .ic { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-soft); }
.dx-list .t { min-width: 0; }
.dx-list .t b { display: block; font-weight: 600; font-size: .95rem; }
.dx-list .t span { display: block; font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-list .empty { cursor: default; color: var(--muted); font-size: .9rem; }
.dx-list .empty:hover { background: none; }

/* Chọn trên bản đồ */
.dx-addr { display: flex; gap: 10px; align-items: center; padding: 12px; margin-bottom: 12px; border-radius: 14px; background: var(--bg-soft); }
.dx-addr b { font-weight: 600; font-size: .95rem; line-height: 1.4; }
.dx-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dx-row2 .btn { padding: 0 10px; }

/* Chọn xe */
.dx-sum { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 12px; border: 0; border-radius: 14px; background: var(--bg-soft); text-align: left; cursor: pointer; }
.dx-sum__r { flex: 1; min-width: 0; display: grid; gap: 4px; font-size: .9rem; }
.dx-sum__r span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-sum__r span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; vertical-align: 1px; }
.dx-sum__r .a::before { background: var(--ok); }
.dx-sum__r .b::before { background: var(--err); border-radius: 2px; }
.dx-sum__e { flex: none; font-weight: 700; color: var(--blue); font-size: .88rem; }
.dx-meta { margin: 8px 2px 12px; font-size: .88rem; color: var(--muted); }
.dx-meta b { color: var(--ink); }

.dx-cars { display: grid; gap: 8px; }
.dx-car {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
  padding: 12px; border: 2px solid var(--line); border-radius: 16px; background: #fff; text-align: left; cursor: pointer; transition: border-color .15s, background .15s;
}
.dx-car:hover { border-color: #BFD0EE; }
.dx-car.on { border-color: var(--blue); background: var(--blue-50); }
.dx-car__ic { display: grid; place-items: center; height: 44px; border-radius: 12px; background: #fff; font-size: 1.8rem; }
.dx-car.on .dx-car__ic { background: #fff; }
.dx-car__n b { display: block; font-size: 1rem; }
.dx-car__n span { font-size: .82rem; color: var(--muted); }
.dx-car__p { text-align: right; min-width: 6.4em; }   /* cột giá cố định: đổi 550.000đ ↔ 1.050.000đ không đẩy chữ bên cạnh */
.dx-car__n span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-car__p b { display: block; font-size: 1.1rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.dx-car__p span { font-size: .78rem; color: var(--muted); }

.dx-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: var(--bg-soft); }
.dx-seg button { min-height: 38px; border: 0; border-radius: 9px; background: none; font-weight: 600; font-size: .86rem; color: var(--muted); cursor: pointer; }
.dx-seg button.on { background: var(--blue); color: #fff; box-shadow: 0 2px 6px rgba(11, 61, 145, .3); }
.dx-seg--full { margin-top: 12px; }
.dx-seg button { transition: background .15s, color .15s; }
.dx-when { margin-top: 10px; }
.dx-when__lbl { display: block; margin: 0 2px 6px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.dx-when__row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 8px; }
.dx-when select {
  width: 100%; height: 46px; padding: 0 34px 0 12px; border: 1.5px solid var(--line); border-radius: 12px; background-color: #fff; font-size: 16px; font-weight: 600; color: var(--ink);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.dx-when select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(11, 61, 145, .12); }
.dx-note { margin: 8px 2px 0; font-size: .8rem; color: #B45309; }
.dx-cta { margin-top: 14px; }

/* Thông tin */
.dx-backstep { border: 0; background: none; padding: 4px 0; color: var(--blue); font-weight: 700; cursor: pointer; }
.dx-bill { padding: 12px 14px; margin: 4px 0 4px; border-radius: 14px; background: var(--bg-soft); font-size: .9rem; }
.dx-bill dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.dx-bill dt { color: var(--muted); }
.dx-bill dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.dx-bill .tong { padding-top: 8px; margin-top: 4px; border-top: 1px dashed var(--line); font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.dx-bill .tong + dd { padding-top: 8px; margin-top: 4px; border-top: 1px dashed var(--line); font-weight: 800; font-size: 1.15rem; color: var(--blue); }
.dx-alt { margin-top: 8px; }
.dx-sheet .form-error { margin-top: 10px; }
.dx-sheet .row { gap: 10px; }
.dx-sheet .field { margin-bottom: 10px; }
.dx-sheet .field input, .dx-sheet .field select { min-height: 46px; font-size: 16px; }
.dx-sheet .field textarea { min-height: 88px; font-size: 16px; line-height: 1.45; padding: 10px 12px; }
.dx-row-ten { grid-template-columns: 1.4fr 1fr; }

/* Hoàn tất */
.dx-done { text-align: center; padding-top: 6px; }
.dx-done__ic { display: grid; place-items: center; width: 64px; height: 64px; margin: 4px auto 10px; border-radius: 50%; background: #DCFCE7; color: var(--ok); font-size: 2rem; font-weight: 800; }
.dx-done__ic.is-warn { background: #FEF3C7; color: #B45309; }
.dx-code { margin: -6px 0 8px; font-family: ui-monospace, Consolas, monospace; font-size: 1.5rem; font-weight: 800; letter-spacing: .08em; color: var(--blue); }
.dx-tip { font-weight: 600; color: var(--blue); }
.dx-msg { margin: 0 0 14px; padding: 12px; border-radius: 12px; background: var(--bg-soft); font: inherit; font-size: .84rem; text-align: left; white-space: pre-wrap; word-break: break-word; max-height: 30dvh; overflow: auto; }
.dx-done .dx-row2 .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ---------- Điện thoại: chừa chỗ cho bản đồ ---------- */
@media (max-width: 1023px) {
  .dx-sheet { max-height: min(60dvh, 560px); }
  .dx-h { font-size: 1.15rem; margin-bottom: 10px; }
  .dx-car { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 9px 12px; border-radius: 14px; }
  .dx-car__ic { height: 36px; font-size: 1.5rem; background: none; }
  .dx-car__n span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
  .dx-car__p b { font-size: 1.02rem; }
  .dx-meta { margin: 6px 2px 8px; }
  .dx-seg--full { margin-top: 8px; }
  /* nút chính luôn nằm ở đáy bảng, không phải cuộn mới thấy */
  .dx-cta { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); z-index: 2; box-shadow: 0 -12px 16px 4px #fff; }
}

/* ---------- Desktop ---------- */
@media (min-width: 640px) {
  .dx-call span { display: inline; }
}
@media (min-width: 1024px) {
  .dx-top { height: 64px; padding: 0 24px; }
  .dx-map-wrap { top: 64px; }
  .dx-sheet {
    top: 84px; left: 24px; right: auto; bottom: auto; width: 420px;
    max-height: calc(100dvh - 108px); padding: 20px 20px 22px; border-radius: 22px;
    box-shadow: 0 20px 50px -20px rgba(11, 61, 145, .45);
  }
  .dx-sheet.is-min { max-height: calc(100dvh - 108px); overflow-y: auto; }
  .dx-handle { display: none; }
  .dx-fab { right: 24px; bottom: 32px; }
  .dx-pin { left: calc(50% + 222px); }   /* tâm vùng bản đồ bên phải bảng nổi (444px / 2) */
  .dx-h { font-size: 1.45rem; }
}

/* Dòng "Không thấy? Chọn … trên bản đồ" ở cuối gợi ý */
.dx-list li.dx-tuchon { margin-top: 4px; border: 1.5px dashed #BFD0EE; border-bottom: 1.5px dashed #BFD0EE; background: #F8FAFF; }
.dx-list li.dx-tuchon b { color: var(--blue); }
.dx-list li.dx-tuchon span span { white-space: normal; }
.dx-note--ok { color: #15803D; font-weight: 600; }

/* Nhúng trong trang chủ: không có thanh trên; máy tính chia 2 bên — form trái, bản đồ phải */
.dx.dx--nhung .dx-top { display: none; }
.dx.dx--nhung .dx-map-wrap { top: 0; }
@media (min-width: 1024px) {
  .dx.dx--nhung .dx-map-wrap { left: 440px; }
  .dx.dx--nhung .dx-sheet, .dx.dx--nhung .dx-sheet.is-min {
    top: 0; left: 0; bottom: 0; width: 440px; max-height: none; padding: 24px 24px 26px;
    border-radius: 0; box-shadow: none; border-right: 1px solid var(--line);
  }
  .dx.dx--nhung .dx-pin { left: 50%; }
}
