/* Master Data Pengadaan — gaya antarmuka. Tanpa gaya inline (CSP: style-src 'self'). */
:root {
    --navy: #111c36; --navy-2: #1b2947; --ink: #1c2740; --muted: #5b6780; --line: #e3e8f0; --canvas: #f4f6fa;
    --surface: #fff; --blue: #3b5bdb; --blue-dark: #2f4ac0; --blue-soft: #edf1ff;
    --green: #0f8a63; --green-soft: #e6f6f0; --amber: #9a5200; --amber-soft: #fff3e0;
    --red: #c92a3e; --red-soft: #fdecee; --purple: #6741d9; --purple-soft: #f1ebff;
    --radius: 12px; --focus: 0 0 0 3px rgba(59, 91, 219, .3);
    --shadow: 0 1px 2px rgba(17, 28, 54, .04), 0 8px 24px rgba(17, 28, 54, .04);
}
* { box-sizing: border-box; }
html { background: var(--canvas); min-width: 320px; }
body { margin: 0; font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--canvas); min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #c9d3ea; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; font-weight: 700; line-height: 1.2; padding: 4px 8px 16px; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(145deg, #7a91ff, #3b5bdb); display: grid; place-items: center; font-style: normal; font-weight: 800; flex: none; }
.side nav { flex: 1; }
.side h6 { margin: 16px 10px 6px; font-size: 11px; letter-spacing: .08em; color: #93a2c6; font-weight: 600; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: #c9d3ea; font-size: 14px; min-height: 40px; }
.nav-link:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.nav-link.on { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600; }
.nav-link svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge-n { margin-left: auto; background: #f08c00; color: #111; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.side-user { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; margin-top: 12px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.user-link { display: flex; gap: 9px; align-items: center; color: #fff; min-width: 0; }
.user-link:hover { text-decoration: none; }
.user-link span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-link strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.user-link small { color: #93a2c6; font-size: 12px; }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 700; flex: none; }
.btn-ghost { background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: #dbe3f6; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; min-height: 34px; }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.search { flex: 1; max-width: 440px; position: relative; margin: 0; }
.search input { width: 100%; padding: 9px 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); font: inherit; color: var(--ink); min-height: 40px; }
.search svg { position: absolute; left: 11px; top: 11px; width: 17px; height: 17px; stroke: var(--muted); fill: none; stroke-width: 2; }
.search kbd { position: absolute; right: 10px; top: 9px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; background: #fff; }
.icon-btn { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
.page { padding: 22px 28px 40px; width: 100%; max-width: 1320px; flex: 1; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { font-size: 22px; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.foot { padding: 14px 28px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); }

/* ---------- komponen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 560px; }
.card > header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card > header h2 { font-size: 16px; }
.card > header small { color: var(--muted); }
.card > header .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card .body { padding: 18px; }
.card .body.flush { padding: 0; }
.btn { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid #cdd5e2; background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; }
.btn:hover { background: var(--canvas); text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #0b7452; color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #a82031; color: #fff; }
.btn-outline-danger { color: var(--red); border-color: #f0b8c0; }
.btn-outline-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-sm { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; margin: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef1f6; color: #4a566e; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-info { background: var(--blue-soft); color: var(--blue); }
.chip-purple { background: var(--purple-soft); color: var(--purple); }
.chip-warn { background: var(--amber-soft); color: var(--amber); }
.chip-ok { background: var(--green-soft); color: var(--green); }
.chip-ok-strong { background: var(--green); color: #fff; }
.chip-err { background: var(--red-soft); color: var(--red); }

.alert { border-radius: 10px; padding: 11px 40px 11px 14px; margin: 0 0 16px; position: relative; border: 1px solid; font-size: 14px; }
.alert-success { background: var(--green-soft); border-color: #b7e4d3; color: #0a5f44; }
.alert-error { background: var(--red-soft); border-color: #f4bcc4; color: #8f1d2c; }
.alert-warn { background: var(--amber-soft); border-color: #f5d49a; color: #7a4100; }
.alert-info { background: var(--blue-soft); border-color: #c5d1fb; color: #243a99; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-close { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 20px; cursor: pointer; color: inherit; width: 32px; height: 32px; border-radius: 8px; }

/* ---------- formulir ---------- */
.fields { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.f { grid-column: span 6; min-width: 0; }
.f.w3 { grid-column: span 3; } .f.w4 { grid-column: span 4; } .f.w8 { grid-column: span 8; } .f.w12 { grid-column: span 12; }
label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label em, .label em { color: var(--red); font-style: normal; }
.in, select.in, textarea.in { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #cdd5e2; border-radius: 9px; background: #fff; min-height: 40px; color: var(--ink); }
textarea.in { min-height: 84px; resize: vertical; }
.in:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus); }
.in[readonly], .in:disabled { background: var(--canvas); color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.f.err .in { border-color: var(--red); }
.f.err .hint, .err-text { color: var(--red); font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .in { width: auto; min-width: 160px; }

/* ---------- tabel ---------- */
.table-wrap { overflow-x: auto; }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; background: #f8f9fc; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr:hover { background: #fafbfe; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.actions-cell { white-space: nowrap; text-align: right; }
table.t .title-cell strong { display: block; }
table.t .title-cell small { color: var(--muted); }
table.t tfoot td, table.t tfoot th { font-weight: 700; background: #f8f9fc; border-top: 2px solid var(--line); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .in { width: auto; min-width: 220px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 12px; font-size: 13px; color: var(--ink); min-height: 32px; display: inline-flex; align-items: center; }
.filter-chip:hover { background: var(--canvas); text-decoration: none; }
.filter-chip.on { background: var(--blue-soft); border-color: #c5d1fb; color: var(--blue); font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); }
.pager-info { color: var(--muted); font-size: 13px; margin: 0; padding: 12px 18px; }
.pager .pager-info { padding: 0; }
.pager-links { display: flex; gap: 4px; flex-wrap: wrap; }
.page-link { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
.page-link.current { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-link.disabled { opacity: .45; }
a.page-link:hover { background: var(--canvas); text-decoration: none; }
a.page-link.current:hover { background: var(--blue-dark); }
.empty-state { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty-state h2 { color: var(--ink); margin: 8px 0; }
.empty-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 22px; font-weight: 700; margin: 0 auto; }

/* ---------- grid rincian (ala Excel) ---------- */
.grid-scroll { overflow-x: auto; }
table.g { border-collapse: collapse; width: 100%; min-width: 1040px; font-size: 14px; table-layout: fixed; }
table.g th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; background: #f8f9fc; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.g td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid #f0f2f7; position: relative; }
table.g td:last-child, table.g th:last-child { border-right: 0; }
table.g input { width: 100%; border: 0; background: transparent; font: inherit; padding: 10px 8px; min-height: 42px; color: var(--ink); }
table.g input:focus { outline: 2px solid var(--blue); outline-offset: -2px; background: var(--blue-soft); box-shadow: none; }
table.g td.num input { text-align: right; font-variant-numeric: tabular-nums; }
table.g td.calc { padding: 0 10px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; background: #fafbfd; }
table.g td.idx { text-align: center; color: var(--muted); background: #fafbfd; }
table.g td.del { text-align: center; }
table.g td.del button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; border-radius: 6px; min-width: 32px; min-height: 32px; }
table.g td.del button:hover { background: var(--red-soft); color: var(--red); }
table.g tr.row-err td { background: var(--red-soft); }
table.g tfoot td { padding: 12px 10px; font-weight: 700; background: #f8f9fc; border-top: 2px solid var(--line); white-space: nowrap; }
.grid-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.col-name { width: auto; } .col-brand { width: 150px; } .col-qty { width: 90px; } .col-unit { width: 90px; } .col-price { width: 130px; }
.col-total { width: 140px; } .col-pct { width: 74px; } .col-acc { width: 220px; } .col-idx { width: 40px; } .col-del { width: 44px; }

/* ---------- layout halaman paket ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.sticky { position: sticky; top: 76px; }
.flow { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 18px; flex-wrap: wrap; }
.flow div { flex: 1 1 120px; padding: 10px 14px; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.flow div:last-child { border-right: 0; }
.flow b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #eef1f6; color: var(--muted); flex: none; }
.flow .done b { background: var(--green); color: #fff; }
.flow .now { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.flow .now b { background: var(--blue); color: #fff; }
.flow .warn { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
progress { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: #eef1f6; appearance: none; display: block; margin: 6px 0 4px; }
progress::-webkit-progress-bar { background: #eef1f6; }
progress::-webkit-progress-value { background: var(--green); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 99px; }
progress.over::-webkit-progress-value { background: var(--red); }
progress.over::-moz-progress-bar { background: var(--red); }
.chk { list-style: none; margin: 0; padding: 0; }
.chk li { display: flex; gap: 9px; padding: 8px 0; font-size: 14px; border-top: 1px solid var(--line); }
.chk li:first-child { border-top: 0; }
.ic { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.ic.ok { background: var(--green-soft); color: var(--green); } .ic.no { background: var(--red-soft); color: var(--red); } .ic.wa { background: var(--amber-soft); color: var(--amber); }
.docs { display: grid; gap: 8px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; flex-wrap: wrap; }
.doc .n { flex: 1; min-width: 140px; }
.doc small { display: block; color: var(--muted); font-size: 12px; }
.sumbar { position: sticky; bottom: 12px; display: flex; gap: 28px; align-items: center; flex-wrap: wrap; background: var(--navy); color: #fff; border-radius: 14px; padding: 12px 18px; box-shadow: 0 10px 30px rgba(17, 28, 54, .25); margin-top: 4px; z-index: 10; }
.sumbar small { display: block; color: #9fb0d4; font-size: 12px; }
.sumbar b { font-variant-numeric: tabular-nums; font-size: 16px; }
.sumbar .actions .btn { background: transparent; color: #fff; border-color: #3a4a73; }
.sumbar .actions .btn-primary { background: var(--blue); border-color: var(--blue); }

/* ---------- ringkasan ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat small { color: var(--muted); display: block; font-size: 13px; }
.stat b { font-size: 24px; font-variant-numeric: tabular-nums; display: block; margin-top: 2px; }
.stat span { font-size: 12px; color: var(--muted); }
.status-bars { display: grid; gap: 10px; }
.status-bars .row { display: grid; grid-template-columns: 110px 1fr 44px; gap: 10px; align-items: center; font-size: 14px; }
.status-bars progress { margin: 0; height: 10px; }

/* ---------- login / tamu ---------- */
.guest-main { max-width: 440px; margin: 0 auto; padding: 9vh 18px 40px; }
.guest-brand { display: flex; gap: 10px; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 20px; }
.guest-main .card { box-shadow: 0 18px 50px rgba(28, 45, 82, .1); }
.pw-wrap { position: relative; }
.pw-wrap .in { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 5px; border: 0; background: none; color: var(--blue); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.btn-block { width: 100%; }
.secret-box { background: var(--canvas); border: 1px dashed #b7c3e6; border-radius: 10px; padding: 10px 12px; word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 14px; user-select: all; }

/* ---------- dialog ---------- */
.dialog { border: 0; border-radius: 14px; padding: 22px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 24px 60px rgba(17, 28, 54, .35); }
.dialog::backdrop { background: rgba(17, 28, 54, .45); }
.dialog h2 { font-size: 18px; margin-bottom: 8px; }
.dialog p { margin: 0 0 18px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; z-index: 50; }

/* ---------- responsif ---------- */
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } .sticky { position: static; } }
@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
    .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(17, 28, 54, .4); }
    .icon-btn { display: grid; place-items: center; }
    .top { padding: 10px 16px; } .page { padding: 16px; }
    .f, .f.w3, .f.w4, .f.w8 { grid-column: span 12; }
    .dl { grid-template-columns: 1fr; gap: 2px 0; } .dl dt { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .top, .actions, .foot, .sumbar { display: none !important; } .shell { display: block; } }

/* login */
.login-title { font-size: 20px; margin-bottom: 4px; }
.login-sub { margin: 0 0 16px; font-size: 14px; }
.guest-main .f { grid-column: auto; margin-bottom: 14px; }

/* tambahan halaman paket */
.hint-list p { margin: 4px 0; font-size: 13px; color: var(--muted); }
.req { color: var(--red); font-style: normal; }
.action-form { margin-bottom: 12px; }
.action-form:last-child { margin-bottom: 0; }
.action-form textarea { margin-bottom: 8px; }
.recent-label { margin-top: 8px; color: var(--muted); }
.item-err { padding: 6px 18px; }

.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
