/* Althaf Konveksi — tampilan v9
   Gaya "denim": biru denim + aksen emas benang. Huruf besar & tombol lebar supaya nyaman di HP. */
:root {
  --brand: #2b4a8b;
  --brand-600: #213b72;
  --brand-50: #eef3fb;
  --brand-100: #dbe5f6;
  --accent: #e3a23b;
  --ok: #1d8350;
  --ok-50: #e6f5ec;
  --warn: #a8640a;
  --warn-50: #fff3df;
  --danger: #c23b3b;
  --danger-50: #fdeceb;
  --bg: #f2f4f8;
  --surface: #ffffff;
  --line: #e1e6ef;
  --text: #1a2233;
  --muted: #5b6678;
  --side: #17264a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 3px 10px rgba(16, 24, 40, .05);
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Kerangka ---------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #d7def0; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); display: grid; place-items: center; color: var(--accent); flex: none; }
.brand-mark svg.i { width: 24px; height: 24px; }
.brand b { font-size: 1rem; letter-spacing: .02em; line-height: 1.2; }
.brand small { display: block; color: #9fb0d4; font-size: .75rem; font-weight: 400; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sec { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #8293b9; padding: 16px 12px 6px; }
.nav a, .nav button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #d7def0; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; width: 100%; }
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: .75rem; font-weight: 700; padding: 1px 8px; }
.nav a.active { background: rgba(227, 162, 59, .16); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
/* Sub menu Produksi (v9.29): Potong … Kirim, menjorok di bawah Produksi. */
.nav a.sub { padding: 7px 12px 7px 26px; font-size: .9rem; gap: 10px; color: #b9c4de; }
.nav a.sub.active { color: #fff; }
.sub-dot { width: 22px; display: inline-flex; justify-content: center; flex: 0 0 22px; }
.sub-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
/* Deretan tombol tahap di atas halaman Produksi / sub tahap / QC; di HP bisa digeser ke samping. */
.stage-nav { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 14px; padding: 4px 0 6px; scrollbar-width: thin; }
.stage-nav a { flex: 0 0 auto; display: inline-flex; gap: 6px; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.stage-nav a.active { background: var(--side); border-color: var(--side); color: #fff; }
.stage-nav .count { background: rgba(0, 0, 0, .08); border-radius: 999px; padding: 0 7px; font-size: .78rem; }
.stage-nav a.active .count { background: rgba(255, 255, 255, .22); }
.stage-jobs-empty { color: var(--muted); font-size: .9rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600); display: grid; place-items: center; font-weight: 700; flex: none; text-transform: uppercase; }

.main { min-width: 0; }
.scrim { display: none; }
/* Bilah atas (v9.38): di komputer hanya tombol pengguna di kanan; di HP juga tombol menu & judul halaman. */
.topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; min-height: 56px; padding: 8px 28px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .tb-menu, .topbar .t { display: none; }
/* Tombol sembunyikan/tampilkan menu kiri (khusus komputer; pilihan diingat di perangkat ini). */
.topbar .tb-side { display: inline-flex; background: none; border: 1px solid transparent; color: var(--text); padding: 8px; border-radius: 10px; cursor: pointer; }
.topbar .tb-side:hover, .topbar .tb-side:focus-visible { background: var(--bg); border-color: var(--line); }
@media (min-width: 901px) {
  .shell.side-hidden { grid-template-columns: minmax(0, 1fr); }
  .shell.side-hidden .side { display: none; }
  /* Tombol selalu di titik yang sama (pojok kiri atas), menu tampil maupun tersembunyi. */
  .topbar .tb-side { position: fixed; top: 12px; left: 12px; z-index: 45; }
  .shell:not(.side-hidden) .tb-side { color: #d7def0; }
  .shell:not(.side-hidden) .tb-side:hover, .shell:not(.side-hidden) .tb-side:focus-visible { background: rgba(255, 255, 255, .08); border-color: transparent; }
  .side { padding-top: 2px; }
  .side .brand { padding-top: 1px; padding-left: 50px; }
  .shell.side-hidden .topbar { padding-left: 64px; }
}
.user-wrap { position: relative; margin-left: auto; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid transparent; border-radius: 999px;
  background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.user-btn:hover, .user-btn[aria-expanded="true"], .user-btn.active { background: var(--bg); border-color: var(--line); }
.user-btn .avatar { width: 32px; height: 32px; font-size: .8rem; }
.user-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .caret { font-size: .75rem; color: var(--muted); }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; padding: 6px; z-index: 45; background: var(--surface);
  color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .16); }
.user-menu[hidden] { display: none; }
.user-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.user-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-head small { color: var(--muted); font-size: .8rem; }
.user-menu a, .user-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; text-decoration: none; text-align: left; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover { background: var(--bg); }
.user-menu [data-logout] { color: var(--danger); }
.content { max-width: 1200px; margin: 0 auto; padding: 26px 28px 60px; }
.bottomnav { display: none; }

/* ---------- Kepala halaman ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; margin-bottom: 8px; font-size: .95rem; }
.backlink:hover { color: var(--brand); }

/* ---------- Kartu ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; border: 1px solid #edf0f5; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; }

/* ---------- Angka ringkasan ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; gap: 14px; align-items: center; border: 1px solid #edf0f5; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--brand-100); }
.stat .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.stat .ico svg.i { width: 24px; height: 24px; }
.stat .ico.ok { background: var(--ok-50); color: var(--ok); }
.stat .ico.warn { background: var(--warn-50); color: var(--warn); }
.stat .ico.danger { background: var(--danger-50); color: var(--danger); }
.stat .lbl { color: var(--muted); font-size: .88rem; }
.stat .val { font-size: 1.35rem; font-weight: 700; line-height: 1.2; word-break: break-word; }
.stat .val.neg { color: var(--danger); }

/* ---------- Tombol ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-600); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.light { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-100); }
.btn.light:hover { background: var(--brand-100); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: #f6f8fb; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a52f2f; }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: #f1c8c8; }
.btn.danger-ghost:hover { background: var(--danger-50); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #166b41; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 8px; min-width: 40px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .92rem; }
.req::after { content: " *"; color: var(--danger); }
.hint { color: var(--muted); font-size: .85rem; }
.money-hint { color: var(--brand-600); font-size: .85rem; font-weight: 600; min-height: 1.2em; }
input, select, textarea { width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid #ccd4e1; border-radius: 10px; padding: 10px 12px; min-height: 46px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(43, 74, 139, .28); outline-offset: 1px; border-color: var(--brand); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: #eef1f6; color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.goods-list { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 4px 0; }
.goods-list .check { font-weight: 400; }
.goods-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.goods-item .gqty { width: 84px; min-height: 40px; padding: 6px 8px; text-align: right; }
.goods-item .gleft { white-space: nowrap; }
/* Tabel sisa item yang belum diambil karyawan: minus = melebihi sisa (merah), 0 = sudah diambil semua (abu-abu). */
.left-t .left-neg { color: var(--danger); }
.left-t .left-zero { color: var(--muted); font-weight: 400; }
/* Detail Order: nama karyawan per item & tahap di bawah angka sisa. */
.who-t td.num { vertical-align: top; }
.who-t .who-ln { display: block; font-size: .78rem; color: var(--muted); line-height: 1.3; margin-top: 2px; white-space: normal; }
.who-t .who-ln b { color: var(--text); font-weight: 600; }
.who-t .who-ok { color: var(--ok); font-weight: 700; }
.who-t .who-part { white-space: nowrap; }
@media (max-width: 700px) {
  table.t.rt.who-t td.num { flex-wrap: wrap; row-gap: 2px; }
  table.t.rt.who-t td.num > div:first-of-type { margin-left: auto; }
  table.t.rt.who-t td.num .who-ln { width: 100%; text-align: right; margin-top: 0; }
}
/* Halaman QC: daftar pekerjaan QC per orang. */
.qc-jobs { display: flex; flex-direction: column; gap: 6px; }
.qc-job { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
/* Status / hasil QC per item: tabel ringkas (tetap tabel di HP, bukan kartu). */
table.t.qc-t th, table.t.qc-t th.num { padding: 6px 8px; font-size: .72rem; letter-spacing: .02em; white-space: normal; }
table.t.qc-t td { padding: 6px 8px; }
table.t.qc-t .qc-ok { color: var(--ok); }
table.t.qc-t .qc-rej { color: var(--danger); font-weight: 700; }
table.t.qc-t input { width: 72px; padding: 6px 8px; text-align: right; }
@media (max-width: 600px) {
  table.t.qc-t th, table.t.qc-t td { padding: 6px 4px; }
  table.t.qc-t th { font-size: .66rem; letter-spacing: 0; }
  table.t.qc-t input { width: 50px; padding: 6px 4px; }
}
.invalid { border-color: var(--danger) !important; background: #fffafa; }
.field-err { color: var(--danger); font-size: .85rem; font-weight: 600; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 50px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 8px; cursor: pointer; border-radius: 8px; }
.form-sec { font-weight: 700; color: var(--brand-600); margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.form-sec:first-child { margin-top: 0; }
.assign-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fbfcfe; }
.assign-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; }
.choice { flex: 1 1 160px; border: 1px solid #ccd4e1; border-radius: 10px; padding: 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }

.infobox { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 12px; padding: 12px 14px; }
.infobox.warn { background: var(--warn-50); border-color: #f3d9a8; }
.infobox.danger { background: var(--danger-50); border-color: #f1c8c8; }
.infobox.ok { background: var(--ok-50); border-color: #bfe3cd; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.alert-line { color: var(--danger); font-weight: 700; }

/* ---------- Alat cari & tab ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 240px; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 40px; }
.toolbar select { width: auto; flex: 0 1 220px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; display: inline-flex; gap: 8px; align-items: center; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab .count { background: rgba(0, 0, 0, .08); border-radius: 999px; padding: 0 8px; font-size: .8rem; }
.tab.active .count { background: rgba(255, 255, 255, .22); }

/* ---------- Tabel (menjadi kartu di HP) ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.t th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; }
table.t td { padding: 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f7f9fd; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }
table.t td.act { white-space: nowrap; text-align: right; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .85rem; }
.thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: #eef1f6; flex: none; border: 1px solid var(--line); }
.thumb.lg { width: 88px; height: 88px; }
.thumb-ph { width: 46px; height: 46px; border-radius: 10px; background: #eef1f6; display: grid; place-items: center; color: #9aa6b8; flex: none; }
.thumb-ph.lg { width: 88px; height: 88px; }
.thumb-ph.pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--danger-50); color: var(--danger); border: 1px solid var(--line); font-size: .68rem; }
.thumb-ph.pdf.lg { font-size: .85rem; }
.pdf-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 100%;
  padding: 6px; color: var(--danger); background: var(--danger-50); text-align: center; text-decoration: none; }
.pdf-tile small { max-width: 100%; color: var(--muted); font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imgpick .preview { grid-template-columns: minmax(0, 1fr); }        /* nama file PDF panjang: dipotong "…", kotak tidak melebar */
.pdf-tile { min-width: 0; box-sizing: border-box; }
.imgpick .preview > a { display: block; width: 100%; height: 100%; text-decoration: none; }
.with-thumb { display: flex; gap: 12px; align-items: center; min-width: 0; }
.thumbs { display: flex; flex-direction: column; gap: 8px; flex: none; }

/* ---------- Lencana, progres, linimasa ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; background: #eef1f6; color: #3d4757; }
.badge.s0 { background: #eceff4; color: #4a5568; }
.badge.s1 { background: #e3ecfb; color: #234c96; }
.badge.s2 { background: #e8e6fb; color: #4535a3; }
.badge.s3 { background: #f3e5f7; color: #7a2f8f; }
.badge.s4 { background: #dff3f1; color: #19665e; }
.badge.s5 { background: #fdf0d9; color: #8a5300; }
.badge.s6, .badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.danger { background: var(--danger-50); color: var(--danger); }
.badge.brand { background: var(--brand-50); color: var(--brand-600); }
.progress { height: 10px; background: #e7ebf2; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.progress.done > span { background: var(--ok); }
.progress-line { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; margin-bottom: 6px; flex-wrap: wrap; }
.timeline { display: flex; gap: 4px; flex-wrap: wrap; }
.step { font-size: .78rem; padding: 4px 10px; border-radius: 999px; background: #eef1f6; color: #6b7587; font-weight: 600; }
.step.done { background: var(--ok-50); color: var(--ok); }
.step.current { background: var(--brand); color: #fff; }
.stars { color: #d3d8e1; letter-spacing: 1px; font-size: 1.1rem; white-space: nowrap; }
.stars .on { color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; background: #fff; text-decoration: none; color: var(--text); font-size: .9rem; margin: 3px 6px 3px 0; }
.chip .avatar { width: 26px; height: 26px; font-size: .75rem; }
.chip.gone { color: var(--muted); border-style: dashed; }
a.chip:hover { border-color: var(--brand); }
.chip-detail { color: var(--muted); font-size: .8rem; }

/* ---------- Kartu produksi & karyawan ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.cards > .card { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.pcard-top { display: flex; gap: 14px; align-items: flex-start; }
.pcard-top .title { font-weight: 700; }
.pcard-foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ecard { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.ecard .avatar { width: 48px; height: 48px; font-size: 1.1rem; }
a.card:hover { border-color: var(--brand-100); }

/* ---------- Kosong & memuat ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty > svg.i { width: 44px; height: 44px; color: #b4bfd0; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }
.loading { padding: 50px 0; text-align: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Dialog & notifikasi ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.dialog.wide { max-width: 760px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 0; }
.dialog-body { padding: 14px 20px; }
.dialog-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; flex-wrap: wrap; }
.dialog .x { background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #1d2a44; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); display: flex; gap: 10px; align-items: flex-start; animation: up .2s; }
.toast.ok svg.i { color: #6fe0a3; }
.toast.err { background: #7f1f1f; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }
/* Persen unggahan PDF (v9.28): di atas dialog, di bawah layar. */
.upbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70; width: min(440px, calc(100vw - 32px));
  background: #1d2a44; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: 14px; }
.upbar-track { height: 8px; background: rgba(255, 255, 255, .2); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.upbar-track i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s; }
/* Bilah "tidak ada sambungan": dipasang di luar <body> (huruf ditulis ulang di sini), tidak menghalangi ketukan. */
.offline-bar { position: fixed; z-index: 70; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); display: flex; gap: 8px; align-items: center; background: var(--warn-50); color: #6b3f00; border: 1px solid #f3d9a8; padding: 8px 14px; border-radius: 14px; font: 600 .85rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; box-shadow: 0 6px 18px rgba(16, 24, 40, .15); pointer-events: none; }
.offline-bar svg.i { flex: none; color: var(--warn); }
.lightbox img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; }

/* ---------- Halaman masuk ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #17264a 0%, #2b4a8b 55%, #3c63ad 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.auth-card.wide { max-width: 560px; }
.auth-logo { width: 60px; height: 60px; border-radius: 16px; background: var(--side); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.auth-logo svg.i { width: 32px; height: 32px; }
.auth-card h1 { font-size: 1.45rem; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 18px 0 4px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Gambar unggahan ---------- */
.imgpick { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.imgpick .preview { width: 110px; height: 110px; border-radius: 12px; border: 1px dashed #b9c3d4; display: grid; place-items: center; overflow: hidden; background: #f6f8fb; color: #9aa6b8; }
.imgpick .preview img { width: 100%; height: 100%; object-fit: cover; }
.imgpick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.imgpick label.btn { position: relative; }
.imgpick .btn[hidden] { display: none; }
.field[hidden] { display: none; }
.imgpick label.btn:focus-within { outline: 3px solid rgba(43, 74, 139, .28); outline-offset: 1px; }

.qr { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); display: inline-block; }
.qr svg { display: block; width: 180px; height: 180px; }
.addr { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; font-weight: 700; word-break: break-all; }
details.faq { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; background: #fff; }
details.faq summary { font-weight: 700; cursor: pointer; }
details.faq[open] summary { margin-bottom: 8px; }
ol.steps { padding-left: 1.3rem; margin: 0; }
ol.steps li { margin-bottom: 6px; }

/* ---------- Invoice ---------- */
.paper { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 34px; border: 1px solid #edf0f5; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--text); padding-bottom: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.inv-head h1 { font-size: 2rem; letter-spacing: .06em; }
.inv-head .co { font-weight: 700; font-size: 1.1rem; margin-top: 4px; }
.inv-table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.inv-table th, .inv-table td { border: 1px solid #d9dee8; padding: 10px; text-align: left; }
.inv-table th { background: #f4f6fa; }
.inv-total { text-align: right; font-size: 1.25rem; font-weight: 800; margin-top: 14px; }
.print-text { display: none; white-space: pre-wrap; }
.paid-stamp { display: inline-block; border: 3px solid var(--ok); color: var(--ok); font-weight: 800; padding: 2px 12px; border-radius: 8px; transform: rotate(-4deg); letter-spacing: .1em; }

/* ---------- HP & tablet ---------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; max-width: 86vw; z-index: 40; transform: translateX(-102%); transition: transform .2s; height: auto; }
  .shell.drawer-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .shell.drawer-open .scrim { display: block; }
  .topbar { background: var(--side); color: #fff; border-bottom: 0; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .t { display: block; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .tb-menu { display: inline-flex; background: none; border: 0; color: #fff; padding: 8px; border-radius: 10px; cursor: pointer; }
  .topbar .tb-side { display: none; }
  .user-btn { padding: 2px; color: #fff; }
  .user-btn:hover, .user-btn[aria-expanded="true"], .user-btn.active { background: rgba(255, 255, 255, .12); border-color: transparent; }
  .user-name, .user-btn .caret { display: none; }
  .content { padding: 16px 14px calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(16, 24, 40, .06); }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h); color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; background: none; border: 0; font-family: inherit; cursor: pointer; }
  .bottomnav svg.i { width: 24px; height: 24px; }
  .bottomnav a.active { color: var(--brand); }
  h1 { font-size: 1.35rem; }
  .grid2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat .ico { width: 38px; height: 38px; }
  .stat .val { font-size: 1.1rem; }
  .card { padding: 16px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); max-width: none; }
  .upbar { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); }
  .offline-bar { top: calc(max(10px, env(safe-area-inset-top)) + 52px); }      /* di bawah bilah judul */
  .overlay { align-items: center; padding: 16px; }
  .dialog, .dialog.wide { border-radius: 16px; max-height: calc(100vh - 32px); }
  .dialog-foot .btn { flex: 1; }
  .form-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: #fff; margin: 16px -16px -16px; padding: 12px 16px; border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -6px 14px rgba(16, 24, 40, .06); }
  .form-actions .btn { flex: 1; }
  .paper { padding: 18px; }

  /* tabel -> kartu */
  table.t.rt thead { display: none; }
  table.t.rt, table.t.rt tbody, table.t.rt tr, table.t.rt td { display: block; width: 100%; }
  table.t.rt tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 4px; background: #fff; }
  table.t.rt td { border: 0; padding: 6px 12px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.t.rt td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; font-weight: 600; flex: none; max-width: 45%; }
  table.t.rt td.lead { display: block; text-align: left; font-size: 1rem; }
  table.t.rt td.lead::before { display: none; }
  table.t.rt td.act { justify-content: flex-end; flex-wrap: wrap; }
  table.t.rt td.act::before { display: none; }
  table.t.rt td.empty-cell { display: block; text-align: center; }
  table.t.rt td.empty-cell::before { display: none; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .btn { padding: 9px 12px; }
}

/* ---------- Dokumen karyawan: serah terima barang & perjanjian kerja ---------- */
.doc-page { margin-bottom: 18px; }
.doc-co { margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--text); }
.doc-title { margin: 8px 0 2px; font-size: 1.15rem; letter-spacing: .02em; text-align: center; }
.doc-no { margin-bottom: 14px; text-align: center; }
.agreement p { margin: 0 0 6px; line-height: 1.55; text-align: justify; }
.agreement .ag-h { margin-top: 10px; font-weight: 700; text-align: left; }
.agreement .ag-gap { height: 6px; }
.sign-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sign-row .meterai { display: grid; place-items: center; width: 90px; margin: 0 auto; border: 1px dashed #b9c3d4; color: #9aa6b8; font-size: .75rem; }

/* ---------- Surat jalan ---------- */
.sj-info { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.sign-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; text-align: center;
  overflow-wrap: anywhere; break-inside: avoid; }
.sign-row .sp { height: 70px; }
@media (max-width: 640px) { .sj-info { grid-template-columns: 1fr; } }

/* ---------- Laporan keuangan standar (Laba Rugi, Neraca, Arus Kas) ---------- */
.fin-head { margin-bottom: 14px; text-align: center; }
.fin-head .co { font-weight: 700; }
.fin-head h2 { margin: 4px 0; font-size: 1.15rem; letter-spacing: .03em; }
.fin-table { width: 100%; border-collapse: collapse; }
.fin-table td { padding: 7px 10px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
.fin-table td.num { width: 38%; text-align: right; white-space: nowrap; }
.fin-table td.neg { color: var(--danger); }
.fin-h td { padding-top: 14px; background: #f4f6fa; color: var(--brand); font-weight: 700; }
.fin-i td:first-child { padding-left: 26px; }
.fin-s td { border-top: 1px solid var(--line); font-weight: 700; }
.fin-t td { border-top: 2px solid var(--text); border-bottom: 3px double var(--text); font-weight: 800; }
.fin-ok { color: var(--ok); font-weight: 600; }
.fin-bad { color: var(--danger); font-weight: 600; }

/* ---------- Item order (banyak item dalam 1 order) ---------- */
.rt-no { display: none; }
.items-t tfoot td { border-top: 2px solid var(--line); background: #f8fafc; }
.items-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 110px 150px 140px 44px; gap: 10px; align-items: center; }
.items-head { padding-bottom: 6px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.items-head .num { text-align: right; }
.item-row { padding: 8px 0; border-top: 1px solid var(--line); }
.item-no { color: var(--muted); font-weight: 700; text-align: center; }
.item-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.item-cell input { width: 100%; }
.item-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }   /* hanya pembaca layar; tampil di HP */
.item-sum { align-items: flex-end; white-space: nowrap; }
.item-row .btn[hidden] { display: none; }
.items-sum { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 20px; padding: 10px 0; border-top: 2px solid var(--line); }
@media (max-width: 900px) {
  .rt-no { display: inline; }
  table.t.rt td.no-mobile { display: none; }
}
@media (max-width: 640px) {
  .items-head { display: none; }
  .items-row.item-row { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 8px;
    grid-template-areas: "no name name del" ". qty price price" ". sum sum sum"; }
  .item-no { grid-area: no; }
  .item-name { grid-area: name; }
  .item-qty { grid-area: qty; }
  .item-price { grid-area: price; }
  .item-sum { grid-area: sum; flex-direction: row; justify-content: space-between; align-items: center; }
  .item-del { grid-area: del; }
  .item-lbl { position: static; width: auto; height: auto; clip: auto; color: var(--muted); font-size: .8rem; font-weight: 600; }
}

/* ---------- Cetak (invoice) ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .side, .topbar, .bottomnav, .no-print, .toasts, .page-head, .backlink, .scrim { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .paper { box-shadow: none; border: 0; padding: 0; }
  .paper input, .paper select, .paper textarea { border: 0 !important; padding: 0 !important; min-height: 0; background: transparent !important; appearance: none; -webkit-appearance: none; }
  .paper textarea, .paper .form-grid input { display: none; }
  .paper .form-grid { grid-template-columns: 1fr 1fr; }
  .print-text { display: block; }
  .pdf-empty { display: none !important; }
  .inv-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Dokumen karyawan: serah terima & perjanjian di halaman terpisah */
  .doc-page { margin: 0; }
  .doc-page + .doc-page { break-before: page; }
  /* Laporan keuangan: ketiga laporan dicetak, masing-masing di halaman sendiri */
  .card:has(.fin-sec) { box-shadow: none; border: 0; padding: 0; }
  .fin-sec[hidden] { display: block !important; }
  .fin-sec { break-after: page; }
  .fin-sec:last-of-type { break-after: auto; }
  .fin-table td.neg { color: inherit; }
  .fin-h td { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Insight bisnis & grafik di Beranda Admin (versi Laravel) ===== */
/* Ringkasan bulan ini (Beranda, v10.2.2): 4 angka kecil dalam satu kartu, lalu grafik per tab. */
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.mini { display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: inherit; text-decoration: none; min-width: 0; }
a.mini:hover { border-color: var(--brand-100); }
.mini .lbl { color: var(--muted); font-size: .8rem; }
.mini .val { font-weight: 700; font-size: 1.1rem; line-height: 1.25; word-break: break-word; }
.mini .val.neg { color: var(--danger); }
#insights .tabs { margin-top: 2px; }
@media (max-width: 700px) { .mini-stats { grid-template-columns: 1fr 1fr; } }
.ins-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ins { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--brand-50); line-height: 1.45; }
.ins .i { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.ins.ok { background: var(--ok-50); } .ins.ok .i { color: var(--ok); }
.ins.warn { background: var(--warn-50); } .ins.warn .i { color: var(--warn); }
.ins.danger { background: var(--danger-50); } .ins.danger .i { color: var(--danger); }
.ins.info .i { color: var(--brand); }
.ins.flip .i { transform: scaleY(-1); }
.chart { display: block; width: 100%; height: auto; margin: 4px 0 8px; }
.chart .ax { stroke: var(--line); stroke-width: 1; }
.chart .lbl { font-size: 9px; fill: var(--muted); }
.chart .b1 { fill: var(--brand); } .chart .b-ok { fill: var(--ok); } .chart .b-danger { fill: var(--danger); }
.chart rect:hover { opacity: .8; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.b-ok { background: var(--ok); } .legend i.b-danger { background: var(--danger); } .legend i.b1 { background: var(--brand); }
.hbars { display: grid; gap: 10px; margin: 6px 0 4px; }
.hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-bottom: 4px; }
.hb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-name .stars { font-size: .85rem; margin-left: 4px; }
.hb-val { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.hb-track { height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.hb-fill { height: 100%; border-radius: 99px; background: var(--brand); }
.hb-fill.ok { background: var(--ok); } .hb-fill.danger { background: var(--danger); } .hb-fill.accent { background: var(--accent); }
.sub-h { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 14px 0 6px; }
.neg { color: var(--danger); }
.insights + .grid2, #insights .grid2 { margin-bottom: 16px; }

/* Bilah "Versi baru tersedia" (melayang di bawah; di HP di atas menu bawah).
   Muncul kalau sidik versi tampilan di server (/api/status "build") berbeda dengan halaman yang sedang terbuka. */
.update-bar { position: fixed; z-index: 70; right: 16px; bottom: 16px; max-width: 560px; display: flex; flex-wrap: wrap; gap: 10px 12px;
  align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--side); color: #fff; box-shadow: 0 10px 30px rgba(16, 24, 40, .25);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }   /* di luar <body>: huruf diatur sendiri */
.update-bar .grow { flex: 1 1 240px; font-size: .92rem; line-height: 1.4; }
.update-bar svg.i { flex: none; color: var(--accent); }
.update-bar .btn-row { margin: 0; gap: 8px; }
.update-bar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .45); }
@media (max-width: 900px) { .update-bar { left: 12px; right: 12px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); } }

/* Ajakan & tombol "Pasang aplikasi" (PWA): disembunyikan kalau tidak bisa / sudah terpasang. */
[data-install][hidden], [data-install-banner][hidden] { display: none !important; }
.install-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.install-banner .grow { flex: 1 1 220px; }
.install-banner .btn-row { margin: 0; }

/* Email + tombol "Kirim kode" sebaris (di HP turun ke bawah) */
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; white-space: nowrap; }
@media (max-width: 420px) { .input-row { flex-direction: column; } }

/* Pengaturan → Foto Halaman Depan */
.photo-group { margin: 18px 0 8px; font-size: .95rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 18px; }
.photo-grid .imgpick .preview { width: 128px; height: 96px; }
