:root {
  --bg: #0d1117;
  --bg-panel: #151b23;
  --bg-panel-2: #1c232c;
  --border: #2a3340;
  --text: #e6edf3;
  --text-dim: #8b98a5;
  --accent: #2f81f7;
  --accent-2: #3fb950;
  --danger: #f85149;
  --warn: #d29922;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mynvr-shell { display: flex; min-height: 100vh; }

.mynvr-sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg-panel);
  border-right: 1px solid var(--border); padding: 16px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.mynvr-brand { padding: 0 18px 16px; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.mynvr-brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.mynvr-brand-logo { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }
.mynvr-nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.mynvr-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-dim); font-weight: 500;
}
.mynvr-nav a:hover { background: var(--bg-panel-2); text-decoration: none; color: var(--text); }
.mynvr-nav a.active { background: rgba(47,129,247,.15); color: var(--accent); }
.mynvr-sidebar .sep { margin: 10px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #5b6672; }

.mynvr-sidebar-online { padding: 4px 8px 12px; }
.sidebar-online-list { display: flex; flex-direction: column; gap: 2px; }
.sidebar-online-empty { padding: 6px 12px; font-size: 12px; color: var(--text-dim); }
.sidebar-online-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; font-size: 12px;
}
.sidebar-online-row .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); flex-shrink: 0;
  box-shadow: 0 0 6px var(--accent-2);
}
.sidebar-online-row .name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-online-row .role { color: var(--text-dim); font-size: 10px; margin-left: auto; flex-shrink: 0; }
.sidebar-online-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.mynvr-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg-panel);
  position: sticky; top: 0; z-index: 20;
}
.mynvr-topbar .acc-switch { flex: 1; min-width: 0; }
.mynvr-topbar .acc-switch select { background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; max-width: 100%; }
/* #gridCols dirender LANGSUNG sbg anak flex .mynvr-topbar (bukan di dalam
   .acc-switch) -- tanpa ini dia kena aturan global `select{width:100%}`
   yg jadi flex-basis:100% (klaim SELURUH lebar topbar), bukan cuma
   selebar kontennya sendiri spt select lain di topbar. */
.mynvr-topbar > select#gridCols {
  width: auto; flex: 0 0 auto;
  background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
.mynvr-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mynvr-badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; background: var(--bg-panel-2); border: 1px solid var(--border); color: var(--text-dim); }
.mynvr-user-link { display: flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; }
.mynvr-user-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.profile-incomplete-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); vertical-align: middle; }

.mynvr-hamburger {
  display: none; background: var(--bg-panel-2); border: 1px solid var(--border); color: var(--text);
  width: 36px; height: 36px; border-radius: 8px; font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.mynvr-sidebar-backdrop { display: none; }

.mynvr-main { flex: 1; min-width: 0; }
/* padding-bottom ekstra di SEMUA halaman (bukan cuma dashboard) -- tombol
   mengambang (Chat/Walkie Talkie/Live) posisinya fixed rata tengah bawah
   LAYAR, jadi bisa menutupi konten paling bawah halaman apa pun kalau tidak
   dikasih jarak. Ditaruh di wrapper ini (dipakai semua halaman lewat
   includes/layout_top.php), bukan per-halaman, supaya konsisten otomatis. */
.mynvr-content { padding: 20px 20px 84px; }

.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
h1, h2, h3 { margin-top: 0; }
h1 { font-size: 20px; } h2 { font-size: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.btn:hover { filter: brightness(1.1); }
.btn.secondary { background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); color: #1a1300; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  background: var(--bg-panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 10px; border-radius: 8px; font-size: 13px; width: 100%;
}
label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; margin-top: 12px; }
.form-row { display: flex; gap: 12px; }
.form-row > div { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; }

