/* Panggil semua, bisukan channel, alat peta, ikuti, putar ulang rute, laporan, editor area. */

/* ---------- tombol PTT ---------- */
.ptt-all { flex: 0 0 210px; background: #8a2be2; }
.ptt-all.active { background: var(--tx); }
.ptt-all .ptt-main { font-size: 17px; }

/* ---------- bisukan channel ---------- */
.channel .mute { background: transparent; border: 0; padding: 0 2px; font-size: 14px; opacity: .45; }
.channel .mute:hover, .channel .mute.on { opacity: 1; }
.channel.muted .name { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(150,160,172,.5); }

/* ---------- alat peta ---------- */
.map-tools { position: absolute; top: 10px; right: 10px; z-index: 600; display: flex; flex-direction: column; gap: 6px; }
.map-tools button { background: rgba(11,14,19,.88); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 13px; font-weight: 600; text-align: left; }
.map-tools button:hover, .map-tools button.on { border-color: var(--private); }
.follow-bar { position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 600; display: flex; gap: 12px;
  align-items: center; background: rgba(11,14,19,.92); border: 1px solid var(--rx); border-radius: 10px; padding: 8px 12px;
  font-weight: 600; font-size: 14px; }
.route-bar { flex-direction: column; align-items: stretch !important; gap: 8px !important; white-space: normal !important; }
.route-bar input[type=range] { flex: 1; min-width: 220px; accent-color: var(--private); }
.route-time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 110px; }
.feed span.geo { color: #ffb36b; }

/* ---------- laporan ---------- */
.report:not([hidden]) { flex: 1; display: flex; padding: 14px; min-height: 0; }
.report .mpane { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.stat b { font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }
.sub-h { font-size: 16px; margin: 28px 0 10px; }
.inline-search { width: 220px !important; margin: 0 !important; }
.link-btn { text-decoration: none; display: inline-flex; align-items: center; color: var(--text) !important; }
#repPlayer { width: 100%; height: 36px; margin: 10px 0; }
a.btn-sm { text-decoration: none; display: inline-block; }

/* ---------- editor area ---------- */
.geo-grid { display: grid; grid-template-columns: 1fr 330px; gap: 14px; margin-bottom: 16px; }
.geo-map-wrap { position: relative; height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); isolation: isolate; }
#geoMap { position: absolute; inset: 0; background: #0f141b; }
.geo-hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 600; background: rgba(11,14,19,.9);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.geo-form { display: grid; gap: 12px; align-content: start; margin: 0; }
.geo-form label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.geo-form select[multiple] { min-height: 110px; }
.btn-sm.ghost.on { border-color: var(--rx); background: rgba(32,112,230,.2); }

/* kepala halaman: kontrol membungkus rapi di layar laptop */
.mhead > .row { flex-wrap: wrap; justify-content: flex-end; max-width: 560px; }
.mhead > div:first-child { min-width: 280px; }

/* ---------- layar sempit (laptop kecil / tablet) ---------- */
.grid { grid-template-columns: 270px minmax(0, 1fr) 310px; }
.center, .panel { min-width: 0; }
.ptt-wrap { gap: 14px; }
.ptt { min-width: 0; }
@media (max-width: 1280px) {
  .grid { grid-template-columns: 220px minmax(0, 1fr) 270px; gap: 10px; padding: 10px; }
  .ptt-all { flex-basis: 170px; }
  .ptt-main { font-size: 17px; }
  .vol { width: 110px; }
  .form-grid, #opForm.form-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .geo-grid { grid-template-columns: 1fr 290px; }
}
@media (max-width: 1100px) {
  .grid { grid-template-columns: 190px minmax(0, 1fr) 240px; }
  .ptt { height: 72px; }
  .ptt-all { flex-basis: 140px; }
  .ptt-all .ptt-main { font-size: 14px; }
  .ptt-main { font-size: 15px; }
  .ptt-sub { font-size: 11.5px; }
  .vol { width: 80px; font-size: 12px; }
  .topbar { gap: 8px; padding: 8px 12px; }
  #toneBtn { padding: 6px 8px; }
  .manage:not([hidden]) { grid-template-columns: 170px 1fr; }
  .geo-grid { grid-template-columns: 1fr; }
  .tab { padding: 8px 5px; font-size: 12px; }
}
/* baris channel & anggota tidak boleh melebar keluar panel */
.side { overflow-x: hidden; }
.channel { min-width: 0; }
.channel .name, .member .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vol input[type=range] { width: 100%; min-width: 0; }
@media (max-width: 1100px) {
  .panel { padding: 12px; }
  .channel { padding: 8px 9px; gap: 7px; }
}

/* ---------- siaran audio ---------- */
.bc-pane:not([hidden]) { display: flex; flex-direction: column; gap: 10px; }
.bc-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.bc-head select { padding: 4px 6px; }
.bc-options { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.bc-options select { padding: 4px 6px; }
.bc-now { background: rgba(214,40,48,.16); border: 1px solid var(--tx); border-radius: 10px; padding: 10px; display: grid; gap: 5px; }
.bc-now.paused { background: var(--surface); border-color: var(--line); }
.bc-now-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bc-now-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-controls { display: flex; gap: 5px; flex-wrap: wrap; }
.bc-controls button { flex: 1 1 auto; }
.bc-progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bc-progress div { height: 100%; width: 0; background: var(--tx); transition: width .25s linear; }
.bc-actions { gap: 6px; }
.bc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; overflow: auto; min-height: 0; }
.bc-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 8px;
  border-radius: 8px; background: var(--surface); font-size: 13px; }
