/* JField — tampilan */
:root {
  --brand: #f7941d;
  --brand-d: #d97a06;
  --brand-50: #fff4e6;
  --navy: #1f3347;
  --navy-2: #2d4760;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1c2530;
  --muted: #6b7684;
  --line: #e3e6ea;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { font-size: 15px; line-height: 1.45; }
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.tr { text-align: right; }

/* ---------- App shell ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px;
}
.topbar .logo { height: 26px; }
.topbar h1 { font-size: 17px; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .who { text-align: right; font-size: 12px; line-height: 1.2; }
.topbar .who b { display: block; font-size: 13px; }
.main { flex: 1; width: 100%; max-width: 620px; margin: 0 auto; padding: 14px 14px calc(88px + var(--safe-b)); }
.main.wide { max-width: 1180px; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 6px 4px calc(6px + var(--safe-b));
}
.bottomnav a {
  flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none;
  color: var(--muted); font-size: 11.5px; font-weight: 550; padding: 4px 0; border-radius: 10px; position: relative;
}
.bottomnav a.on { color: var(--brand-d); }
.bottomnav a .badge { position: absolute; top: 0; right: calc(50% - 22px); }
.badge { background: var(--err); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.offline-bar { background: #fff7e6; color: #8a5300; border-bottom: 1px solid #f4d8a8; font-size: 13px; padding: 7px 14px; display: flex; align-items: center; gap: 8px; }
.offline-bar button { margin-left: auto; }

/* ---------- Buttons & inputs ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 16px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px;
}
a.btn { text-decoration: none; color: inherit; }
a.btn.primary, a.btn.navy, a.btn.ok, a.btn.danger { color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--navy); }
.icon-btn:hover { background: var(--bg); }

.field { display: block; margin-bottom: 14px; }
.field .lbl { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.req { color: var(--brand-d); margin-left: 2px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid #d5d9df; border-radius: 10px; background: #fff; padding: 10px 12px; min-height: 44px; outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(247, 148, 29, .18); }
.input[readonly] { background: #f7f8fa; color: var(--muted); }
.input.err, .has-err .input, .has-err .photo-box { border-color: var(--err) !important; }
textarea.input { min-height: 80px; resize: vertical; }
.stepper { display: flex; align-items: stretch; border: 1px solid #d5d9df; border-radius: 10px; overflow: hidden; background: #fff; }
.stepper .pre { padding: 0 10px; display: flex; align-items: center; color: var(--muted); font-weight: 600; }
.stepper input { border: 0; flex: 1; min-width: 0; padding: 10px 4px; outline: none; font-size: 17px; font-weight: 600; }
.stepper button { border: 0; border-left: 1px solid var(--line); background: #fafbfc; width: 46px; cursor: pointer; color: var(--navy); display: flex; align-items: center; justify-content: center; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid #d5d9df; border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 11px; font-weight: 650; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.picker { text-align: left; justify-content: space-between; font-weight: 500; }
.picker .ph { color: #9aa3ad; }

.photo-box {
  width: 100%; min-height: 64px; border: 1.5px dashed #c9cfd6; background: #fbfbfc; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; gap: 8px; cursor: pointer; color: var(--navy-2); font-weight: 600;
}
.photo-box.has { border-style: solid; border-color: #b8e2c5; background: #f3fbf5; color: var(--ok); min-height: 46px; }
.photo-preview { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; }
.photo-preview img { width: 160px; height: 120px; object-fit: contain; background: #111; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- Cards / lists ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin-bottom: 10px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title h2 { margin: 0; }
.form-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.form-head img { width: 44px; height: 44px; object-fit: contain; }
.form-head h2 { font-size: 18px; flex: 1; }
.info { background: var(--brand-50); border: 1px solid #fbd9ae; color: #7a4a0b; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px; }
.info ul { margin: 4px 0 0; padding-left: 18px; }
.warnbox { background: #fff1f1; border: 1px solid #f5c2c2; color: #8f1d1d; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin: 10px 0; }
.okbox { background: #effaf2; border: 1px solid #bde5c8; color: #155d2c; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin: 10px 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; word-break: break-word; }

.home-hello { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.home-hello .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; }
.warning-leader { color: #c81e1e; font-weight: 700; font-size: 13px; text-align: center; margin: 2px 0 12px; letter-spacing: .2px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1.08; position: relative; cursor: pointer; text-decoration: none; box-shadow: var(--shadow); }
.tile img { width: 100%; height: 100%; object-fit: contain; }
.tile.off { cursor: default; box-shadow: none; }
.tile.off img { filter: grayscale(1); opacity: .35; }
.tile.off::after { content: "Nonaktif"; position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); background: #f0f1f3; padding: 1px 7px; border-radius: 8px; }
.tile .badge { position: absolute; top: 6px; right: 6px; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.quick .q { background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.quick .q b { font-size: 20px; display: block; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs button .badge { margin-left: 6px; }

.item { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 12px; padding: 10px; box-shadow: var(--shadow); margin-bottom: 8px; cursor: pointer; }
.item .thumb { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; background: #eef0f3; flex: none; }
.item .t1 { font-weight: 650; }
.item .t2 { font-size: 13px; color: var(--muted); }
.item .amt { font-weight: 700; white-space: nowrap; }
.item .flag { color: var(--warn); display: inline-flex; vertical-align: -4px; }
.item input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.bulkbar { position: sticky; bottom: calc(66px + var(--safe-b)); background: var(--navy); color: #fff; border-radius: 14px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; box-shadow: 0 6px 20px rgba(0,0,0,.18); margin-top: 10px; }
.bulkbar .btn { min-height: 38px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.st-req { background: #fff4db; color: #9a6700; }
.st-app { background: #e0edff; color: #1d4ed8; }
.st-rej { background: #fde2e2; color: #b91c1c; }
.st-trf { background: #dcf5e4; color: #15803d; }
.st-rec { background: #eceff3; color: #475467; }
.st-sac { background: #efe4ff; color: #6d28d9; }
.st-inv { background: #d7f5f3; color: #0f766e; }
.st-paid { background: #1f7a3d; color: #fff; }
.st-queue { background: #fff; color: #8a5300; border: 1px dashed #d99a3c; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos figure { margin: 0; cursor: pointer; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #eef0f3; }
.photos figcaption { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.flags { list-style: none; padding: 0; margin: 8px 0; }
.flags li { display: flex; gap: 6px; align-items: flex-start; color: #9a3412; font-size: 13.5px; padding: 3px 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline li { padding: 6px 0 6px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }

.map { height: 190px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #e8eef2; margin-top: 6px; }
.coord { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.geo-status { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: #f3f5f8; }
.geo-status.good { background: #effaf2; color: #155d2c; }
.geo-status.bad { background: #fff1f1; color: #8f1d1d; }

/* ---------- Sheet / modal ---------- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(15, 23, 32, .5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 620px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .18s ease-out; }
.sheet.wide { max-width: 900px; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { flex: 1; font-size: 16.5px; }
.sheet-body { padding: 16px 18px calc(18px + var(--safe-b)); overflow-y: auto; }
.full-img { width: 100%; border-radius: 10px; }
.pick-list { max-height: 55vh; overflow-y: auto; margin-top: 8px; }
.pick-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 12px 6px; cursor: pointer; }
.pick-list button:hover { background: var(--bg); }
.pick-list button.on { color: var(--brand-d); font-weight: 700; }

/* ---------- Camera ---------- */
.cam-wrap { position: fixed; inset: 0; background: #000; z-index: 200; display: flex; flex-direction: column; }
.cam-video { flex: 1; width: 100%; object-fit: contain; background: #000; }
.cam-video.mirror { transform: scaleX(-1); }
.cam-hint { position: absolute; top: 14px; left: 14px; right: 14px; color: #fff; background: rgba(0,0,0,.45); border-radius: 10px; padding: 8px 12px; font-size: 14px; text-align: center; }
.cam-hint:empty { display: none; }
.cam-bar { display: flex; align-items: center; justify-content: space-around; padding: 18px 0 calc(22px + var(--safe-b)); background: #000; }
.cam-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: var(--brand); cursor: pointer; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 800px) { .kpis { grid-template-columns: repeat(4, 1fr); } .dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .dash-grid .card { margin: 0; } }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 8px; font-size: 13px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #3b4652; }
.bar-track { height: 14px; background: #f0f2f5; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); min-width: 2px; }
.bar-row .val { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 60px; text-align: right; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filters .field { margin: 0; }
.filters .input { min-height: 40px; padding: 8px 10px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
.tbl td { padding: 8px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.bad td { background: #fff5f5; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafbfc; }

/* ---------- Misc ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 30px 0; }
.spinner { width: 22px; height: 22px; border: 3px solid #e5e7eb; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty-ic { color: #b7bec7; margin-bottom: 6px; }
.empty p { margin: 4px 0; }
#toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 550; opacity: 0; pointer-events: none; transition: .2s; z-index: 300; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: #b91c1c; }
#toast.ok { background: #15803d; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #fff 0%, #fff4e6 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; box-shadow: 0 10px 40px rgba(31, 51, 71, .12); padding: 28px 24px; }
.login-card .logo { display: block; width: 190px; margin: 0 auto 6px; }
.login-card .tag { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.login-foot { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.login-foot img { height: 20px; }
.map { position: relative; isolation: isolate; z-index: 0; }
.bulkbar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.45); }
