/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #070b14;
  --panel: #111827;
  --panel-2: #172033;
  --panel-3: #202c43;
  --border: #26344f;
  --border-2: #3a4b6d;
  --text: #f1f5ff;
  --muted: #a9b8d3;
  --faint: #71819e;
  --accent: #4f8cff;
  --accent-2: #6aa1ff;
  --green: #2fc56a;
  --green-bg: rgba(47, 197, 106, .12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, .12);
  --amber: #f5a524;
  --amber-bg: rgba(245, 165, 36, .12);
  --cyan: #38cfe0;
  --info: #4f8cff;
  --radius: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .38);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, .25);
  --ring: rgba(79, 140, 255, .28);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 13.5px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.login-screen {
  position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center;
  padding: 24px; background:
    radial-gradient(circle at 18% 22%, rgba(244, 196, 0, .22), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(3, 59, 112, .18), transparent 32%),
    linear-gradient(135deg, #f5f8fc 0%, #e9f1f8 52%, #ffffff 100%);
}
.source-field[hidden] { display: none; }
.pm-intro { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; padding:18px 16px 10px; }
.pm-intro h3 { margin:0 0 6px; }
.pm-intro p, .pm-footnote { color:var(--muted); font-size:12px; line-height:1.6; }
.pm-intro p { margin:0; max-width:720px; }
.pm-error { padding:12px; background:#fff0e8; color:#8c3816; border:1px solid #edbb9f; border-radius:8px; margin:8px 0; }
.pm-error[hidden] { display:none; }
.pm-status { display:inline-block; padding:4px 9px; border-radius:14px; font-size:11px; font-weight:700; white-space:nowrap; }
.ic-detail-head > .pm-status { align-self:flex-start; }
.pm-status.pm-upcoming { background:#fff3ce; color:#805800; }
.pm-status.pm-due, .pm-status.pm-overdue { background:#ffe4e4; color:#a32828; }
.pm-status.pm-scheduled { background:#e6f3ed; color:#286648; }
.pm-status.pm-unknown, .pm-status.pm-baseline_required { background:#eaf0f8; color:#415875; }
.pm-card small { white-space:normal; line-height:1.5; }
#pm-detail fieldset { border:1px solid var(--line, #dde3ec); border-radius:10px; padding:14px; margin:16px 0 0; min-width:0; }
#pm-detail fieldset:disabled { opacity:.65; }
#pm-detail legend { font-size:12px; font-weight:700; padding:0 6px; }
.pm-check { display:flex; align-items:flex-start; gap:8px; padding:8px 0; font-size:12px; line-height:1.6; cursor:pointer; }
.pm-check input { flex:0 0 auto; margin-top:4px; }
.pm-note-label { display:block; font-size:12px; font-weight:600; margin:12px 0 6px; }
#pm-note { width:100%; resize:vertical; padding:10px; border:1px solid var(--line, #dde3ec); border-radius:6px; font:inherit; box-sizing:border-box; }
#pm-baseline { width:100%; padding:10px; border:1px solid var(--line, #dde3ec); border-radius:6px; box-sizing:border-box; }
.pm-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.pm-history-row { border-top:1px solid var(--line, #dde3ec); padding:12px 0; display:grid; gap:5px; font-size:12px; }
.pm-history-row span { color:var(--muted); }
.pm-history-row p { white-space:pre-wrap; overflow-wrap:anywhere; margin:0; }
#pm-summary { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); }
@media(max-width:680px) { .pm-intro { flex-wrap:wrap; } .pm-actions .btn { flex:1 1 auto; } #pm-summary { grid-template-columns:repeat(3,minmax(0,1fr)); } }
.login-screen[hidden] { display: none; }
.login-card {
  width: min(440px, calc(100vw - 32px)); background: rgba(255, 255, 255, .96);
  border: 1px solid #c8d8e8; border-radius: 22px; box-shadow: 0 24px 70px rgba(3, 59, 112, .18);
  overflow: hidden;
}
.login-card::before { content: ""; display: block; height: 5px; background: linear-gradient(90deg, #033b70 0 72%, #f4c400 72% 100%); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 24px 14px; text-align: center; }
.login-logo { width: 96px; height: auto; object-fit: contain; }
.login-logo.irys-logo { width: min(280px, 82vw); }
.login-brand-copy { display: grid; gap: 4px; justify-items: center; }
.login-brand h1 { margin: 0; color: #033b70; font-size: 23px; line-height: 1.05; }
.login-brand p { margin: 5px 0 0; color: #718399; font-size: 12px; letter-spacing: .25px; }
.login-copy { padding: 8px 24px 14px; border-bottom: 1px solid #d9e5f0; text-align: center; }
.login-copy b { display: block; color: #0f2137; font-size: 15px; }
.login-copy span { display: block; margin-top: 4px; color: #53667d; font-size: 12.5px; line-height: 1.45; }
.login-form { display: grid; gap: 8px; padding: 18px 24px 20px; }
.login-form label { color: #53667d; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .45px; }
.login-form input { width: 100%; height: 39px; }
.login-form .btn { justify-content: center; margin-top: 8px; height: 39px; }
#login-status { display: block; min-height: 18px; text-align: center; color: #53667d; font-size: 11.5px; }
#login-status.err { color: #b42318; font-weight: 700; }
.login-foot { padding: 12px 24px 18px; color: #718399; font-size: 11px; background: #f8fbff; border-top: 1px solid #e1ebf4; text-align: center; }
body.login-mode #topbar, body.login-mode .layout, body.login-mode .data-explorer, body.login-mode #drawer, body.login-mode #alert-banner, body.login-mode #alarm-consent { display: none !important; }

/* ------------------------------------------------------------------ header */
#topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: linear-gradient(180deg, var(--panel) 0%, #121928 100%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-home { border: 0; background: transparent; padding: 3px 6px; margin-left: -6px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }
.brand-home:hover { background: rgba(3, 59, 112, .06); }
.brand-home:focus-visible { outline: 2px solid rgba(3, 59, 112, .35); outline-offset: 2px; }
.logo-int {
  height: 36px; width: auto; display: block;
  flex: 0 0 auto;
}
.logo-irys { height: 40px; width: auto; display: block; flex: 0 0 auto; }
.brand-txt { display: grid; gap: 2px; min-width: 0; }
.brand-txt h1 { margin: 0; font-size: 16px; font-weight: 750; letter-spacing: .1px; white-space: nowrap; line-height: 1.05; }
.brand-txt span { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.powered-by { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.powered-by img { height: 20px; width: auto; display: block; }
.top-powered { padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, .72); color: #53667d; }
.login-powered { flex: 0 0 auto; }
.login-powered img { height: 24px; }

.gw-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 12px; white-space: nowrap;
}
.gw-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.gw-pill.good .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.gw-pill.bad .dot  { background: var(--red);  box-shadow: 0 0 0 3px var(--red-bg); animation: blink 1.4s infinite; }
.gw-pill.idle .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
@keyframes blink { 50% { opacity: .35; } }

.toolbar { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.field { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
select, input[type=text], input[type=search], input[type=datetime-local] {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: 6px 8px; font: inherit; font-size: 12.5px; outline: none;
  transition: border-color .15s;
}
select:focus, input:focus { border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: 7px 12px; font: inherit; font-size: 12.5px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--panel-3); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.issue-top { position: relative; gap: 7px; }
.issue-top b { min-width: 18px; height: 18px; border-radius: 999px; display: inline-grid; place-items: center; padding: 0 6px; background: #eef6ff; color: #033b70; border: 1px solid #bdd7ef; font-size: 10px; line-height: 1; }
.issue-top.needs-ack b { background: #d12f2f; color: #fff; border-color: #d12f2f; box-shadow: 0 0 0 3px rgba(209,47,47,.14); }
.issue-top b[hidden] { display: none; }
.btn.danger { background: var(--red-bg); border-color: rgba(239, 68, 68, .4); color: #b42318; }
/* toolbar popup wrappers: menu selalu nempel presisi di bawah tombolnya */
.dl-wrap, .alert-wrap, .account-wrap { position: relative; }
.dl-wrap .menu { right: 0; top: calc(100% + 7px); }
.alert-wrap .menu.alert-menu { right: 0; top: calc(100% + 7px); }
.account-wrap .menu.account-menu { right: 0; top: calc(100% + 7px); }

/* account pill: tinggi & gaya sejajar tombol lain, bukan blok penuh */
.toolbar .account-btn.primary {
  height: 34px; min-width: 0; margin: 0; border-radius: 10px;
  background: #ffffff; border-color: #b9c9dc; color: #102033;
  box-shadow: 0 1px 2px rgba(12, 35, 64, .04);
  padding: 3px 9px 3px 4px; gap: 8px;
  display: inline-flex; align-items: center;
}
.toolbar .account-btn.primary:hover { background: #f7fbff; border-color: #5f9ed8; }
.acct-avatar { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 50%; background: #033b70; color: #fff; font-weight: 800; font-size: 12px; }
.acct-copy { display: grid; min-width: 0; text-align: left; line-height: 1.15; }
.acct-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 132px; font-size: 12px; font-weight: 650; color: #102033; }
.acct-copy small { color: #53667d; font-size: 10.5px; text-transform: capitalize; }
.acct-caret { color: #53667d; font-size: 16px; line-height: 1; }
.menu.account-menu { width: 260px; padding: 10px; display: none; }
.menu.account-menu:not([hidden]) { display: block; }
.acct-head { padding: 4px 4px 8px; border-bottom: 1px solid var(--border); }
.acct-head b { display: block; font-size: 13px; color: var(--text); }
.acct-head span { display: inline-flex; margin-top: 5px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .35px; }
.acct-desc { padding: 9px 4px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.account-menu .mi.danger { color: #b42318; }
.btn.danger:hover { background: #ffe7e4; }
.btn.icon { padding: 7px 9px; }
.refresh-btn { font-size: 16px; line-height: 1; min-width: 36px; justify-content: center; }
.refresh-btn .refresh-icon { display: inline-block; line-height: 1; }
.refresh-btn.refreshing .refresh-icon { color: var(--accent-2); animation: rot .75s linear infinite; }
.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.clock { font: 12px var(--mono); color: var(--faint); white-space: nowrap; }

/* download menu */
.menu {
  position: absolute; right: 96px; top: 50px; z-index: 1200; min-width: 260px;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px; display: none;
}
.menu.open { display: block; }
.menu .mi {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px;
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer;
  background: transparent; border: 0;
}
.menu .mi:hover { background: var(--panel-3); }
.menu .mi.on { background: rgba(79, 140, 255, .14); color: var(--accent-2); }
.menu .mi small { display: block; color: var(--muted); font-size: 11px; }
.menu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.menu .fmt-row { display: flex; gap: 6px; padding: 6px 10px 8px; align-items: center; }
.menu .fmt-row label { font-size: 11.5px; color: var(--muted); }
.dl-scoped { position: absolute; top: 50px; right: 8px; z-index: 1300; }
.range-field { position: relative; }
.range-btn { min-width: 150px; justify-content: space-between; }
.menu.range-menu { right: 0; top: 42px; width: 352px; padding: 10px; z-index: 2200; }
.menu.range-menu:not([hidden]) { display: block; }
.range-title { padding: 3px 4px 8px; font-weight: 700; color: var(--text); }
.range-presets { display: flex; flex-direction: column; gap: 7px; }
.range-presets .range-group { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.range-presets .mi { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 7px 2px; text-align: center; font: inherit; font-size: 11.5px; color: var(--muted); cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.range-presets .mi:hover { border-color: var(--accent-2); color: #dfe8f7; }
.range-presets .mi.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.range-presets .mi.cust { border-style: dashed; color: var(--accent-2); margin-top: 2px; }
.range-presets .mi.cust:hover { border-color: var(--accent); background: rgba(79, 140, 255, .10); }
.range-btn #range-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-custom { padding: 2px 4px 10px; }
.rc-status { font-size: 11.5px; font-weight: 600; color: var(--accent-2); min-height: 15px; padding: 2px 4px 10px; }
.range-time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.rc-time-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rc-time-field > span { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .15px; }
.rc-time-pick {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 5px;
  padding: 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2);
}
.rc-time-pick b { color: var(--muted); font-size: 13px; text-align: center; }
.rc-time-pick select {
  width: 100%; min-width: 0; padding: 4px 6px; border-radius: 7px;
  font-family: var(--mono); font-size: 12px; text-align: center; text-align-last: center;
  background: var(--panel); border-color: var(--border-2);
}
.rc-cal { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); padding: 8px; }
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rc-nav { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.rc-nav:hover { border-color: var(--accent-2); color: #dfe8f7; }
.rc-month { font-size: 12.5px; font-weight: 700; color: var(--text); }
.rc-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.rc-days span { text-align: center; font-size: 10px; color: var(--muted); font-weight: 600; }
.rc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.rc-day { height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; transition: background .1s ease; }
.rc-day:hover { background: rgba(79, 140, 255, .16); }
.rc-day.blank { pointer-events: none; visibility: hidden; }
.rc-day.today { box-shadow: inset 0 0 0 1px var(--accent); }
.rc-day.sel { background: var(--accent); color: #fff; font-weight: 700; }
.rc-day.between { background: rgba(79, 140, 255, .18); color: #dbe6ff; }
.rc-day.preview { background: rgba(79, 140, 255, .34); color: #eaf1ff; }
.range-actions { display: flex; gap: 8px; padding: 2px 4px 4px; margin-top: 10px; }
.range-actions .btn { flex: 1; justify-content: center; }

/* ------------------------------------------------------------------ layout */
.layout { display: flex; height: calc(100vh - 58px); position: relative; }
.mapwrap { flex: 1 1 auto; position: relative; min-width: 0; overflow: hidden; }

/* body.sb-off = sidebar collapsed jadi rail tipis; bukan disembunyikan total.
   Best practice: user tetap punya affordance jelas untuk membuka daftar unit lagi. */

/* ringkasan armada di atas peta (widget kesehatan) */
.fleet {
  position: absolute; top: 12px; left: 12px; z-index: 400;
  background: rgba(255,255,255,.96); border: 1px solid #c7d5e6; border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden; width: auto; min-width: 300px; max-width: calc(100% - 24px);
}
.fleet::before {
  content: ""; display: block; height: 4px;
  background: linear-gradient(90deg, #033b70 0 68%, #f4c400 68% 100%);
}
.fleet.urgent::before { background: linear-gradient(90deg, #d12f2f 0 58%, #f4c400 58% 100%); }
.fleet.urgent { border-color: rgba(209, 47, 47, .28); }
.fleet.ok::before { background: linear-gradient(90deg, #12834a 0 72%, #f4c400 72% 100%); }
.fleet.min { min-width: 0; }
.fleet[hidden] { display: none; }
.fl-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.fl-head b { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.fl-mini { font-size: 10px; color: var(--faint); flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fl-min {
  font: inherit; width: 20px; height: 20px; border-radius: 6px; cursor: pointer; flex: 0 0 20px;
  background: var(--panel); border: 1px solid var(--border-2); color: var(--muted); line-height: 1;
}
.fl-min:hover { color: var(--text); }
.fleet.min .fl-body { display: none; }
.fleet .fl-body { display: flex; gap: 14px; align-items: center; padding: 5px 14px 14px; }
.fms-summary { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 8px; padding: 0 14px 14px; }
.fms-summary[hidden] { display: none; }
.fms-summary > div { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px; }
.fms-summary b { display: block; font-size: 12.5px; }
.fms-summary span { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .3px; }
.fms-summary .bad b { color: #d12f2f; }
.fl-left { position: relative; width: 96px; flex: 0 0 96px; }
.fl-pie { width: 96px; height: 96px; display: grid; place-items: center; }
.fl-pie svg { display: block; filter: drop-shadow(0 5px 10px rgba(3, 59, 112, .12)); }
.fl-pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  width: 48px; height: 26px; margin: auto; border-radius: 999px;
  background: rgba(255, 255, 255, .9); border: 1px solid rgba(3, 59, 112, .12);
  font: 700 15px var(--mono); color: var(--green); pointer-events: none;
}
.fl-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fl-tag {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  font-size: 12px; color: #0f6f3f; line-height: 1.35; font-weight: 700;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: rgba(255,255,255,.72);
}
.fl-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.fl-tag.ok { color: #0f6f3f; border-color: #b9e1c9; background: #effbf4; }
.fl-tag.bad { color: #7d5400; border-color: #eed08b; background: #fff7e6; }
.fl-tag.bad::before { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.fl-leg { display: flex; gap: 6px; flex-wrap: wrap; }
.ds-item {
  background: #f7fbff; border: 1px solid #d5e0ec; border-radius: 9px;
  padding: 4px 10px; text-align: center; cursor: pointer; min-width: 58px;
  transition: border-color .15s, transform .06s;
}
.ds-item:hover { border-color: var(--border-2); }
.ds-item.hot { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ds-item b { display: block; font-size: 15px; font-weight: 700; font-family: var(--mono); color: var(--muted); margin-right: 0; }
.ds-item span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.ds-item.ok b { color: var(--green); }
.ds-item.na b { color: var(--accent); }
.ds-item.bad b, .ds-item.warn b { color: var(--muted); }
.ds-item.bad.live b { color: #ff8a8a; }
.ds-item.warn.live b { color: #ffc861; }
.ds-item.bad.live, .ds-item.warn.live { background: #fff6f0; border-color: rgba(216, 139, 0, .35); }
.ds-item.bad.live { border-color: rgba(209, 47, 47, .35); background: #fff0f0; }
.ds-item.bad.live b { color: #d12f2f; }
.ds-item.warn.live b { color: #b87500; }

/* pilihan peta dasar (satelit / peta) - diletakkan kiri-bawah, jauh dari drawer kanan */
.basemap {
  position: absolute; bottom: 26px; left: 12px; z-index: 400;
  display: flex; gap: 2px; background: var(--panel-2);
  border: 1px solid var(--border-2); border-radius: 10px; padding: 3px;
  box-shadow: var(--shadow);
}
.basemap button {
  font: inherit; font-size: 11px; color: var(--muted); cursor: pointer;
  background: transparent; border: 0; border-radius: 7px; padding: 4px 10px;
}
.basemap button.on { color: #fff; background: rgba(79, 140, 255, .22); }
.basemap button:hover { color: var(--text); }

/* toggle switch (menu notifikasi) */
.switch { position: relative; width: 34px; height: 18px; display: inline-block; flex: 0 0 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch span::before {
  content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }

/* menu kontrol notifikasi */
.menu.alert-menu { right: 70px; width: 310px; display: none; }
.menu.alert-menu:not([hidden]) { display: block; }
.alert-menu .am-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.alert-menu .am-row b { font-size: 12.5px; flex: 1; }
.alert-menu .am-row .am-muted { flex: 1; font-size: 12.5px; }
.alert-menu .am-desc { font-size: 11px; color: var(--muted); padding: 0 4px 6px; }
.alert-menu .am-row .btn { flex: 1; justify-content: center; }
.alert-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 4px 10px; }
.alert-summary div { border: 1px solid var(--border); border-radius: 9px; padding: 7px 8px; background: rgba(255,255,255,.08); }
.alert-summary b { display: block; font: 700 15px var(--mono); }
.alert-summary span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .3px; }
#btn-alert svg { transition: color .15s; }
#bell-ic { color: var(--muted); }
#btn-alert.on #bell-ic { color: var(--accent-2); }

/* banner notifikasi peristiwa (device offline dll) */
.alert-banner {
  position: absolute; top: 66px; left: 50%; transform: translateX(-50%); z-index: 1400;
  display: flex; gap: 10px; align-items: center;
  background: var(--panel-2); border: 1px solid rgba(239, 68, 68, .55); border-left: 4px solid var(--red);
  border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow);
  width: min(560px, calc(100vw - 40px));
  animation: slidein .18s ease-out;
}
.alert-banner .ab-ic { color: #ff8a8a; font-size: 19px; flex: 0 0 auto; }
.alert-banner .ab-txt { flex: 1; min-width: 0; }
.alert-banner .ab-txt b { display: block; font-size: 12px; color: #ffb3b3; text-transform: uppercase; letter-spacing: .5px; }
.alert-banner .ab-txt span { font-size: 12px; color: var(--text); }
.alert-banner .ab-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* admin konfigurasi unit/module */
.admin-modal {
  position: fixed; inset: 0; z-index: 2400; display: grid; place-items: stretch;
  padding: 12px; background: rgba(16, 32, 51, .28);
}
.auth-modal {
  position: fixed; inset: 0; z-index: 2450; display: grid; place-items: center;
  padding: 18px; background: rgba(16, 32, 51, .34);
}
.auth-modal[hidden] { display: none; }
.auth-card {
  width: min(420px, 100%); overflow: hidden; background: #fff; border: 1px solid #9fc3e6;
  border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.auth-card::before { content: ""; height: 4px; background: linear-gradient(90deg, #033b70 0 72%, #f4c400 72% 100%); }
.auth-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.auth-head h2 { margin: 0; font-size: 17px; }
.auth-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.auth-body { display: grid; gap: 8px; padding: 16px 18px; }
.auth-body label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.auth-body .btn { justify-content: center; margin-top: 4px; }
.admin-card {
  width: 100%; height: calc(100vh - 24px); max-height: none; overflow: hidden;
  background: #fff; border: 1px solid #9fc3e6; border-radius: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.admin-card::before { content: ""; height: 4px; background: linear-gradient(90deg, #033b70 0 72%, #f4c400 72% 100%); }
.admin-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.admin-head h2 { margin: 0; font-size: 17px; }
.admin-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.admin-tabs { display: flex; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: #f8fbff; }
.admin-tabs button { border: 1px solid var(--border); background: #fff; color: #50657c; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 12px; cursor: pointer; }
.admin-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.admin-body { display: grid; grid-template-columns: 300px 1fr; gap: 18px; padding: 18px; overflow: auto; min-height: 0; }
.admin-body[data-tab="integrations"], .admin-body[data-tab="users"] { grid-template-columns: 1fr 1fr; }
.admin-body[data-tab="users"] { grid-template-columns: 1fr; }
.admin-panel[hidden] { display: none !important; }
.integration-tabs { grid-column: 1 / -1; display: flex; gap: 8px; padding-bottom: 4px; }
.integration-tabs button { border: 1px solid var(--border); background: #fff; color: #50657c; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 12px; cursor: pointer; }
.integration-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.admin-form { display: grid; gap: 7px; align-content: start; }
.admin-form label, .admin-section-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.admin-form input, .admin-form select { width: 100%; }
.admin-unit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; }
.admin-unit-row .btn { white-space: nowrap; height: 32px; }
.admin-modules { display: grid; gap: 8px; }
.admin-module {
  display: grid; grid-template-columns: auto 1fr 150px; gap: 10px; align-items: center;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: #f7fbff;
}
.admin-module input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.admin-module b { display: block; font-size: 12.5px; }
.admin-module small { display: block; color: var(--muted); font-size: 10.5px; }
.admin-module .fms-map { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.admin-module .module-thresholds { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding-top: 6px; border-top: 1px dashed #c9d6e6; }
.admin-module .module-thresholds b { grid-column: 1 / -1; color: #50657c; font-size: 11px; }
.admin-users-panel { grid-column: 1 / -1; display: grid; gap: 14px; }
.admin-audit-panel { grid-column: 1 / -1; display: grid; gap: 12px; align-content: start; }
.admin-access-head { display: flex; justify-content: space-between; gap: 12px; }
.admin-access-head p, .access-card p { margin: 4px 0 0; color: #53667d; font-size: 12px; line-height: 1.45; }
.admin-access-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 14px; }
.access-card {
  border: 1px solid #d7e2ee; border-radius: 16px; background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 8px 20px rgba(12, 35, 64, .055); padding: 14px;
}
.access-card h3 { margin: 0; font-size: 14px; color: #102033; }
.access-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.admin-user-create { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.admin-user-create select[multiple] { min-height: 86px; }
.admin-user-create .btn { justify-content: center; }
.admin-org-create { display: grid; gap: 9px; margin-top: 12px; }
.admin-users { display: grid; gap: 10px; }
.audit-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.audit-toolbar input { flex: 1 1 260px; min-width: 180px; }
.audit-log { border: 1px solid #d7e2ee; border-radius: 16px; overflow: auto; background: #fff; box-shadow: 0 8px 20px rgba(12, 35, 64, .045); }
.audit-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 820px; }
.audit-table th { text-align: left; padding: 9px 10px; color: #718399; font-size: 10px; text-transform: uppercase; letter-spacing: .45px; border-bottom: 1px solid #d7e2ee; background: #f8fbff; }
.audit-table td { padding: 9px 10px; border-bottom: 1px solid #edf2f7; vertical-align: top; }
.audit-table tr:last-child td { border-bottom: 0; }
.audit-table td b { display: block; color: #102033; font-size: 12px; }
.audit-table td span { display: block; color: #718399; font-size: 10.5px; margin-top: 2px; }
.audit-action { display: inline-flex !important; padding: 3px 7px; border-radius: 999px; color: #033b70 !important; background: #eef6ff; border: 1px solid #c9dff5; font-weight: 800; }
.audit-table code { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #53667d; background: #f6f9fd; border: 1px solid #dfe8f2; border-radius: 8px; padding: 4px 6px; font-size: 10.5px; }
.admin-user-list { display: grid; gap: 9px; }
.admin-user-row {
  display: grid; grid-template-columns: 42px minmax(220px, 1.4fr) minmax(100px, .5fr) minmax(220px, 1fr) minmax(90px, .45fr) auto;
  gap: 12px; align-items: center; padding: 12px; border: 1px solid #d7e2ee; border-radius: 14px;
  background: #fff; box-shadow: 0 5px 14px rgba(12,35,64,.04);
}
.aur-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: #eaf4ff; color: #033b70; font-weight: 850; }
.aur-main { min-width: 0; }
.aur-main b { display: flex; align-items: center; gap: 7px; color: #102033; }
.aur-main small { color: #718399; font-size: 10px; font-weight: 600; }
.aur-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #53667d; font-size: 11.5px; margin-top: 2px; }
.aur-meta span { display: block; color: #718399; font-size: 9.5px; text-transform: uppercase; font-weight: 800; letter-spacing: .35px; }
.aur-meta b { display: block; margin-top: 2px; color: #102033; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aur-meta b.ok { color: #0f6f3f; }
.aur-meta b.bad { color: #a72323; }
.aur-actions { display: flex; justify-content: flex-end; }
.user-editor-backdrop { position: fixed; inset: 0; z-index: 2500; background: rgba(16, 32, 51, .24); }
.user-editor { position: fixed; z-index: 2501; top: 12px; right: 12px; bottom: 12px; width: min(520px, calc(100vw - 24px)); background: #fff; border: 1px solid #9fc3e6; border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.user-editor.compact { bottom: auto; max-height: calc(100vh - 24px); }
.ued-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #d7e2ee; background: linear-gradient(180deg, #fff, #f6f9fd); }
.ued-head b { display: block; font-size: 15px; color: #102033; }
.ued-head span { display: block; margin-top: 2px; color: #53667d; font-size: 12px; }
.ued-body { flex: 1; overflow: auto; padding: 16px 18px; display: grid; gap: 16px; align-content: start; }
.user-editor.compact .ued-body { flex: 0 1 auto; }
.ued-body section { display: grid; gap: 9px; align-content: start; }
.ued-body h4 { margin: 0; color: #102033; font-size: 12px; text-transform: uppercase; letter-spacing: .45px; }
.ued-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; align-items: start; }
.ued-body label { display: grid; gap: 5px; color: #53667d; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .35px; }
.ued-body input, .ued-body select { width: 100%; height: 36px; min-height: 36px; background: #fff; color: #102033; border-color: #c7d5e6; }
.ued-note { margin: 0; color: #718399; font-size: 11.5px; line-height: 1.45; }
.ued-admin-full { border: 1px solid #b9e1c9; background: #e9f8ef; color: #0f6f3f; border-radius: 13px; padding: 12px 13px; }
.ued-admin-full b { display: block; font-size: 13px; }
.ued-admin-full span { display: block; margin-top: 3px; color: #2d7f50; font-size: 11.5px; line-height: 1.45; }
.ued-org-preview { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; border: 1px solid #b9d7f5; background: #eaf4ff; color: #033b70; border-radius: 13px; padding: 10px 12px; }
.ued-org-preview b { font: 800 16px var(--mono); }
.ued-org-preview span { color: #53667d; font-size: 11.5px; }
.ued-org-list { display: grid; gap: 5px; max-height: 130px; overflow: auto; border: 1px solid #d7e2ee; background: #fff; border-radius: 12px; padding: 8px; }
.ued-org-list span { font-size: 12px; color: #102033; padding: 3px 2px; }
.ued-unit-q { margin-bottom: 2px; }
.ued-unit-count { display: inline-flex; align-items: center; gap: 5px; color: #53667d; font-size: 11px; }
.ued-unit-count b { color: #033b70; font-family: var(--mono); }
.ued-units { max-height: 260px; overflow: auto; border: 1px solid #d7e2ee; border-radius: 12px; background: #f8fbff; padding: 6px; display: grid; gap: 3px; }
.ued-units label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; color: #102033; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; }
.ued-units label:hover { background: #eef6ff; }
.ued-units input { width: 15px; min-height: 15px; accent-color: #033b70; }
.ued-reset { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.ued-reset .btn { height: 36px; }
.ued-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #d7e2ee; background: #f8fbff; }
.sync-progress { position: relative; height: 32px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #eef4fb; display: flex; align-items: center; padding: 0 10px; }
.sync-progress span { position: absolute; inset: 0 auto 0 0; width: 35%; background: linear-gradient(90deg, rgba(79,140,255,.20), rgba(79,140,255,.48)); animation: syncbar 1.2s infinite ease-in-out; }
.sync-progress b { position: relative; z-index: 1; font-size: 11px; color: #29415d; }
@keyframes syncbar { 50% { width: 75%; } }
.admin-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
#admin-hint { margin-right: auto; color: var(--muted); font-size: 11.5px; }

/* izin suara harus berasal dari interaksi pengguna agar lolos autoplay policy browser */
.alarm-consent {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(5, 9, 17, .55);
}
.alarm-consent-card {
  width: min(420px, calc(100vw - 32px));
  padding: 18px; background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 12px; box-shadow: var(--shadow);
}
.alarm-consent-icon {
  display: none;
  width: 36px; height: 36px; place-items: center; border-radius: 10px;
  color: #ffb3b3; background: var(--red-bg); border: 1px solid rgba(239, 68, 68, .4);
  font: 700 20px var(--mono);
}
.alarm-consent h2 { margin: 0 0 8px; font-size: 16px; }
.alarm-consent p { margin: 0; color: var(--text); font-size: 12.5px; }
.alarm-consent .alarm-consent-note { margin-top: 8px; color: var(--muted); font-size: 11.5px; }
.alarm-consent-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.hint { font-size: 11px; color: var(--faint); margin-top: 8px; }

/* ------------------------------------------------------------------ sidebar */
#sidebar { width: 312px; flex: 0 0 312px; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--border); z-index: 5; position: relative; transition: width .18s ease, flex-basis .18s ease, box-shadow .18s ease; }
.side-rail { display: none; }
.side-rail .rail-text,
.side-rail b,
.side-rail small { display: none; }
.side-search-row { display: flex; align-items: center; gap: 8px; }
.side-search-row #q-dev { width: auto; flex: 1 1 auto; min-width: 0; }
.side-collapse {
  width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center;
  border: 1px solid #c9d6e6; border-radius: 11px;
  background: #ffffff; color: #033b70; cursor: pointer;
  font: 900 22px/1 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  box-shadow: 0 5px 12px rgba(12, 35, 64, .06);
}
.side-collapse:hover { background: #fff7cf; border-color: #f4c400; }
body.sb-off #sidebar {
  display: flex; width: 64px; flex: 0 0 64px; align-items: stretch;
  background: rgba(255, 255, 255, .96); border-right-color: #d6e1ed;
  box-shadow: 8px 0 24px rgba(12, 35, 64, .08);
}
body.sb-off #sidebar .side-head,
body.sb-off #sidebar .side-body,
body.sb-off #sidebar .side-foot { display: none; }
body.sb-off #sidebar .side-rail {
  position: static; width: 100%; height: auto; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 10px; border: 0; border-radius: 0; padding: 14px 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f7fc 100%); color: #033b70;
  cursor: pointer; font: inherit; box-shadow: inset -1px 0 0 #d6e1ed;
}
body.sb-off .side-rail .rail-ic svg { display: block; }
body.sb-off .side-rail .rail-ic::before { content: none; }
body.sb-off #sidebar .side-rail:hover { background: linear-gradient(180deg, #fffdf0 0%, #eef6ff 100%); }
.side-rail .rail-ic {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px;
  background: #fff7cf; border: 1px solid rgba(244, 196, 0, .75); color: #033b70;
  box-shadow: 0 6px 14px rgba(12, 35, 64, .08);
}
body.sb-off .side-rail .rail-text {
  display: inline;
  writing-mode: vertical-rl; transform: rotate(180deg); text-transform: uppercase;
  letter-spacing: .9px; font-weight: 800; font-size: 10px; color: #53667d;
}
body.sb-off .side-rail b {
  display: inline-grid;
  min-width: 28px; height: 22px; place-items: center; padding: 0 6px;
  border-radius: 999px; background: #eaf4ff; border: 1px solid #b9d7f5;
  color: #033b70; font: 800 11px var(--mono);
}
body.sb-off .side-rail small:not([hidden]) {
  display: inline-flex; align-items: center; justify-content: center;
  max-width: 48px; padding: 4px 5px; border-radius: 999px;
  background: #fff3d8; border: 1px solid #f5d38b; color: #8a5608;
  font-size: 9px; font-weight: 900; line-height: 1; text-transform: uppercase; letter-spacing: .25px;
  writing-mode: vertical-rl; transform: rotate(180deg);
}
.side-head { padding: 10px; border-bottom: 1px solid var(--border); }
#q-dev { width: 100%; }
.side-filters { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 11.5px; color: var(--muted); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border-2);
  padding: 4px 9px; border-radius: 999px; transition: all .15s;
}
.chip:hover { color: var(--text); }
.chip.on { color: #fff; background: rgba(79, 140, 255, .18); border-color: var(--accent); }
.side-module-filter { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); }
.smf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.smf-head span { color: var(--muted); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .45px; }
.smf-head button { border: 0; background: transparent; color: var(--accent-2); font: inherit; font-size: 11px; cursor: pointer; padding: 2px 0; }
.smf-list { display: flex; gap: 6px; flex-wrap: wrap; }
.mf-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 4px 8px; font-size: 11.5px; cursor: pointer; user-select: none; }
.mf-chip input { width: 12px; height: 12px; margin: 0; accent-color: var(--accent); }
.mf-chip.on { color: #fff; background: rgba(79, 140, 255, .22); border-color: var(--accent); }
.side-body { flex: 1; overflow-y: auto; padding: 8px; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
.side-foot { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--faint); display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; line-height: 1.25; }
.side-foot span { min-width: 0; }
.side-foot .foot-count { flex: 0 0 auto; }
.side-foot .foot-hint { flex: 1 1 auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* device cards */
.dev {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 11px; margin-bottom: 8px;
  transition: transform .08s, border-color .15s, background .15s;
  position: relative; overflow: hidden;
}
.dev:hover { border-color: var(--border-2); }
.dev.sel { border-color: var(--accent); background: var(--panel-3); }
.dev.alarm-live { border-left: 3px solid var(--red); }
.dev .row1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dev .dicon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 30px; background: var(--panel); position: relative; }
.dev .dicon svg { width: 17px; height: 17px; }
.dev .dname { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev .ddev { font: 11px var(--mono); color: var(--faint); display: block; }
.dev .stat { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .4px;
}
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.red   { color: #ff8a8a; background: var(--red-bg); }
.badge.amber { color: #ffc861; background: var(--amber-bg); }
.badge.gray  { color: var(--muted); background: rgba(143, 160, 189, .12); }
.badge.blue  { color: var(--accent-2); background: rgba(79, 140, 255, .14); }
.badge.red-o { color: #ff8a8a; background: var(--red-bg); border: 1px solid rgba(239,68,68,.45); }
.dev .meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; font-size: 11px; color: var(--muted); align-items: center; }
.dev .meta .coords { font: 10.5px var(--mono); color: var(--faint); }
.dev .meta .rel { white-space: nowrap; }
.dev .ev-line { margin-top: 6px; font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; overflow: hidden; }
.dev .ev-line .sev { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.dev .ev-line.hot { color: #ffc0c0; }
.issue-line { margin-top: 7px; color: #a72323; background: #fff0f0; border: 1px solid rgba(209, 47, 47, .22); border-radius: 8px; padding: 5px 7px; font-size: 11.5px; font-weight: 700; }
.issue-line .issue-ack, .issue-line em { display: inline-flex; margin-left: 5px; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-style: normal; }
.issue-line .issue-ack { cursor: pointer; color: #033b70; background: #eef6ff; border: 1px solid rgba(3, 59, 112, .22); }
.issue-line em { color: #53667d; background: #f1f4f8; border: 1px solid #d8e0ea; }
.dev .c { display: flex; gap: 6px; margin-top: 6px; }
.dev .metric {
  flex: 1; background: var(--panel); border: 1px solid var(--border);
  border-radius: 7px; padding: 5px 7px; text-align: center;
}
.dev .metric b { display: block; font-size: 12.5px; font-weight: 650; }
.dev .metric span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }

.data-explorer {
  position: fixed; inset: 58px 12px 12px; z-index: 1050;
  background: rgba(7, 13, 24, .30); backdrop-filter: blur(3px);
  display: grid; place-items: stretch;
}
.data-explorer[hidden] { display: none; }
.de-card {
  background: rgba(255,255,255,.98); border: 1px solid var(--border-2); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}
.de-card::before { content: ""; height: 4px; background: linear-gradient(90deg, #033b70 0 72%, #f4c400 72% 100%); flex: 0 0 auto; }
.de-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.de-head h2 { margin: 0; font-size: 18px; color: var(--text); }
.de-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.de-toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.de-toolbar input { flex: 1 1 260px; }
.de-toolbar select { min-width: 150px; }
.de-summary { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.de-summary span { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 5px 9px; color: var(--muted); font-size: 11px; }
.de-summary b { color: var(--text); font-family: var(--mono); }
.de-table-wrap { overflow: auto; min-height: 0; }
.de-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.de-table th { position: sticky; top: 0; z-index: 1; background: #eef6ff; color: #53667d; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid #cfe0f1; padding: 9px 10px; }
.de-table td { border-bottom: 1px solid var(--border); padding: 9px 10px; vertical-align: top; }
.de-table tbody tr:hover { background: #f8fbff; }
.de-table td b, .de-table td small { display: block; }
.de-table td small { margin-top: 2px; color: var(--muted); }
.de-mod, .de-issue { display: inline-flex; margin: 0 4px 4px 0; border-radius: 999px; padding: 2px 7px; font-size: 10px; }
.de-mod { color: #033b70; background: #eef6ff; border: 1px solid rgba(3, 59, 112, .18); }
.de-issue { color: #a72323; background: #fff0f0; border: 1px solid rgba(209, 47, 47, .22); }

.reports-page {
  position: fixed; inset: 58px 12px 12px; z-index: 1050;
  background: rgba(7, 13, 24, .26); backdrop-filter: blur(3px);
  display: grid; place-items: stretch;
}
.reports-page[hidden] { display: none; }
.rp-card {
  background: rgba(255,255,255,.98); border: 1px solid var(--border-2); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}
.rp-card::before { content: ""; height: 4px; background: linear-gradient(90deg, #033b70 0 72%, #f4c400 72% 100%); flex: 0 0 auto; }
.rp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.rp-head h2 { margin: 0; font-size: 18px; color: var(--text); }
.rp-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.rp-toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rp-toolbar span { flex: 1; color: var(--muted); font-size: 12px; }
.rp-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.rp-summary div { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 9px 10px; }
.rp-summary b { display: block; color: var(--text); font: 800 16px var(--mono); }
.rp-summary span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .35px; }
.rp-table-wrap { overflow: auto; min-height: 0; }
.rp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.rp-table th { position: sticky; top: 0; z-index: 1; background: #eef6ff; color: #53667d; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid #cfe0f1; padding: 9px 10px; }
.rp-table td { border-bottom: 1px solid var(--border); padding: 9px 10px; vertical-align: top; }
.rp-table td b, .rp-table td small { display: block; }
.rp-table td small { margin-top: 2px; color: var(--muted); }
.rp-table tbody tr:hover { background: #f8fbff; }

.issues-page {
  position: fixed; inset: 58px 12px 12px; z-index: 1050;
  background: rgba(7, 13, 24, .26); backdrop-filter: blur(3px);
  display: grid; place-items: stretch;
}
.issues-page[hidden] { display: none; }
.ic-card { background: rgba(255,255,255,.98); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.ic-card::before { content: ""; height: 4px; background: linear-gradient(90deg, #d12f2f 0 42%, #033b70 42% 78%, #f4c400 78%); flex: 0 0 auto; }
.ic-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ic-head h2 { margin: 0; font-size: 18px; color: var(--text); }
.ic-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.op-tabs { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: #f8fbff; }
.op-tabs button { border: 1px solid var(--border); background: #fff; color: #50657c; border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 12px; cursor: pointer; }
.op-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-op-panel][hidden] { display: none !important; }
.ic-toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ic-toolbar input { flex: 1 1 280px; }
.ic-summary { display: grid; grid-template-columns: repeat(5, minmax(98px, 1fr)); gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: #f8fbff; }
.ic-sum { border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 9px 10px; text-align: left; cursor: pointer; }
.ic-sum:hover { border-color: #8dbbe4; box-shadow: 0 6px 18px rgba(3, 59, 112, .08); }
.ic-sum b { display: block; color: var(--text); font: 800 17px var(--mono); }
.ic-sum span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .35px; }
.ic-sum.unacked b { color: #a72323; }
.ic-sum.acked b { color: #075a8a; }
.ic-sum.cleared b { color: #7d5400; }
.ic-sum.resolved b { color: #0f6f3f; }
.ic-body { display: grid; grid-template-columns: 390px 1fr; min-height: 0; flex: 1; }
.ic-list { overflow: auto; border-right: 1px solid var(--border); padding: 10px; display: grid; gap: 8px; align-content: start; }
.ic-item { text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 10px 11px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 5px 8px; }
.ic-item:hover, .ic-item.sel { border-color: #5f9ed8; background: #f8fbff; }
.ic-item b { display: block; font-size: 13px; color: var(--text); }
.ic-item span:not(.ic-status) { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.ic-item small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.ic-item .sev { font-style: normal; text-transform: uppercase; font-weight: 800; color: #53667d; }
.ic-item .sev.critical { color: #a72323; }
.ic-item .sev.warning { color: #7d5400; }
.ic-status { display: inline-flex; align-items: center; align-self: start; border-radius: 999px; padding: 3px 7px; font-size: 10px; text-transform: uppercase; letter-spacing: .35px; border: 1px solid #d8e0ea; color: #53667d; background: #f4f7fb; }
.ic-status.active { color: #a72323; background: #fff0f0; border-color: rgba(209,47,47,.24); }
.ic-status.unacked { color: #a72323; background: #fff0f0; border-color: rgba(209,47,47,.24); }
.ic-status.acked { color: #075a8a; background: #eef8ff; border-color: #bddcf3; }
.ic-status.cleared { color: #7d5400; background: #fff7e6; border-color: rgba(244,196,0,.35); }
.ic-status.resolved { color: #0f6f3f; background: #effbf4; border-color: #b9e1c9; }
.ic-detail { overflow: auto; padding: 16px; }
.ic-detail-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.ic-detail-head h3 { margin: 0; font-size: 18px; }
.ic-detail-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.ic-fields { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 8px; }
.ic-fields div { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 9px 10px; }
.ic-fields span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .35px; }
.ic-fields b { display: block; margin-top: 3px; font-size: 12px; }
.ic-actions { display: flex; gap: 8px; margin: 12px 0; }
.ic-action-form { display: grid; grid-template-columns: 130px 1fr; gap: 7px 8px; align-items: center; margin-top: 12px; }
.ic-action-form label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .35px; font-weight: 800; }
.ic-action-form textarea { resize: vertical; min-height: 38px; }
.ic-action-form textarea, .ic-action-form select { border: 1px solid var(--border-2); border-radius: 10px; background: #fff; color: var(--text); padding: 8px 10px; font: inherit; font-size: 12px; outline: none; }
.ic-note { margin: 12px 0; color: #7d5400; background: #fff7e6; border: 1px solid rgba(244,196,0,.35); border-radius: 11px; padding: 9px 10px; font-size: 12px; }
.ic-detail h4 { margin: 15px 0 8px; font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
.ic-history { display: grid; gap: 8px; }
.ic-history > div:not(.empty) { border: 1px solid var(--border); border-radius: 11px; padding: 9px 10px; background: #fff; }
.ic-history b { text-transform: uppercase; font-size: 11px; color: #033b70; }
.ic-history span, .ic-history small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.ic-history p { margin: 7px 0 0; padding: 7px 8px; border-radius: 9px; background: #f8fbff; color: #24384f; font-size: 12px; line-height: 1.4; }

/* ------------------------------------------------------------------ map */
#map { position: absolute; inset: 0; width: 100%; height: 100%; background: #111827; z-index: 1; }
#map .leaflet-container { background: #0e1524; font: inherit; }
.leaflet-popup-content-wrapper { background: var(--panel-2); color: var(--text); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); }
.leaflet-popup-tip { background: var(--panel-2); border: 1px solid var(--border-2); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a { background: var(--panel-2) !important; color: var(--text) !important; border-color: var(--border-2) !important; }
.leaflet-control-attribution { background: rgba(20, 27, 45, .75) !important; color: var(--faint) !important; font-size: 9.5px; }
.leaflet-control-attribution a { color: var(--faint) !important; }

.pop { min-width: 272px; max-width: 310px; }
.pop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pop h4 { margin: 0 0 3px; font-size: 14px; letter-spacing: -.1px; }
.pop .pdev { font: 10.5px var(--mono); color: var(--faint); }
.pop-status { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .45px; }
.pop-status.ok { color: #08713f; background: #dff7e9; border: 1px solid #aee6c5; }
.pop-status.bad { color: #9b1c1c; background: #ffe3e3; border: 1px solid #ffc6c6; }
.pop-status.maintenance { color: #8a5608; background: #fff3d8; border: 1px solid #f5d38b; }
.pop-status.not_available { color: #09518a; background: #e7f2ff; border: 1px solid #bdd9f6; }
.pop-summary { margin-top: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pop-summary > div { border: 1px solid #d8e5f1; background: linear-gradient(180deg, #f8fbff, #eef5fb); border-radius: 11px; padding: 8px 9px; }
.pop-summary span { display: block; font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .35px; }
.pop-summary b { display: block; margin-top: 2px; color: var(--text); font-size: 12.5px; }
.pop-summary b .pop-status { display: inline-flex; align-items: center; padding: 3px 7px; font-size: 9.5px; }
.pop-summary small { display: block; margin-top: 3px; color: #6b7d95; font-size: 10px; line-height: 1.25; }
.pop-chips { margin-top: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.pop-chip { min-width: 0; min-height: 48px; border-radius: 11px; border: 1px solid #d8e5f1; padding: 7px 8px; background: #f8fbff; }
.pop-chip span { display: block; color: #50657c; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-chip b { display: block; margin-top: 2px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .35px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-chip small { display: block; margin-top: 1px; color: #6b7d95; font-size: 10px; }
.pop-chip.ok { background: #effaf3; border-color: #bfe8ce; }
.pop-chip.ok b { color: #08713f; }
.pop-chip.data { background: #eef6ff; border-color: #bfd9f5; }
.pop-chip.data b { color: #09518a; }
.pop-chip.bad { background: #fff0f0; border-color: #ffc6c6; }
.pop-chip.bad b { color: #a51f1f; }
.pop-chip.na { background: #f6f8fb; border-color: #d8e0ea; }
.pop-chip.na b { color: #6b7d95; }
.pop .popbtns { margin-top: 11px; display: flex; gap: 8px; }
.pop .popbtns .btn { flex: 1; justify-content: center; }

/* device map marker (gambar truck) */
.dmark { background: transparent; border: 0; overflow: visible !important; }
.dmark .dot-wrap { position: relative; width: 46px; height: 46px; }
.dmark .pulse {
  position: absolute; left: 50%; bottom: 1px; width: 16px; height: 16px;
  margin-left: -8px; border-radius: 50%;
  background: var(--color); animation: pulsering 2.2s ease-out infinite;
}
.dmark.issue .pulse { bottom: 25px; background: #d12f2f; box-shadow: 0 0 14px rgba(209, 47, 47, .65); }
.dmark .issue-wave {
  position: absolute; left: 50%; bottom: 15px; width: 30px; height: 30px;
  margin-left: -15px; border-radius: 50%; border: 3px solid rgba(209, 47, 47, .92);
  background: radial-gradient(circle, rgba(209, 47, 47, .20) 0 28%, rgba(209, 47, 47, 0) 58%);
  box-shadow: 0 0 0 2px rgba(255,255,255,.28), 0 0 18px rgba(209, 47, 47, .42);
  animation: issuewave 2.2s ease-out infinite; pointer-events: none;
}
.dmark .issue-wave.w2 { animation-delay: .55s; border-color: rgba(209, 47, 47, .78); box-shadow: 0 0 0 2px rgba(255,255,255,.18), 0 0 18px rgba(209, 47, 47, .34); }
.dmark .issue-wave.w3 { animation-delay: 1.1s; border-color: rgba(209, 47, 47, .62); }
.dmark .core { position: absolute; inset: 0 0 2px 0; display: flex; align-items: flex-end; justify-content: center; }
.dmark .core img.timg { width: 42px; height: 28px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
.dmark.issue .core img.timg { filter: drop-shadow(0 4px 7px rgba(0,0,0,.72)) drop-shadow(0 0 8px rgba(209,47,47,.55)); }
.dmark.off .pulse { animation: none; opacity: .5; }
.dmark.off .core img.timg { opacity: .8; filter: grayscale(1) drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
.dmark.off.issue .pulse { animation: pulsering 1.8s ease-out infinite; opacity: 1; }
.dmark.off.issue .core img.timg { opacity: .9; filter: grayscale(.55) drop-shadow(0 4px 7px rgba(0,0,0,.72)) drop-shadow(0 0 8px rgba(209,47,47,.55)); }
.dmark.inactive .pulse { animation: none; opacity: .9; box-shadow: 0 0 10px rgba(0,0,0,.25); }
.dmark.inactive .core img.timg { opacity: .72; filter: grayscale(.45) drop-shadow(0 3px 4px rgba(0,0,0,.55)); }
.dmark .note {
  position: absolute; top: -3px; right: -6px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--red); border: 2px solid #0c1220;
  color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center;
}

/* cluster marker (grouping unit di zoom rendah) */
.dcluster { background: transparent; border: 0; overflow: visible !important; }
.dcluster .cluster-core {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; font-family: var(--mono);
  color: #fff; letter-spacing: .2px;
  background: rgba(18, 33, 55, .92);
  border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .45), inset 0 0 0 3px rgba(255, 255, 255, .16);
}
.dcluster.issue .cluster-core { background: rgba(209, 47, 47, .94); box-shadow: 0 3px 12px rgba(209, 47, 47, .55), inset 0 0 0 3px rgba(255, 255, 255, .18); }
.dcluster.offline .cluster-core { background: rgba(226, 148, 28, .95); box-shadow: 0 3px 12px rgba(226, 148, 28, .5), inset 0 0 0 3px rgba(255, 255, 255, .18); }
.dcluster.ok .cluster-core { background: rgba(18, 131, 74, .94); box-shadow: 0 3px 12px rgba(18, 131, 74, .5), inset 0 0 0 3px rgba(255, 255, 255, .18); }
.dcluster .cluster-note {
  position: absolute; top: -4px; right: -4px; width: 16px; height: 16px;
  border-radius: 50%; background: #d12f2f; border: 2px solid #fff;
  color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 0 8px rgba(209, 47, 47, .6);
  animation: note-blink 1.4s ease-in-out infinite;
}
@keyframes note-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
.dcluster::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  margin: -22px 0 0 -22px; border-radius: 50%; pointer-events: none;
  animation: cluster-ring 2.4s ease-out infinite;
  border: 2px solid rgba(255, 255, 255, .35);
}
@keyframes cluster-ring {
  0% { transform: scale(.6); opacity: .9; }
  70% { transform: scale(1.45); opacity: 0; }
  100% { opacity: 0; }
}
@keyframes pulsering {
  0% { transform: scale(.55); opacity: .85; }
  70% { transform: scale(1.55); opacity: 0; }
  100% { opacity: 0; }
}
@keyframes issuewave {
  0% { transform: scale(.35); opacity: 1; }
  55% { opacity: .42; }
  100% { transform: scale(2.65); opacity: 0; }
}

/* track + vehicle */
.veh-wrap { position: relative; width: 34px; height: 34px; }
.veh-core {
  position: absolute; inset: 1px; display: grid; place-items: center;
  transition: transform .3s linear;
}
.veh-core img.timg { height: 34px; width: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,.65)); }

/* ------------------------------------------------------------------ drawer */
.drawer {
  position: absolute; top: 61px; right: 0; bottom: 0; z-index: 100;
  width: 460px; max-width: calc(100vw - 330px);
  background: var(--panel); border: 1px solid var(--border-2); border-right: 0; border-bottom: 0; border-radius: var(--radius) 0 0 var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  animation: slidein .18s ease-out;
}
.drawer.wide { width: 566px; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* detail workspace: More details menggantikan area peta, bukan drawer kecil */
body.detail-mode .fleet,
body.detail-mode .basemap { display: none; }
body.detail-mode .drawer {
  position: absolute; top: 58px; left: 312px; right: 0; bottom: 0;
  width: auto; max-width: none; border-radius: 0; border-top: 0; border-right: 0; border-bottom: 0;
  z-index: 900; animation: none;
}
body.detail-mode.sb-off .drawer { left: 64px; }
body.detail-mode .drawer.wide { width: auto; }
body.detail-mode .dr-head { min-height: 64px; }
body.detail-mode .dr-body { padding: 18px 22px; background: #f6f9fd; }
body.detail-mode .tabs { position: sticky; top: -18px; z-index: 2; background: #f6f9fd; padding-top: 2px; }
body.detail-mode #map { filter: saturate(.75) opacity(.2); }
body.detail-mode .menu.range-menu { position: fixed; top: 50px; right: 190px; z-index: 2200; }
.dr-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border); background: var(--panel-2);
  min-width: 0;
}
.dr-head .back { font-size: 18px; color: var(--muted); cursor: pointer; background: none; border: 0; padding: 2px 6px; border-radius: 7px; }
.dr-head .back:hover { color: var(--text); background: var(--panel-3); }
.dr-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; overflow: hidden; flex-wrap: wrap; min-width: 0; flex: 1 1 auto; }
.dr-head h3 .dname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-head h3 .dr-sub { font: 10.5px var(--mono); color: var(--faint); font-weight: 400; display: block; width: 100%; }
.dr-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--panel-3); border: 1px solid var(--border-2); flex: 0 0 40px; }
.dr-ic svg { width: 30px; height: 15px; }
.dr-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; position: relative; flex: 0 0 auto; }
.dr-actions .btn { height: 30px; padding: 0 13px; white-space: nowrap; }
.dr-actions .btn.icon { width: 30px; padding: 0; justify-content: center; }
.dr-body { flex: 1; overflow-y: auto; padding: 14px; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

@media (max-width: 760px) {
  .drawer:not(.wide) .dr-actions {
    width: 100%; justify-content: flex-end; margin-left: 50px;
  }
}

/* stream chips (sidebar) */
.schips { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; max-height: 42px; overflow: hidden; }
.schip {
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px; padding: 1px 7px;
  border-radius: 999px; text-transform: uppercase;
}
.schip.checkfire { color: #ff9a5a; background: rgba(245, 124, 31, .14); border: 1px solid rgba(245, 124, 31, .45); }
.schip.hourmeter { color: var(--cyan); background: rgba(56, 207, 224, .12); border: 1px solid rgba(56, 207, 224, .4); }
.schip.gps { color: var(--accent-2); background: rgba(79, 140, 255, .12); border: 1px solid rgba(79, 140, 255, .4); }
.schip.muster { color: #b87500; background: rgba(244, 196, 0, .16); border: 1px solid rgba(244, 196, 0, .55); }
.schip.g2_lube { color: #12834a; background: rgba(18, 131, 74, .12); border: 1px solid rgba(18, 131, 74, .35); }
.schip.flowmec { color: #007f92; background: rgba(0, 127, 146, .12); border: 1px solid rgba(0, 127, 146, .35); }
.schip.tpms { color: #8a5608; background: rgba(245, 165, 36, .16); border: 1px solid rgba(245, 165, 36, .45); }
.schip.payload { color: #6d3bbd; background: rgba(109, 59, 189, .12); border: 1px solid rgba(109, 59, 189, .35); }

/* panel per-stream dengan batas yang jelas */
.panel {
  border: 1px solid var(--border-2); border-radius: 12px;
  padding: 12px 14px; margin-top: 14px; background: var(--panel-2);
}
.panel > h5 {
  margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .4px;
  display: flex; align-items: center; gap: 7px; text-transform: uppercase;
}
.panel > h5 svg { width: 15px; height: 15px; flex: 0 0 15px; }
.panel > h5::after { content: ""; flex: 1; height: 1px; margin-left: 6px; background: var(--border); }
.panel.fire { border-color: rgba(245, 124, 31, .45); }
.panel.fire > h5 { color: #ff9a5a; }
.panel.hm { border-color: rgba(56, 207, 224, .4); }
.panel.hm > h5 { color: var(--cyan); }
.panel.gps { border-color: rgba(79, 140, 255, .45); }
.panel.gps > h5 { color: var(--accent-2); }
.panel.gw { border-color: rgba(143, 160, 189, .35); }
.panel.gw > h5 { color: var(--muted); }
.panel .section { margin-top: 10px; }
.panel .section:first-of-type { margin-top: 6px; }
.panel .section > h5 { text-transform: none; letter-spacing: .3px; color: var(--text); font-size: 12px; font-weight: 600; }
.p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.p-grid .metric {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 11px;
}
.p-grid .metric span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.p-grid .metric b { font-size: 14px; font-weight: 650; word-break: break-word; }

/* overview grid */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.ov-grid .metric {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px;
}
.ov-grid .metric span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.ov-grid .metric b { font-size: 15px; font-weight: 650; }
.ov-grid .metric .sub { font-size: 11px; color: var(--faint); }
.section { margin-top: 16px; }
.section > h5 {
  margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); display: flex; align-items: center; gap: 6px;
}
.section > h5::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* event rows / tables */
.evlist { display: flex; flex-direction: column; gap: 6px; }
.ev {
  display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
}
.ev .sev { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 9px; }
.ev .ev-main { flex: 1; min-width: 0; }
.ev .ev-t { font-size: 12px; font-weight: 600; }
.ev .ev-d { font-size: 11.5px; color: var(--muted); }
.ev .ev-x { font: 10.5px var(--mono); color: var(--faint); white-space: nowrap; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border-2); }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; font-family: var(--mono); font-size: 11px; }
.tbl tr:hover td { background: var(--panel-2); }
.tbl td:first-child { font-family: var(--mono); }
.g2-activity-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.g2-activity-grid .tbl { min-width: 0; }
.g2-run-total { color: var(--muted); font-size: 11.5px; margin: 0 0 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 7px 12px; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer;
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent-2); border-bottom-color: var(--accent); font-weight: 600; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 12px 0 4px; }
.pager .info { font-size: 11.5px; color: var(--muted); }
.seg-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border-2); border-radius: 999px; background: var(--panel-2); margin: 0 0 10px; }
.seg-tabs button { border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.seg-tabs button.on { background: #006fd6; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.table-headline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.table-headline b { font-size: 15px; }
.table-headline span { color: var(--muted); font-size: 12px; }
.filters-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.filters-row select { flex: 1; min-width: 110px; }

/* charts */
.chart-box { position: relative; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 6px; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-title { font-size: 11px; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .5px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart-note { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.chart-note.warn { color: var(--amber); font-weight: 600; }
.chart-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.fchip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 11px; border: 1px solid var(--border-2); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 4px 12px; cursor: pointer; user-select: none; transition: background .12s ease, color .12s ease, border-color .12s ease, opacity .12s ease; }
.fchip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.fchip:hover { border-color: var(--accent-2); color: #dfe8f7; }
.fchip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 2px 10px rgba(79, 140, 255, .38); }
.fchip.on i { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4); }
.fchip.off { opacity: .45; }
.fchip.off i { opacity: .55; filter: saturate(.25); }
.ctip { position: absolute; pointer-events: none; background: rgba(10, 17, 30, .95); border: 1px solid #2c3a57; color: #dfe8f7; font-size: 11px; border-radius: 8px; padding: 7px 10px; z-index: 30; box-shadow: 0 10px 26px rgba(0, 0, 0, .38); max-width: 240px; }
.ctip-t { color: #9fb1cf; font: 10px var(--mono); margin-bottom: 5px; white-space: nowrap; }
.ctip-row { display: flex; align-items: baseline; gap: 6px; padding: 1px 0; white-space: nowrap; }
.ctip-row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; align-self: center; }
.ctip-row b { margin-left: auto; padding-left: 10px; font-family: var(--mono); font-weight: 600; }

/* replay */
.rp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.rp-gapnote { font-size: 11.5px; margin: 0 0 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rp-gapbadge { display: inline-flex; align-items: center; gap: 5px; background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(245, 165, 36, .45); border-radius: 999px; padding: 4px 10px; font-weight: 700; }
.rp-gapbadge.ok { background: rgba(47, 197, 106, .10); color: #2fc56a; border-color: rgba(47, 197, 106, .35); }
.rp-seglist { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
.rp-seglist-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.rp-seg { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 9px; }
.rp-seg-info { min-width: 0; }
.rp-seg-info b { font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-seg-info span { font-size: 10.5px; color: var(--muted); }
.rp-seg .btn { padding: 5px 11px; font-size: 12px; }
.rp-seglist .rp-seg-more { margin: 2px auto 0; }
.rp-capnote { font-size: 11.5px; color: var(--muted); margin: 0 0 10px; padding: 8px 10px; background: var(--panel-2); border: 1px dashed var(--border); border-radius: 8px; line-height: 1.45; }
.rp-stats .metric { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; text-align: center; }
.rp-stats .metric b { display: block; font-size: 14px; }
.rp-stats .metric span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.rp-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rp-controls input[type=range] { flex: 1; min-width: 140px; accent-color: var(--accent); }
.rp-times { font: 11px var(--mono); color: var(--muted); margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; }
.rp-time-now { color: var(--accent-2); font-weight: 600; }

/* replay floating bar */
.replaybar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 18px; z-index: 110; width: min(720px, calc(100vw - 360px));
  background: rgba(255, 255, 255, .94); border: 1px solid #c9d8e8; border-radius: 18px;
  box-shadow: 0 18px 46px rgba(3, 59, 112, .20); padding: 12px 14px 13px;
  backdrop-filter: blur(10px);
}
.replaybar::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 3px; border-radius: 999px; background: linear-gradient(90deg, #033b70, #4f8cff 58%, #f4c400); }
.replaybar .rb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.replaybar .rb-title { font-weight: 800; font-size: 13px; display: flex; gap: 8px; align-items: center; color: #102033; }
.replaybar .rb-title b { color: #033b70; font-family: var(--mono); }
.replaybar .rb-dot { width: 9px; height: 9px; border-radius: 50%; background: #4f8cff; box-shadow: 0 0 0 4px rgba(79, 140, 255, .16); }
.replaybar .rb-spacer { flex: 1; }
.replaybar input[type=range] { width: 100%; accent-color: #033b70; cursor: pointer; }
.replaybar .rb-times { display: flex; justify-content: space-between; margin-top: 4px; color: #53667d; font: 11px var(--mono); }
.replaybar .rb-gap { margin-top: 5px; color: #d88b00; font-size: 11px; font-weight: 700; }
.replaybar .rb-ctrl { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.replaybar .rb-op { color: #53667d; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.replaybar select { height: 34px; border-radius: 9px; border-color: #c7d5e6; background: #fff; color: #102033; }
.replaybar .rb-speed { display: grid; justify-items: end; line-height: 1.05; color: #718399; font-size: 10px; text-transform: uppercase; letter-spacing: .35px; }
.replaybar .rb-speed b { margin-top: 3px; color: #033b70; font: 800 14px var(--mono); text-transform: none; letter-spacing: 0; }

/* toasts */
.toast {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 1300; background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 9px 16px; font-size: 12.5px; box-shadow: var(--shadow);
  animation: slidein .15s ease-out;
}
.toast.ok { border-color: rgba(47,197,106,.5); }
.toast.err { border-color: rgba(239,68,68,.5); color: #ffb3b3; }

.empty { padding: 26px 10px; text-align: center; color: var(--faint); font-size: 12.5px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- visual refresh */
#topbar {
  background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(9, 14, 25, .98));
  border-bottom-color: rgba(58, 75, 109, .65);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
  position: relative; z-index: 2300;
}
.brand { gap: 12px; }
.logo-int { height: 34px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .25)); }
.brand-txt h1 { font-size: 16px; color: #fff; }
.brand-txt span { color: var(--faint); }
.gw-pill {
  background: rgba(23, 32, 51, .92); border-color: rgba(58, 75, 109, .75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.gw-pill.bad { color: #ffd1d1; border-color: rgba(239, 68, 68, .38); background: rgba(63, 24, 34, .72); }
.gw-pill.good { color: #d6ffe5; border-color: rgba(47, 197, 106, .32); background: rgba(19, 57, 42, .62); }
.btn, select, input[type=text], input[type=search], input[type=datetime-local] {
  background: rgba(23, 32, 51, .94); border-color: rgba(58, 75, 109, .78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.btn { min-height: 34px; font-weight: 520; }
.btn:hover, select:hover, input[type=text]:hover, input[type=search]:hover, input[type=datetime-local]:hover {
  border-color: rgba(106, 161, 255, .75); background: rgba(32, 44, 67, .96);
}
.btn:focus-visible, select:focus-visible, input:focus-visible, .chip:focus-visible, .ds-item:focus-visible {
  outline: 3px solid var(--ring); outline-offset: 2px;
}
.btn.primary {
  background: linear-gradient(180deg, #5b98ff, #3f7eef); border-color: #77a9ff;
  box-shadow: 0 8px 20px rgba(79, 140, 255, .2);
}
.clock { color: var(--muted); }
.menu {
  background: rgba(17, 24, 39, .98); border-color: rgba(71, 85, 122, .85);
  border-radius: 13px; box-shadow: var(--shadow);
}

.fleet {
  background: rgba(255,255,255,.96); border-color: #c7d5e6;
  border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.fl-head { padding: 8px 10px; }
.fl-head b { color: #22354b; }
.fl-mini { color: var(--muted); }
.fleet .fl-body { padding: 5px 14px 14px; gap: 14px; }
.fl-tag { font-size: 12.5px; font-weight: 700; }
.fl-tag.bad { color: #7d5400; }
.ds-item {
  background: #f7fbff; border-color: #d5e0ec;
  border-radius: 9px; padding: 4px 10px; min-width: 58px;
}
.ds-item:hover { transform: translateY(-1px); border-color: rgba(106, 161, 255, .65); }
.ds-item.hot { background: rgba(79, 140, 255, .12); box-shadow: 0 0 0 1px rgba(79, 140, 255, .4); }
.ds-item b { font-size: 15px; }
.ds-item span { color: #718399; font-size: 9px; }
.basemap { background: rgba(17, 24, 39, .92); border-color: rgba(71, 85, 122, .72); border-radius: 13px; }
.basemap button { padding: 6px 12px; }
.basemap button.on { background: rgba(79, 140, 255, .26); box-shadow: inset 0 0 0 1px rgba(106, 161, 255, .25); }

#sidebar { background: #0e1524; border-right-color: rgba(58, 75, 109, .65); }
.side-head { padding: 12px; background: rgba(17, 24, 39, .75); border-bottom-color: rgba(58, 75, 109, .55); }
#q-dev { min-height: 38px; border-radius: 11px; }
.chip { padding: 6px 11px; background: rgba(23, 32, 51, .8); border-color: rgba(58, 75, 109, .7); }
.chip:hover { border-color: rgba(106, 161, 255, .55); background: rgba(32, 44, 67, .95); }
.chip.on { background: rgba(79, 140, 255, .22); border-color: rgba(106, 161, 255, .75); }
.side-body { padding: 10px; }
.side-foot { border-top-color: rgba(58, 75, 109, .55); background: rgba(17, 24, 39, .7); }
.dev {
  background: linear-gradient(180deg, rgba(23, 32, 51, .98), rgba(17, 24, 39, .98));
  border-color: rgba(58, 75, 109, .58); border-radius: 14px; padding: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}
.dev:hover { transform: translateY(-1px); border-color: rgba(106, 161, 255, .58); }
.dev.sel { border-color: rgba(106, 161, 255, .9); box-shadow: 0 0 0 1px rgba(79, 140, 255, .35); }
.dev.alarm-live { border-left: 4px solid var(--red); }
.issue-line { color: #ffb3b3; background: rgba(209, 47, 47, .13); border-color: rgba(239, 68, 68, .35); }
.dev .dicon { width: 34px; height: 34px; border-radius: 11px; background: rgba(13, 19, 32, .86); }
.dev .dname { font-size: 13.5px; color: #fff; }
.dev .ddev { color: var(--faint); margin-top: 1px; }
.badge { padding: 3px 8px; font-size: 10px; border: 1px solid transparent; }
.badge.green { border-color: rgba(47, 197, 106, .25); }
.badge.red { border-color: rgba(239, 68, 68, .28); }
.badge.amber { border-color: rgba(245, 165, 36, .28); }
.dev .metric, .p-grid .metric, .ov-grid .metric, .rp-stats .metric {
  background: rgba(13, 19, 32, .62); border-color: rgba(58, 75, 109, .56); border-radius: 11px;
}

.drawer {
  background: rgba(17, 24, 39, .98); border-color: rgba(71, 85, 122, .78);
  border-radius: 18px; box-shadow: var(--shadow);
}
.dr-head {
  padding: 14px 15px; background: linear-gradient(180deg, rgba(23, 32, 51, .98), rgba(17, 24, 39, .98));
  border-bottom-color: rgba(58, 75, 109, .58);
}
.dr-ic { border-radius: 13px; background: rgba(13, 19, 32, .7); }
.dr-head h3 { color: #fff; }
.dr-body { padding: 16px; }
.panel, .chart-box {
  background: linear-gradient(180deg, rgba(23, 32, 51, .92), rgba(17, 24, 39, .92));
  border-color: rgba(58, 75, 109, .68); border-radius: 15px;
}
.section > h5, .panel > h5 { color: #dbe7fb; }
.tabs { gap: 6px; border-bottom-color: rgba(58, 75, 109, .55); }
.tab { border-radius: 9px 9px 0 0; }
.tab:hover { background: rgba(79, 140, 255, .08); }
.tab.on { background: rgba(79, 140, 255, .12); }
.ev { background: rgba(13, 19, 32, .55); border-color: rgba(58, 75, 109, .55); border-radius: 11px; }
.tbl th { color: #bcc9df; border-bottom-color: rgba(58, 75, 109, .72); }
.tbl td { border-bottom-color: rgba(58, 75, 109, .4); }

.leaflet-bar a { background: rgba(17, 24, 39, .94) !important; border-color: rgba(71, 85, 122, .72) !important; }
.leaflet-control-attribution { border-radius: 8px 0 0 0; }
.leaflet-popup-content-wrapper { border-radius: 15px; }
.dmark .core img.timg { filter: drop-shadow(0 5px 8px rgba(0,0,0,.8)); }

.alert-banner, .toast {
  background: rgba(17, 24, 39, .98); border-color: rgba(71, 85, 122, .78); border-radius: 14px;
}
.alarm-consent { background: rgba(7, 11, 20, .62); }
.alarm-consent-card {
  width: min(480px, calc(100vw - 32px)); display: grid; grid-template-columns: 42px 1fr; gap: 14px;
  padding: 20px; background: linear-gradient(180deg, #172033, #111827);
  border-color: rgba(106, 161, 255, .38); border-radius: 16px;
}
.alarm-consent-icon { display: grid; }
.alarm-consent h2 { margin-top: 1px; font-size: 17px; color: #fff; }
.alarm-consent p { line-height: 1.55; }
.alarm-consent-actions { grid-column: 1 / -1; margin-top: 2px; }

@media (max-width: 980px) {
  #sidebar { width: 250px; flex-basis: 250px; }
  .toolbar .field:not(.range-field) { display: none; }
  .drawer { max-width: calc(100vw - 270px); }
  #topbar { gap: 10px; padding: 0 10px; }
  .brand-txt span { display: none; }
  .brand-txt h1 { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
  .top-powered { display: none; }
  .toolbar { gap: 7px; }
  .clock { display: none; }
  #btn-download span { display: none; }
  body.detail-mode .drawer { left: 250px; }
  .admin-body { grid-template-columns: 1fr; }
  .admin-body[data-tab="integrations"] { grid-template-columns: 1fr; }
  .admin-card { width: 100%; height: calc(100vh - 24px); }
  .admin-access-grid { grid-template-columns: 1fr; }
  .admin-user-create { grid-template-columns: 1fr; }
  .admin-org-create { grid-template-columns: 1fr; }
  .admin-user-row { grid-template-columns: 42px 1fr; }
  .aur-meta, .aur-actions { grid-column: 2 / -1; }
  .aur-actions { justify-content: flex-start; }
  .ued-grid, .ued-reset { grid-template-columns: 1fr; }
  .de-toolbar input { flex-basis: 100%; }
  .rp-summary { grid-template-columns: repeat(3, 1fr); }
  .ic-summary { grid-template-columns: repeat(3, 1fr); }
  .ic-body { grid-template-columns: 1fr; grid-template-rows: 38vh minmax(0, 1fr); }
  .ic-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 38vh; }
  .ic-detail { min-height: 0; }
  .g2-activity-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  #topbar { height: 58px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  #topbar::-webkit-scrollbar { display: none; }
  .layout { height: calc(100vh - 58px); }
  .brand { flex: 0 0 auto; }
  .logo-int { height: 28px; }
  .logo-irys { height: 26px; }
  .brand-txt h1 { max-width: 118px; font-size: 13px; }
  .gw-pill { width: 34px; height: 34px; padding: 0; justify-content: center; flex: 0 0 34px; overflow: hidden; }
  .gw-pill .gw-txt { display: none; }
  .toolbar { flex: 0 0 auto; }
  .range-field label { display: none; }
  .range-btn { min-width: 118px; max-width: 150px; }
  .range-btn #range-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu.range-menu { position: fixed; top: 62px; left: 10px; right: 10px; width: auto; }
  .dl-wrap .menu, .alert-wrap .menu.alert-menu, .account-wrap .menu.account-menu { position: fixed; top: 62px; left: auto; right: 10px; }
  .btn.icon { padding-left: 8px; padding-right: 8px; }
  .fleet { top: 10px; left: 10px; right: 10px; min-width: 0; max-width: none; }
  .fleet .fl-body { align-items: flex-start; }
  .fl-left, .fl-pie { width: 82px; height: 82px; flex-basis: 82px; }
  .fl-pct { font-size: 15px; }
  .ds-item { flex: 1; min-width: 72px; }
  .drawer { left: 10px; right: 10px; top: 68px; bottom: 10px; width: auto; max-width: none; }
  .data-explorer { inset: 58px 0 0; }
  .reports-page { inset: 58px 0 0; }
  .issues-page { inset: 58px 0 0; }
  .de-card { border-radius: 0; }
  .rp-card { border-radius: 0; }
  .ic-card { border-radius: 0; }
  .de-head, .de-toolbar, .de-summary { padding-left: 10px; padding-right: 10px; }
  .rp-head, .rp-toolbar, .rp-summary { padding-left: 10px; padding-right: 10px; }
  .ic-head, .ic-toolbar, .ic-summary { padding-left: 10px; padding-right: 10px; }
  .de-toolbar select, .de-toolbar .btn { flex: 1 1 120px; }
  .rp-summary { grid-template-columns: repeat(2, 1fr); }
  .ic-summary { grid-template-columns: repeat(2, 1fr); }
  .ic-fields { grid-template-columns: 1fr; }
  .ic-action-form { grid-template-columns: 1fr; }
  body.detail-mode #sidebar { display: none; }
  body.detail-mode .drawer {
    top: 58px; left: 0; right: 0; bottom: 0; border-left: 0; border-radius: 0;
  }
  body.detail-mode.sb-off .drawer { left: 0; }
  body.detail-mode .dr-body { padding: 14px; }
  body.detail-mode .tabs { top: -14px; overflow-x: auto; flex-wrap: nowrap; }
  .alert-banner { top: 68px; width: calc(100vw - 24px); align-items: flex-start; }
  .alert-banner .ab-actions { flex-direction: column; }
  .alarm-consent-card { grid-template-columns: 1fr; padding: 18px; gap: 10px; }
  .alarm-consent-icon { width: 38px; height: 38px; }
  .alarm-consent-actions { grid-column: auto; flex-direction: column-reverse; margin-top: 8px; }
  .alarm-consent-actions .btn { justify-content: center; }
  .replaybar { width: calc(100vw - 20px); bottom: 10px; }
  .admin-modal { padding: 8px; place-items: stretch; }
  .admin-card { max-height: calc(100vh - 16px); border-radius: 14px; }
  .admin-head, .admin-body, .admin-actions { padding-left: 12px; padding-right: 12px; }
  .admin-module { grid-template-columns: auto 1fr; }
  .admin-module input[data-stream] { grid-column: 1 / -1; }
  .admin-user-create { grid-template-columns: 1fr; }
  .admin-actions { flex-wrap: wrap; }
  #admin-hint { width: 100%; }
}

/* ---------------------------------------------------------------- INTECS theme */
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --panel-3: #eef4fb;
  --border: #d8e2ef;
  --border-2: #b9c9dc;
  --text: #102033;
  --muted: #53667d;
  --faint: #7b8ca1;
  --accent: #033b70;
  --accent-2: #075ca8;
  --green: #12834a;
  --green-bg: rgba(18, 131, 74, .12);
  --red: #d12f2f;
  --red-bg: rgba(209, 47, 47, .11);
  --amber: #d88b00;
  --amber-bg: rgba(216, 139, 0, .13);
  --cyan: #007f92;
  --info: #033b70;
  --shadow: 0 18px 48px rgba(12, 35, 64, .17);
  --shadow-soft: 0 8px 24px rgba(12, 35, 64, .12);
  --ring: rgba(3, 59, 112, .24);
}

body { background: linear-gradient(180deg, #f8fbff, #eef4fb); color: var(--text); }
#topbar {
  background: linear-gradient(180deg, #ffffff, #f3f7fc);
  border-bottom-color: #d6e1ed; box-shadow: 0 8px 28px rgba(12, 35, 64, .08);
}
#topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: linear-gradient(90deg, #033b70 0 72%, #f4c400 72% 100%);
}
.logo-int { filter: none; }
.brand-txt h1 { color: #102033; }
.brand-txt span { color: #6b7d92; }
.gw-pill, .btn, select, input[type=text], input[type=search], input[type=datetime-local] {
  background: #ffffff; color: var(--text); border-color: #c9d6e6;
  box-shadow: 0 1px 2px rgba(12, 35, 64, .04);
}
.gw-pill.bad { color: #9d1d1d; background: #fff2f2; border-color: #f0b5b5; }
.gw-pill.good { color: #0f6f3f; background: #effbf4; border-color: #a8dcc0; }
.btn:hover, select:hover, input[type=text]:hover, input[type=search]:hover, input[type=datetime-local]:hover {
  background: #f7fbff; border-color: #5f9ed8;
}
.btn.primary {
  background: linear-gradient(180deg, #075ca8, #033b70); border-color: #033b70;
  color: #fff; box-shadow: 0 8px 20px rgba(3, 59, 112, .2);
}
.btn.primary:hover { background: linear-gradient(180deg, #0b6ebd, #044b8f); }
.clock { color: #6b7d92; }
.menu, .alert-menu {
  background: #ffffff; border-color: #c7d5e6; box-shadow: var(--shadow);
}
.menu .mi:hover { background: #eef4fb; }
.menu .mi.on { background: rgba(3, 59, 112, .1); color: #033b70; }

.fleet, .drawer, .alert-banner, .toast, .replaybar, .alarm-consent-card {
  background: rgba(255, 255, 255, .96); color: var(--text); border-color: #c7d5e6;
  box-shadow: var(--shadow); backdrop-filter: none;
}
.fl-head b, .section > h5, .panel > h5 { color: #22354b; }
.fl-mini, .ds-item span, .dev .ddev, .dev .meta .coords, .hint { color: #718399; }
.fl-tag.bad { color: #7d5400; }
.ds-item, .dev .metric, .p-grid .metric, .ov-grid .metric, .rp-stats .metric {
  background: #f7fbff; border-color: #d5e0ec; color: var(--text);
}
.ds-item.hot { background: rgba(3, 59, 112, .08); border-color: #033b70; box-shadow: 0 0 0 1px rgba(3, 59, 112, .35); }
.ds-item:hover { border-color: #5f9ed8; }
.ds-item.bad.live b { color: #d12f2f; }
.ds-item.warn.live b { color: #b87500; }
.fl-pct { color: #8a8f99; }
.basemap { background: #ffffff; border-color: #c7d5e6; box-shadow: var(--shadow-soft); }
.basemap button { color: #53667d; }
.basemap button.on {
  color: #033b70; background: linear-gradient(180deg, #fff7cf, #eaf4ff);
  box-shadow: inset 0 0 0 1px rgba(244, 196, 0, .45);
}

#sidebar { background: #f3f7fc; border-right-color: #d6e1ed; }
.side-head, .side-foot { background: #ffffff; border-color: #d6e1ed; }
.chip { color: #53667d; background: #ffffff; border-color: #c9d6e6; }
.chip:hover { color: #102033; background: #f7fbff; border-color: #5f9ed8; }
.chip.on { color: #033b70; background: #fff7cf; border-color: #f4c400; }
.side-module-filter { border-top-color: #d6e1ed; }
.smf-head span { color: #53667d; }
.smf-head button { color: #033b70; }
.mf-chip { color: #53667d; background: #ffffff; border-color: #c9d6e6; }
.mf-chip.on { color: #033b70; background: #eef6ff; border-color: #5f9ed8; }
.dev {
  background: #ffffff; border-color: #d7e2ee; color: var(--text);
  box-shadow: 0 8px 20px rgba(12, 35, 64, .07);
}
.dev:hover { border-color: #5f9ed8; }
.dev.sel { background: #f2f8ff; border-color: #033b70; box-shadow: 0 0 0 1px rgba(3, 59, 112, .25); }
.dev .dicon, .dr-ic { background: #eef4fb; border-color: #d5e0ec; }
.dev .dicon {
  overflow: visible; background: linear-gradient(180deg, #fff8d8, #eef4fb);
  border-color: rgba(244, 196, 0, .6);
}
.dev .dicon.map-mini { background: transparent; border-color: transparent; }
.dev .dicon.map-mini .dot-wrap { position: relative; width: 34px; height: 34px; transform: scale(.86); transform-origin: center; }
.dev .dicon.map-mini .pulse {
  position: absolute; left: 50%; bottom: 1px; width: 16px; height: 16px;
  margin-left: -8px; border-radius: 50%; background: var(--color);
  animation: pulsering 2.2s ease-out infinite;
}
.dev .dicon.map-mini .core { position: absolute; inset: 0 0 2px 0; display: flex; align-items: flex-end; justify-content: center; }
.dev .dicon.map-mini img.timg { width: 30px; height: 24px; object-fit: contain; display: block; filter: drop-shadow(0 3px 4px rgba(3, 59, 112, .32)); }
.dev .dicon.map-mini.off .pulse { animation: none; opacity: .5; }
.dev .dicon.map-mini.off img.timg { filter: grayscale(1) opacity(.8) drop-shadow(0 3px 4px rgba(3, 59, 112, .2)); }
.dr-ic.map-mini { background: transparent; border-color: transparent; overflow: visible; }
.dr-ic.map-mini .dot-wrap { position: relative; width: 34px; height: 40px; }
.dr-ic.map-mini .pulse {
  position: absolute; left: 50%; bottom: 1px; width: 16px; height: 16px;
  margin-left: -8px; border-radius: 50%; background: var(--color);
  animation: pulsering 2.2s ease-out infinite;
}
.dr-ic.map-mini .core { position: absolute; inset: 0 0 2px 0; display: flex; align-items: flex-end; justify-content: center; }
.dr-ic.map-mini img.timg { height: 34px; width: auto; display: block; filter: drop-shadow(0 3px 4px rgba(3, 59, 112, .32)); }
.dr-ic.map-mini.off .pulse { animation: none; opacity: .5; }
.dr-ic.map-mini.off img.timg { filter: grayscale(1) opacity(.8) drop-shadow(0 3px 4px rgba(3, 59, 112, .2)); }
.dev .dname, .dr-head h3 { color: #102033; }
.badge.green { color: #0f6f3f; background: #e9f8ef; border-color: #b9e1c9; }
.badge.red { color: #a72323; background: #fff0f0; border-color: #f0b5b5; }
.badge.amber { color: #8b5a00; background: #fff7e6; border-color: #eed08b; }
.badge.blue { color: #075ca8; background: #eaf4ff; border-color: #b9d7f5; }

.drawer { background: #ffffff; }
.dr-head { background: linear-gradient(180deg, #ffffff, #f6f9fd); border-bottom-color: #d6e1ed; }
.dr-head .back:hover { background: #eef4fb; }
.dr-body { background: #f6f9fd; }
.panel, .chart-box, .ev {
  background: #ffffff; border-color: #d7e2ee; color: var(--text);
  box-shadow: 0 6px 16px rgba(12, 35, 64, .045);
}
.panel.fire { border-color: rgba(216, 139, 0, .35); }
.panel.fire > h5 { color: #b87500; }
.panel.hm { border-color: rgba(0, 127, 146, .3); }
.panel.hm > h5 { color: #007f92; }
.panel.gps { border-color: rgba(3, 59, 112, .35); }
.panel.gps > h5 { color: #033b70; }
.tabs, .tbl th, .tbl td, .section > h5::after, .panel > h5::after { border-color: #d7e2ee; }
.tab { color: #53667d; }
.tab:hover { color: #033b70; background: rgba(3, 59, 112, .07); }
.tab.on { color: #033b70; background: rgba(3, 59, 112, .08); border-bottom-color: #f4c400; }
.tbl tr:hover td { background: #f4f8fd; }

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #ffffff; color: var(--text); border-color: #c7d5e6; }
.leaflet-bar a { background: #ffffff !important; color: #102033 !important; border-color: #c7d5e6 !important; }
.leaflet-control-attribution { background: rgba(255, 255, 255, .86) !important; color: #53667d !important; }
.leaflet-control-attribution a { color: #033b70 !important; }

.alert-banner { border-left-color: #d12f2f; }
.alert-banner .ab-txt b { color: #a72323; }
.toast.ok { border-color: #8fd2ad; }
.toast.err { border-color: #f0b5b5; color: #a72323; }
.alarm-consent { background: rgba(16, 32, 51, .18); }
.alarm-consent-card { background: #ffffff; border-color: #9fc3e6; box-shadow: 0 18px 48px rgba(3, 59, 112, .18); }
.alarm-consent-card::before {
  content: ""; grid-column: 1 / -1; height: 4px; margin: -20px -20px 10px;
  background: linear-gradient(90deg, #033b70 0 72%, #f4c400 72% 100%); border-radius: 16px 16px 0 0;
}
.alarm-consent h2 { color: #102033; }
.alarm-consent .alarm-consent-note { color: #53667d; }
.alarm-consent-icon { color: #a72323; background: #fff0f0; border-color: #f0b5b5; }

@media (max-width: 520px) {
  #topbar { background: #ffffff; }
  .gw-pill.bad { background: #fff0f0; }
  .fleet { background: rgba(255, 255, 255, .97); }
  .alarm-consent-card::before { margin: -18px -18px 8px; }
}

/* Atribut hidden WAJIB menang atas display:flex/block di class manapun
   (mis. .drawer/.alert-banner). Tanpa ini elemen tertutup tetap terlihat. */
[hidden] { display: none !important; }

/* panel tab (Issues/Reports) harus jadi flex column utuh di dalam card,
   supaya .ic-detail / .rp-table-wrap bisa scroll tanpa keclip */
.ic-card [data-op-panel] { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
[data-op-panel="reports"] .rp-table-wrap { flex: 1 1 auto; overflow: auto; }

/* ------------------------------------------------- skeleton & error state */
.skel { display: grid; gap: 8px; padding: 4px 2px; }
.skel-label { font-size: 11.5px; color: #718399; padding-bottom: 2px; }
.skel-bar {
  height: 30px; border-radius: 8px; background: linear-gradient(90deg,
  #e7eef7 25%, #f4f8fc 40%, #e7eef7 60%);
  background-size: 300% 100%; animation: skelflow 1.3s linear infinite;
}
@keyframes skelflow { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.load-err { display: flex; align-items: center; gap: 10px; padding: 14px; color: #8b2a23; font-size: 12.5px; }
.load-err .btn { margin-left: auto; flex: 0 0 auto; }

/* ------------------------------------------------- ack visibility */
.ack-flag {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #d12f2f; margin-left: 6px; box-shadow: 0 0 0 3px rgba(209, 47, 47, .15);
  vertical-align: middle;
}
.dev.needs-ack .dname { padding-right: 2px; }

.ic-badges { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; }
.ic-ack {
  display: inline-flex; align-items: center; border-radius: 999px;
  background: #fff0f0; color: #b42318; border: 1px solid #f3c2c2;
  font-size: 10px; font-weight: 700; padding: 2px 8px; white-space: nowrap;
}
.ic-ack.on { background: #effbf4; color: #0f6f3f; border-color: #a8dcc0; }
.ic-tz-note { margin-left: auto; color: #7b8ca1; font-size: 11px; white-space: nowrap; }
.ic-tz-note b { color: #53667d; }

/* ------------------------------------------------- audit timeline */
.ic-timeline { display: grid; gap: 0; padding: 4px 2px 10px; }
.tl-item { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 4px; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: #dbe4ee; }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; background: #4f8cff; box-shadow: 0 0 0 3px rgba(79, 140, 255, .14); }
.tl-item.res .tl-dot { background: #12834a; box-shadow: 0 0 0 3px rgba(18, 131, 74, .14); }
.tl-body b { text-transform: capitalize; font-size: 12.5px; color: #102033; }
.tl-meta { display: block; color: #53667d; font-size: 11.5px; margin-top: 1px; }
.tl-until { color: #718399; font-size: 11px; }
.tl-body p { margin: 5px 0 0; font-size: 12px; color: #3d587a; background: #f4f8fc; border: 1px solid #dde6f0; border-radius: 8px; padding: 6px 9px; }

/* ------------------------------------------------- breadcrumb */
#context-bar {
  position: fixed; top: 58px; left: 0; right: 0; height: 30px; z-index: 2250;
  display: flex; align-items: center; gap: 4px; padding: 0 14px;
  background: #ffffff; border-bottom: 1px solid #d6e1ed; box-shadow: 0 4px 14px rgba(12, 35, 64, .07);
  font-size: 12px; white-space: nowrap; overflow: hidden;
}
body.ctx-on .layout { height: calc(100vh - 88px); }
.ctx-link { border: 0; background: none; color: #075ca8; font-size: 12px; padding: 0 2px; cursor: pointer; }
.ctx-link:hover { text-decoration: underline; }
.ctx-sep { color: #b9c9dc; padding: 0 3px; }
.ctx-cur { color: #53667d; font-weight: 600; }

/* ------------------------------------------------- clock freshness */
.clock.stale { color: #b45309; font-weight: 700; }
.clock.nodata { color: #d12f2f; font-weight: 700; }

/* ------------------------------------------------- responsive 1440 */
.lbl-short { display: none; }
@media (max-width: 1440px) {
  #topbar { gap: 12px; padding: 0 12px; }
  .toolbar { gap: 7px; }
  #app-sub, .field.source-field label, .field.range-field label { display: none; }
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
  #btn-download span { display: none; }
  .acct-copy b { max-width: 96px; }
}

/* TPMS / Payload overview */
.tpms-wrap { padding: 0 10px 10px; display: grid; gap: 10px; }
.truck-top {
  min-height: 210px; border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.truck-stage { position: relative; width: min(100%, 680px); }
.truck-stage img { display: block; width: 100%; height: auto; user-select: none; pointer-events: none; }
.truck-body { display: none; }
.tire-dot {
  position: absolute; transform: translate(-50%, -50%); min-width: 26px; height: 24px;
  border-radius: 999px; border: 2px solid rgba(255,255,255,.82); color: #fff;
  font: 900 10px var(--mono); cursor: default; box-shadow: 0 4px 12px rgba(0,0,0,.38);
}
.tire-dot.ok { background: rgba(18, 131, 74, .54); }
.tire-dot.warn { background: rgba(217, 145, 0, .58); }
.tire-dot.bad { background: rgba(209, 47, 47, .54); animation: pulsebad 1.3s infinite; }
.tpms-table { margin: 0; }
@keyframes pulsebad { 50% { box-shadow: 0 0 0 7px rgba(209,47,47,.22), 0 4px 12px rgba(0,0,0,.38); } }
.payload-bar { height: 18px; overflow: hidden; border-radius: 999px; border: 1px solid #c9d6e6; background: #eef4fb; }
.payload-bar span { display: block; height: 100%; border-radius: inherit; }
.payload-bar span.green { background: #2fc56a; }
.payload-bar span.amber { background: #f5a524; }
.payload-bar span.red { background: #d12f2f; }
.tpms-history td b { display: block; font-size: 11px; }
.tpms-history td small { display: block; color: #6b7d95; font-size: 10px; }
.mini-status { display: inline-flex; margin-top: 3px; padding: 1px 5px; border-radius: 999px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.mini-status.ok { color: #08713f; background: #dff7e9; }
.mini-status.warn { color: #8a5608; background: #fff3d8; }
.mini-status.bad { color: #9b1c1c; background: #ffe3e3; }
