/* S-Core - gaya dasar. Token warna ada di :root; ubah di sini untuk mengganti tema. */
:root {
  --steel-950: #071A2F;
  --steel-900: #0B2545;
  --steel-800: #153B6B;
  --steel-700: #1F5190;
  --steel-500: #7FA0CB;
  --brass: #F28C28;
  --brass-ink: #A24E00;
  --brass-tint: #FDEBD5;
  --bg: #EDF1F6;
  --surface: #FFFFFF;
  --line: #D2DAE4;
  --line-soft: #E4EAF1;
  --text: #14202E;
  --muted: #546477;
  --ok: #1D7048;
  --ok-tint: #DCEFE5;
  --danger: #A8322B;
  --danger-tint: #F7E1DE;
  --radius: 6px;
  --sidebar-w: 260px;
  --font: "Bahnschrift", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg);
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--brass-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
body:not(.is-ready) .shell .content > * { visibility: hidden; }
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--steel-900); color: #D7E2F0; display: flex; flex-direction: column;
  transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand strong { display: block; color: #fff; font-size: 1.05rem; letter-spacing: .01em; }
.brand small { display: block; color: var(--steel-500); font-size: .72rem; line-height: 1.2; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-link, .nav-group-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius);
  background: none; color: inherit; text-decoration: none; text-align: left; cursor: pointer;
}
.nav-link:hover, .nav-group-btn:hover { background: rgba(255,255,255,.06); }
.nav-group-btn .chev { margin-left: auto; transition: transform .15s ease; }
.nav-group.is-open > .nav-group-btn .chev { transform: rotate(180deg); }
.nav-sub { display: none; margin: 2px 0 6px 21px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.12); }
.nav-group.is-open > .nav-sub { display: block; }
.nav-sub .nav-link { padding: 7px 10px; font-size: .92rem; color: #B9CAE0; }
.nav-link.is-active { background: rgba(242,140,40,.16); color: #fff; box-shadow: inset 3px 0 0 var(--brass); }
.nav-group-btn.has-active { color: #fff; }

.main { margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 58px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.1rem; }
.icon-btn { display: none; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.topbar .spacer { flex: 1; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border: 1px solid transparent; border-radius: var(--radius); background: none; cursor: pointer; text-align: left; }
.user-btn:hover { background: var(--bg); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--steel-800); color: #fff; font-size: .8rem; font-weight: 600; }
.user-btn .who { line-height: 1.2; }
.user-btn .who b { display: block; font-weight: 600; font-size: .9rem; }
.user-btn .who span { font-size: .78rem; color: var(--muted); }
.user-menu { position: relative; }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; padding: 6px; display: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(7,26,47,.14);
}
.user-pop.is-open { display: block; }
.user-pop a, .user-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 4px; background: none; color: var(--text); text-decoration: none; cursor: pointer; text-align: left; }
.user-pop a:hover, .user-pop button:hover { background: var(--bg); }
.content { padding: 24px; max-width: 1240px; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(7,26,47,.5); z-index: 35; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; }
  .main { margin-left: 0; }
  .icon-btn { display: grid; }
  .topbar { padding: 0 14px; }
  .user-btn .who { display: none; }
  .content { padding: 16px 14px; }
}

/* ---------- Komponen ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { color: var(--muted); margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.toolbar .grow { flex: 1 1 220px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; min-height: 38px;
  border: 1px solid var(--steel-800); border-radius: var(--radius); background: var(--steel-800); color: #fff; cursor: pointer; text-decoration: none; font-weight: 600;
}
.btn:hover { background: var(--steel-700); border-color: var(--steel-700); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); font-weight: 500; }
.btn-ghost:hover { background: var(--bg); border-color: var(--steel-500); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #DDB4AF; font-weight: 500; }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: .86rem; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 4px; font-size: .88rem; font-weight: 600; }
label.field small { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #A9B7C8; border-radius: var(--radius); background: #fff;
}
.input:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
.input:disabled { background: var(--bg); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--steel-800); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
.tbl th { font-size: .82rem; font-weight: 600; color: var(--muted); background: #F4F7FA; white-space: nowrap; }
.tbl tbody tr:hover { background: #F8FAFC; }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tbl .num { text-align: center; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; color: var(--muted); font-size: .9rem; }
.pager-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.page-size { display: inline-flex; align-items: center; gap: 6px; }
.page-size .input { width: auto; min-height: 32px; padding: 3px 8px; }
.pager .btns { display: flex; gap: 6px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--line-soft); color: var(--muted); }
.badge-ok { background: var(--ok-tint); color: var(--ok); }
.badge-off { background: var(--danger-tint); color: var(--danger); }
.badge-brass { background: var(--brass-tint); color: var(--brass-ink); }

.alert { padding: 12px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.alert-warn { background: var(--brass-tint); border-color: #F2CC9A; color: #6B3A00; }
.alert-error { background: var(--danger-tint); border-color: #E3B5B0; color: #7C241E; }

dialog { width: min(520px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(7,26,47,.35); }
dialog::backdrop { background: rgba(7,26,47,.55); }
dialog .dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
dialog .dlg-body { padding: 18px 20px 6px; max-height: 70vh; overflow-y: auto; }
dialog .dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
.secret { display: flex; gap: 8px; align-items: center; padding: 12px; background: var(--bg); border: 1px dashed var(--steel-500); border-radius: var(--radius); font-family: Consolas, "Courier New", monospace; font-size: 1.15rem; letter-spacing: .04em; }
.secret code { flex: 1; word-break: break-all; }
pre.json { margin: 0; padding: 12px; background: var(--bg); border-radius: var(--radius); overflow: auto; font: .82rem/1.5 Consolas, "Courier New", monospace; white-space: pre-wrap; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; }
.toast { padding: 11px 16px; border-radius: var(--radius); background: var(--steel-900); color: #fff; box-shadow: 0 8px 24px rgba(7,26,47,.3); max-width: 360px; }
.toast.err { background: var(--danger); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Hak akses ---------- */
.ra-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .ra-layout { grid-template-columns: 1fr; } }
.ra-layout > * { min-width: 0; }
.role-list { padding: 6px; display: grid; gap: 2px; }
.role-item { display: block; width: 100%; padding: 10px 12px; border: 0; border-left: 3px solid transparent; border-radius: 4px; background: none; text-align: left; cursor: pointer; }
.role-item:hover { background: var(--bg); }
.role-item.is-active { background: var(--brass-tint); border-left-color: var(--brass); }
.role-item b { display: block; font-weight: 600; }
.role-item span { font-size: .8rem; color: var(--muted); }
.tbl .group-row th { background: var(--steel-800); color: #fff; font-size: .86rem; }
.save-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }

