/* AsetTrack by indilabs — shared styles */
:root {
  --navy: #0F1E33;
  --navy-2: #1B3152;
  --navy-3: #162A47;
  --blue: #1A73E7;
  --blue-ink: #1557B0;
  --blue-soft: #E5EFFD;
  --green: #2FB886;
  --green-ink: #126B4A;
  --green-soft: #E3F6EE;
  --amber: #F59E0B;
  --amber-ink: #9A4A00;
  --amber-soft: #FDEFD9;
  --orange: #E8590C;
  --teal: #0097A7;
  --ink: #0F1E33;
  --ink-2: #3A4A5E;
  --muted: #55657E;
  --line: #E3E8F0;
  --line-2: #DCE2EC;
  --bg: #F3F5F9;
  --card: #FFFFFF;
  --radius: 18px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue-ink); }
a:hover { color: var(--navy); }
button, input, select { font: inherit; }
h1, h2, h3 { margin: 0; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  flex: 0 0 240px; background: var(--navy); color: #C9D3E3;
  padding: 24px 16px; display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--blue); display: grid; place-items: center; }
.brand-name { font-weight: 800; font-size: 17px; color: #fff; letter-spacing: -0.2px; display: block; }
.brand-sub { font-size: 11px; color: #8FA0BA; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  color: #C9D3E3; text-decoration: none; font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--navy-3); color: #fff; }
.nav a.active { background: var(--navy-2); color: #fff; font-weight: 600; }
.nav .count { margin-left: auto; background: var(--amber); color: var(--navy); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.sync { margin-top: auto; background: var(--navy-3); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #8FA0BA; }
.sync strong { font-size: 13px; color: #fff; }

.main { flex: 1; min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 24px; }

@media (max-width: 960px) {
  .app { flex-direction: column; }
  .sidebar { position: static; height: auto; flex: none; padding: 14px 16px; gap: 12px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .sync { display: none; }
  .main { padding: 20px 16px 32px; }
}

/* ---------- Header ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 500; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line-2);
  border-radius: 12px; padding: 0 14px; height: 44px; min-width: 260px;
}
.search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 14px; color: var(--ink); }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,231,.15); }

/* ---------- Buttons ---------- */
.btn {
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff;
  color: var(--ink); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #B9C7DC; color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #1765CC; color: #fff; }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-2); color: #fff; }
.btn-icon { width: 44px; padding: 0; position: relative; }
.btn-icon .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.btn-block { width: 100%; }

/* ---------- Cards / layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 18px; font-weight: 700; }
.card-sub { font-size: 13px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.row > .grow { flex: 999 1 560px; min-width: 0; }
.row > .side { flex: 1 1 320px; min-width: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi.ok .kpi-label { color: var(--green-ink); }
.kpi.out .kpi-label { color: var(--blue-ink); }
.kpi.warn .kpi-label { color: var(--amber-ink); }

/* Chips */
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip.tersedia { background: var(--green-soft); color: var(--green-ink); }
.chip.dipinjam { background: var(--blue-soft); color: var(--blue-ink); }
.chip.kalibrasi { background: var(--amber-soft); color: var(--amber-ink); }
.chip.neutral { background: #EEF2F7; color: var(--ink-2); font-weight: 600; }
.warn-text { color: var(--amber-ink) !important; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Map ---------- */
.map-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); flex: 1; min-height: 420px; display: flex; }
#map { flex: 1; min-height: 420px; background: #E8F0FB; }
.map-live {
  position: absolute; left: 12px; bottom: 12px; z-index: 500; background: rgba(255,255,255,.94);
  border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 10px; font-size: 12px; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px;
}
.map-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.unit-marker { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.unit-dot {
  position: relative; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff;
  font-weight: 800; font-size: 14px; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(15,30,51,.25);
  font-family: var(--font);
}
.unit-dot.alert::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--amber); border: 2px solid #fff;
}
.unit-marker.selected .unit-dot { outline: 3px solid var(--blue); outline-offset: 3px; }
.unit-label {
  background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 8px; font-size: 12px;
  font-weight: 700; color: var(--ink); white-space: nowrap; box-shadow: 0 2px 6px rgba(15,30,51,.08); font-family: var(--font);
}
.leaflet-div-icon.unit-icon { background: transparent; border: 0; }
@media (max-width: 600px) {
  #map, .map-wrap { min-height: 320px; }
  .unit-label { display: none; }
  .unit-marker.selected .unit-label { display: block; }
}

/* ---------- Selected asset panel ---------- */
.panel-photo { width: 100%; height: 200px; border-radius: 14px; overflow: hidden; background: #EEF2F7; display: grid; place-items: center; color: #7C8DA8; font-size: 13px; }
.panel-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.label-caps { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.asset-name { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.meta { margin: 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); row-gap: 10px; column-gap: 12px; font-size: 13px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 600; }
.panel-actions { display: flex; gap: 10px; margin-top: auto; }
.panel-actions .btn { flex: 1; padding: 0 12px; white-space: nowrap; }

/* ---------- Table ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
}
.filter[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.unit-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--blue); background: var(--blue-soft); color: var(--blue-ink); font-size: 12px; font-weight: 700; cursor: pointer;
}
.table-scroll { overflow-x: auto; }
.asset-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.asset-table th {
  text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--line);
}
.asset-table td { padding: 12px; border-bottom: 1px solid #EEF1F6; vertical-align: middle; }
.asset-table tbody tr { cursor: pointer; }
.asset-table tbody tr:hover { background: #F7F9FC; }
.asset-table tbody tr.selected { background: #F0F6FF; }
.asset-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thumb { width: 40px; height: 40px; border-radius: 10px; overflow: hidden; background: #EEF2F7; flex: 0 0 40px; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-cell strong { display: block; }
.asset-cell .mono, .sub { font-size: 11px; color: var(--muted); }
.td-sub { display: block; font-size: 12px; color: var(--muted); }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); }

/* ---------- Activity / timeline ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.feed li { display: flex; gap: 12px; font-size: 13px; }
.feed .ic { width: 32px; height: 32px; border-radius: 10px; flex: 0 0 32px; display: grid; place-items: center; }
.ic.blue { background: var(--blue-soft); color: var(--blue-ink); }
.ic.amber { background: var(--amber-soft); color: var(--amber-ink); }
.ic.green { background: var(--green-soft); color: var(--green-ink); }
.feed time, .timeline time { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; font-size: 13px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .rail i { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; }
.timeline .rail b { flex: 1; width: 2px; background: var(--line-2); min-height: 40px; }
.timeline li:last-child .rail b { display: none; }
.timeline .body { padding-bottom: 16px; display: flex; flex-direction: column; gap: 2px; }
.timeline .body span { color: var(--ink-2); }

/* ---------- Asset detail ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs a { font-weight: 600; text-decoration: none; }
.crumbs strong { color: var(--ink); }
.identity { flex-direction: row; flex-wrap: wrap; gap: 24px; }
.identity > img { width: 220px; height: 220px; object-fit: cover; object-position: top; border-radius: 14px; flex: 0 0 220px; }
.identity .info { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.identity h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.facts div { display: flex; flex-direction: column; gap: 4px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; font-size: 14px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line-2); }
.tab {
  height: 44px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent;
  font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer;
}
.tab[aria-selected="true"] { border-bottom-color: var(--blue); color: var(--ink); font-weight: 700; }

/* Floor plan */
.floor {
  position: relative; width: 100%; aspect-ratio: 16 / 8.5; border: 2px solid #C5D0E0; border-radius: 12px; overflow: hidden;
  background-color: #F7F9FC;
  background-image: linear-gradient(#E9EEF5 1px, transparent 1px), linear-gradient(90deg, #E9EEF5 1px, transparent 1px);
  background-size: 24px 24px;
}
.zone {
  position: absolute; background: #fff; border: 1.5px solid #B9C7DC; border-radius: 8px; padding: 10px;
  display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.zone small { font-weight: 400; font-size: 11px; color: var(--muted); }
.zone.active { background: #F0F6FF; border: 2px solid var(--blue); color: var(--blue-ink); }
.shelves { flex: 1; display: grid; gap: 6px; }
.shelves span { background: #EEF2F7; border-radius: 4px; }
.zone.active .shelves span { background: #DCE6F5; }
.zone.active .shelves span.here { background: #BCD3F5; }
.gw { position: absolute; width: 12px; height: 12px; background: var(--teal); border-radius: 3px; }
.gate { position: absolute; left: 76%; bottom: 0; width: 15%; height: 6px; background: var(--orange); border-radius: 3px 3px 0 0; }
.gate-label { position: absolute; left: 76%; bottom: 10px; font-size: 11px; font-weight: 700; color: #B4410A; background: #fff; padding: 2px 6px; border-radius: 6px; }
.pos-ring { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(26,115,231,.16); border: 1.5px dashed var(--blue); animation: pulse 2.4s ease-out infinite; }
.pos-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(15,30,51,.3); }
.pos-tip { position: absolute; background: var(--navy); color: #fff; border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 6px 16px rgba(15,30,51,.25); font-size: 13px; font-weight: 700; }
.pos-tip span { font-size: 11px; font-weight: 400; color: #C9D3E3; }
@keyframes pulse { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.3); opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .pos-ring { animation: none; } }

.list-rows { display: flex; flex-direction: column; font-size: 13px; }
.list-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EEF1F6; }
.list-rows > div:last-child { border-bottom: 0; }
.kv { display: flex; justify-content: space-between; font-size: 13px; }
.kv span { color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: #EEF2F7; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.checks li { display: flex; align-items: center; gap: 10px; }

/* ---------- Mobile (pinjam.html) ---------- */
.phone-page { min-height: 100vh; display: flex; justify-content: center; background: #DCE2EC; }
.phone { width: 100%; max-width: 430px; min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.phone-head { height: 60px; flex: 0 0 60px; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 8px; padding: 0 8px; position: sticky; top: 0; z-index: 10; }
.phone-head button { width: 44px; height: 44px; border: 0; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.phone-head h1 { font-size: 17px; font-weight: 700; }
.phone-head small { margin-left: auto; margin-right: 8px; font-size: 12px; color: #8FA0BA; }
.phone-body { flex: 1; padding: 18px 18px 96px; display: flex; flex-direction: column; gap: 16px; }
.step[hidden] { display: none !important; }
.step { display: flex; flex-direction: column; gap: 16px; }
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--line); padding: 4px; border-radius: 12px; }
.segment button { height: 44px; border: 0; border-radius: 9px; font-weight: 700; font-size: 14px; cursor: pointer; background: transparent; color: var(--muted); }
.segment button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,30,51,.12); }
.viewfinder { position: relative; height: 380px; border-radius: 20px; background: #1B2638; overflow: hidden; display: grid; place-items: center; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame { position: relative; width: 220px; height: 220px; }
.frame i { position: absolute; width: 44px; height: 44px; border: 4px solid var(--green); }
.frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
.frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
.frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
.frame b { position: absolute; left: 16px; right: 16px; height: 2px; background: var(--green); box-shadow: 0 0 12px var(--green); animation: scan 2s ease-in-out infinite alternate; }
@keyframes scan { from { top: 12%; } to { top: 88%; } }
@media (prefers-reduced-motion: reduce) { .frame b { animation: none; top: 50%; } }
.viewfinder p { position: absolute; bottom: 18px; left: 0; right: 0; margin: 0; text-align: center; font-size: 13px; color: #C9D3E3; }
.nfc { height: 380px; border-radius: 20px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; padding: 0 30px; color: var(--ink-2); font-size: 14px; }
.nfc-rings { width: 180px; height: 180px; border-radius: 50%; background: var(--blue-soft); display: grid; place-items: center; }
.nfc-rings > div { width: 120px; height: 120px; border-radius: 50%; background: #BCD3F5; display: grid; place-items: center; }
.nfc-rings > div > div { width: 68px; height: 68px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; }
.btn-lg { height: 52px; border-radius: 14px; font-size: 15px; }
.asset-mini { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; gap: 14px; align-items: center; }
.asset-mini img { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; object-position: center 70%; }
.asset-mini div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field input, .field select { height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; padding: 0 12px; font-size: 14px; color: var(--ink); font-weight: 400; }
.field input:focus, .field select:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,231,.15); }
fieldset.kit { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
fieldset.kit legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
fieldset.kit label { display: flex; align-items: center; gap: 10px; font-size: 14px; }
fieldset.kit input { width: 20px; height: 20px; accent-color: var(--blue); }
.done-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 40px 10px 10px; }
.done-hero .ok { width: 84px; height: 84px; border-radius: 50%; background: var(--green-soft); display: grid; place-items: center; }
.done-hero h2 { font-size: 22px; font-weight: 800; }
.done-hero p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.summary { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; height: 72px; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabbar a.active { color: var(--blue); font-weight: 700; }