.pill { padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill.on { background: rgba(63,185,80,.15); color: var(--accent-2); }
.pill.off { background: rgba(139,148,165,.15); color: var(--text-dim); }
.pill.rec { background: rgba(248,81,73,.15); color: var(--danger); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.flash.error { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.4); color: #ffb4ae; }
.flash.success { background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.4); color: #9be8a5; }
.flash.info { background: rgba(47,129,247,.12); border: 1px solid rgba(47,129,247,.4); color: #a9cdfd; }
.flash.info a { color: #fff; text-decoration: underline; }

/* ==== Profil Saya ==== */
.profile-photo-row { display: flex; align-items: center; gap: 16px; }
.profile-photo-preview { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); background: #000; }

/* ==== Grid live view ==== */
.cam-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  /* Jarak dari bar tombol bawah sudah ditangani di .mynvr-content
     (padding-bottom, berlaku semua halaman), tidak perlu diulang di sini. */
}
.cam-grid.cols-1 { grid-template-columns: 1fr; }
.cam-tile {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); aspect-ratio: 16/9;
  /* pan-y (BUKAN none) -- izinkan scroll vertikal 1 jari lewat tile kamera
     seperti biasa, browser cuma dilarang pinch-zoom bawaan (biar custom
     pinch-zoom JS yang jalan). touch-action:none sebelumnya blokir SEMUA
     gesture default termasuk scroll -- itu penyebab "scroll susah di HP". */
  touch-action: pan-y;
}
.cam-tile video { width: 100%; height: 100%; object-fit: contain; background: #000; transform-origin: center center; }
.cam-tile .cam-overlay-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; background: linear-gradient(180deg, rgba(0,0,0,.75), transparent); font-size: 12px; z-index: 2;
}
.cam-tile .cam-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cam-tile .cam-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.cam-tile .cam-status-dot.live { background: var(--accent-2); box-shadow: 0 0 6px var(--accent-2); }
.cam-tile .cam-status-dot.err { background: var(--danger); }
.cam-tile .cam-controls {
  position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: flex-end; gap: 6px;
  padding: 6px 8px; background: linear-gradient(0deg, rgba(0,0,0,.75), transparent); z-index: 2; opacity: 0;
  transition: opacity .15s;
}
.cam-tile:hover .cam-controls, .cam-tile:focus-within .cam-controls { opacity: 1; }
.cam-tile .icon-btn {
  background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 6px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px;
}
.cam-tile .cam-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 12px; z-index: 1; }
.cam-tile.rec-on .cam-name::after { content: "\25CF REC"; color: var(--danger); font-size: 10px; margin-left: 6px; }
/* Tanda "ada catatan laporan" -- muncul di samping REC (::after SELALU
   dirender PALING AKHIR oleh browser apa pun urutan child aslinya, jadi
   badge ini otomatis kelihatan tepat di kiri REC). display:none default
   diatur JS (report_notes.js) begitu tahu kamera itu punya catatan. */
.cam-note-badge { cursor: pointer; font-size: 12px; line-height: 1; }
.cam-tile .btn-record.recording { background: var(--danger); animation: cam-rec-pulse 1s infinite; }
@keyframes cam-rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.cam-tile .btn-record.starting { animation: cam-rec-spin 0.8s linear infinite; }
@keyframes cam-rec-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.cam-download-ready {
  position: absolute; left: 8px; right: 8px; bottom: 46px; z-index: 3;
  display: block; text-align: center; padding: 8px; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.cam-download-ready:hover { filter: brightness(1.1); }

.cam-tile:fullscreen video, .cam-tile:-webkit-full-screen video { object-fit: contain; }

/* Tile Live Broadcast (kamera device user, bukan CCTV terpasang) -- lihat
   assets/js/live_viewer.js. Outline merah + label "🔴 LIVE dari [nama]"
   (di cam-name via JS) supaya jelas beda dari tile kamera CCTV asli. */
.cam-tile.cam-tile-live { outline: 2px solid var(--danger); outline-offset: -2px; }

/* ==== Timeline (playback) ==== */
.timeline-wrap { background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 10px; }
.timeline-track { position: relative; height: 34px; background: #0a0e13; border-radius: 6px; overflow: hidden; cursor: pointer; touch-action: none; user-select: none; }
.timeline-seg { position: absolute; top: 3px; bottom: 3px; background: var(--accent); opacity: .55; border-radius: 3px; pointer-events: none; }
.timeline-cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; z-index: 3; pointer-events: none; }
.timeline-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-top: 6px; }

.pb-file-list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; margin-top: 8px; }
.pb-file-row {
  display: flex; justify-content: space-between; gap: 10px; text-align: left; padding: 7px 10px;
  background: var(--bg-panel-2); border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  color: var(--text); font-size: 12px;
}
.pb-file-row:hover { border-color: var(--border); }
.pb-file-row.active { border-color: var(--accent); background: rgba(47,129,247,.15); color: var(--accent); }
.pb-file-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.pb-file-row .pb-file-time { font-weight: 600; }
.pb-file-row .pb-file-name { color: var(--text-dim); font-family: monospace; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-file-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.pb-file-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 6px; background: transparent; border: 1px solid var(--border); color: var(--text);
  text-decoration: none; font-size: 12px; cursor: pointer;
}
.pb-file-icon-btn:hover { background: var(--bg-panel); }