/* ---------- Dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat small { display: block; color: var(--muted); font-size: .84rem; }
.stat strong { display: block; margin-top: 2px; font-size: 1.25rem; font-weight: 600; }
.menu-block { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.menu-block:last-child { border-bottom: 0; }
.menu-block h3 { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; }
.chip:hover { border-color: var(--brass); background: var(--brass-tint); }
.chip.is-soon { color: var(--muted); border-style: dashed; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.login-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 48px; background: var(--steel-900); color: #D7E2F0; overflow: hidden; }
.login-aside .brand { padding: 0; border: 0; }
.login-aside h2 { max-width: 18em; margin-bottom: 8px; color: #fff; font-size: 1.7rem; line-height: 1.2; }
.login-aside p { max-width: 30em; color: #A9BDD6; }
.rack { display: grid; grid-template-columns: 26px repeat(4, minmax(0, 1fr)); gap: 6px; max-width: 420px; }
.rack .lbl { display: grid; place-items: center; font-size: .75rem; color: var(--steel-500); }
.rack .cell { position: relative; height: 40px; border: 1px solid var(--steel-700); border-radius: 3px; background: rgba(255,255,255,.02); }
.rack .cell.is-full { background: var(--steel-800); }
.rack .cell.is-low { background: repeating-linear-gradient(135deg, var(--steel-800) 0 5px, transparent 5px 10px); }
.rack .cell.is-pick { border-color: var(--brass); background: rgba(242,140,40,.22); box-shadow: 0 0 0 3px rgba(242,140,40,.18); }
.rack .cell small { position: absolute; left: 5px; top: 3px; font-size: .66rem; color: var(--steel-500); }
.rack .cell.is-pick small { color: #FFC98A; }
.login-main { display: grid; place-items: center; padding: 32px 24px; }
.login-box { width: min(380px, 100%); }
.login-box h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-box > p { color: var(--muted); margin-bottom: 22px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; height: 32px; padding: 0 10px; border: 0; border-radius: 4px; background: none; color: var(--brass-ink); font-weight: 600; cursor: pointer; }
.login-box .btn { width: 100%; }
.login-foot { margin-top: 28px; font-size: .8rem; color: var(--muted); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-aside { padding: 22px 20px; gap: 16px; }
  .login-aside h2, .login-aside p, .rack { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Tambahan Tahap master data ---------- */
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
textarea.input { min-height: 84px; resize: vertical; }
.site-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.site-head p { color: var(--muted); margin-top: 2px; }
.role-item .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-item.is-off b { color: var(--muted); }
.login-logo { display: block; width: min(300px, 80%); height: auto; margin: 0 auto 26px; }
.num-right { text-align: right; font-variant-numeric: tabular-nums; }
code.kode { padding: 1px 6px; border-radius: 4px; background: var(--bg); font: .85rem Consolas, "Courier New", monospace; }

