:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e3e6ea;
  --text: #111b21;
  --muted: #667781;
  --accent: #008069;
  --accent-2: #25d366;
  --accent-soft: #e7f6f1;
  --danger: #d93025;
  --warn: #b26a00;
  --warn-soft: #fff4e0;
  --info: #1a73e8;
  --info-soft: #e8f0fe;
  --wa-header: #008069;
  --wa-bg: #efeae2;
  --wa-out: #d9fdd3;
  --wa-in: #ffffff;
  --wa-link: #027eb5;
  --tick: #53bdeb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.muted { color: var(--muted); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #00a884, #008069);
  color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: .5px;
}
.brand strong { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; gap: 8px; align-items: center; }

.privacy-banner {
  margin: 12px 24px 0; padding: 10px 14px; border-radius: 10px;
  background: var(--info-soft); color: #174ea6; font-size: 12.5px; line-height: 1.5;
  border: 1px solid #d2e3fc;
}

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); white-space: nowrap;
}
.pill-ok { background: var(--accent-soft); border-color: #c4ebdd; color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot-green { background: #1fa855; }
.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0,128,105,.5);} 70% { box-shadow: 0 0 0 7px rgba(0,128,105,0);} 100% { box-shadow: 0 0 0 0 rgba(0,128,105,0);} }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13px;
  background: var(--accent); color: #fff; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); }
.btn-block { width: 100%; }

