:root{
  /* warna dari logo PT Agape Solusi Andalan */
  --bg:#f2f4f9; --card:#fff; --ink:#141b33; --muted:#646d80; --line:#dfe4ef;
  --navy:#03168a; --blue:#0d33c6; --blue-soft:#e6ebfb; --yellow:#fdd500; --yellow-soft:#fff7cc;
  --orange:#d9730d; --orange-soft:#fdeedd; --red:#b3362b; --red-soft:#f8e3e0;
  --gray-soft:#eceff5; --radius:14px; --shadow:0 1px 2px rgba(0,0,0,.05),0 4px 14px rgba(0,0,0,.05);
  --nav-h:64px;
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg);color:var(--ink);font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-tap-highlight-color:transparent;padding-bottom:calc(var(--nav-h) + 20px + env(safe-area-inset-bottom))}
a{color:var(--navy);text-decoration:none}
svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
h1,h2,h3{margin:0;line-height:1.25}
h2{font-size:20px}
h3{font-size:15px;font-weight:650}
small,.muted{color:var(--muted)}
.hidden{display:none!important}

/* header */
.top{position:sticky;top:0;z-index:50;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 16px;padding-top:calc(10px + env(safe-area-inset-top));background:var(--navy);color:#fff;border-bottom:3px solid var(--yellow)}
.brand{display:flex;align-items:center;gap:8px;color:#fff;font-weight:700;font-size:17px;letter-spacing:.2px}
.brand img{height:30px;width:auto;background:#fff;border-radius:7px;padding:3px 5px;display:block}
.sales-chip{border:1px solid rgba(255,255,255,.35);background:rgba(255,255,255,.12);color:#fff;border-radius:99px;padding:5px 12px;font:inherit;font-size:13px;max-width:45vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}

main{max-width:680px;margin:0 auto;padding:14px 14px 0}

/* bottom nav */
.bottom{position:fixed;left:0;right:0;bottom:0;z-index:60;display:flex;justify-content:space-around;align-items:center;height:calc(var(--nav-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);background:#fff;border-top:1px solid var(--line)}
.bottom a{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11.5px;color:var(--muted);padding:6px 0}
.bottom a.on{color:var(--navy);font-weight:600}
.bottom .fab{flex:0 0 auto;width:56px;height:56px;border-radius:50%;background:var(--yellow);color:var(--navy);justify-content:center;margin-top:-26px;box-shadow:0 6px 16px rgba(3,22,138,.3);border:4px solid var(--bg)}
.bottom .fab svg{width:26px;height:26px;stroke-width:2.4}
.bottom .fab.on{color:var(--navy);background:var(--yellow)}

/* cards & layout */
.card{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px;margin-bottom:12px}
.card > h3{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.step{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--yellow);color:var(--navy);font-size:12px;font-weight:700;flex:none}
.row{display:flex;align-items:center;gap:10px}
.between{justify-content:space-between}
.grow{flex:1;min-width:0}
.stack>*+*{margin-top:8px}
.page-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:4px 2px 12px}
.back{display:inline-flex;align-items:center;gap:4px;font-weight:600;margin-bottom:8px}
.back svg{width:18px;height:18px}
.empty{text-align:center;color:var(--muted);padding:26px 10px}
.empty svg{width:40px;height:40px;stroke-width:1.4;margin-bottom:6px;color:#aab2c3}

.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:12px}
.stat{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:12px}
.stat b{display:block;font-size:24px;line-height:1.1;color:var(--navy)}
.stat span{font-size:12px;color:var(--muted)}

.cta{display:flex;align-items:center;gap:14px;width:100%;padding:16px;border-radius:var(--radius);background:linear-gradient(135deg,var(--navy),var(--blue));color:#fff;box-shadow:var(--shadow);margin-bottom:16px}
.cta svg{width:34px;height:34px;flex:none;color:var(--yellow)}
.cta b{display:block;font-size:17px}
.cta span{opacity:.85;font-size:13px}

/* lists */
.list{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.li{display:flex;align-items:center;gap:12px;padding:11px 12px;border-bottom:1px solid var(--line);color:inherit}
.li:last-child{border-bottom:0}
.li .t{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.li .s{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.thumb{width:52px;height:52px;border-radius:10px;object-fit:cover;background:var(--gray-soft);flex:none;display:grid;place-items:center;color:#aab2c3}
.thumb svg{width:24px;height:24px}
img.thumb{cursor:zoom-in}
.thumb.sm{width:38px;height:38px;border-radius:8px}
.thumb.sm svg{width:18px;height:18px}
.pfoto{display:flex;gap:12px;align-items:center}
.pfoto-img{width:96px;height:96px;border-radius:12px;object-fit:cover;flex:none;background:var(--gray-soft);display:grid;place-items:center;color:#aab2c3}
.pfoto-img svg{width:34px;height:34px;stroke-width:1.4}
img.pfoto-img{cursor:zoom-in}
.pfoto-btn{display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.section-title{font-size:13px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;margin:18px 4px 8px}

.badge{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;font-weight:600;padding:2px 8px;border-radius:99px;white-space:nowrap}
.b-kita{background:var(--blue-soft);color:var(--navy)}
.b-lain{background:var(--orange-soft);color:var(--orange)}
.b-warn{background:var(--red-soft);color:var(--red)}
.b-gray{background:var(--gray-soft);color:var(--muted)}
.badges{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}

/* forms */
label.f{display:block;font-size:12.5px;font-weight:600;color:var(--muted);margin:10px 0 4px}
input,select,textarea{width:100%;font:inherit;color:inherit;padding:10px 11px;border:1px solid var(--line);border-radius:10px;background:#fff;outline:none}
input:focus,select:focus,textarea:focus{border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-soft)}
textarea{min-height:76px;resize:vertical}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;font:inherit;font-weight:600;padding:10px 14px;border-radius:10px;border:1px solid var(--line);background:#fff;color:var(--ink);cursor:pointer}
.btn svg{width:18px;height:18px}
.btn.primary{background:var(--navy);border-color:var(--navy);color:#fff}
.btn.danger{color:var(--red);border-color:#efcdc8}
.btn.sm{padding:6px 10px;font-size:13px}
.btn.block{width:100%}
.btn.big{padding:15px;font-size:16px;border-radius:12px}
.btn:disabled{opacity:.55}
.search{position:relative;margin-bottom:10px}
.search input{padding-left:36px}
.search svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);width:18px;height:18px;color:var(--muted)}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#fff}
.seg button{font:inherit;font-size:13px;border:0;background:none;padding:7px 11px;cursor:pointer;color:var(--muted)}
.seg button+button{border-left:1px solid var(--line)}
.seg button.on{background:var(--navy);color:#fff;font-weight:600}
.seg.stok button.on[data-v=sedikit]{background:var(--orange)}
.seg.stok button.on[data-v=habis]{background:var(--red)}

/* GPS */
.gps{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;font-size:13.5px;background:var(--gray-soft)}
.gps.ok{background:var(--blue-soft);color:var(--navy)}
.gps.warn{background:var(--orange-soft);color:var(--orange)}
.gps.err{background:var(--red-soft);color:var(--red)}
.dot{width:10px;height:10px;border-radius:50%;background:currentColor;flex:none}
.gps.wait .dot{animation:pulse 1.2s infinite}
@keyframes pulse{50%{opacity:.25}}

.pick{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--line);border-radius:12px;margin-top:8px;cursor:pointer;background:#fff;width:100%;text-align:left;font:inherit;color:inherit}
.pick.near{border-color:var(--blue);background:#f3f6fe}
.pick .d{font-size:12.5px;font-weight:700;color:var(--navy);white-space:nowrap}
.pick .d.far{color:var(--muted)}
.chosen{display:flex;align-items:center;gap:12px;padding:12px;border-radius:12px;background:var(--blue-soft)}
.chosen b{display:block}

/* camera */
.camera{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:150px;border:2px dashed #c3cbdc;border-radius:12px;color:var(--muted);cursor:pointer;text-align:center;padding:16px}
.camera svg{width:40px;height:40px;stroke-width:1.5;color:var(--navy)}
.camera input{display:none}
.foto-prev{width:100%;border-radius:12px;display:block}
.foto-actions{display:flex;gap:8px;margin-top:8px}

/* produk rows in visit */
.prow{border:1px solid var(--line);border-radius:12px;margin-top:8px;overflow:hidden}
.prow.on{border-color:var(--blue)}
.prow .ph{display:flex;align-items:center;gap:10px;padding:10px 12px;cursor:pointer}
.prow.on .ph{background:#f3f6fe}
.prow .ph input{width:20px;height:20px;accent-color:var(--navy);flex:none;margin:0}
.pd label{font-size:12px;color:var(--muted);font-weight:600;display:block;margin-bottom:3px}
.lrow{border:1px solid var(--line);border-radius:12px;padding:10px;margin-top:8px;display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:end}
.lrow .full{grid-column:1/-1}
.lrow .del{border:0;background:none;color:var(--red);cursor:pointer;padding:8px}
.prefill{font-size:12.5px;background:var(--yellow-soft);color:#5c4a00;padding:8px 10px;border-radius:10px;margin-bottom:6px}

/* items view */
.items{display:flex;flex-direction:column}
.item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 0;border-bottom:1px dashed var(--line)}
.item:last-child{border-bottom:0}
.item .n{font-weight:600}
.item .r{text-align:right;font-size:13px;white-space:nowrap}

.hero{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:var(--radius);display:block;background:var(--gray-soft);cursor:zoom-in}
.map{height:220px;border-radius:12px;overflow:hidden;z-index:1}
.map.tall{height:calc(100vh - 230px);min-height:320px}
.kv{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;font-size:14px}
.kv dt{color:var(--muted)}
.kv dd{margin:0}

/* rekap */
.bar{height:8px;border-radius:99px;background:var(--gray-soft);overflow:hidden;margin-top:5px;display:flex}
.bar i{display:block;height:100%;background:var(--blue)}
.bar i.h{background:var(--red)}
.bar i.o{background:var(--orange)}
.rk{padding:10px 0;border-bottom:1px dashed var(--line)}
.rk:last-child{border-bottom:0}
.share{display:flex;height:14px;border-radius:99px;overflow:hidden;margin:8px 0 6px}
.share i{display:block;height:100%}
.legend{display:flex;gap:14px;font-size:12.5px;color:var(--muted)}
.legend span::before{content:"";display:inline-block;width:9px;height:9px;border-radius:3px;margin-right:5px;background:var(--c)}

/* modal */
.modal{position:fixed;inset:0;z-index:100;background:rgba(20,25,22,.45);display:flex;align-items:flex-end;justify-content:center}
.sheet{background:#fff;width:100%;max-width:560px;max-height:92vh;overflow:auto;border-radius:18px 18px 0 0;padding:18px 16px calc(18px + env(safe-area-inset-bottom))}
@media(min-width:640px){.modal{align-items:center}.sheet{border-radius:18px}}
.sheet h2{margin-bottom:6px}
.sheet .actions{display:flex;gap:8px;margin-top:16px}
.sheet .actions .btn{flex:1}

.toast{position:fixed;left:50%;bottom:calc(var(--nav-h) + 24px);transform:translateX(-50%) translateY(20px);opacity:0;pointer-events:none;background:#222;color:#fff;padding:10px 16px;border-radius:10px;font-size:14px;z-index:200;transition:.25s;max-width:90vw}
.toast.show{opacity:1;transform:translateX(-50%)}
.toast.err{background:var(--red)}
.lightbox{position:fixed;inset:0;z-index:300;background:rgba(0,0,0,.92);display:grid;place-items:center;padding:10px}
.lightbox img{max-width:100%;max-height:100%}
.spin{width:28px;height:28px;border:3px solid var(--line);border-top-color:var(--navy);border-radius:50%;animation:r .8s linear infinite;margin:40px auto}
@keyframes r{to{transform:rotate(360deg)}}
.leaflet-container{font:inherit}

/* ===== check-in & aktivitas ===== */
.center{text-align:center}
.b-live{background:#e5f6ec;color:#127a3f}
.pulse{width:10px;height:10px;border-radius:50%;background:#1aa356;flex:none;box-shadow:0 0 0 0 rgba(26,163,86,.5);animation:ping 1.6s infinite}
@keyframes ping{70%{box-shadow:0 0 0 9px rgba(26,163,86,0)}100%{box-shadow:0 0 0 0 rgba(26,163,86,0)}}
.live{display:block;padding:16px;border-radius:var(--radius);background:linear-gradient(135deg,var(--navy),var(--blue));color:#fff;box-shadow:var(--shadow);margin-bottom:16px;border-bottom:4px solid var(--yellow)}
.live .row{gap:8px}
.live small{opacity:.85}
.live-name{font-size:20px;font-weight:700;margin:6px 0 10px}
.live-go{display:inline-flex;align-items:center;gap:2px;font-weight:700;color:var(--yellow)}
.live-go svg{width:18px;height:18px}
.progress{height:8px;border-radius:99px;background:rgba(128,140,170,.25);overflow:hidden;margin:6px 0}
.progress i{display:block;height:100%;background:var(--yellow);border-radius:99px;transition:width .3s}
.card .progress{background:var(--gray-soft)}
.card .progress i{background:var(--blue)}
.live-head{border-left:4px solid #1aa356}
.thumb.lg{width:72px;height:72px;border-radius:12px;cursor:zoom-in}

.acts{display:flex;flex-direction:column;gap:10px}
.act{display:flex;align-items:center;gap:12px;padding:14px;border-radius:var(--radius);background:var(--card);box-shadow:var(--shadow);color:inherit;border:2px solid transparent}
.act b{display:block}
.act small{color:var(--muted);font-size:12.5px}
.act-n{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;flex:none;font-weight:700;background:var(--yellow);color:var(--navy)}
.act-n svg{width:18px;height:18px;stroke-width:2.6}
.act-go{display:inline-flex;align-items:center;font-size:13px;font-weight:600;color:var(--blue);white-space:nowrap}
.act-go svg{width:16px;height:16px}
.act.done{border-color:#bfe6cf}
.act.done .act-n{background:#1aa356;color:#fff}
.act.locked{opacity:.6}
.act.locked .act-n{background:var(--gray-soft);color:var(--muted)}
.act.locked .act-go{visibility:hidden}

.or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12.5px;margin:14px 0 8px}
.or::before,.or::after{content:"";flex:1;height:1px;background:var(--line)}
.savebar{position:sticky;bottom:calc(var(--nav-h) + 10px + env(safe-area-inset-bottom));z-index:20;padding-top:4px}
.savebar .btn{box-shadow:0 6px 18px rgba(3,22,138,.25)}

.prow .pd{display:none;grid-template-columns:1fr 1fr;gap:8px 10px;padding:6px 12px 12px}
.prow.on .pd{display:grid}
.fld label{font-size:12px;color:var(--muted);font-weight:600;display:block;margin-bottom:3px}
.fld.full{grid-column:1/-1}
.hint{display:block;font-size:11.5px;color:var(--muted);margin-top:3px}
.lrow{grid-template-columns:1fr 1fr 1fr}

.cek-row{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px dashed var(--line);font-size:14px}
.cek-row:last-of-type{border-bottom:0}
.seg.yn button{min-width:58px}
.seg.yn button.on[data-v="1"]{background:var(--blue)}
.seg.yn button.on[data-v="0"]{background:var(--red)}
.cek-view{display:flex;align-items:flex-start;gap:8px;font-size:13.5px;padding:4px 0}
.cek-view svg{width:18px;height:18px;flex:none;stroke-width:2.6}
.cek-view.ya svg{color:#1aa356}
.cek-view.tidak{color:var(--muted)}
.cek-view.tidak svg{color:var(--red)}

.photos{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:8px}
.ph-item{position:relative;aspect-ratio:1;border-radius:10px;overflow:hidden;background:var(--gray-soft)}
.ph-item img{width:100%;height:100%;object-fit:cover;cursor:zoom-in;display:block}
.ph-del{position:absolute;top:4px;right:4px;width:28px;height:28px;border-radius:50%;border:0;background:rgba(0,0,0,.6);color:#fff;display:grid;place-items:center;cursor:pointer;padding:0}
.ph-del svg{width:16px;height:16px}

.jrow{padding:12px 0;border-bottom:1px dashed var(--line)}
.jrow:first-child{padding-top:0}
.jin{margin-top:8px}
.jin label{font-size:12px;color:var(--muted);font-weight:600;display:block;margin-bottom:3px}
.total{padding-top:12px;margin-top:4px;border-top:2px solid var(--line);font-size:16px}
.note{white-space:pre-wrap;margin:12px 0 0;padding:10px;background:var(--bg);border-radius:10px;font-size:14px}
.card > h3 svg{width:20px;height:20px}
.stats{grid-template-columns:repeat(3,1fr)}
.stat b small{font-size:13px;font-weight:600}