/* ==== Chat Grup CCTV ==== */
.chat-messages {
  display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px;
  max-height: 320px; min-height: 160px; overflow-y: auto; padding: 4px 2px;
}
.chat-msg { display: flex; gap: 8px; max-width: 85%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; margin-top: 2px; }
.chat-msg-body { display: flex; flex-direction: column; min-width: 0; }
.chat-msg-meta { font-size: 10px; color: var(--text-dim); margin-bottom: 2px; }
.chat-msg.mine .chat-msg-meta { text-align: right; }
.chat-msg-text {
  background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 10px; font-size: 13px; word-break: break-word; white-space: pre-wrap;
}
.chat-msg.mine .chat-msg-text { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ==== Walkie Talkie ==== */
.wt-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
  align-items: center; justify-content: center; padding: 16px;
}
.wt-modal-box {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 420px; padding: 18px; max-height: 90vh; overflow-y: auto;
}
.wt-modal-header { display: flex; align-items: center; justify-content: space-between; }
.wt-modal-header h2 { font-size: 16px; margin: 0; }
/* Modal billing (trial habis/belum bayar) -- z-index PALING TINGGI di atas
   SEMUA modal lain (.wt-modal=100, overlay install Docker=200) krn modal
   ini WAJIB menang mutlak & tidak bisa ditutup sampai bayar selesai. */
.billing-gate-modal { z-index: 10000 !important; }
.billing-gate-modal .wt-modal-box { max-height: 95vh; }
.wt-empty { color: var(--text-dim); font-size: 12px; padding: 10px 0; }
/* Daftar user online, di bawah tombol PTT -- dibuat compact (lebih kecil
   drpd versi awal) & WAJIB scroll begitu isinya lebih dari yg muat, bukan
   bikin modal makin tinggi terus. */
.wt-online-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 110px; overflow-y: auto; }
.wt-user {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px;
  background: var(--bg-panel-2); border: 1px solid transparent; transition: border-color .15s, background .15s;
}
.wt-user .wt-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.wt-user .wt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); flex-shrink: 0; }
.wt-user .wt-name { font-weight: 600; flex: 1; font-size: 13px; }
.wt-user .wt-role { font-size: 11px; color: var(--text-dim); }
.wt-user.speaking { border-color: var(--accent-2); background: rgba(63,185,80,.12); }
.wt-user.speaking .wt-dot { animation: wt-pulse 0.6s infinite alternate; }
@keyframes wt-pulse { from { box-shadow: 0 0 0 0 rgba(63,185,80,.6); } to { box-shadow: 0 0 0 6px rgba(63,185,80,0); } }

/* Bar tombol aksi (Chat/Walkie Talkie/Live) -- BUKAN kelompok pil
   mengambang lagi, sekarang jadi bar PENUH selebar layar spt topbar
   (.mynvr-topbar) tapi nempel di BAWAH, position:fixed permanen (selalu
   kelihatan di semua halaman, tidak ikut scroll konten). Tombol rata
   tengah horizontal & bisa discroll horizontal sendiri kalau kepanjangan
   di layar sempit (overflow-x:auto), TIDAK PERNAH bikin halaman jadi
   scroll horizontal krn bar-nya sendiri yang scroll, bukan body-nya.
   Konten halaman WAJIB dikasih padding-bottom cukup (lihat .mynvr-content)
   supaya bar ini tidak pernah menutupi apa pun di halaman manapun. */