/* ---------- Layout ---------- */
.view-switch { display: none; }
.stage {
  display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 24px;
  padding: 20px 24px 40px; max-width: 1480px; margin: 0 auto; align-items: start;
}
.phone-col { position: sticky; top: 78px; }
.phone-hint { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ---------- Phone frame ---------- */
.phone {
  width: 380px; height: 790px; margin: 0 auto; border-radius: 48px; padding: 12px;
  background: #1b1f23; box-shadow: 0 0 0 2px #3a3f45, 0 30px 60px rgba(0,0,0,.25);
  position: relative;
}
.phone-notch {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 92px; height: 24px; background: #000; border-radius: 20px; z-index: 30;
}
.screen {
  width: 100%; height: 100%; border-radius: 37px; overflow: hidden; position: relative;
  background: var(--wa-bg); display: flex; flex-direction: column;
}
.statusbar {
  height: 40px; padding: 12px 26px 0; display: flex; justify-content: space-between; align-items: center;
  background: var(--wa-header); color: #fff; font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}
.sb-icons { display: flex; gap: 5px; align-items: center; }
.batt { width: 20px; height: 10px; border: 1.5px solid #fff; border-radius: 3px; position: relative; display: inline-block; }
.batt i { position: absolute; inset: 1px; right: 4px; background: #fff; border-radius: 1px; }

/* ---------- WhatsApp ---------- */
.wa-header {
  display: flex; align-items: center; gap: 4px; padding: 6px 4px 8px; background: var(--wa-header); color: #fff; flex-shrink: 0;
}
.icon-btn { background: transparent; border: 0; color: inherit; padding: 7px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn.muted { color: #8696a0; }
.icon-btn.muted:hover { background: rgba(0,0,0,.05); }
.wa-avatar { width: 38px; height: 38px; border-radius: 50%; background: #fde68a; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.wa-title { flex: 1; min-width: 0; padding-left: 6px; }
.wa-name { font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.verified { background: #25d366; color: #fff; font-size: 9px; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; }
.wa-sub { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.wa-chat {
  flex: 1; overflow-y: auto; padding: 8px 10px 12px; scroll-behavior: smooth;
  background-color: var(--wa-bg);
  background-image:
    radial-gradient(rgba(0,0,0,.035) 1.2px, transparent 1.3px),
    radial-gradient(rgba(0,0,0,.025) 1px, transparent 1.1px);
  background-size: 22px 22px, 31px 31px;
  background-position: 0 0, 11px 7px;
}
.wa-chat::-webkit-scrollbar { width: 4px; }
.wa-chat::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }

.day-chip, .e2e-chip, .sys-chip {
  margin: 6px auto 8px; width: fit-content; max-width: 88%;
  background: #fff; color: #54656f; font-size: 11.5px; padding: 5px 10px; border-radius: 8px; text-align: center;
  box-shadow: 0 1px .5px rgba(11,20,26,.13);
}
.e2e-chip { background: #ffeecd; color: #54656f; line-height: 1.4; }
.sys-chip { background: #e1f2fb; }

.msg-row { display: flex; margin: 2px 0; }
.msg-row.out { justify-content: flex-end; }
.msg-row.first { margin-top: 8px; }
.bubble {
  position: relative; max-width: 84%; padding: 6px 8px 8px 9px; border-radius: 8px; font-size: 14px; line-height: 1.38;
  box-shadow: 0 1px .5px rgba(11,20,26,.13); word-wrap: break-word; animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.msg-row.in .bubble { background: var(--wa-in); }
.msg-row.out .bubble { background: var(--wa-out); }
.msg-row.first.in .bubble { border-top-left-radius: 0; }
.msg-row.first.out .bubble { border-top-right-radius: 0; }
.msg-row.first.in .bubble::before, .msg-row.first.out .bubble::before {
  content: ""; position: absolute; top: 0; width: 8px; height: 13px;
}
.msg-row.first.in .bubble::before { left: -8px; background: linear-gradient(to bottom left, var(--wa-in) 50%, transparent 50%); }
.msg-row.first.out .bubble::before { right: -8px; background: linear-gradient(to bottom right, var(--wa-out) 50%, transparent 50%); }
.bubble .meta { float: right; margin: 6px 0 -4px 10px; font-size: 11px; color: #667781; display: inline-flex; align-items: center; gap: 3px; }
.ticks { color: var(--tick); }
.ticks.grey { color: #8696a0; }
.bubble b { font-weight: 600; }
.bubble a { color: var(--wa-link); text-decoration: none; word-break: break-all; }
.bubble a:hover { text-decoration: underline; }
.bubble .biz-tag { font-size: 11px; color: #1fa855; font-weight: 600; margin-bottom: 2px; display: block; }
.bubble hr { border: 0; border-top: 1px dashed #cfd6db; margin: 6px 0; }
.bubble .row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.bubble .row.total { font-weight: 700; font-size: 14px; }
.bubble .small { font-size: 12px; color: #667781; }

.wa-actions { max-width: 84%; display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.wa-actions button {
  background: #fff; border: 0; color: var(--wa-link); font-weight: 500; padding: 9px; border-radius: 8px;
  box-shadow: 0 1px .5px rgba(11,20,26,.13); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px;
}
.wa-actions button:hover { background: #f5f6f6; }
.wa-actions button:disabled { color: #8696a0; cursor: default; background: #fff; }
.msg-stack { display: flex; flex-direction: column; max-width: 84%; }
.msg-stack .bubble { max-width: 100%; }
.msg-stack .wa-actions { max-width: 100%; }

.typing { display: inline-flex; gap: 3px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa5ac; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* Order (cart) message */
.order-card { display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,.04); border-radius: 6px; padding: 6px; margin-bottom: 6px; min-width: 230px; }
.order-thumbs { width: 54px; height: 54px; border-radius: 6px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; flex-shrink: 0; }
.order-thumbs span { display: grid; place-items: center; font-size: 15px; }
.order-card .t1 { font-weight: 600; display: flex; align-items: center; gap: 5px; }
.order-card .t2 { font-size: 12.5px; color: #667781; }
.bubble-link { display: block; text-align: center; color: var(--wa-link); border-top: 1px solid rgba(0,0,0,.08); margin: 6px -8px -6px -9px; padding: 8px; font-weight: 500; cursor: pointer; }

/* Location message */
.loc-card { width: 240px; border-radius: 6px; overflow: hidden; margin-bottom: 4px; }
.loc-map {
  height: 120px; position: relative; background:
    linear-gradient(90deg, transparent 47%, #fff 47%, #fff 53%, transparent 53%),
    linear-gradient(0deg, transparent 60%, #fff 60%, #fff 66%, transparent 66%),
    linear-gradient(20deg, transparent 30%, #fde68a 30%, #fde68a 34%, transparent 34%),
    linear-gradient(#e5efe0, #dbe8d3);
}
.loc-map::after { content: "📍"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -85%); font-size: 26px; }
.loc-card .loc-txt { padding: 6px 2px 0; font-size: 13px; }
.loc-card .loc-txt b { display: block; }

/* Payment link card */
.pay-card { border-radius: 6px; overflow: hidden; background: rgba(0,0,0,.04); margin-bottom: 6px; }
.pay-card .ph { background: linear-gradient(135deg, #e11d48, #9f1239); color: #fff; padding: 12px; display: flex; align-items: center; gap: 10px; }
.qris-badge { background: #fff; color: #111; font-weight: 800; font-size: 13px; padding: 3px 7px; border-radius: 4px; letter-spacing: .5px; }
.pay-card .pb { padding: 8px 10px; font-size: 12.5px; }

/* Composer */
.wa-composer { display: flex; align-items: center; gap: 6px; padding: 6px 6px 14px; background: transparent; flex-shrink: 0; }
.composer-box { flex: 1; display: flex; align-items: center; background: #fff; border-radius: 24px; padding: 2px 4px; box-shadow: 0 1px .5px rgba(11,20,26,.13); }
.composer-box input { flex: 1; border: 0; outline: 0; padding: 9px 4px; font-size: 15px; background: transparent; min-width: 0; }
.send-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; border: 0; display: grid; place-items: center; flex-shrink: 0; }

/* Bottom sheet */
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 16px 16px 0 0; z-index: 21;
  transform: translateY(105%); transition: transform .25s ease; max-height: 80%; overflow-y: auto; padding-bottom: 18px;
}
.sheet.show { transform: none; }
.sheet-grip { width: 36px; height: 4px; background: #d1d7db; border-radius: 4px; margin: 8px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 10px; font-weight: 600; font-size: 16px; }
.sheet-head .icon-btn { color: #54656f; }
.sheet-section { padding: 6px 16px 4px; font-size: 13px; color: var(--accent); font-weight: 600; }
.opt { display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
.opt:hover { background: #f5f6f6; }
.opt .opt-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.opt .opt-main { flex: 1; min-width: 0; }
.opt .opt-title { font-weight: 600; font-size: 14.5px; }
.opt .opt-desc { font-size: 12.5px; color: var(--muted); }
.opt .opt-price { font-weight: 700; font-size: 14px; text-align: right; }
.opt input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.sheet-foot { padding: 12px 16px 0; }

/* Overlays inside phone */
.overlay {
  position: absolute; inset: 0; background: #fff; z-index: 25; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .28s ease;
}
.overlay.show { transform: none; }
.ov-head { background: var(--wa-header); color: #fff; padding: 46px 6px 10px; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ov-head .ov-title { flex: 1; font-weight: 600; font-size: 16px; }
.ov-head .ov-sub { font-size: 12px; opacity: .85; font-weight: 400; }
.ov-body { flex: 1; overflow-y: auto; }
.ov-foot { padding: 10px 14px 18px; border-top: 1px solid var(--border); background: #fff; flex-shrink: 0; }

/* Catalog */
.cat-hero { padding: 14px 16px; display: flex; gap: 12px; align-items: center; border-bottom: 8px solid #f0f2f5; }
.cat-hero .wa-avatar { width: 52px; height: 52px; font-size: 26px; }
.cat-hero h3 { margin: 0; font-size: 16px; }
.cat-hero p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.cat-tabs { display: flex; gap: 6px; padding: 10px 14px; position: sticky; top: 0; background: #fff; z-index: 2; border-bottom: 1px solid #f0f2f5; overflow-x: auto; }
.cat-tabs button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; white-space: nowrap; }
.cat-tabs button.active { background: var(--accent-soft); color: var(--accent); border-color: #b9e3d5; font-weight: 600; }
.item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f0f2f5; align-items: center; }
.item.disabled { opacity: .5; }
.item-img { width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center; font-size: 30px; flex-shrink: 0; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 14.5px; }
.item-price { font-size: 14px; margin-top: 2px; }
.item-stock { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-stock.low { color: var(--warn); }
.item-stock.out { color: var(--danger); font-weight: 600; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.qty button { border: 0; background: #fff; width: 30px; height: 30px; font-size: 18px; color: var(--accent); font-weight: 600; }
.qty button:disabled { color: #c3c9cd; cursor: not-allowed; }
.qty span { min-width: 24px; text-align: center; font-weight: 600; }
.add-btn { border: 1px solid var(--accent); color: var(--accent); background: #fff; border-radius: 999px; padding: 5px 14px; font-weight: 600; font-size: 13px; }
.add-btn:disabled { border-color: #c3c9cd; color: #8696a0; cursor: not-allowed; }
.cart-bar { display: flex; align-items: center; justify-content: space-between; background: var(--accent); color: #fff; border-radius: 10px; padding: 11px 14px; border: 0; width: 100%; font-weight: 600; }
.cart-bar:disabled { background: #a7b4ba; }
.cart-line { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid #f0f2f5; }
.cart-line .item-img { width: 44px; height: 44px; font-size: 22px; }
.note-input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-size: 13px; resize: none; }
.sum-box { padding: 12px 16px; }
.sum-box .row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13.5px; }
.sum-box .row.total { font-weight: 700; font-size: 15px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Address picker */
.map-box { height: 230px; position: relative; background: #e5efe0; }
.map-box .leaflet-container { height: 100%; width: 100%; }
.map-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12.5px; padding: 20px; }
.addr-form { padding: 12px 16px; display: grid; gap: 10px; }
.addr-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.addr-chip { border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 7px 10px; text-align: left; font-size: 12.5px; line-height: 1.3; flex: 1 1 30%; min-width: 0; }
.addr-chip b { display: block; font-size: 13px; }
.addr-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-size: 13.5px; background: #fff; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid #b9e3d5; border-color: var(--accent); }
.dist-box { display: flex; justify-content: space-between; align-items: center; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.dist-box b { font-size: 16px; }
.dist-box.err { background: #fde8e7; color: var(--danger); }

/* Payment gateway webview */
.web-head { padding: 44px 10px 8px; background: #f8f9fa; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.web-url { flex: 1; background: #eceff1; border-radius: 999px; padding: 6px 12px; font-size: 12px; color: #3c4043; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.web-url .lock { color: #188038; }
.pg { background: #f4f6fb; flex: 1; overflow-y: auto; }
.pg-top { background: #1e2a5a; color: #fff; padding: 14px 16px 50px; }
.pg-top .pg-brand { font-size: 12px; opacity: .7; display: flex; justify-content: space-between; }
.pg-top .pg-merchant { font-weight: 600; font-size: 15px; margin-top: 6px; }
.pg-top .pg-amount { font-size: 26px; font-weight: 700; margin-top: 4px; }
.pg-top .pg-oid { font-size: 12px; opacity: .75; }
.pg-card { background: #fff; margin: -38px 14px 12px; border-radius: 14px; box-shadow: var(--shadow); padding: 14px; text-align: center; }
.qris-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.qris-logo { font-weight: 900; font-size: 20px; letter-spacing: 1px; }
.qris-logo small { display: block; font-size: 8px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.gpn { font-size: 10px; font-weight: 700; border: 2px solid #c8102e; color: #c8102e; border-radius: 4px; padding: 2px 5px; }
#qrCanvas { width: 200px; height: 200px; image-rendering: pixelated; margin: 4px auto; display: block; }
.qris-merchant { font-weight: 700; font-size: 14px; }
.qris-nmid { font-size: 11px; color: var(--muted); }
.countdown { display: inline-flex; gap: 6px; align-items: center; background: var(--warn-soft); color: var(--warn); padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; margin-top: 8px; }
.pg-steps { margin: 0 14px 12px; background: #fff; border-radius: 14px; padding: 12px 14px; font-size: 12.5px; color: #3c4043; }
.pg-steps ol { margin: 6px 0 0; padding-left: 18px; line-height: 1.6; }
.pg-wallets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pg-wallets span { font-size: 11px; border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px; color: #555; }
.pg-actions { padding: 0 14px 18px; display: grid; gap: 8px; }
.pg-status { font-size: 12px; color: var(--muted); text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }
.spinner { width: 14px; height: 14px; border: 2px solid #c9ced6; border-top-color: #1e2a5a; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.pg-success { padding: 40px 20px; text-align: center; }
.check-anim { width: 84px; height: 84px; border-radius: 50%; background: #1fa855; color: #fff; font-size: 44px; display: grid; place-items: center; margin: 0 auto 14px; animation: popin .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes popin { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.receipt { text-align: left; background: #fff; border-radius: 12px; padding: 12px 14px; margin-top: 16px; font-size: 13px; box-shadow: var(--shadow); }
.receipt .row { display: flex; justify-content: space-between; padding: 3px 0; gap: 10px; }
.receipt .row span:last-child { text-align: right; }

/* Tracking */
.track-map { height: 330px; position: relative; flex-shrink: 0; background: #e5efe0; }
.track-map .leaflet-container { height: 100%; }
.track-panel { padding: 14px 16px; }
.eta { font-size: 20px; font-weight: 700; }
.track-steps { list-style: none; margin: 12px 0; padding: 0; }
.track-steps li { position: relative; padding: 0 0 14px 26px; font-size: 13px; color: var(--muted); }
.track-steps li::before { content: ""; position: absolute; left: 5px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #d1d7db; }
.track-steps li::after { content: ""; position: absolute; left: 9.5px; top: 15px; bottom: -1px; width: 1px; background: #d1d7db; }
.track-steps li:last-child::after { display: none; }
.track-steps li.done { color: var(--text); }
.track-steps li.done::before { background: var(--accent); }
.track-steps li.now { color: var(--text); font-weight: 600; }
.track-steps li.now::before { background: #fff; border: 3px solid var(--accent); width: 6px; height: 6px; }
.driver-card { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.driver-ava { width: 44px; height: 44px; border-radius: 50%; background: #e2e8f0; display: grid; place-items: center; font-size: 22px; }
.driver-card .plate { font-family: "JetBrains Mono", monospace; font-weight: 600; background: #111; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 11.5px; white-space: nowrap; display: inline-block; margin-top: 4px; }
.driver-card .muted { font-size: 12px; white-space: nowrap; }
.marker-emoji { font-size: 24px; line-height: 1; text-align: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }

.toast {
  position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: rgba(32,33,36,.92); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 13px; z-index: 40;
  transition: all .25s; pointer-events: none; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast-dash { position: fixed; bottom: 24px; }

/* ---------- Dashboard ---------- */
.dash { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 22px 12px; flex-wrap: wrap; }
.dash-head h1 { margin: 0; font-size: 20px; }
.dash-head p { margin: 4px 0 0; font-size: 13px; }
.dash-head-right { display: flex; gap: 6px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 4px 22px 16px; }
.kpi { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.kpi .k-label { font-size: 12px; color: var(--muted); }
.kpi .k-val { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpi.warn .k-val { color: var(--warn); }

.tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { background: none; border: 0; padding: 11px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; margin-left: 4px; }
.tab-panel { display: none; padding: 18px 22px 24px; }
.tab-panel.active { display: block; }

.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-toolbar h2 { margin: 0; font-size: 16px; }
.panel-toolbar .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; }
.filters button.active { background: var(--text); color: #fff; border-color: var(--text); }
.search { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 200px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.flash td { animation: flash 1.8s ease-out; }
@keyframes flash { from { background: #fff7cc; } to { background: transparent; } }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-name { display: flex; align-items: center; gap: 10px; }
.inv-name .item-img { width: 36px; height: 36px; font-size: 18px; border-radius: 8px; }
.inv-name small { display: block; color: var(--muted); font-size: 11.5px; }
.cell-input { width: 100px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.cell-input.changed { border-color: var(--warn); background: var(--warn-soft); }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 26px; height: 28px; border: 1px solid var(--border); background: #fff; border-radius: 6px; font-weight: 700; }
.stepper .cell-input { width: 64px; }
.switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c5ccd3; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.b-grey { background: #eef0f2; color: #54656f; }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-ok { background: var(--accent-soft); color: var(--accent); }
.b-purple { background: #f3e8ff; color: #7e22ce; }
.b-red { background: #fde8e7; color: var(--danger); }

.order-list { display: grid; gap: 12px; }
.order {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 16px; align-items: start;
}
.order.new { animation: flashBorder 2.5s ease-out; }
@keyframes flashBorder { from { box-shadow: 0 0 0 3px #ffe08a; } to { box-shadow: 0 0 0 0 transparent; } }
.order-id { font-weight: 700; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.order .o-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.order ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.order ul li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.o-kv { font-size: 12.5px; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.o-kv span:nth-child(odd) { color: var(--muted); }
.o-right { text-align: right; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.o-total { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.o-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.progress { display: flex; gap: 4px; margin-top: 10px; }
.progress i { flex: 1; height: 4px; border-radius: 4px; background: #e3e6ea; }
.progress i.on { background: var(--accent); }

.loc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; }
.loc-map-dash { height: 380px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); position: relative; background: #e5efe0; }
.loc-map-dash .leaflet-container { height: 100%; }
.form-grid { display: grid; gap: 12px; }
.form-grid .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); }
.card-soft { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; }
.tariff { width: 100%; font-size: 12.5px; }
.tariff td, .tariff th { padding: 6px 8px; }

.logs { background: #0f1720; color: #c9d5e0; border-radius: 12px; padding: 12px 14px; font-family: "JetBrains Mono", monospace; font-size: 12px; max-height: 520px; overflow-y: auto; line-height: 1.6; }
.logs .l { display: grid; grid-template-columns: 70px 92px 1fr; gap: 10px; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.logs .t { color: #6b7d8f; }
.logs .src { font-weight: 600; }
.src-wa { color: #4ade80; } .src-pos { color: #fbbf24; } .src-pay { color: #f472b6; } .src-kurir { color: #60a5fa; } .src-sys { color: #a78bfa; }
.logs .body { word-break: break-all; }

/* Leaflet tweaks */
.leaflet-control-attribution { font-size: 9px !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order { grid-template-columns: 1fr; }
  .o-right { text-align: left; align-items: flex-start; }
  .loc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .topbar { padding: 10px 16px; }
  .topbar .brand span { display: none; }
  .privacy-banner { margin: 10px 16px 0; }
  .view-switch { display: flex; gap: 6px; margin: 12px 16px 0; background: var(--surface); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
  .view-switch button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 7px; font-weight: 600; color: var(--muted); }
  .view-switch button.active { background: var(--accent); color: #fff; }
  .stage { grid-template-columns: 1fr; padding: 14px 16px 30px; }
  .phone-col { position: static; }
  .stage[data-view="phone"] .dash-col, .stage[data-view="dash"] .phone-col { display: none; }
  .tab-panel { padding: 14px 14px 20px; }
  .dash-head, .kpis { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 440px) {
  .phone { width: 100%; height: 760px; border-radius: 0; padding: 0; background: none; box-shadow: none; }
  .phone-notch { display: none; }
  .screen { border-radius: 14px; border: 1px solid var(--border); }
  .kpi .k-val { font-size: 18px; }
  .form-grid .two { grid-template-columns: 1fr; }
  .search { min-width: 0; width: 100%; }
  .topbar-right .pill { display: none; }
}
