/* InvenIT — gaya aplikasi (mengikuti mockup desain 2026-09-24).
   Warna brand: hijau #009D90, oranye #FC9900. Tombol & teks kecil pakai hijau gelap #00796F
   karena teks putih di atas #009D90 kontrasnya kurang (3,4:1). */
:root {
  --bg: #F5F5F2;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --border: #E3E3DD;
  --border-strong: #CFCFC7;
  --text: #17191E;
  --text-2: #474B55;
  --muted: #5F6470;
  --green: #009D90;
  --accent: #00796F;
  --accent-dark: #005F57;
  --accent-soft: #E0F3F1;
  --orange: #FC9900;
  --orange-soft: #FFF1DB;
  --orange-text: #8A4B06;
  --danger: #A32218;
  --danger-soft: #FCE8E6;
  --ink-panel: #0F2E2B;
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'IBM Plex Sans', system-ui, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
/* overflow-x: hidden di sini KUNCI untuk Safari iPhone: begitu ada elemen mana pun yang
   sedikit lebih lebar dari layar (walau sudah terkurung rapi di kotaknya sendiri, mis. tabel),
   Safari membolehkan SELURUH halaman digeser 1 jari ke kiri/kanan (efek "lenting" khas iOS).
   Baris ini mematikan itu di level dokumen, apa pun penyebab kelebarannya. */
/* pan-x pan-y (BUKAN "manipulation"): geser/scroll normal tetap jalan (termasuk geser tabel),
   tapi pinch-zoom & double-tap-zoom dimatikan di level CSS juga (manipulation masih mengizinkan
   pinch-zoom sesuai spesifikasi, makanya tidak dipakai di sini). */
html, body { height: 100%; overflow-x: hidden; touch-action: pan-x pan-y; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icon { flex-shrink: 0; }

/* ---------- Shell ----------
   Sidebar otomatis mengecil jadi deretan ikon (72px) dan melebar saat disorot mouse / fokus keyboard.
   Melebarnya menumpuk di atas konten (tidak menggeser halaman). Tombol pin menahannya tetap lebar. */
:root { --rail: 72px; --sidebar: 240px; }
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40; width: var(--rail); overflow: hidden;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 16px;
  transition: width 0.18s ease, box-shadow 0.18s ease;
}
.sidebar:hover, .sidebar:focus-within, body.sidebar-pinned .sidebar { width: var(--sidebar); }
.sidebar:hover, .sidebar:focus-within { transition-delay: 0.12s; box-shadow: 8px 0 24px rgba(15, 20, 25, 0.08); }
body.sidebar-pinned .sidebar { box-shadow: none; }
.brand-row { display: flex; align-items: center; justify-content: space-between; padding-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--green); color: #062925; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 600;
}
.brand-name { display: flex; flex-direction: column; white-space: nowrap; }
.brand-name strong { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.brand-name span { font-size: 12px; color: var(--muted); }
.btn.pin-btn { width: 36px; height: 36px; padding: 0; flex-shrink: 0; }
body.sidebar-pinned .pin-btn { color: var(--accent); background: var(--accent-soft); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 11px; border-radius: var(--radius);
  color: var(--text-2); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 3px 4px; border-top: 1px solid var(--border); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; background: var(--bg); border: 1px solid var(--border); color: var(--text-2); }
.sidebar-user .who { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; white-space: nowrap; }
.sidebar-user .who strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
/* Teks & tombol yang disembunyikan saat sidebar mengecil */
.sidebar .brand-name, .sidebar .nav a span, .sidebar .who, .sidebar .pin-btn, .sidebar #logoutBtn, .sidebar #passwordBtn {
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease, visibility 0.12s;
}
.sidebar:hover :is(.brand-name, .nav a span, .who, .pin-btn, #logoutBtn, #passwordBtn),
.sidebar:focus-within :is(.brand-name, .nav a span, .who, .pin-btn, #logoutBtn, #passwordBtn),
body.sidebar-pinned .sidebar :is(.brand-name, .nav a span, .who, .pin-btn, #logoutBtn, #passwordBtn) {
  opacity: 1; visibility: visible; transition-delay: 0.12s;
}

.main { min-width: 0; margin-left: var(--rail); padding: 28px 36px 48px; transition: margin-left 0.18s ease; }
body.sidebar-pinned .main { margin-left: var(--sidebar); }
.main:focus { outline: none; }
.page { display: flex; flex-direction: column; gap: 16px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.page-header p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: #B9B9B0; color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #E8B4AE; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { height: 36px; padding: 0 12px; }
.btn.icon-only { width: 44px; height: 44px; padding: 0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .field > label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field.req > span::after { content: ' *'; color: var(--danger); }
.input, .select, .textarea {
  height: 40px; width: 100%; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  /* 16px, BUKAN kosmetik: di bawah 16px, Safari iPhone otomatis zoom-in tiap kali field ini
     disentuh (supaya teksnya kebaca) — begitu ter-zoom otomatis, seluruh halaman jadi bisa
     digeser lagi. Ini kemungkinan besar biang kerok utama masalah "bisa digeser" di iPhone. */
  font-size: 16px;
}
.textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235F6470' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: transparent; }
.input:disabled, .select:disabled { background: var(--bg); color: var(--text-2); }
.input.sm, .select.sm { height: 36px; padding: 0 10px; }
.select.sm { padding-right: 28px; background-position: right 8px center; }
.search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.search input { flex-grow: 1; border: 0; outline: none; background: transparent; color: var(--text); min-width: 0; font-size: 16px; }
.search:focus-within { outline: 2px solid var(--green); outline-offset: -1px; border-color: transparent; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.card h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip .n { color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.chip[aria-pressed="true"] .n { color: #fff; opacity: 0.75; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; background: #EEEEEB; color: #4A4E57; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.s-aktif { background: #E0F3F1; color: #006B63; }
.badge.s-aktif::before { background: var(--green); }
.badge.s-standby { background: #EAF0FB; color: #24479A; }
.badge.s-standby::before { background: #3A63C7; }
.badge.s-diperbaiki { background: var(--orange-soft); color: var(--orange-text); }
.badge.s-diperbaiki::before { background: var(--orange); }
.badge.s-rusak { background: var(--danger-soft); color: var(--danger); }
.badge.s-rusak::before { background: #D0402F; }
.badge.s-non-aktif::before { background: #8A8E96; }
.badge.s-hilang { background: #2A2D34; color: #fff; }
.badge.s-hilang::before { background: #C9CCD2; }
.tag-soft { font-size: 12px; font-weight: 600; color: var(--accent-dark); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.label-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--accent-dark); }
.label-no { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--orange-text); }
.label-no::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.invnum { display: inline-flex; gap: 3px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; white-space: nowrap; }
.code-chip { font-family: var(--mono); font-size: 15px; font-weight: 600; padding: 6px 10px; border-radius: var(--radius); background: var(--text); color: #fff; }

/* ---------- Table ---------- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; text-align: left;
  padding: 0 12px; height: 40px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
table.data td { padding: 8px 12px; height: 48px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #FAFBF9; }
table.data tbody tr.selected { background: #F2FAF9; }
table.data td.cb, table.data th.cb { width: 44px; padding-right: 0; }
.th-sort {
  background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit;
  text-transform: inherit; letter-spacing: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.th-sort:hover, .th-sort.active { color: var(--text); }
.th-sort .arrow { font-size: 9px; width: 8px; display: inline-block; }
.asset-name { display: flex; flex-direction: column; gap: 2px; }
.asset-name strong { font-weight: 500; }
.asset-name span { font-size: 12px; color: var(--muted); }
.holder { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.table-foot { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 8px 16px; font-size: 13px; color: var(--muted); gap: 12px; flex-wrap: wrap; }
.table-foot .actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-foot .btn.sm { min-width: 36px; }
.table-foot .btn.sm.active { background: var(--text); border-color: var(--text); color: #fff; }
.page-ellipsis { padding: 0 4px; color: var(--muted); }
.foot-pagesize, .foot-jump { display: inline-flex; align-items: center; gap: 6px; }
.foot-jump .input.sm { width: 56px; text-align: center; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Filter bar & selection bar ---------- */
.filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filters .search { width: 380px; max-width: 100%; }
.filters .select { width: 170px; }
.selbar { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; background: var(--ink-panel); color: #fff; border-radius: 10px; flex-wrap: wrap; }
.selbar strong { font-size: 14px; }
.selbar .sep { width: 1px; height: 20px; background: rgba(255,255,255,0.2); }
.selbar .btn { background: transparent; border-color: rgba(255,255,255,0.25); color: #fff; height: 36px; }
.selbar .btn:hover { background: rgba(255,255,255,0.08); }
.selbar .btn.ghost { border-color: transparent; color: #C4D6D3; margin-left: auto; }

/* ---------- Detail ---------- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.breadcrumb a { text-decoration: none; font-weight: 500; }
.detail-title { display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap; }
.detail-title .left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-title h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; }
.kv-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv span { font-size: 12px; font-weight: 500; color: var(--muted); }
.kv div { overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.subhead { margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.segs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.seg { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--bg); border-radius: var(--radius); min-width: 0; }
.seg b { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.seg span { font-size: 12px; font-weight: 500; color: var(--muted); }
.seg em { font-style: normal; font-size: 13px; overflow-wrap: break-word; }
.timeline { display: flex; flex-direction: column; }
.tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.tl-item:not(:last-child)::after { content: ''; position: absolute; left: 5px; top: 18px; bottom: -4px; width: 2px; background: var(--border); }
.tl-dot { width: 12px; height: 12px; flex-shrink: 0; margin-top: 4px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); }
.tl-item.current .tl-dot { border-color: var(--green); background: var(--green); }
.tl-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tl-body .name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tl-body small { font-size: 13px; color: var(--muted); }
.note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 0; }
.mt-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--border); }
.mt-item .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 25, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; z-index: 50; }
.modal { width: 100%; max-width: 720px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.asset-form { display: flex; flex-direction: column; gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { display: flex; flex-direction: column; gap: 12px; }
.form-section h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.inv-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--bg); border-radius: var(--radius); }
.inv-row { display: flex; gap: 10px; }
.inv-row .input { font-family: var(--mono); letter-spacing: 0.04em; }
.form-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 14px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: var(--text); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.2); font-size: 14px; }
.toast.error { background: var(--danger); }

/* ---------- Placeholder & loading ---------- */
.placeholder-card { max-width: 560px; }
.loading { padding: 48px; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
.login { display: flex; min-height: 100vh; }
.login-panel { width: 42%; max-width: 600px; background: var(--ink-panel); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login-panel .brand { color: #fff; padding: 0; }
.login-panel .brand-mark { width: 40px; height: 40px; font-size: 15px; border-radius: 10px; }
.login-panel .brand strong { font-size: 20px; }
.login-panel h1 { margin: 0 0 20px; font-size: 40px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.login-panel p { margin: 0; font-size: 16px; line-height: 1.6; color: #C4D6D3; max-width: 440px; }
.login-panel .tagline { margin: 0 0 16px; font-size: 18px; font-weight: 500; color: #fff; }
.login-panel .inv-demo { display: inline-flex; gap: 5px; margin-top: 28px; font-family: var(--mono); font-size: 15px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16); border-radius: 8px; padding: 8px 12px; }
.login-panel .foot { font-size: 13px; color: #9FB8B4; }
.login-main { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-form h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.login-form .intro { margin: 6px 0 0; color: var(--muted); }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.login-form .input { height: 44px; font-size: 16px; }
.login-form .btn { height: 46px; font-size: 15px; font-weight: 600; }
.login-form .hint { margin: 0; font-size: 13px; color: var(--muted); }
.login-form .hint code { font-family: var(--mono); font-size: 12px; background: #ECECE7; padding: 2px 6px; border-radius: 4px; }
.login-error { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--danger); }

/* ---------- Responsif ---------- */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .segs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar, .sidebar:hover, .sidebar:focus-within, body.sidebar-pinned .sidebar {
    position: static; width: auto; height: auto; box-shadow: none; overflow: visible;
    flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 8px;
  }
  .brand-row { padding: 0 8px 0 0; }
  .sidebar .brand-name, .sidebar #logoutBtn, .sidebar #passwordBtn { opacity: 1; visibility: visible; }
  .sidebar .pin-btn { display: none; }
  .main, body.sidebar-pinned .main { margin-left: 0; }
  .nav { flex-direction: row; overflow-x: auto; flex-grow: 1; }
  .nav a { height: 40px; padding: 0 12px; white-space: nowrap; }
  .nav a span { display: none; }
  .sidebar-user { margin: 0; border: 0; padding: 0; }
  .sidebar-user .who { display: none; }
  .main, body.sidebar-pinned .main { padding: 20px 16px 40px; }
  .kv-grid, .kv-grid.four, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .login-panel { display: none; }
}

/* ---------- Serah terima & pemegang ---------- */
.holder-box:not(:empty) { padding: 10px 12px; border-radius: var(--radius); background: var(--bg); font-size: 14px; }
.user-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.user-head .avatar { width: 52px; height: 52px; font-size: 18px; }
.user-head h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.user-head p { margin: 2px 0 0; color: var(--muted); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); }
.list-row:hover { color: var(--text); background: #FAFBF9; }
.list-row .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row small { color: var(--muted); font-size: 13px; }
.arrow { color: var(--muted); }
table.data td.nowrap, .nowrap { white-space: nowrap; }
.cart-count { min-width: 40px; height: 24px; padding: 0 7px; margin-left: 2px; border-radius: 6px; background: var(--bg); color: var(--text-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
#cartBtn.has-items .cart-count { background: var(--orange); color: #17191E; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 8px; padding: 18px; text-decoration: none; color: var(--text); transition: border-color 0.12s, box-shadow 0.12s; }
.kpi:hover { color: var(--text); border-color: var(--border-strong); box-shadow: 0 4px 14px rgba(15, 20, 25, 0.06); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi-value { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-sub { font-size: 13px; color: var(--muted); }
.kpi-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-danger { background: #D0402F; }
.dot-orange { background: var(--orange); }
.dot-muted { background: var(--muted); }
.dash-row { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.bars { display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: flex; align-items: center; gap: 12px; min-height: 30px; padding: 2px 6px; margin: 0 -6px; border-radius: 6px; text-decoration: none; color: var(--text); }
.bar-row:hover { background: var(--bg); color: var(--text); }
.bar-row:hover .bar { background: var(--accent); }
.bar-label { width: 100px; flex-shrink: 0; text-align: right; font-size: 13px; color: var(--text-2); }
.bar-track { flex-grow: 1; display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--border-strong); min-height: 26px; }
.bar { display: block; height: 18px; min-width: 2px; background: var(--green); border-radius: 0 4px 4px 0; transition: background 0.12s; }
.bar-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.att-list { display: flex; flex-direction: column; }
.att-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); }
.att-row:first-child { border-top: 0; padding-top: 0; }
.att-row:hover { color: var(--text); }
.att-row:hover .att-title { text-decoration: underline; }
.att-row .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-title { font-weight: 500; }
.att-row small { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.att-icon { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.tone-danger { color: var(--danger); }
.tone-orange { color: var(--orange-text); }
.tone-muted { color: var(--text-2); }
.act-list { display: flex; flex-direction: column; }
.act-row { display: grid; grid-template-columns: 32px 170px minmax(0, 1.2fr) minmax(0, 1fr) 130px; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); }
.act-row:first-child { border-top: 0; }
.act-row:hover { color: var(--text); background: #FAFBF9; }
.act-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; }
.act-kind { font-size: 13px; font-weight: 500; color: var(--text-2); }
.act-asset, .act-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-detail { color: var(--text-2); }
.act-when { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .act-row { grid-template-columns: 32px minmax(0, 1fr); }
  .act-kind, .act-detail { display: none; }
  .act-when { grid-column: 2; text-align: left; }
}

/* ---------- Pengaturan ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab { height: 44px; padding: 0 16px; border: 0; background: transparent; color: var(--text-2); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-dark); border-bottom-color: var(--green); font-weight: 600; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.status-list { display: flex; flex-direction: column; margin-bottom: 12px; }
.status-item { display: flex; align-items: center; gap: 4px; min-height: 48px; border-top: 1px solid var(--border); }
.status-item .grow { flex-grow: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.status-item small { font-size: 12px; color: var(--muted); }
.status-item > .muted { width: 44px; display: flex; justify-content: center; }
.status-add { display: flex; gap: 8px; }
@media (max-width: 1100px) { .status-grid { grid-template-columns: minmax(0, 1fr); } }

/* Legend Inventory Number (Pengaturan) */
.legend-tree { display: flex; flex-direction: column; }
.legend-row { display: flex; align-items: center; gap: 8px; min-height: 44px; border-top: 1px solid var(--border); }
.legend-tree > .legend-node:first-child > .legend-row { border-top: none; }
.legend-row .code { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--muted); width: 60px; flex: none; }
.legend-row .grow { flex: 1; min-width: 0; font-weight: 500; }
.legend-children { margin-left: 28px; border-left: 1px dashed var(--border); padding-left: 12px; }
.legend-children .legend-row { border-top: 1px dashed var(--border); }
.legend-children .legend-node:first-child > .legend-row { border-top: none; }
.tl-item .tl-edit { width: 36px; height: 36px; margin-left: auto; flex-shrink: 0; opacity: 0.55; }
.tl-item:hover .tl-edit, .tl-item .tl-edit:focus-visible { opacity: 1; }

/* Tombol ganti password & keluar di bawah sidebar dibuat ringkas supaya nama tetap terbaca. */
.sidebar-user { gap: 8px; }
.sidebar-user .btn.icon-only { width: 32px; height: 32px; min-width: 32px; padding: 0; flex-shrink: 0; }
.sidebar-user .btn.icon-only + .btn.icon-only { margin-left: -6px; }

/* ---------- Hak akses ---------- */
/* Viewer hanya bisa melihat: tombol tambah/ubah disembunyikan (server juga menolak). */
body.role-viewer [data-write] { display: none !important; }
/* Tombol hapus hanya untuk admin atau akun yang diberi akses hapus (server juga menolak). */
body:not(.can-delete) [data-delete] { display: none !important; }
.badge.r-admin { background: var(--accent-soft); color: var(--accent-dark); }
.badge.r-admin::before { background: var(--green); }
.badge.r-staff { background: #EAF0FB; color: #24479A; }
.badge.r-staff::before { background: #3A63C7; }
.badge.r-viewer::before { background: #8A8E96; }
.acc-off td { color: var(--muted); }

/* ---------- Tombol lihat password (public/js/pwtoggle.js) ---------- */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap .input { width: 100%; padding-right: 44px; }
.pw-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-toggle:hover { color: var(--text); background: var(--bg); }
.pw-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.pw-toggle[aria-pressed="true"] { color: var(--accent-dark); }

/* Tabel Purchase Request: kolom kiri (No. PR, Status, Deskripsi) & kolom aksi kanan menempel saat digeser. */
table.pr-table { min-width: 1500px; }
table.pr-table th.pr-s1, table.pr-table td.pr-s1 { position: sticky; left: 0; z-index: 2; width: 215px; min-width: 215px; max-width: 215px; }
table.pr-table th.pr-s2, table.pr-table td.pr-s2 { position: sticky; left: 215px; z-index: 2; width: 138px; min-width: 138px; max-width: 138px; }
table.pr-table th.pr-s3, table.pr-table td.pr-s3 { position: sticky; left: 353px; z-index: 2; width: 260px; min-width: 260px; max-width: 260px; box-shadow: 4px 0 6px -4px rgba(0,0,0,0.18); }
table.pr-table th.pr-act, table.pr-table td.pr-act { position: sticky; right: 0; z-index: 2; box-shadow: -4px 0 6px -4px rgba(0,0,0,0.18); }
table.pr-table td.pr-s1, table.pr-table td.pr-s2, table.pr-table td.pr-s3, table.pr-table td.pr-act { background: var(--surface); }
table.pr-table tbody tr:hover td.pr-s1, table.pr-table tbody tr:hover td.pr-s2, table.pr-table tbody tr:hover td.pr-s3, table.pr-table tbody tr:hover td.pr-act { background: #FAFBF9; }
table.pr-table th.pr-s1, table.pr-table th.pr-s2, table.pr-table th.pr-s3, table.pr-table th.pr-act { z-index: 3; }
table.pr-table td.pr-s3 { white-space: normal; overflow-wrap: anywhere; }
.pr-date { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
select.pr-st { height: 34px; padding: 0 28px 0 10px; font-size: 13px; font-weight: 600; border-radius: 999px; border: 1px solid transparent; width: 100%; background-position: right 8px center; }
select.pr-st[data-st="Open"] { background-color: var(--orange-soft); color: var(--orange-text); }
select.pr-st[data-st="Pending"] { background-color: #EAF0FB; color: #24479A; }
select.pr-st[data-st="Close"] { background-color: #E0F3F1; color: #006B63; }
select.pr-st[data-st="Cancel"] { background-color: #EEEEEB; color: #4A4E57; }
.viewer-only { display: none; }
body.role-viewer .viewer-only { display: inline-flex; }

/* Isi halaman (bukan sidebar/menu) & jendela form diperkecil di layar desktop. Mau lebih kecil/besar:
   ubah angka --content-zoom (1 = normal, 0.9 = 90%, 0.85 = 85%). HP tidak terpengaruh (jaga zoom otomatis iOS). */
:root { --content-zoom: 0.9; }
@media (min-width: 901px) and (hover: hover) {
  .main .page, .modal { zoom: var(--content-zoom); }
}

/* No. PR di tabel Purchase Request = link ke edit. Untuk Viewer tampil sebagai teks biasa (tidak bisa diklik). */
a.pr-link { font-weight: 600; color: var(--accent-dark); text-decoration: none; }
a.pr-link:hover { text-decoration: underline; }
body.role-viewer a.pr-link { color: inherit; pointer-events: none; }

/* Status aset sebagai pilihan di baris tabel Aset (warna mengikuti kelas badge s-<status>) */
select.as-st.badge { appearance: none; height: 30px; padding: 0 28px 0 12px; border: 0; cursor: pointer; font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235F6470' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
select.as-st.badge:disabled { opacity: .6; cursor: wait; }
select.as-st.badge option { background: #fff; color: var(--text); }
