/* Inventaris Retinad — gaya mengikuti template Furnixar (Josefin Sans, sudut tegas, garis tipis) dengan aksen warna Retinad */
:root {
  --primary: #E7128B;
  --primary-dark: #c20d74;
  --primary-soft: #fde8f3;
  --title: #172430;
  --text: #3C474E;
  --muted: #7a858c;
  --border: #E8E9EA;
  --snow: #F6F6F6;
  --white: #fff;
  --ok: #138a4f;
  --ok-soft: #e7f6ee;
  --err: #c62828;
  --err-soft: #fdecec;
  --info-soft: #eef3f8;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'Josefin Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--snow);
}
body.has-nav { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }
a { color: var(--title); text-decoration: none; }
a:hover { color: var(--primary); }
h1, h2, h3, h4 { color: var(--title); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 26px; } h2 { font-size: 21px; } h3 { font-size: 18px; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; }
.only-desktop { display: none !important; }
@media (min-width: 900px) {
  .only-desktop { display: revert !important; }
  .only-mobile { display: none !important; }
  body.has-nav { padding-bottom: 32px; }
}

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--white); border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 1200px; margin: 0 auto; height: 60px; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--title); }
.brand img { height: 20px; width: auto; display: block; }
.brand span { font-size: 15px; padding-left: 10px; border-left: 1px solid var(--border); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.topnav { display: flex; gap: 4px; margin-left: 24px; }
.topnav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font-weight: 500; color: var(--text); border-bottom: 2px solid transparent; }
.topnav a .mdi { font-size: 18px; }
.topnav a.on, .topnav a:hover { color: var(--primary); border-bottom-color: var(--primary); }
.user-menu { margin-left: auto; position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; font: inherit; color: var(--title); cursor: pointer; padding: 4px; }
.avatar { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; background: var(--title); color: #fff; font-weight: 600; }
.dropdown { display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(23,36,48,.12); z-index: 60; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; background: none; border: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--snow); color: var(--primary); }
.dropdown form { margin: 0; border-top: 1px solid var(--border); }
.dd-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dd-head strong { display: block; color: var(--title); }
.dd-head small { color: var(--muted); }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; color: var(--title); margin-left: -8px; }

/* ---------- Bottom nav (HP) ---------- */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); }
.bottomnav a .mdi { font-size: 24px; line-height: 1; }
.bottomnav a.scan { position: relative; }
.scan-btn { width: 56px; height: 56px; margin-top: -26px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(231,18,139,.35); }
.scan-btn .mdi { font-size: 28px !important; }

