:root {
  --accent: #0f766e; --accent-dark: #115e59; --accent-soft: #e6f4f2;
  --bg: #f4f6f7; --card: #fff; --text: #1c2730; --muted: #66727d; --line: #e1e6ea;
  --red: #b42318; --red-bg: #fde8e6; --green: #15803d; --green-bg: #e0f6e7;
  --yellow: #92610a; --yellow-bg: #fdf2d0; --blue: #1d4ed8; --blue-bg: #e1eafe; --gray-bg: #eceff2;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 0; }
input, select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font: inherit; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
button, .btn { display: inline-block; min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { background: #f8fafa; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); }
.card.issues { border-color: var(--red); border-left-width: 4px; }
.link { color: var(--accent-dark); font-weight: 700; white-space: nowrap; }
button.link { min-height: 0; padding: 0; border: 0; background: none; text-decoration: underline; }
.tile-link { display: block; color: inherit; text-decoration: none; }
.tile-link:hover { border-color: var(--accent); }
button.danger { color: var(--red); border-color: var(--red); }
button.danger:hover { background: var(--red-bg); }
[hidden] { display: none !important; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 18px 12px; background: #fff; border-right: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 16px; color: var(--accent); padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { padding: 0 10px 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.nav a { padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--bg); }
.nav a.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.who { display: flex; justify-content: space-between; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.who button { background: none; border: 0; min-height: 0; padding: 0; color: var(--text); font-weight: 400; text-decoration: underline; text-align: left; white-space: normal; }
.topbar, .scrim { display: none; }
main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.nowrap { white-space: nowrap; }
.more { position: relative; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 4; display: flex; flex-direction: column; min-width: 200px; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.menu button { border: 0; background: none; text-align: left; font-weight: 400; }
.menu button:hover { background: var(--bg); }
.extra summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.extra-in { padding-top: 12px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.table { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 12px; font-size: 12px; color: var(--muted); background: #fafbfb; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--accent-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.red { color: var(--red); }
.green { color: var(--green); }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile b { display: block; font-size: 26px; }
.tile span { font-size: 13px; color: var(--muted); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--gray-bg); }
.badge.masuk, .badge.ok { color: var(--green); background: var(--green-bg); }
.badge.keluar, .badge.low { color: var(--red); background: var(--red-bg); }
.badge.transfer { color: var(--blue); background: var(--blue-bg); }
.badge.opname { color: var(--yellow); background: var(--yellow-bg); }
.badge.retur { color: #6d28d9; background: #efe8fd; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.seg button { white-space: normal; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#code { font-size: 18px; min-height: 52px; }
.okmsg { background: var(--green-bg); color: var(--green); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.okmsg[hidden] { display: none; }
.qty { width: 84px; text-align: right; }
.scanvideo { width: 100%; max-height: 260px; border-radius: 8px; background: #000; }
.scanvideo[hidden] { display: none; }
tr.fresh { background: var(--accent-soft); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.filters > * { min-width: 0; }
.stack > h2 { margin: 10px 0 -4px; }
.searchbar { display: flex; gap: 10px; }
.searchbar input { flex: 1; min-width: 0; }
form.stack { display: flex; flex-direction: column; gap: 12px; }
label.f { display: flex; flex-direction: column; gap: 4px; }
label.f > span { font-size: 13px; font-weight: 600; color: var(--muted); }
label.c { display: flex; gap: 8px; align-items: center; }
.err { background: var(--red-bg); color: var(--red); padding: 10px 12px; border-radius: 8px; font-size: 14px; white-space: pre-line; }
.err[hidden] { display: none; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 8px; }
.sj { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.sj-void { border: 3px solid var(--red); color: var(--red); font-size: 22px; font-weight: 800; text-align: center; padding: 8px; border-radius: 8px; letter-spacing: 2px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sj-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sj-from { text-align: right; }
.sj table { border: 1px solid var(--line); }
.sj-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; text-align: center; }
.sj-line { min-height: 90px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--text); }
@media print {
  body { background: #fff; }
  .side, .topbar, .noprint, .toast { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .sj { border: 0; padding: 0; }
  th { background: none; color: #000; }
}
.bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; overflow-y: auto; z-index: 20; }
.modal { background: #fff; border-radius: 14px; padding: 16px; width: 100%; max-width: 460px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-h button { border: 0; background: none; min-height: 0; padding: 4px 8px; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 22px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 30; max-width: calc(100vw - 32px); }
@media (max-width: 860px) {
  .shell { display: block; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); }
  .topbar button { border: 0; padding: 4px 8px; background: none; font-size: 20px; }
  .menu { left: 0; right: auto; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: 240px; z-index: 11; transform: translateX(-100%); transition: transform .15s; }
  .open .side { transform: none; }
  .open .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(15, 23, 42, .4); }
  main { padding: 16px 16px 48px; }
  .table td:first-child { min-width: 170px; }
}
@media (max-width: 720px) { .grid2 { grid-template-columns: minmax(0, 1fr); } .bg { padding: 12px; } }