.mynvr-floating-actions {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 40; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px;
  background: var(--bg-panel); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 14px rgba(0,0,0,.35);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.mynvr-floating-actions button {
  position: relative; border-radius: 20px; padding: 7px 14px; border: none; font-size: 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; background: #fff; color: #1a1a1a;
}
.mynvr-floating-actions button:hover { background: #ececec; }
#liveOpenBtn.live-active { background: var(--danger); color: #fff; animation: cam-rec-pulse 1.2s infinite; }
.floating-badge {
  position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; line-height: 1;
  border: 2px solid #fff;
}

/* Badge status koneksi WebRTC (HT Radio) di pojok kiri topbar -- titik
   merah/kuning/hijau + keterangan teks, di-update dari
   assets/js/walkie.js -> updateWtStatusDot(), dipanggil bareng
   updateDebugPanel() (tiap 1200ms, site-wide) supaya SELALU sinkron dgn
   connectedPeerKeys() yg sama dipakai list "Online Sekarang" & badge --
   jadi warnanya cerminan JUJUR status koneksi beneran, bukan basa-basi. */
.wt-status-badge {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: var(--bg-panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 4px 10px 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.wt-status-indicator {
  flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%;
}
.wt-status-indicator.red { background: var(--danger); }
.wt-status-indicator.yellow { background: var(--warn); animation: wt-status-pulse 1s infinite; }
.wt-status-indicator.green { background: var(--accent-2); }
@keyframes wt-status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ==== Catatan Laporan (per kamera) ==== */
.report-note-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 18px; max-height: 320px; overflow-y: auto; }
.report-note-row {
  background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px; position: relative;
}
.report-note-meta { font-size: 11px; color: var(--text-dim); }
.report-note-text { font-size: 13px; word-break: break-word; white-space: pre-wrap; padding-right: 60px; }
.report-note-delete {
  position: absolute; top: 8px; right: 8px; background: transparent; border: 1px solid var(--border);
  color: var(--danger); border-radius: 6px; font-size: 11px; padding: 3px 7px; cursor: pointer;
}
.report-note-delete:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ==== Sedang Menonton CCTV ==== */
.cam-viewer-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 6px; max-height: 320px; overflow-y: auto; }
.cam-viewer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.cam-viewer-row span { color: var(--text-dim); text-align: right; }

.wt-ptt-btn {
  width: 100%; padding: 22px 12px; border-radius: 14px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none; -webkit-tap-highlight-color: transparent; outline: none;
}
.wt-ptt-btn.active { background: var(--danger); }
.wt-ptt-btn:disabled, .wt-ptt-btn.wt-ptt-blocked {
  background: var(--bg-panel); color: var(--text-dim); cursor: not-allowed; opacity: 0.75;
}

.wt-debug-panel {
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-dim); display: flex; flex-direction: row; align-items: center; gap: 12px;
}
.wt-debug-panel span { color: var(--text); font-family: monospace; }

/* Titik + angka ringkas utk "Koneksi ke user lain" -- ganti daftar nama+
   status yang bisa panjang kalau user online banyak. */
.wt-status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim); margin-right: 5px; vertical-align: middle;
}
.wt-status-dot.live { background: var(--accent-2); box-shadow: 0 0 6px var(--accent-2); }

/* "X orang sedang mendengarkan Anda" -- cuma tampil selama PTT ditekan. */
.wt-listener-info {
  margin-top: 8px; padding: 6px 10px; border-radius: 8px; font-size: 12px; text-align: center;
  background: rgba(63,185,80,.12); color: var(--accent-2); border: 1px solid rgba(63,185,80,.3);
}

/* Popup "X sedang online" -- mengambang di sisi KANAN layar, tumpukan
   tumbuh dari bawah ke atas (column-reverse: toast baru ditambahkan di
   akhir DOM tapi VISUAL-nya muncul di bawah tumpukan, mendorong yang lama
   naik ke atas), fade-in + geser naik sedikit saat muncul, fade-out di
   akhir sebelum dihapus dari DOM. */
#presenceToastContainer {
  position: fixed; right: 16px; bottom: 90px; z-index: 90;
  display: flex; flex-direction: column-reverse; gap: 8px;
  pointer-events: none; max-width: min(280px, calc(100vw - 32px));
}
.presence-toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(24px);
  transition: opacity .4s ease, transform .4s ease;
}
.presence-toast.show { opacity: 1; transform: translateY(0); }
.presence-toast-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.presence-toast-name { font-weight: 600; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-toast-status { font-size: 11px; color: var(--accent-2); }

/* Notifikasi kecil top-center: muncul saat ada lawan bicara yang lagi
   ngomong di walkie talkie, walau modal WT sendiri sedang ditutup/tidak
   dilihat -- supaya tidak kelewat ada yang manggil. */
.wt-speaking-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%) translateY(-140%);
  z-index: 200; display: flex; align-items: center; gap: 10px;
  background: var(--bg-panel); border: 1px solid var(--accent-2); border-radius: 999px;
  padding: 8px 16px 8px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.45);
  font-size: 13px; font-weight: 600; color: var(--text);
  opacity: 0; transition: transform .25s ease, opacity .25s ease; pointer-events: none;
  max-width: 92vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wt-speaking-banner.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.wt-wave { display: flex; align-items: center; gap: 2px; height: 18px; flex-shrink: 0; }