/* ---------- Layout ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }
@media (min-width: 900px) { .wrap { padding: 28px 16px; } }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }
.card { background: #fff; border: 1px solid var(--border); padding: 18px; margin-bottom: 16px; }
@media (min-width: 900px) { .card { padding: 24px; } }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1.1fr .9fr; align-items: start; } }
.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---------- Form ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; color: var(--title); margin-bottom: 8px; }
.field label .req { color: var(--primary); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
  width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--border); background: #fff; color: var(--title);
  font: inherit; font-size: 16px; outline: none; border-radius: 0; transition: border-color .2s; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Button ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border: 1px solid var(--title);
  background: var(--title); color: #fff; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-transform: uppercase; letter-spacing: .04em;
  transition: background .2s, border-color .2s, color .2s; white-space: nowrap; border-radius: 0; }
.btn .mdi { font-size: 20px; }
.btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--title); border-color: var(--border); }
.btn-outline:hover { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-danger { background: #fff; color: var(--err); border-color: #f2c4c4; }
.btn-danger:hover { background: var(--err); border-color: var(--err); color: #fff; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-lg { height: 56px; font-size: 16px; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions-sticky { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); background: linear-gradient(to top, var(--snow) 70%, transparent); padding: 12px 0 4px; margin-top: 8px; z-index: 5; }
@media (min-width: 900px) { .actions-sticky { position: static; background: none; padding: 0; } }

/* ---------- Alert ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px; border: 1px solid; }
.alert .mdi { font-size: 20px; line-height: 1.2; }
.alert-ok { background: var(--ok-soft); border-color: #bfe5cf; color: var(--ok); }
.alert-err { background: var(--err-soft); border-color: #f5c6c6; color: var(--err); }
.alert-info { background: var(--info-soft); border-color: #d6e2ee; color: var(--title); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--border); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; color: var(--title); line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Search ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 16px; }
.searchbar .in { position: relative; flex: 1; }
.searchbar .in .mdi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
.searchbar input { padding-left: 44px; }

/* ---------- Item list ---------- */
.items { display: grid; gap: 10px; }
@media (min-width: 700px) { .items { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .items { grid-template-columns: repeat(3, 1fr); } }
.item-card { display: flex; gap: 12px; background: #fff; border: 1px solid var(--border); padding: 10px; color: var(--text); transition: border-color .2s; }
.item-card:hover { border-color: var(--primary); color: var(--text); }
.thumb { width: 84px; height: 84px; flex: none; background: var(--snow); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .mdi { font-size: 32px; color: #c5cacd; }
.item-card .body { min-width: 0; flex: 1; }
.item-card h3 { font-size: 16px; margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { font-size: 13px; color: var(--muted); }
.meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px 1px; background: var(--primary-soft); color: var(--primary-dark); letter-spacing: .03em; }
.tag-dark { background: var(--title); color: #fff; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: #fff; border: 1px dashed var(--border); }
.empty .mdi { font-size: 48px; display: block; color: #c5cacd; }

/* ---------- Detail ---------- */
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.gallery img { height: 220px; width: auto; max-width: 85%; object-fit: cover; scroll-snap-align: start; cursor: zoom-in; background: var(--snow); }
@media (min-width: 900px) { .gallery img { height: 260px; } }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; color: var(--title); font-weight: 500; word-break: break-word; }
.qrbox { display: flex; gap: 16px; align-items: center; }
.qrbox .qr { width: 120px; height: 120px; flex: none; background: #fff; padding: 6px; border: 1px solid var(--border); }
.qrbox .qr svg { width: 100%; height: 100%; display: block; }
.notes { white-space: pre-line; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline > li::before { content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; background: var(--primary); }
.timeline .when { font-size: 13px; color: var(--muted); }
.timeline .who { font-weight: 600; color: var(--title); font-size: 17px; }
.timeline .by { font-size: 14px; }
.photos-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.photos-row img { width: 72px; height: 72px; object-fit: cover; cursor: zoom-in; background: var(--snow); }
.photos-row img.sig { width: auto; max-width: 160px; object-fit: contain; background: #fff; border: 1px solid var(--border); }

/* ---------- Photo picker ---------- */
.picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 600px) { .picker { grid-template-columns: repeat(5, 1fr); } }
.picker .ph { position: relative; aspect-ratio: 1; background: var(--snow); overflow: hidden; }
.picker .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker .ph .rm { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; background: rgba(23,36,48,.8); color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.picker .ph.busy::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Ccircle cx='25' cy='25' r='18' fill='none' stroke='%23E7128B' stroke-width='4' stroke-dasharray='80 40'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center/36px no-repeat; }
.picker .add { aspect-ratio: 1; border: 1px dashed #c5cacd; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; color: var(--title); font: inherit; font-size: 13px; font-weight: 600; text-align: center; padding: 4px; }
.picker .add .mdi { font-size: 30px; color: var(--primary); }
.picker .add:hover { border-color: var(--primary); }
.picker .ph.existing.del img { opacity: .3; }
.picker .ph.existing.del::before { content: 'Dihapus'; position: absolute; inset: auto 0 0 0; background: var(--err); color: #fff; font-size: 12px; text-align: center; padding: 2px; z-index: 1; }

/* ---------- Signature ---------- */
.sigpad { position: relative; border: 1px solid var(--border); background: #fff; }
.sigpad canvas { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.sigpad .ph-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #c5cacd; pointer-events: none; font-size: 15px; }
.sigpad .sig-line { position: absolute; left: 24px; right: 24px; bottom: 44px; border-top: 1px dashed #d5d9dc; pointer-events: none; }
.sigpad .clear { position: absolute; top: 6px; right: 6px; }
.sigpad.signed .ph-text { display: none; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl th { background: var(--snow); color: var(--title); font-weight: 600; white-space: nowrap; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fcfcfc; }

/* ---------- Tabs / filter ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 12px 16px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.filters .full { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; } .filters .full { grid-column: auto; } }
.filters label { font-size: 13px; font-weight: 600; color: var(--title); display: block; margin-bottom: 4px; }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin: 20px 0 8px; }
.pager a, .pager span { min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: #fff; font-weight: 600; }
.pager .cur { background: var(--title); color: #fff; border-color: var(--title); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; }
.login-side { display: none; flex: 1; background: var(--title); color: #fff; padding: 48px; position: relative; overflow: hidden; }
.login-side h2 { color: #fff; font-size: 34px; max-width: 420px; }
.login-side p { color: #b9c2c8; max-width: 420px; }
.login-side .bars { position: absolute; right: -40px; bottom: 60px; display: grid; gap: 18px; transform: skewX(-12deg); }
.login-side .bars i { display: block; width: 280px; height: 44px; background: var(--primary); }
@media (min-width: 900px) { .login-side { display: flex; flex-direction: column; justify-content: center; } }
.login-form { width: 100%; max-width: 520px; margin: auto; padding: 40px 24px; }
@media (min-width: 900px) { .login-form { padding: 64px; } }
.login-form .logo { height: 32px; width: auto; margin-bottom: 36px; }
.login-form h1 { font-size: 32px; }

/* ---------- Scanner ---------- */
.scanner { position: relative; background: #000; aspect-ratio: 3/4; max-height: 70vh; width: 100%; overflow: hidden; }
@media (min-width: 900px) { .scanner { aspect-ratio: 4/3; } }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; left: 50%; top: 50%; width: 64%; aspect-ratio: 1; transform: translate(-50%, -50%); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }
.scanner .frame::before, .scanner .frame::after { content: ''; position: absolute; inset: 0; border: 3px solid var(--primary); clip-path: polygon(0 0, 22% 0, 22% 4px, 4px 4px, 4px 22%, 0 22%, 0 78%, 4px 78%, 4px calc(100% - 4px), 22% calc(100% - 4px), 22% 100%, 78% 100%, 78% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 78%, 100% 78%, 100% 22%, calc(100% - 4px) 22%, calc(100% - 4px) 4px, 78% 4px, 78% 0, 100% 0, 100% 100%, 0 100%); }
.scanner .status { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px; text-align: center; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); font-weight: 500; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10,15,20,.92); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 26px; cursor: pointer; }

/* ---------- Label pilih ---------- */
.pick-list { max-height: 60vh; overflow: auto; border: 1px solid var(--border); background: #fff; }
.pick-list label { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-list label:last-child { border-bottom: 0; }
.pick-list input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.pick-list .t { min-width: 0; }
.pick-list .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-cards { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.radio-cards label { border: 1px solid var(--border); padding: 12px; cursor: pointer; background: #fff; display: block; }
.radio-cards input { accent-color: var(--primary); margin-right: 6px; }
.radio-cards label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-cards small { display: block; color: var(--muted); margin-top: 2px; }

.clock { font-variant-numeric: tabular-nums; }

/* Perbaikan overflow di HP */
.items > *, .grid-2 > *, .stats > * { min-width: 0; }
.stat span { font-size: 12px; }
.dl dd .muted { font-family: 'Josefin Sans', system-ui, sans-serif; letter-spacing: 0; }
