/* Sistem desain sama dengan HT: warna = status. */
:root {
  --bg: #0b0e13;
  --panel: #141922;
  --surface: #1c2129;
  --line: #2a313c;
  --text: #f2f4f7;
  --muted: #96a0ac;
  --idle: #169658;   /* Siaga */
  --tx: #d62830;     /* Bicara */
  --rx: #2070e6;     /* Menerima */
  --wait: #f0b000;   /* Menyambung */
  --off: #58606c;    /* Terputus */
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.error { color: #ff6b6b; min-height: 1.2em; margin: 0; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; height: 100%; }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.login-card input { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 16px; }
.login-card input:focus { outline: 2px solid var(--rx); border-color: transparent; }
.btn-primary { background: var(--rx); color: #fff; border: 0; border-radius: 8px; padding: 11px; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }

/* ---------- layout ---------- */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--idle); }
.spacer { flex: 1; }
.op { color: var(--muted); font-size: 14px; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill-ok { background: rgba(22,150,88,.18); color: #3fd08a; }
.pill-wait { background: rgba(240,176,0,.18); color: var(--wait); }
.pill-off { background: rgba(214,40,48,.18); color: #ff6b6b; }

.grid { flex: 1; display: grid; grid-template-columns: 270px 1fr 310px; gap: 14px; padding: 14px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; overflow: auto; min-height: 0; }
.panel h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin-top: 14px; }

/* ---------- channel ---------- */
.channel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.channel { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid transparent; cursor: pointer; }
.channel:hover { border-color: var(--line); }
.channel.current { border-color: var(--rx); background: rgba(32,112,230,.12); }
.channel .name { flex: 1; font-weight: 600; }
.channel .count { color: var(--muted); font-size: 13px; }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.channel.talking .live { background: var(--rx); box-shadow: 0 0 0 4px rgba(32,112,230,.25); }

/* ---------- kiri ---------- */
.side { display: flex; flex-direction: column; }
.mt { margin-top: 20px !important; }
.cur-name { color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 600; margin-left: 4px; }

/* ---------- tengah ---------- */
.center { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.map-wrap { position: relative; isolation: isolate; z-index: 0; flex: 1; min-height: 240px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
#map { position: absolute; inset: 0; background: #0f141b; }
.legend { position: absolute; left: 10px; bottom: 10px; z-index: 500; display: flex; gap: 12px; padding: 6px 10px;
  background: rgba(11,14,19,.85); border-radius: 8px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lg-idle { background: var(--idle); } .lg-rx { background: var(--rx); } .lg-sos { background: var(--tx); } .lg-off { background: var(--off); }

/* Penanda HT di peta */
.ht-marker { display: flex; flex-direction: column; align-items: center; }
.ht-dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.6); background: var(--idle); }
.ht-label { margin-top: 3px; padding: 1px 6px; border-radius: 4px; background: rgba(11,14,19,.85); color: #fff; font: 600 12px/1.4 'Segoe UI', sans-serif; white-space: nowrap; }
.ht-marker.rx .ht-dot { background: var(--rx); box-shadow: 0 0 0 6px rgba(32,112,230,.35); }
.ht-marker.off .ht-dot { background: var(--off); }
.ht-marker.sos .ht-dot { background: var(--tx); animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(214,40,48,.7); } 100% { box-shadow: 0 0 0 18px rgba(214,40,48,0); } }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { font: 14px/1.5 'Segoe UI', sans-serif; margin: 12px 14px; }
.pop-title { font-weight: 700; font-size: 15px; }
.pop-row { color: var(--muted); }
.no-fix { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500; }
.now { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius); font-weight: 600; font-size: 18px; }
.now-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.now.idle { background: rgba(22,150,88,.14); color: #3fd08a; }
.now.rx { background: var(--rx); color: #fff; }
.now.tx { background: var(--tx); color: #fff; }

.members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; align-content: start; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid transparent; cursor: pointer; }
.member .pos { margin-left: auto; font-size: 12px; color: var(--muted); }
.member .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  font-size: 13px; background: var(--line); flex: none; }
.member .who { display: grid; min-width: 0; }
.member .who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .who span { font-size: 12px; color: var(--muted); }
.member.talking { border-color: var(--rx); background: rgba(32,112,230,.16); }
.member.talking .avatar { background: var(--rx); }
.member.me .avatar { background: var(--idle); }

.ptt-wrap { display: flex; align-items: center; gap: 24px; }
.ptt { flex: 1; height: 84px; border-radius: 16px; border: 0; background: var(--idle); color: #fff;
  display: grid; place-content: center; gap: 4px; user-select: none; touch-action: none; transition: background .08s; }
.ptt-main { font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.ptt-sub { font-size: 13px; opacity: .85; }
.ptt.active { background: var(--tx); }
.ptt:disabled { background: var(--off); cursor: not-allowed; }
.vol { display: grid; gap: 6px; color: var(--muted); font-size: 13px; width: 150px; }

/* ---------- aktivitas ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed li { display: grid; grid-template-columns: 54px 1fr; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.feed .sos { color: #ff6b6b; font-weight: 700; }
.feed .tx { color: #ff8a8f; }

/* ---------- SOS ---------- */
.sos-bar { position: relative; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--tx); color: #fff;
  font-weight: 700; font-size: 18px; animation: blink 1s steps(1) infinite; }
.sos-icon { background: #fff; color: var(--tx); border-radius: 6px; padding: 2px 8px; }
.sos-text { flex: 1; }
.btn-sos-ghost { background: transparent; color: #fff; border: 2px solid #fff; border-radius: 8px; padding: 6px 14px; font-weight: 700; }
.btn-sos { background: #fff; color: var(--tx); border: 0; border-radius: 8px; padding: 8px 18px; font-weight: 800; }
@keyframes blink { 50% { background: #8a0e14; } }

/* ---------- gerbang audio ---------- */
.gate { position: fixed; inset: 0; z-index: 3000; background: rgba(5,7,10,.8); display: grid; place-items: center; }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 360px; text-align: center; }
.gate-card h2 { margin-top: 0; }
