/* SIPENDOK — gaya aplikasi. Mobile-first; ≥ 900px memakai sidebar. */
:root {
  --navy: #0b2e59; --navy-2: #12407c; --navy-3: #1d5aa6;
  --gold: #c99a2e; --gold-bg: #fbf4e2;
  --bg: #f3f6fb; --surface: #ffffff; --line: #dde5ef; --line-2: #eaf0f7;
  --text: #14233a; --muted: #5b6b82; --faint: #8896ab;
  --ok: #1b7f55; --ok-bg: #e5f5ed; --warn: #9a6a0b; --warn-bg: #fdf3dc; --err: #b42323; --err-bg: #fdeaea; --info: #1d5aa6; --info-bg: #e7f0fb;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11,46,89,.06), 0 4px 14px rgba(11,46,89,.06);
  --nav-h: 62px; --side-w: 248px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-3); }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(29, 90, 166, .45); outline-offset: 2px; border-radius: 6px; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--sat)) 16px 10px; background: var(--navy); color: #fff;
}
.topbar .brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.topbar .t1 { font-weight: 700; letter-spacing: .4px; font-size: 16px; }
.topbar .t2 { font-size: 11.5px; opacity: .78; letter-spacing: .2px; }
.topbar .page-title { margin-left: auto; font-size: 13px; opacity: .9; font-weight: 600; }
.main { padding: 16px 14px calc(var(--nav-h) + var(--sab) + 28px); max-width: 780px; margin: 0 auto; }
.main.with-bar { padding-bottom: calc(var(--nav-h) + var(--sab) + 96px); }
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: var(--sab); height: calc(var(--nav-h) + var(--sab));
}
.bottom button, .bottom a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; min-width: 0;
}
.bottom .on { color: var(--navy-3); }
.bottom .on svg { stroke-width: 2.4; }
.offline { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: 13px; padding: 6px 10px; font-weight: 600; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--navy); color: #fff; padding: 20px 14px;
  }
  .side .brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 20px; }
  .side .brand img { width: 40px; height: 40px; border-radius: 10px; }
  .side .brand b { display: block; font-size: 18px; letter-spacing: .5px; }
  .side .brand span { font-size: 12px; opacity: .75; }
  .side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .side nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #cfdcef; text-decoration: none; font-weight: 600; font-size: 14.5px;
  }
  .side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .side nav a.on { background: rgba(255,255,255,.14); color: #fff; }
  .side .user { border-top: 1px solid rgba(255,255,255,.14); padding: 12px 8px 0; font-size: 13px; display: flex; align-items: center; gap: 10px; }
  .side .user button { margin-left: auto; background: none; border: 0; color: #cfdcef; cursor: pointer; padding: 6px; border-radius: 8px; }
  .side .user button:hover { background: rgba(255,255,255,.1); color: #fff; }
  .topbar, .bottom { display: none; }
  .main { padding: 28px 32px 48px; max-width: 1080px; width: 100%; }
  .main.with-bar { padding-bottom: 110px; }
}

/* ---------- Komponen dasar ---------- */
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }
.page-head .spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.card + .card, .stack > * + * { margin-top: 12px; }
.card h2 { font-size: 15px; margin-bottom: 10px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 900px) { .grid4 { grid-template-columns: repeat(4, 1fr); } .cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; } .cols2 > .card + .card { margin-top: 0; } }
.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.divider { height: 1px; background: var(--line-2); margin: 10px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1.5px solid transparent;
  background: var(--navy); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; transition: filter .12s, transform .05s;
}
.btn:hover { filter: brightness(1.08); } .btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 54px; font-size: 16px; letter-spacing: .3px; }
.btn.gold { background: var(--gold); color: #fff; }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy-3); border-color: var(--line); }
.btn.danger { background: var(--err); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.icon { padding: 0; width: 40px; min-height: 40px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.err { background: var(--err-bg); color: var(--err); } .chip.info { background: var(--info-bg); color: var(--info); }

.banner { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 14px; background: var(--info-bg); color: #164a8a; border: 1px solid #cfe0f5; }
.banner svg { flex: none; margin-top: 1px; }
.banner.ok { background: var(--ok-bg); color: #0f5f3f; border-color: #bfe6d1; }
.banner.warn { background: var(--warn-bg); color: #7a540a; border-color: #f1dca8; }
.banner.err { background: var(--err-bg); color: #8f1a1a; border-color: #f4c4c4; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.input, .select, textarea.input {
  width: 100%; min-height: 46px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; font-size: 16px; /* 16px: cegah zoom iOS */
}
textarea.input { min-height: 74px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(29, 90, 166, .15); }
.input[readonly] { background: var(--bg); color: var(--muted); }
.input.num-in { text-align: center; font-weight: 700; font-size: 18px; padding: 8px 4px; }
.hint { font-size: 12.5px; color: var(--faint); }
.form-grid { display: grid; gap: 12px; }
.seg { display: flex; background: var(--line-2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(11,46,89,.15); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { width: 20px; height: 20px; accent-color: var(--navy-3); }

/* ---------- Dashboard ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border-radius: var(--radius); padding: 16px 16px 14px; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero .eyebrow { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; opacity: .8; font-weight: 700; }
.hero .date { font-size: 24px; font-weight: 800; margin: 3px 0 2px; }
.hero .day { opacity: .85; font-size: 14px; }
.hero .row { margin-top: 12px; }
.hero .datepick { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 14px; min-height: 36px; }
.hero .datepick::-webkit-calendar-picker-indicator { filter: invert(1); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .l { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 2px; color: var(--navy); }
.stat .s { font-size: 12.5px; color: var(--faint); }
.pagu-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.pagu-line:last-of-type { border-bottom: 0; }
.pagu-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; padding: 12px 14px; background: var(--gold-bg); border: 1px solid #ecd9a3; border-radius: 12px; }
.pagu-total .l { font-weight: 800; letter-spacing: .5px; font-size: 13px; color: #7a5a0a; }
.pagu-total .v { font-weight: 800; font-size: 22px; color: #6b4d06; }
.cta { display: grid; gap: 10px; }
@media (min-width: 640px) { .cta { grid-template-columns: 1fr 1fr; } .grid4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Penerimaan ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs a { padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; text-decoration: none; color: var(--muted); background: var(--line-2); }
.tabs a.on { background: var(--navy); color: #fff; }
.pm-card { padding: 12px 12px 10px; }
.pm-card.saved { border-left: 4px solid var(--ok); }
.pm-card.empty { border-left: 4px solid var(--line); }
.pm-card.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px rgba(201,154,46,.65); } 100% { box-shadow: var(--shadow); } }
.pm-card .name { font-weight: 800; font-size: 15.5px; }
.pm-card .meta { font-size: 12.5px; color: var(--muted); }
.pm-card .inputs { display: grid; gap: 8px; margin: 10px 0 6px; }
.pm-card .inputs.c3 { grid-template-columns: repeat(3, 1fr); } .pm-card .inputs.c2 { grid-template-columns: repeat(2, 1fr); }
.pm-card .inputs label { font-size: 11.5px; font-weight: 700; color: var(--muted); display: block; text-align: center; margin-bottom: 3px; }
.pm-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.pm-card .total { font-weight: 800; color: var(--navy); font-size: 15px; }
.linkbtn { background: none; border: 0; color: var(--navy-3); font-weight: 700; font-size: 13px; cursor: pointer; padding: 6px 4px; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--sab)); z-index: 25; background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: center; gap: 12px; backdrop-filter: blur(6px);
}
.savebar .sum { flex: 1; min-width: 0; line-height: 1.25; }
.savebar .sum b { font-size: 18px; color: var(--navy); } .savebar .sum span { display: block; font-size: 12.5px; color: var(--muted); }
@media (min-width: 900px) { .savebar { left: var(--side-w); bottom: 0; padding: 12px 32px; } .savebar .inner { max-width: 1016px; width: 100%; margin: 0 auto; display: flex; gap: 12px; align-items: center; } }
.savebar .inner { display: flex; gap: 12px; align-items: center; width: 100%; max-width: 780px; margin: 0 auto; }

/* ---------- Daftar & tabel responsif ---------- */
.list { display: grid; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.item .title { font-weight: 800; }
.item .sub { color: var(--muted); font-size: 13px; }
.item.off { opacity: .62; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
.group-h { font-size: 12.5px; letter-spacing: .6px; font-weight: 800; color: var(--muted); text-transform: uppercase; margin: 16px 2px 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl .r { text-align: right; } .tbl tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; background: var(--bg); }
.only-wide { display: none; } @media (min-width: 900px) { .only-wide { display: block; } .only-narrow { display: none; } }
.empty-state { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-state svg { color: var(--faint); margin-bottom: 8px; }

/* ---------- Masalah validasi ---------- */
.issue { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.issue:last-child { border-bottom: 0; }
.issue .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--faint); }
.issue.error .dot { background: var(--err); } .issue.warning .dot { background: #d79a1a; }
.issue b { font-weight: 800; }

/* ---------- Modal, toast, busy ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8, 22, 44, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--sab)); animation: up .2s; }
.sheet h2 { font-size: 18px; margin-bottom: 12px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.sheet .actions .btn { flex: 1; min-width: 130px; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 18px; padding-bottom: 18px; } }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(24px); opacity: .4; } }
#toasts { position: fixed; z-index: 90; left: 0; right: 0; top: calc(10px + var(--sat)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 560px; animation: up .2s; display: flex; gap: 10px; align-items: center; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--err); } .toast.warn { background: #8a5d08; }
.toast button { background: rgba(255,255,255,.2); border: 0; color: #fff; padding: 4px 10px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.busy { position: fixed; inset: 0; z-index: 80; background: rgba(8,22,44,.62); display: flex; align-items: center; justify-content: center; padding: 20px; }
.busy .box { background: #fff; border-radius: 18px; padding: 24px 22px; text-align: center; max-width: 340px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--navy-3); animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, #e7edf5 25%, #f3f6fb 37%, #e7edf5 63%); background-size: 400% 100%; animation: sh 1.3s infinite; border-radius: 12px; height: 84px; }
@keyframes sh { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 18px; max-width: 420px; margin: 0 auto; }
.login .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login .logo img { width: 54px; height: 54px; border-radius: 14px; box-shadow: var(--shadow); }
.login h1 { font-size: 26px; letter-spacing: .6px; color: var(--navy); }
.login .tag { color: var(--muted); font-size: 13.5px; }
.login form { display: grid; gap: 14px; }

/* No. Kendaraan pada kartu penerimaan */
.pm-card .veh { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.pm-card .veh label { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pm-card .veh .input { min-height: 38px; font-size: 14.5px; padding: 5px 10px; text-transform: uppercase; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
.cat-grid .k { font-size: 12px; color: var(--muted); font-weight: 700; }
.cat-grid .v { font-size: 20px; font-weight: 800; color: var(--navy); }
.issue-box h3 { font-size: 15px; letter-spacing: .6px; color: var(--err); }
.issue .fields { color: var(--err); font-weight: 700; font-size: 13.5px; }
