@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f3f4fb;
  --card: #ffffff;
  --text: #151a2d;
  --muted: #6b7190;
  --line: #e7e8f2;
  --primary: #5b3df5;
  --primary-2: #8b5cf6;
  --primary-soft: #efebff;
  --accent: #ff7a1a;
  --accent-soft: #fff1e6;
  --ok: #0f9d63;
  --ok-soft: #e2f8ee;
  --warn: #c26a00;
  --warn-soft: #fff4dd;
  --bad: #e5384f;
  --bad-soft: #ffe8ec;
  --info: #2b7fff;
  --info-soft: #e6f0ff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(21, 26, 45, .04), 0 8px 24px -12px rgba(21, 26, 45, .12);
  --shadow-lg: 0 20px 50px -18px rgba(60, 40, 160, .35);
  --grad: linear-gradient(135deg, #5b3df5 0%, #8b5cf6 55%, #c056f0 100%);
  --grad-warm: linear-gradient(135deg, #ff7a1a 0%, #ff4f6d 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; font-weight: 600; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
::selection { background: #d9d0ff; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  background: radial-gradient(120% 60% at 0% 0%, #2c1d78 0%, transparent 60%), linear-gradient(180deg, #120d2e 0%, #0c0a1c 100%);
  color: #b9b6d6; display: flex; flex-direction: column;
}
.side .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 16px; padding: 2px 8px 24px; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--grad-warm); display: grid; place-items: center; font-size: 20px; box-shadow: 0 8px 20px -6px rgba(255, 106, 60, .6); flex-shrink: 0; }
.side .brand small { display: block; font-weight: 500; font-size: 11px; color: #8d89b5; letter-spacing: .04em; text-transform: uppercase; }
.side a { display: flex; gap: 12px; align-items: center; color: #b9b6d6; padding: 11px 12px; border-radius: 12px; margin-bottom: 4px; font-weight: 600; transition: background .15s, color .15s; }
.side a .ic { width: 22px; text-align: center; font-size: 16px; }
.side a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side a.active { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px rgba(139, 92, 246, .8); }
.side .bottom { margin-top: auto; }
.main { flex: 1; padding: 28px 34px 70px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .topbar h2 { font-size: 16px; }
.hello { color: var(--muted); font-size: 14px; margin: -16px 0 20px; }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: sticky; z-index: 20; flex-direction: row; overflow-x: auto; padding: calc(10px + env(safe-area-inset-top)) 10px 10px; gap: 4px; scrollbar-width: none; }  .side::-webkit-scrollbar { display: none; }
  .side .brand { padding: 0 8px 0 2px; }
  .side .brand span { display: none; }
  .side a { white-space: nowrap; margin: 0; padding: 9px 12px; }
  .side .bottom { margin: 0; }
  .main { padding: 18px 16px calc(60px + env(safe-area-inset-bottom)); }
  .topbar h1 { font-size: 22px; }
}

/* ---------- Components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.stat .n { font-size: clamp(17px, 1.45vw, 28px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat > div:last-child { min-width: 0; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat.hero { background: var(--grad); color: #fff; border: none; box-shadow: var(--shadow-lg); }
.stat.hero .l, .stat.hero .n span { color: rgba(255, 255, 255, .8) !important; }
.stat.hero .ic { background: rgba(255, 255, 255, .18); }
.stat.hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.ic.violet { background: var(--primary-soft); }
.ic.green { background: var(--ok-soft); }
.ic.orange { background: var(--accent-soft); }
.ic.red { background: var(--bad-soft); }
.ic.blue { background: var(--info-soft); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 9px 16px; border-radius: 11px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; transition: transform .12s, box-shadow .15s, background .15s; }
.btn:hover { background: #f6f6fc; border-color: #d9dbea; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 8px 20px -8px rgba(91, 61, 245, .7); }
.btn.primary:hover { box-shadow: 0 10px 24px -8px rgba(91, 61, 245, .9); filter: brightness(1.05); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 6px 16px -8px rgba(15, 157, 99, .8); }
.btn.ok:hover { filter: brightness(1.05); background: var(--ok); }
.btn.danger { color: var(--bad); border-color: #f6c6ce; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

table.list { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.list th { text-align: left; color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; background: #f8f8fd; border-bottom: 1px solid var(--line); }
table.list th:first-child { border-top-left-radius: 10px; }
table.list th:last-child { border-top-right-radius: 10px; }
table.list td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: none; }
table.list tr.click { cursor: pointer; transition: background .12s; }
table.list tr.click:hover td { background: #f7f5ff; }
.table-wrap { overflow-x: auto; }
.r { text-align: right; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #eef0f6; color: #4b5170; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 18px; }
.dash-grid .full { grid-column: 1 / -1; }
label.f { display: block; font-size: 13px; font-weight: 600; color: #39405e; }
label.f span.req { color: var(--bad); }
input, select, textarea { width: 100%; font: inherit; font-weight: 500; padding: 10px 13px; border: 1.5px solid #e1e3ef; border-radius: 11px; background: #fbfbfe; margin-top: 6px; color: var(--text); transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover, textarea:hover { border-color: #cfd2e6; }
input:focus, select:focus, textarea:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91, 61, 245, .12); }
textarea { min-height: 76px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; padding: 8px 13px; border: 1.5px solid #e1e3ef; border-radius: 11px; background: #fbfbfe; transition: all .15s; }
.checks label:hover { border-color: #cfd2e6; }
.checks label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.checks input { width: auto; margin: 0; accent-color: var(--primary); }
.hint { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 5px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(18, 13, 46, .5); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; z-index: 50; animation: fade .15s ease; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 720px; padding: 26px; box-shadow: 0 30px 80px -20px rgba(18, 13, 46, .45); animation: pop .18s ease; }
.modal.sm { max-width: 460px; }
.modal h2 { font-size: 19px; font-weight: 800; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #151a2d; color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 100; font-size: 14px; font-weight: 600; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .4); animation: pop .2s ease; }
.toast.err { background: var(--bad); }

/* ---------- Motor ---------- */
.motor-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.motor-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.motor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.motor-card .top { position: relative; height: 92px; background: var(--grad); display: flex; align-items: flex-end; justify-content: space-between; padding: 12px 14px; }
.motor-card .top.c1 { background: linear-gradient(135deg, #ff7a1a, #ff4f6d); }
.motor-card .top.c2 { background: linear-gradient(135deg, #0fb5a8, #2b7fff); }
.motor-card .top.c3 { background: linear-gradient(135deg, #1f2a5a, #5b3df5); }
.motor-card .top .emoji { position: absolute; right: 12px; top: 6px; font-size: 52px; opacity: .9; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); transform: scaleX(-1); }
.motor-card .top .badge { background: rgba(255, 255, 255, .92); position: relative; }
.motor-card .top { height: 150px; }
.motor-card .top.has-photo { background: #eceaf6; }
.motor-card .top .emoji { font-size: 64px; top: 28px; right: 24px; }
.motor-card .top img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.motor-photo-field { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.motor-photo-prev { width: 120px; height: 90px; border-radius: 12px; background: var(--primary-soft); display: grid; place-items: center; font-size: 36px; overflow: hidden; flex-shrink: 0; border: 1px solid var(--line); }
.motor-photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.motor-card .body { padding: 14px 16px 16px; }
.motor-card .plat { display: inline-block; font-family: "JetBrains Mono", Consolas, monospace; font-weight: 700; background: #fff; color: #111; border: 2px solid #111; padding: 1px 8px; border-radius: 6px; font-size: 13px; letter-spacing: .04em; }
.motor-card .name { font-weight: 800; font-size: 17px; margin: 10px 0 2px; }
.motor-card .price { margin-top: 12px; display: flex; gap: 8px; }
.motor-card .price div { flex: 1; background: #f7f6fd; border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.motor-card .price b { display: block; color: var(--text); font-size: 14px; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; font-size: 14px; }
.kv .k { color: var(--muted); font-weight: 500; }
.linkbox { display: flex; gap: 8px; align-items: center; background: linear-gradient(135deg, #f3efff, #fdf0ff); border: 1px dashed #c7b8ff; border-radius: 12px; padding: 12px 14px; flex-wrap: wrap; }
.linkbox code { flex: 1; min-width: 200px; word-break: break-all; font-size: 13px; color: #4a2fd0; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 6px; }

table.list tr.tot-row td { font-weight: 800; background: #f8f8fd; border-top: 2px solid var(--line); }
.jt-info { margin-top: 6px; padding: 10px 13px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.swap-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swap-chip { display: inline-flex; flex-direction: column; background: var(--primary-soft); color: var(--primary); font-weight: 800; padding: 6px 12px; border-radius: 12px; font-family: "JetBrains Mono", Consolas, monospace; letter-spacing: .03em; }
.swap-chip small { font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-weight: 600; color: var(--muted); letter-spacing: 0; font-size: 11.5px; }
.swap-arrow { font-size: 20px; color: var(--accent); font-weight: 800; }
.thumb { width: 52px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--primary-soft); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.bar { height: 6px; background: #eeedf6; border-radius: 99px; margin: 5px 0 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--grad-warm); border-radius: 99px; }
.lama { display: inline-block; font-weight: 800; font-size: 15px; color: var(--primary); background: var(--primary-soft); padding: 3px 10px; border-radius: 10px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: #b4530a; white-space: nowrap; }

/* Reimburse & nota */
.ded { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: #fcfcff; }
.ded-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
table.rin { width: 100%; max-width: 460px; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
table.rin td { padding: 4px 0; border-bottom: 1px dashed var(--line); }
table.rin tr.tot td { font-weight: 800; border-bottom: none; padding-top: 6px; }
.notas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.nota { position: relative; width: 84px; height: 84px; }
.nota img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; background: #fff; }
.nota .x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--bad); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.nota.add { border: 2px dashed #c9c3ea; border-radius: 10px; display: grid; place-items: center; text-align: center; font-size: 12px; font-weight: 700; color: var(--primary); cursor: pointer; background: #fff; }
.nota.add:hover { background: var(--primary-soft); }
.rin-row { display: grid; grid-template-columns: 1fr 150px 40px; gap: 8px; align-items: center; }
.rin-row input { margin-top: 6px; }
.rin-row .btn { margin-top: 6px; justify-content: center; }
.rin-total { text-align: right; margin-top: 8px; font-size: 15px; }

/* Signature pad */
.sigpad { border: 2px dashed #c9c3ea; border-radius: 14px; background: repeating-linear-gradient(0deg, #fff, #fff 34px, #f4f2fd 35px); touch-action: none; width: 100%; height: 180px; display: block; cursor: crosshair; }

/* ---------- Login ---------- */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(60% 50% at 15% 10%, rgba(139, 92, 246, .35), transparent 70%), radial-gradient(50% 50% at 90% 90%, rgba(255, 122, 26, .28), transparent 70%), #120d2e; }
.center-page .card { width: 100%; max-width: 400px; padding: 30px; border: none; border-radius: 22px; box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .55); }
.center-page .logo { width: 54px; height: 54px; font-size: 28px; border-radius: 16px; margin-bottom: 16px; }
.center-page h2 { font-size: 22px; font-weight: 800; }
.site-chip { display: inline-block; margin: -4px 0 14px; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; letter-spacing: .01em; }
.center-page .btn { justify-content: center; padding: 12px; font-size: 15px; }

/* ---------- Dokumen (perjanjian/invoice) ---------- */
.doc-toolbar { display: flex; gap: 8px; justify-content: space-between; align-items: center; max-width: 210mm; margin: 0 auto 14px; flex-wrap: wrap; }
.doc { background: #fff; max-width: 210mm; margin: 0 auto; padding: 16mm 16mm; font-family: "Times New Roman", Georgia, serif; font-size: 13.5px; color: #000; line-height: 1.5; box-shadow: 0 10px 40px -12px rgba(21, 26, 45, .2); border-radius: 4px; position: relative; }
.doc a { font-weight: inherit; }
.doc-head { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; text-align: center; }
.doc-brand { font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.doc-sub { font-size: 12px; }
.doc-title { text-align: center; font-size: 17px; margin: 6px 0 2px; }
.doc-title.left { text-align: left; font-size: 26px; letter-spacing: .05em; }
.doc-no { text-align: center; font-size: 12px; margin-bottom: 10px; }
.doc h2 { font-size: 14px; margin: 16px 0 6px; }
.doc table.ft { width: 100%; border-collapse: collapse; }
.doc table.ft td { padding: 3px 0; vertical-align: top; }
.doc table.ft td.lbl { width: 34%; }
.doc table.ft td.sep { width: 14px; }
.doc .blank { display: inline-block; width: 100%; border-bottom: 1px dotted #555; height: 1.1em; }
.doc .cb { display: inline-block; width: 13px; height: 13px; border: 1px solid #000; text-align: center; line-height: 12px; font-size: 11px; vertical-align: -2px; margin-right: 2px; }
.doc ol.terms { padding-left: 20px; margin: 0; }
.doc ol.terms > li { margin-bottom: 6px; }
.doc ol.terms ul { padding-left: 18px; margin: 2px 0; list-style: circle; }
.doc .signs { display: flex; justify-content: space-between; text-align: center; margin-top: 18px; gap: 20px; }
.doc .signs > div { flex: 1; }
.doc .signs.single { justify-content: flex-end; }
.doc .signs.single > div { flex: 0 0 240px; }
.doc .sign-box { height: 80px; display: flex; align-items: center; justify-content: center; }
.doc .sign-box img { max-height: 78px; max-width: 220px; }
.doc .muted { color: #555; }
.doc .inv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.doc table.mini td { padding: 1px 6px; font-size: 13px; }
.doc .bill-to { margin: 14px 0; }
.doc table.items { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc table.items th, .doc table.items td { border-bottom: 1px solid #bbb; padding: 7px 8px; text-align: left; vertical-align: top; }
.doc table.items th { background: #f1f1f1; }
.doc table.items.grid th, .doc table.items.grid td { border: 1px solid #999; font-size: 12.5px; }
.doc table.items .r { text-align: right; }
.doc table.rin-doc { border-collapse: collapse; margin: 4px 0 2px 6px; font-size: 12.5px; }
.doc table.rin-doc td { border: none !important; padding: 1px 14px 1px 0 !important; }
.doc.lampiran { margin-top: 22px; }
.doc .nota-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 12px; }
.doc .nota-grid figure { margin: 0; border: 1px solid #ccc; padding: 6px; page-break-inside: avoid; }
.doc .nota-grid img { width: 100%; max-height: 110mm; object-fit: contain; display: block; }
.doc .nota-grid figcaption { font-size: 11.5px; text-align: center; margin-top: 4px; }
.doc .pay-info { border: 1px solid #bbb; padding: 10px 12px; border-radius: 4px; margin: 12px 0; }
@media (max-width: 600px) { .doc .signs { flex-direction: column; gap: 26px; } .doc .signs.single > div { flex: 1; } }
.doc .stamp { position: absolute; left: 16mm; bottom: 22mm; transform: rotate(-14deg); border: 3px solid #138a4b; color: #138a4b; font-size: 30px; font-weight: 800; padding: 2px 18px; letter-spacing: .1em; opacity: .75; font-family: Arial, sans-serif; }

@page { size: A4; margin: 12mm; }
@media print {
  body { background: #fff; }
  .no-print, .side, .topbar, .doc-toolbar, .toast { display: none !important; }
  .main { padding: 0; }
  .doc { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .doc-page-break { page-break-before: always; }
  .doc h2 { page-break-after: avoid; }
  .doc .signs { page-break-inside: avoid; }
}