.bc-item.playing { outline: 1px solid var(--tx); background: rgba(214,40,48,.12); }
.bc-play { width: 28px; height: 28px; border-radius: 50%; border: 0; background: #8a2be2; color: #fff; font-size: 11px; }
.bc-item.playing .bc-play { background: var(--tx); }
.bc-meta { display: grid; min-width: 0; }
.bc-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-meta span { color: var(--muted); font-size: 11.5px; }
.bc-tools { display: flex; gap: 2px; }
.bc-tools button { background: transparent; border: 0; color: var(--muted); padding: 2px 5px; font-size: 13px; }
.bc-tools button:hover:not(:disabled) { color: var(--text); }
.bc-tools button:disabled { opacity: .3; }

/* Siaran: judul panjang dipotong "…", kartu & tombol Stop tetap di dalam panel (tanpa gulir ke samping). */
.bc-pane > * { min-width: 0; max-width: 100%; }
.bc-now { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.bc-now-head { min-width: 0; }
.bc-now-head b { flex: 1; min-width: 0; display: block; }
.bc-now-head .btn-sm { flex: none; }
#bcNowTarget, #bcTime { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-list { grid-template-columns: minmax(0, 1fr); }
.tabpane { overflow-x: hidden; }
/* Tab panel kanan berbagi lebar: 5 tab tidak pernah melebihi panel. */
.right .tabs { overflow: hidden; }
.right .tab { flex: 1 1 auto; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .right .tab { padding: 8px 2px; font-size: 11.5px; } }

/* ---------- Mode Bridge (radio analog) ---------- */
.st-br { background: rgba(120, 140, 255, .18); color: #a9b6ff; }
#ddBridge label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
#ddBridge label.check input { width: auto; }
.br-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.br-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.br-grid input, .br-grid select { width: 100%; min-width: 0; box-sizing: border-box; }
.br-grid .wide { grid-column: 1 / -1; }
.br-grid[hidden] { display: none; }
#ddBridge .hint { margin-top: 0; }
@media (max-width: 700px) { .br-grid { grid-template-columns: 1fr; } }

/* ---------- multi-organisasi ---------- */
.org-label { font-weight: 600; color: var(--muted); margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; display: inline-block; vertical-align: bottom; }
body:not(.is-org-admin) .org-admin-only { display: none !important; }
body:not(.is-super) .super-only { display: none !important; }
.scope-list { display: grid; gap: 6px; padding: 12px 20px; max-height: 50vh; overflow: auto; }
.scope-list label.check { display: flex; align-items: center; gap: 8px; }
.scope-list input { width: auto; }
#chForm label.inline select { max-width: 260px; }
#opScopeNew { min-height: 96px; }
#opScopeWrap { grid-column: span 2; }

/* ---------- Tahap 2: masuk dengan Wuzchat, pengajuan, syarat, tautan gabung ---------- */
.login-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.wz-box { display: grid; gap: 10px; font-size: 14px; }
.wz-box p { margin: 0; }
.wz-box .wz-code { font: 800 28px/1 Consolas, monospace; letter-spacing: 6px; text-align: center; padding: 12px;
  border: 1px dashed var(--line); border-radius: 10px; }
.wz-box .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wz-box a.btn { text-decoration: none; padding: 8px 14px; border-radius: 8px; }
.wz-box .small { font-size: 12px; }
.wz-box .sim-note { font-size: 12px; color: #f0b000; }
.wz-choose { display: grid; gap: 6px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: #3fd08a;
  border-radius: 50%; animation: wzsp .9s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes wzsp { to { transform: rotate(360deg); } }
.section-gap { margin-top: 28px; }
.rules-table td:first-child { color: var(--muted); }
.rules-table input[type=number] { width: 110px; }
.link-url { font: 13px Consolas, monospace; word-break: break-all; }
.big-link { font-size: 16px; margin: 8px 0 12px; color: #3fd08a; }
.wz-box .wz-qr { display: block; margin: 0 auto; width: 180px; height: 180px; border-radius: 10px; background: #fff; padding: 6px; }
.wz-link { border-top: 1px solid var(--line); }
.wz-link h2 { font-size: 16px; }
.ch-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 12px; max-height: 180px; overflow: auto; margin: 6px 0; }
.wz-box .wz-alt { border-top: 1px solid var(--line); padding-top: 8px; }
.channel .spk { color: var(--rx, #2070e6); font-size: 12px; font-weight: 600; margin-left: auto; margin-right: 6px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel .mute:disabled { cursor: default; }
.channel.muted .name { text-decoration: none; }
.ota-row { padding: 8px 0; border-top: 1px solid var(--line); }
.ota-row:first-of-type { border-top: 0; }
.ota-row .btn-sm { margin-top: 4px; }

/* =====================================================================
   Navigasi ringkas, aksi cepat, HP & tablet
   ===================================================================== */
.menu-btn, .mnav, .phone-only { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
body.is-individual .not-individual { display: none !important; }
.mgroup { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); opacity: .7; padding: 10px 12px 2px; }
.mgroup:first-child { padding-top: 2px; }
.quick { display: grid; gap: 6px; margin-bottom: 16px; }
.quick .btn-primary { width: 100%; padding: 11px; font-size: 15px; }
.q-reqs { color: var(--text); border-color: var(--private); text-align: left; padding: 9px 12px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > .table { min-width: 560px; }

/* ---------- tablet: channel | tengah, panel aktivitas di bawah ---------- */
@media (max-width: 1100px) and (min-width: 821px) {
  .grid { grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(180px, 34vh); }
  .right { grid-column: 1 / -1; }
  .ptt-all { flex-basis: 150px; }
}

/* ---------- HP ---------- */
@media (max-width: 820px) {
  html, body { height: 100%; overflow: hidden; }
  .app { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .phone-only { display: inline-flex; }

  /* bilah atas: merek + status + ☰ */
  .topbar { position: relative; gap: 8px; padding: 8px 10px; flex-wrap: nowrap; }
  .topbar .views { display: none; }
  .brand { font-size: 15px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .brand .org-label { max-width: 40vw; }
  #conn { font-size: 12px; padding: 3px 8px; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .menu-btn { display: inline-flex; font-size: 20px; padding: 4px 12px; color: var(--text); }
  .top-actions { display: none; position: absolute; right: 8px; top: calc(100% + 4px); z-index: 2000; flex-direction: column; align-items: stretch;
    gap: 6px; padding: 10px; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
  body.menu-open .top-actions { display: flex; }
  .top-actions .btn-ghost { text-align: left; padding: 11px 12px; color: var(--text); }

  .sos-bar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .sos-text { flex: 1 1 100%; }

  /* operasi: satu bagian per layar */
  .grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 8px; padding: 8px; }
  .panel { padding: 12px; border-radius: 12px; }
  .side, .center, .right { grid-column: 1; }
  body[data-mp="radio"] .right, body[data-mp="radio"] .map-wrap { display: none; }
  body[data-mp="radio"] .side { grid-row: 1; }
  body[data-mp="radio"] .center { grid-row: 2; gap: 8px; }
  body[data-mp="peta"] .side, body[data-mp="peta"] .right, body[data-mp="peta"] .ptt-wrap { display: none; }
  body[data-mp="peta"] .grid, body[data-mp="pesan"] .grid { grid-template-rows: minmax(0, 1fr); }
  body[data-mp="peta"] .center { grid-row: 1; gap: 8px; }
  body[data-mp="peta"] .map-wrap { min-height: 0; }
  body[data-mp="pesan"] .side, body[data-mp="pesan"] .center { display: none; }
  body[data-mp="pesan"] .right { grid-row: 1; }

  .now { font-size: 15px; padding: 10px 12px; }
  .ptt-wrap { flex-wrap: wrap; gap: 8px; }
  .ptt { flex: 1 1 100%; height: 92px; touch-action: none; -webkit-user-select: none; user-select: none; }
  .ptt-all, .ptt-private { flex: 1 1 calc(50% - 4px); height: 60px; }
  .ptt-all .ptt-main, .ptt-private .ptt-main { font-size: 14px; }
  .ptt-sub { font-size: 12px; }
  .vol { width: auto; flex: 1 1 calc(50% - 4px); }
  .channel { padding: 12px; }
  .hint { display: none; }
  .right .tab { padding: 10px 2px; font-size: 13px; }
  .msg-pane textarea, .msg-pane input, .msg-pane select { font-size: 16px; }

  /* kelola & laporan: menu jadi baris geser di atas */
  .manage:not([hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px; padding: 8px; }
  .mtabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 6px; gap: 4px; position: sticky; top: 0; z-index: 5; }
  .mtabs .mgroup { display: none; }
  .mtab { white-space: nowrap; padding: 10px 12px; }
  .mpane { padding: 14px 12px; border-radius: 12px; }
  .report:not([hidden]) { padding: 8px; }
  .mhead { flex-direction: column; gap: 10px; }
  .mhead > div:first-child { min-width: 0; }
  .mhead > .row { justify-content: flex-start; max-width: none; }
  .mhead .search, .inline-search { width: 100% !important; }
  .form-grid, #opForm.form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-inline input { max-width: none; }
  /* formulir sebaris (tambah HT, channel, undangan…) jadi bertumpuk */
  .mpane form.form-inline, .mpane .form-inline, .mpane form.row { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .mpane label.inline { flex-direction: column; align-items: stretch !important; gap: 4px; }
  .mpane label.inline input, .mpane label.inline select { width: 100%; max-width: none !important; }
  .mpane .form-inline .btn-primary, .mpane form.row .btn-primary { min-height: 44px; }
  .geo-grid { grid-template-columns: 1fr !important; }
  .route-bar input[type=range] { min-width: 0; }

  .dlg, .dlg.small { width: 96vw; max-width: 96vw; max-height: 92vh; overflow: auto; }
  .toast { bottom: calc(74px + env(safe-area-inset-bottom)); max-width: 92vw; }
  input, select, textarea { font-size: 16px; } /* iOS tidak memperbesar halaman saat mengetik */

  /* navigasi bawah */
  .mnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
  .mnav button { position: relative; display: grid; justify-items: center; gap: 1px; padding: 6px 2px; min-height: 52px; background: transparent;
    border: 0; border-radius: 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
  .mnav button i { font-style: normal; font-size: 20px; line-height: 1.1; }
  .mnav button.active { color: var(--text); background: var(--surface); }
  .mnav .badge { position: absolute; top: 2px; right: calc(50% - 26px); margin: 0; }
  body:not(.is-admin) .mnav .admin-only { display: none !important; }
}
@media (max-width: 380px) {
  .brand-dot { display: none; }
  .ptt-main { font-size: 17px; }
}
