@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');
:root {
  --red: #e2231a;
  --red-dark: #b3140d;
  --ink: #22252b;
  --muted: #6c717b;
  --line: #e6e8ec;
  --bg: #f2f3f5;
  --card: #fff;
  --lane: #ffc72c;
  --ok: #12a150;
  --sheet: 24px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Plus Jakarta Sans', -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--red); }
:focus-visible { outline: 3px solid rgba(226, 35, 26, 0.45); outline-offset: 2px; }

/* ---------- Bar atas (rider/admin) ---------- */
header.top { background: var(--red); color: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 1000; }
header.top .logo, .logo { font-weight: 800; font-size: 20px; letter-spacing: -0.3px; }
header.top .logo span, .logo span { font-weight: 600; opacity: 0.8; }
header.top .right { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 14px; }
header.top button.link { background: rgba(255, 255, 255, 0.18); color: #fff; border: 0; padding: 8px 14px; border-radius: 999px; font-size: 14px; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1200px; }

/* ---------- Skrin peta penuh + panel bawah (pelanggan & tracking) ---------- */
body.app { height: 100dvh; overflow: hidden; background: #dfe3e8; }
.fullmap { position: fixed; inset: 0; z-index: 1; }
.float-bar { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 1100; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.float-bar > * { pointer-events: auto; }
.brand-pill { background: var(--red); color: #fff; padding: 9px 15px; font-size: 17px; border-radius: 999px; box-shadow: 0 4px 14px rgba(34, 37, 43, 0.25); text-decoration: none; }
.round-btn { margin-left: auto; background: #fff; color: var(--ink); border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 14px; box-shadow: 0 4px 14px rgba(34, 37, 43, 0.18); text-decoration: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200; background: #fff; border-radius: var(--sheet) var(--sheet) 0 0; box-shadow: 0 -8px 30px rgba(34, 37, 43, 0.16); max-height: 74dvh; overflow-y: auto; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; transition: max-height 0.3s ease; }
.sheet.tall { max-height: 92dvh; }
.sheet .handle { width: 42px; height: 5px; border-radius: 3px; background: #d5d8de; margin: 4px auto 12px; }
.sheet h1 { font-size: 22px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.4px; font-weight: 800; }
.sheet .sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
@media (min-width: 900px) {
  .sheet { left: 24px; right: auto; bottom: 24px; top: 84px; width: 420px; max-height: none; border-radius: var(--sheet); }
}

/* Laluan A → B gaya app */
.route { position: relative; background: var(--bg); border-radius: 18px; padding: 6px 12px 6px 40px; }
.route::before { content: ''; position: absolute; left: 19px; top: 30px; bottom: 30px; border-left: 2px dotted #b7bcc5; }
.route .stop { position: relative; }
.route .stop + .stop { border-top: 1px solid var(--line); }
.route .dot { position: absolute; left: -28px; top: 17px; width: 14px; height: 14px; border-radius: 50%; }
.route .dot.a { background: var(--red); box-shadow: 0 0 0 4px rgba(226, 35, 26, 0.18); }
.route .dot.b { background: var(--ink); border-radius: 3px; }
.route input { border: 0; background: transparent; padding: 14px 4px; font-weight: 600; }
.route input:focus { outline: none; }
.route .stop:focus-within { background: #fff; margin: 0 -8px; padding: 0 8px; border-radius: 12px; }
.mini-actions { display: flex; gap: 8px; margin: 10px 0 2px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }

/* Tag harga warna garisan jalan */
.price-tag { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; padding: 14px 16px; border-radius: 18px; background: var(--lane); color: var(--ink); }
.price-tag .amt { font-size: 32px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1; }
.price-tag .meta { font-size: 13px; font-weight: 600; text-align: right; }
.price-tag.bad { background: #fff4e5; color: #8a4b00; display: block; font-size: 14px; font-weight: 600; }
.rates { display: flex; gap: 8px; margin: 2px 0 14px; overflow-x: auto; }
.rates span { white-space: nowrap; font-size: 13px; background: var(--bg); border-radius: 999px; padding: 6px 11px; color: var(--muted); }
.rates b { color: var(--ink); }

.section-title { font-size: 15px; font-weight: 700; margin: 16px 0 2px; }
details.more { margin-top: 8px; }
details.more summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); padding: 8px 0; }
.cta-bar { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: linear-gradient(rgba(255,255,255,0), #fff 30%); padding: 14px 0 4px; margin-top: 6px; }

/* ---------- Komponen umum ---------- */
.card { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); }
.card h2 { margin: 0 0 12px; font-size: 19px; letter-spacing: -0.3px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 13px 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(226, 35, 26, 0.3); border-color: var(--red); }
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 13px 18px; font-size: 16px; font-weight: 700; border-radius: 14px; border: 0; background: var(--red); color: #fff; cursor: pointer; text-decoration: none; font-family: inherit; transition: transform 0.08s; }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { background: #c9ccd2; color: #fff; cursor: default; transform: none; }
button.big, .btn.big { width: 100%; padding: 17px; font-size: 17px; border-radius: 16px; }
button.ghost, .btn.ghost { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
button.grey, .btn.grey { background: var(--bg); color: var(--ink); }
button.green, .btn.green { background: var(--ok); }
button.small, .btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
button.block, .btn.block { width: 100%; }
.map { height: 260px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); margin-top: 10px; z-index: 1; }
.map.tall { height: 58vh; min-height: 320px; }
.search-wrap { position: relative; }
ul.suggest { position: absolute; left: -12px; right: -12px; top: 100%; z-index: 1500; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin: 4px 0 0; padding: 4px 0; list-style: none; max-height: 240px; overflow: auto; box-shadow: 0 12px 30px rgba(34, 37, 43, 0.16); }
ul.suggest li { padding: 11px 14px; font-size: 14px; cursor: pointer; }
ul.suggest li:hover, ul.suggest li:active { background: var(--bg); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.quote { display: flex; align-items: center; justify-content: space-between; background: #fff4f3; border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.quote .price { font-size: 26px; font-weight: 800; color: var(--red); }
.quote.bad { background: #fff4e5; }
.pin-dot { width: 30px; height: 30px; border-radius: 50%; color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(34, 37, 43, 0.35); font-size: 13px; }
.rider-dot { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: 0 0 0 6px rgba(226, 35, 26, 0.18), 0 3px 10px rgba(34, 37, 43, 0.3); border: 3px solid var(--red); }
.pin { background: none; border: 0; }
.leaflet-control-attribution { font-size: 10px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.st-pending { background: #fff4e5; color: #a35a00; }
.st-assigned { background: #e8f0fe; color: #1a56db; }
.st-picked { background: #efe9ff; color: #6533c7; }
.st-done { background: #e3f6ea; color: var(--ok); }
.st-cancel { background: var(--bg); color: var(--muted); }

/* Langkah status (urutan sebenar) */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 6px; }
.steps div { height: 6px; border-radius: 3px; background: var(--line); }
.steps div.on { background: var(--red); }
.steps-label { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11px; color: var(--muted); }
.steps-label span.on { color: var(--ink); font-weight: 700; }
.rider-card { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 18px; padding: 12px; margin-top: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto; }
.rider-card .who { flex: 1; min-width: 0; }
.rider-card .who b { display: block; }
.rider-card .who span { font-size: 13px; color: var(--muted); }
.call { width: 46px; height: 46px; border-radius: 50%; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; text-decoration: none; flex: 0 0 auto; }

.timeline { list-style: none; padding: 0; margin: 10px 0 0; }
.timeline li { padding: 6px 0 6px 26px; position: relative; color: var(--muted); }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: #d4d7dd; }
.timeline li.done { color: var(--ink); font-weight: 600; }
.timeline li.done::before { background: var(--ok); }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { background: #fff; color: var(--ink); border: 1px solid var(--line); white-space: nowrap; font-size: 14px; padding: 9px 14px; border-radius: 999px; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.order { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; background: #fff; }
.order .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.order .code { font-weight: 800; }
.order .addr { font-size: 14px; margin: 4px 0; }
.order .addr b { display: inline-block; width: 20px; color: var(--red); }
.order .meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.order .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.stats b { display: block; font-size: 24px; letter-spacing: -0.5px; }
.stats span { font-size: 12px; color: var(--muted); }
.notice { background: #fff8e1; border-radius: 14px; padding: 12px; font-size: 14px; margin-bottom: 12px; }
.notice.ok { background: #e3f6ea; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
#toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%) translateY(-140px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 3000; transition: transform 0.25s; max-width: 92vw; font-size: 15px; font-weight: 600; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red-dark); }
#toast.ok { background: var(--ok); }
.gps-on { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ok); }
.gps-on::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row.stack { flex-direction: column; gap: 0; }
}
@media (min-width: 980px) {
  .admin-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
  .admin-grid .sticky { position: sticky; top: 76px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===== v2: corak Uber / Grab / Gojek ===== */
/* Peta lembut (warna OSM diredamkan supaya pin & laluan menonjol) */
.fullmap .leaflet-tile-pane { filter: saturate(0.45) brightness(1.04) contrast(0.96); }
.pin-svg { filter: drop-shadow(0 3px 4px rgba(34, 37, 43, 0.35)); display: block; }
.pin-label { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; box-shadow: 0 3px 10px rgba(34, 37, 43, 0.25); }
.rider-dot { width: 46px; height: 46px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; border: 3px solid var(--red); box-shadow: 0 3px 12px rgba(34, 37, 43, 0.3); position: relative; }
.rider-dot span { font-size: 22px; line-height: 1; }
.rider-dot::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid rgba(226, 35, 26, 0.45); animation: ring 1.8s ease-out infinite; }
@keyframes ring { from { transform: scale(0.7); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }

/* Panel boleh ditarik: ketik/tarik pemegang untuk kecil/besar */
.sheet .grab { padding: 6px 0 10px; margin: -8px -18px 0; cursor: grab; touch-action: none; }
.sheet .grab .handle { margin: 4px auto 0; }
.sheet.mini { max-height: 30dvh; overflow: hidden; }
.sheet.dragging { transition: none; }

/* Tempat terkini */
.recent { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0 0; padding-bottom: 2px; }
.recent button { flex: 0 0 auto; max-width: 220px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent button::before { content: '🕘 '; }

/* Kad perkhidmatan gaya Uber */
.service { display: flex; align-items: center; gap: 14px; border: 2px solid var(--ink); border-radius: 18px; padding: 12px 14px; margin: 14px 0 4px; }
.service .ico { width: 52px; height: 52px; border-radius: 14px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 28px; flex: 0 0 auto; }
.service .info { flex: 1; min-width: 0; }
.service .info b { display: block; font-size: 16px; }
.service .info span { font-size: 13px; color: var(--muted); }
.service .fare { text-align: right; }
.service .fare b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.service .fare span { display: inline-block; margin-top: 2px; background: var(--lane); color: var(--ink); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.service.bad { border-color: #f0c36d; background: #fff8e8; }
.skeleton { display: inline-block; width: 64px; height: 22px; border-radius: 8px; background: linear-gradient(90deg, #eceef1 25%, #f7f8fa 50%, #eceef1 75%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Anggaran masa tiba (tracking) */
.eta { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 4px; }
.eta b { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.eta span { color: var(--muted); font-size: 14px; font-weight: 600; }