/* ---------- Stok ---------- */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(7,26,47,.16); }
.picker-item { display: block; width: 100%; padding: 8px 12px; border: 0; background: none; text-align: left; cursor: pointer; }
.picker-item:hover, .picker-item.is-active { background: var(--brass-tint); }
.picker-item small { display: block; color: var(--muted); }
.picker-empty { padding: 10px 12px; color: var(--muted); }
.tx-form { margin-bottom: 18px; }
/* Jarak sama dengan kartu filter di Kartu stok: kolom Barang -> baris berikutnya 10px */
.tx-form > .field { margin-bottom: 10px; }
.tx-form .form-row > div.field { margin-bottom: 14px; }
.field-label { display: block; margin-bottom: 4px; font-size: .88rem; font-weight: 600; }
.hint { padding: 9px 12px; margin-bottom: 14px; border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: .92rem; }
.loc-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.loc { display: inline-block; padding: 1px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .8rem; white-space: nowrap; }
.loc b { font-weight: 600; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }
.section-title { margin: 22px 0 10px; }

/* ---------- Impor / ekspor Excel ---------- */
dialog.wide { width: min(1080px, calc(100vw - 28px)); }
.chk-list { display: grid; gap: 10px; margin: 6px 0 14px; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sum-chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: .9rem; }
.sum-chip b { font-size: 1.05rem; }
.msg-err { color: var(--danger); font-size: .84rem; }
.msg-warn { color: var(--muted); font-size: .84rem; }

/* Tombol dan panel Filter pada toolbar */
.filter-wrap { position: relative; }
.filter-wrap .btn.is-on { border-color: var(--brass); background: var(--brass-tint); color: var(--brass-ink); }
.filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--brass); color: #fff; font-size: .75rem; font-weight: 700; }
.filter-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 280px; max-width: calc(100vw - 28px); padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(7,26,47,.16); }
.filter-pop[hidden] { display: none; }
.filter-pop .field:last-of-type { margin-bottom: 0; }
.filter-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
@media (max-width: 560px) { .filter-pop { position: fixed; left: 14px; right: 14px; top: auto; bottom: 14px; width: auto; max-width: none; } }

/* Header tabel yang bisa diurutkan */
.th-sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: inherit; cursor: pointer; white-space: nowrap; }
.th-sort:hover { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 3px; }
.sort-ico { position: relative; display: inline-block; width: 9px; height: 14px; flex: none; }
.sort-ico::before, .sort-ico::after { content: ""; position: absolute; left: 0; border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; opacity: .35; }
.sort-ico::before { top: 1px; border-bottom: 5px solid currentColor; }
.sort-ico::after { bottom: 1px; border-top: 5px solid currentColor; }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--steel-800); }
th[aria-sort="ascending"] .sort-ico::before, th[aria-sort="descending"] .sort-ico::after { opacity: 1; }