.wt-wave span {
  display: block; width: 3px; height: 100%; border-radius: 2px; background: var(--accent-2);
  animation: wt-wave-bounce 0.9s ease-in-out infinite;
}
.wt-wave span:nth-child(1) { animation-delay: 0s; }
.wt-wave span:nth-child(2) { animation-delay: .12s; }
.wt-wave span:nth-child(3) { animation-delay: .24s; }
.wt-wave span:nth-child(4) { animation-delay: .36s; }
.wt-wave span:nth-child(5) { animation-delay: .48s; }
@keyframes wt-wave-bounce {
  0%, 100% { transform: scaleY(.3); }
  50% { transform: scaleY(1); }
}

@media (max-width: 860px) {
  .mynvr-shell { display: block; }
  .mynvr-sidebar {
    position: fixed; top: 0; left: -260px; width: 260px; height: 100vh;
    transition: left .2s; z-index: 70; box-shadow: 4px 0 16px rgba(0,0,0,.5);
  }
  .mynvr-sidebar.open { left: 0; }
  .mynvr-sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,0);
    z-index: 60; pointer-events: none; transition: background .2s;
  }
  .mynvr-sidebar-backdrop.open { background: rgba(0,0,0,.55); pointer-events: auto; }

  .mynvr-hamburger { display: block; }

  /* Di HP, hamburger + tombol user tetap 1 baris atas (biar selalu
     kejangkau jempol) -- acc-switch (filter grup/akun) & #gridCols masing2
     dipaksa 1 baris PENUH sendiri di bawahnya, TIDAK berdempetan lagi. */
  .mynvr-topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .mynvr-topbar .acc-switch { flex: 1 1 100%; order: 3; min-width: 0; }
  .mynvr-topbar .acc-switch select { width: 100%; }
  .mynvr-topbar > select#gridCols { flex: 1 1 100%; width: 100%; order: 4; }
  .mynvr-content { padding: 12px 12px 76px; }

  /* Badge status WAJIB tetap di baris PALING ATAS bareng hamburger (BUKAN
     pindah ke baris sendiri) -- supaya muat, bagian nama user & role di
     kanan (.mynvr-user) dipangkas ke avatar+tombol Keluar saja di HP,
     bukan badge status yang dikorbankan/disembunyikan/dipindah. */
  .wt-status-badge { padding: 4px 8px 4px 6px; font-size: 10px; }
  .mynvr-user .mynvr-badge { display: none; }
  .mynvr-user-link span { display: none; }

  h1 { font-size: 18px; }

  /* Form 2-kolom jadi 1-kolom biar tidak sempit di HP */
  .form-row { flex-direction: column; gap: 0; }

  /* Tabel lebar (daftar kamera/user/akun) bisa digeser horizontal drpd overflow rusak */
  .card { overflow-x: auto; }
  table { min-width: 480px; }

  /* Modal walkie talkie & PTT button menyesuaikan lebar layar */
  .wt-modal { padding: 10px; align-items: flex-end; }
  .wt-modal-box { width: 100%; max-width: 100%; }
  .wt-ptt-btn { padding: 26px 12px; font-size: 16px; }

  /* Playback: video pemutar rekaman lebih pendek di layar kecil (tile live
     monitor TIDAK disentuh -- itu sudah diatur lewat aspect-ratio sendiri) */
  #pbVideo { max-height: 45vh !important; }

  /* Bar tombol bawah tetap 1 baris horizontal + scroll di HP jg (TIDAK
     ditumpuk vertikal) -- cukup dikecilkan sedikit paddingnya spy muat. */
  .mynvr-floating-actions { padding: 8px 12px; gap: 6px; }
  .mynvr-floating-actions button { padding: 6px 12px; font-size: 11px; }
}

@media (max-width: 480px) {
  .mynvr-user span:not(.mynvr-badge) { display: none; } /* sembunyikan nama, sisakan badge role + tombol */
  .mynvr-topbar .btn.small { padding: 6px 8px; font-size: 11px; }
}
