:root {
  --navy: #1b2765; --navy-2: #2a3a8c; --orange: #f17e1f; --ink: #1e2128; --muted: #6b7080;
  --line: #dfe2ea; --bg: #f4f5f9; --card: #ffffff; --green: #1d8c55; --red: #c62f28; --amber: #d98e04; --blue: #2563c9;
  --radius: 10px; font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
[x-cloak] { display: none !important; }
a { color: var(--navy-2); }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 10px; } h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Kerangka */
header.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
header.top .bar { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 8px 16px; }
header.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; }
header.top .brand img { height: 30px; background: #fff; border-radius: 5px; padding: 2px 6px; }
nav.main { display: flex; gap: 2px; flex-wrap: wrap; }
nav.main a { color: #dfe4ff; text-decoration: none; padding: 7px 10px; border-radius: 7px; font-size: 14px; }
nav.main a.on, nav.main a:hover { background: rgba(255,255,255,.14); color: #fff; }
nav.main .count { background: var(--orange); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 22px; }
main { max-width: 1200px; margin: 0 auto; padding: 18px 16px 60px; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  nav.main { display: none; position: absolute; top: 48px; left: 0; right: 0; background: var(--navy); flex-direction: column; padding: 8px; }
  nav.main.open { display: flex; }
  .userbox .who { display: none; }
}

/* Kartu & tabel */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.tight { padding: 10px 12px; }
.kpi .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kpi .value { font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 8px; border-bottom: 1px solid #eef0f5; vertical-align: top; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover td { background: #f7f8fc; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.b-Draf { background: #eceef3; color: #555; } .b-Diajukan { background: #fde8d4; color: #b85a07; }
.b-Diperiksa { background: #fff2c9; color: #8a6200; } .b-Disetujui { background: #dfe5ff; color: var(--navy); }
.b-Dibayar { background: #d8f2e4; color: var(--green); } .b-Dibatalkan { background: #fbdcda; color: var(--red); }
.b-red { background: #fbdcda; color: var(--red); } .b-amber { background: #fff2c9; color: #8a6200; } .b-green { background: #d8f2e4; color: var(--green); }
.b-gray { background: #eceef3; color: #555; }

/* Formulir */
label.f { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd3de; border-radius: 7px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9c4ff; border-color: var(--navy-2); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: #f6f7fa; color: #444; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
button, .btn { font: inherit; font-size: 14px; border: 1px solid #cfd3de; background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover { background: #f3f4f8; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; } button.primary:hover { background: var(--navy-2); }
button.orange { background: var(--orange); border-color: var(--orange); color: #fff; }
button.green { background: var(--green); border-color: var(--green); color: #fff; }
button.danger { color: var(--red); border-color: #f0b7b3; }
button.link { border: 0; background: none; color: var(--navy-2); padding: 4px 6px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small { padding: 4px 9px; font-size: 13px; }

/* Baris rincian voucher */
.lines .line { display: grid; grid-template-columns: minmax(170px, 1.3fr) 2fr 110px 150px 36px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #e4e6ee; }
@media (max-width: 760px) { .lines .line { grid-template-columns: 1fr 1fr; } .lines .line .desc { grid-column: span 2; } }
.totals { margin-left: auto; width: min(380px, 100%); }
.totals .t { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 700; font-size: 17px; color: var(--navy); border-top: 2px solid var(--navy); margin-top: 6px; padding-top: 8px; }
.terbilang { font-style: italic; color: var(--navy); background: #fff6ee; border-left: 3px solid var(--orange); padding: 8px 10px; border-radius: 4px; font-size: 13.5px; }

/* Notifikasi & dialog */
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #1f2433; color: #fff; padding: 10px 16px; border-radius: 9px; z-index: 50; max-width: 92vw; white-space: pre-line; box-shadow: 0 6px 22px rgba(0,0,0,.25); }
.toast.err { background: var(--red); }
.modal-back { position: fixed; inset: 0; background: rgba(15,18,30,.45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(520px, 100%); padding: 18px; max-height: 90vh; overflow: auto; }
.alert { padding: 10px 12px; border-radius: 8px; background: #fff6e6; border: 1px solid #f3d59a; color: #6b4a00; font-size: 14px; }
.alert.red { background: #fdeceb; border-color: #f2b8b4; color: #8f1f19; }
.alert.green { background: #e8f7ef; border-color: #b4e2c8; color: #155d39; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 16px; padding: 4px 11px; font-size: 13px; cursor: pointer; background: #fff; }
.pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.attach { display: flex; gap: 8px; flex-wrap: wrap; }
.attach a { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; font-size: 13px; text-decoration: none; background: #fafbff; }
.login { max-width: 380px; margin: 9vh auto; }
.login img { height: 60px; display: block; margin: 0 auto 14px; }

/* Cetak voucher A4 */
.print-wrap { overflow-x: auto; }
.print-page { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 14mm 14mm 10mm; color: #1e2128; font-size: 10.5pt; position: relative; }
.pv-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2.5px solid var(--navy); padding-bottom: 8px; }
.pv-head img { height: 54px; }
.pv-head .co { text-align: right; font-size: 8pt; color: #555; } .pv-head .co b { font-size: 12pt; color: var(--navy); letter-spacing: .5px; }
.pv-title { display: flex; justify-content: space-between; align-items: flex-start; margin: 12px 0; }
.pv-title h1 { color: var(--navy); font-size: 16pt; letter-spacing: 1px; margin: 0; } .pv-title .sub { color: var(--orange); font-size: 8pt; letter-spacing: 3px; font-weight: 700; }
.pv-meta { border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font-size: 9pt; }
.pv-meta td { padding: 1px 6px 1px 0; }
.pv-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pv-box .b { border: 1px solid var(--line); } .pv-box .h { background: var(--navy); color: #fff; font-size: 7.5pt; font-weight: 700; letter-spacing: 1px; padding: 3px 8px; }
.pv-box table { font-size: 9pt; padding: 4px 8px; } .pv-box td:first-child { color: #666; padding-right: 10px; white-space: nowrap; }
.pv-lines { width: 100%; border-collapse: collapse; font-size: 9pt; }
.pv-lines th { background: var(--navy); color: #fff; font-size: 7.5pt; letter-spacing: .8px; padding: 5px 6px; text-align: left; }
.pv-lines td { border-bottom: .5px solid var(--line); padding: 5px 6px; } .pv-lines .num { text-align: right; font-variant-numeric: tabular-nums; }
.pv-tot { margin-left: auto; width: 290px; border: 1px solid var(--line); margin-top: 8px; font-size: 9pt; }
.pv-tot .t { display: flex; justify-content: space-between; padding: 4px 8px; border-bottom: .5px solid var(--line); }
.pv-tot .g { background: var(--navy); color: #fff; font-weight: 700; padding: 6px 8px; display: flex; justify-content: space-between; }
.pv-sign { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.pv-sign .s { border: 1px solid var(--line); text-align: center; font-size: 8pt; }
.pv-sign .s .h { background: #f4f5fa; color: #666; padding: 3px; } .pv-sign .s .sp { height: 54px; display: flex; align-items: center; justify-content: center; }
.pv-sign .stamp { border: 1.5px solid rgba(27,39,101,.6); color: rgba(27,39,101,.7); font-weight: 800; letter-spacing: 2px; padding: 2px 6px; border-radius: 3px; transform: rotate(-8deg); font-size: 8pt; }
.pv-water { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: 80pt; font-weight: 900; color: rgba(120,120,120,.10); transform: rotate(-30deg); pointer-events: none; }
.pv-lunas { position: absolute; top: 118mm; left: 22mm; border: 3px solid rgba(29,140,85,.75); color: rgba(29,140,85,.8); font-weight: 900; font-size: 20pt; letter-spacing: 4px; padding: 4px 14px; border-radius: 8px; transform: rotate(-12deg); text-align: center; }
.pv-foot { margin-top: 14px; border-top: .5px solid var(--line); padding-top: 4px; font-size: 7pt; color: #777; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; } header.top, .no-print, .toast { display: none !important; }
  main { padding: 0; max-width: none; } .print-page { width: auto; min-height: auto; box-shadow: none; }
}

/* Pengadaan & gudang */
.b-Ditolak { background: #fbdcda; color: var(--red); } .b-Diposting { background: #d8f2e4; color: var(--green); } .b-Dipesan { background: #dfe5ff; color: var(--navy); }
table.edit td { padding: 4px 4px; vertical-align: top; }
table.edit input, table.edit select { min-width: 60px; }
.po-print .pv-lines td { font-size: 8.5pt; }
@media (max-width: 760px) {
  table.edit thead { display: none; }
  table.edit tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid #e4e6ee; }
  table.edit td { display: block; padding: 0; border: 0; text-align: left; }
  table.edit td[data-label="Barang"], table.edit td[data-label="Deskripsi"], table.edit td[data-label="Catatan"] { grid-column: span 2; }
  table.edit td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  table.edit input, table.edit select { width: 100% !important; }
}