/* ---------- Latar bergerak panel login ---------- */
.login-aside > :not(.aside-fx) { position: relative; z-index: 1; }
.aside-fx { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aside-fx .orb { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.aside-fx .o1 { width: 460px; height: 460px; left: -120px; top: -100px; background: rgba(47,109,181,.55); animation: orb-a 18s ease-in-out infinite alternate; }
.aside-fx .o2 { width: 380px; height: 380px; right: -110px; top: 34%; background: rgba(76,142,214,.34); animation: orb-b 23s ease-in-out infinite alternate; }
.aside-fx .o3 { width: 420px; height: 420px; left: 18%; bottom: -170px; background: rgba(31,81,144,.65); animation: orb-c 27s ease-in-out infinite alternate; }
.login-aside::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(127,160,203,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(127,160,203,.08) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse at 40% 55%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse at 40% 55%, #000 25%, transparent 78%);
  animation: grid-pan 40s linear infinite;
}
@keyframes orb-a { to { transform: translate(180px, 140px) scale(1.15); } }
@keyframes orb-b { to { transform: translate(-200px, -120px) scale(.9); } }
@keyframes orb-c { to { transform: translate(160px, -150px) scale(1.2); } }
@keyframes grid-pan { to { background-position: 46px 46px, 46px 46px; } }

/* Denah rak ikut hidup */
.rack .cell.is-full { animation: cell-breathe 5s ease-in-out infinite; }
.rack .cell:nth-child(3n) { animation-delay: -1.6s; }
.rack .cell:nth-child(4n) { animation-delay: -3.2s; }
.rack .cell.is-low { background-size: 14px 14px; animation: cell-stripes 2.4s linear infinite; }
.rack .cell.is-pick { animation: cell-pick 2.6s ease-in-out infinite; }
@keyframes cell-breathe { 50% { background-color: #1B4A82; } }
@keyframes cell-stripes { to { background-position: 14px 0; } }
@keyframes cell-pick { 50% { box-shadow: 0 0 0 7px rgba(242,140,40,.06), 0 0 22px rgba(242,140,40,.35); } }

/* Rak terisi otomatis di form transaksi stok */
.input[hidden], .rack-choices[hidden], .link-btn[hidden] { display: none !important; }
.input-auto { background: var(--bg); color: var(--text); font-weight: 600; cursor: default; }
.input-auto:placeholder-shown { font-weight: 400; color: var(--muted); }
.rack-choices { display: grid; gap: 6px; }
.rack-choice { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.rack-choice:hover { border-color: var(--brass); }
.rack-choice:has(input:checked) { border-color: var(--brass); background: var(--brass-tint); }
.rack-choice small { margin-left: auto; color: var(--muted); }
.link-btn { margin-top: 4px; padding: 0; border: 0; background: none; color: var(--steel-700); font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--brass-ink); }

/* Approver transaksi stok (halaman Peran dan hak akses) */
.apv { margin-top: 18px; }
.apv-head h2 { margin-bottom: 4px; }
.apv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.apv-tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.apv-tab:hover { border-color: var(--steel-500); }
.apv-tab[aria-selected="true"] { background: var(--steel-800); border-color: var(--steel-800); color: #fff; }
.apv-tab .cnt { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--line-soft); color: var(--muted); font-size: .78rem; font-weight: 700; text-align: center; }
.apv-tab[aria-selected="true"] .cnt { background: rgba(255,255,255,.2); color: #fff; }
.apv-form { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 12px; align-items: end; padding: 14px 20px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.apv-form[hidden] { display: none; }
.apv-form .field { margin: 0; }
.apv-lvl { width: 84px; text-align: center; }
@media (max-width: 700px) { .apv-form { grid-template-columns: 1fr; } .apv-form .btn { width: 100%; } }

/* Persetujuan transaksi stok */
.nav-link { position: relative; }
.nav-badge { display: inline-block; min-width: 20px; margin-left: auto; padding: 0 6px; border-radius: 999px; background: var(--brass); color: #fff; font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center; }
.nav-badge[hidden] { display: none; }
.nav-badge:not([hidden]) + .chev { margin-left: 8px; } /* panah merapat ke badge hanya saat badge tampil; kalau tersembunyi, panah tetap di ujung kanan */
.nav-group.is-open > .nav-group-btn .nav-badge-grp { display: none; }
.ap-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding-bottom: 14px; }
.ap-bar .apv-tabs { margin-top: 0; }
.ap-filter { display: inline-flex; align-items: center; gap: 8px; }
.ap-filter[hidden] { display: none; }
.ap-filter .input { width: auto; min-height: 36px; }
.apv-tab .cnt-hot { background: var(--brass); color: #fff; }
.ap-tbl td { vertical-align: top; }
.ap-sub { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.ap-note { margin: 1px 0 0 18px; color: var(--muted); font-size: .8rem; font-style: italic; }
.ap-steps { margin: 6px 0 0; padding: 0; list-style: none; font-size: .85rem; }
.ap-step { margin: 2px 0; color: var(--muted); }
.ap-step.is-approved { color: var(--ok); }
.ap-step.is-rejected { color: var(--danger); }
.ap-step.is-turn { color: var(--text); font-weight: 600; }
.ap-ic { display: inline-block; width: 14px; text-align: center; }
.ap-warn { padding: 0 6px; border-radius: 999px; background: var(--danger-tint); color: var(--danger); font-size: .75rem; font-weight: 700; }

/* Pop-up modal galat / konfirmasi */
dialog.msg-dlg { width: min(440px, calc(100vw - 28px)); }
.msg-dlg .msg-body { display: flex; gap: 14px; padding: 22px 22px 8px; }
.msg-dlg .msg-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.msg-dlg .msg-ico svg { width: 22px; height: 22px; }
.msg-dlg.msg-err .msg-ico { background: var(--danger-tint); color: var(--danger); }
.msg-dlg.msg-ask .msg-ico { background: var(--brass-tint); color: var(--brass-ink); }
.msg-dlg .msg-text h3 { margin: 2px 0 6px; font-size: 1.05rem; }
.msg-dlg .msg-text p { margin: 0; color: var(--muted); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.msg-dlg .msg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-solid-danger:hover { background: #8A2923; border-color: #8A2923; }

/* ---------- Lonceng notifikasi ---------- */
.bell-menu { position: relative; }
.bell-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--steel-800); cursor: pointer; }
.bell-btn:hover, .bell-btn[aria-expanded="true"] { background: var(--bg); }
.bell-btn .ico { width: 21px; height: 21px; transform-origin: 50% 4px; }
.bell-count { position: absolute; top: 1px; right: 0; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--brass); color: #fff; border: 2px solid var(--surface); box-sizing: content-box; font-size: .68rem; font-weight: 700; line-height: 16px; text-align: center; }
.bell-count[hidden] { display: none; }
.bell-btn.is-ring .ico { animation: bell-ring .9s ease-in-out 1; }
@keyframes bell-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); }
  45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); }
}

.bell-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; display: none; width: 390px; max-width: calc(100vw - 20px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(7,26,47,.14); overflow: hidden;
}
.bell-pop.is-open { display: block; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.bell-link { border: 0; background: none; padding: 2px 0; color: var(--brass-ink); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.bell-link:hover:not(:disabled) { text-decoration: underline; }
.bell-link:disabled { color: var(--muted); font-weight: 400; cursor: default; }
.bell-list { max-height: min(460px, 70vh); overflow-y: auto; }
.bell-empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.bell-foot { display: block; padding: 10px 14px; border-top: 1px solid var(--line-soft); text-align: center; font-weight: 600; font-size: .9rem; text-decoration: none; background: #F4F7FA; }
.bell-foot:hover { background: var(--bg); }

.nt { position: relative; display: flex; gap: 11px; width: 100%; padding: 11px 14px 11px 17px; border: 0; border-bottom: 1px solid var(--line-soft); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.nt:last-child { border-bottom: 0; }
.nt:hover { background: #F4F7FA; }
.nt.is-unread { background: #FBF6EE; }
.nt.is-unread:hover { background: #F8EFE0; }
.nt.is-unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brass); }
.nt-ico { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--line-soft); color: var(--steel-700); }
.nt-ico .ico { width: 16px; height: 16px; }
.nt-success .nt-ico { background: var(--ok-tint); color: var(--ok); }
.nt-warning .nt-ico { background: var(--brass-tint); color: var(--brass-ink); }
.nt-danger .nt-ico { background: var(--danger-tint); color: var(--danger); }
.nt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nt-title { font-weight: 600; font-size: .92rem; line-height: 1.35; }
.nt:not(.is-unread) .nt-title { font-weight: 500; }
.nt-body { color: var(--muted); font-size: .86rem; line-height: 1.4; overflow-wrap: anywhere; }
.nt-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; color: var(--muted); font-size: .78rem; }
.nt-done { color: var(--ok); font-weight: 600; }
.nt.is-resolved .nt-title { color: var(--muted); }

.nt-page .nt { padding: 14px 18px 14px 21px; cursor: pointer; }
.nt-page .nt-ico { width: 34px; height: 34px; }
.nt-page .nt-ico .ico { width: 18px; height: 18px; }
.nt-page .nt-title { font-size: .98rem; }
.nt-page .nt-body { font-size: .92rem; }

@media (max-width: 600px) {
  .bell-pop { position: fixed; left: 10px; right: 10px; top: 64px; width: auto; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bell-btn.is-ring .ico { animation: none; }
}

/* ---------- Laporan Stok ---------- */
.rep-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rep-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.rep-stats .stat { display: block; text-decoration: none; color: inherit; }
.rep-hint { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; }
.rep-stat-link:hover { border-color: var(--brass); background: var(--brass-tint); }
.rep-about { padding: 0 20px 12px; color: var(--muted); font-size: .92rem; max-width: 100ch; }
.rep-filters { align-items: flex-end; border-top: 1px solid var(--line-soft); }
.rep-filters[hidden], .rep-f[hidden] { display: none; }
.rep-f { display: block; }
.rep-f > span { display: block; margin-bottom: 4px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.rep-f .input { min-width: 140px; }
.rep-f-grow { flex: 1 1 240px; }
.rep-f-grow .input { width: 100%; }
.rep-info { padding: 10px 20px 0; color: var(--muted); font-size: .88rem; }
.rep-in { color: var(--ok); }
.rep-out { color: var(--danger); }
@media print {
  .sidebar, .topbar, .rep-actions, .rep-filters, .apv-tabs, .pager, .backdrop, .toasts, .actions, th .sort-ico { display: none !important; }
  .shell, .main, .content { display: block !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .card { border: 0; }
  .table-wrap { overflow: visible; }
  .tbl th, .tbl td { padding: 5px 8px; font-size: .82rem; }
}

/* ---------- Karyawan / pemilihan karyawan di form Pengguna ---------- */
.emp-info { margin-bottom: 14px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius); font-size: .92rem; }
.emp-info[hidden] { display: none; }

/* ---- Hak akses khusus per pengguna (tab Per Pengguna) */
.ra-tabs { margin: 0 0 14px; }
.ra-layout[hidden] { display: none; }
.ua-side { padding: 0; overflow: hidden; }
.ua-search { padding: 10px; border-bottom: 1px solid var(--line-soft); }
.ua-list { max-height: 560px; overflow-y: auto; padding: 6px; }
.ua-list .role-item .row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: .82rem; color: var(--muted); }
.perm-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; border: 1px solid var(--line); }
.perm-legend .lg-add { background: var(--ok-tint); border-color: var(--ok); }
.perm-legend .lg-rev { background: var(--danger-tint); border-color: var(--danger); }
.tbl td.is-add { background: var(--ok-tint); }
.tbl td.is-rev { background: var(--danger-tint); }
.tbl tr.is-locked td { color: var(--muted); }
.tbl .lock-note { display: block; font-size: .76rem; color: var(--muted); }
.save-bar .sb-actions { display: flex; gap: 8px; }
.ua-list .role-item .badge { font-size: .72rem; color: var(--brass-ink); }
#uMatrixCard .save-bar { flex-wrap: wrap; }
.sb-actions .btn { white-space: nowrap; }
