:root{
  --bg:#0b0f14;
  --panel:#121923;
  --panel2:#0f1620;
  --text:#e6eef7;
  --muted:#93a4b8;
  --accent:#3ddc97;
  --accent2:#4ea1ff;
  --danger:#ff4d4d;
  --border:#213042;
  --shadow: rgba(0,0,0,.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  background:linear-gradient(180deg,#070b10,#0b0f14);
  color:var(--text);
}

a{color:inherit}
code, .mono{font-family:var(--mono); font-size:.95em}
.muted{color:var(--muted)}

#app{min-height:100%; display:flex; flex-direction:column}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  border-bottom:1px solid var(--border);
  background:rgba(18,25,35,.85);
  backdrop-filter: blur(8px);
  position:sticky; top:0; z-index:10;
}

.brand-title{font-weight:800; letter-spacing:.2px}
.brand-sub{color:var(--muted); font-size:12px}

.top-right{display:flex; align-items:center; gap:14px}
.stat{display:flex; flex-direction:column; align-items:flex-end}
.stat-label{color:var(--muted); font-size:11px}
.stat-value{font-weight:700; font-family:var(--mono)}
.admin-link{
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  text-decoration:none;
  background:rgba(15,22,32,.7);
}

.grid{
  flex:1;
  display:grid;
  grid-template-columns: 320px 1fr 340px;
  grid-template-rows: 1fr 1.1fr;
  gap:12px;
  padding:12px;
}

.panel{
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  background:rgba(18,25,35,.65);
  box-shadow:0 12px 30px var(--shadow);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.panel-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  background:rgba(15,22,32,.8);
  border-bottom:1px solid var(--border);
  font-weight:700;
}

.panel-title input[type="search"]{
  width: 48%;
  min-width: 140px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  outline:none;
  background:rgba(0,0,0,.25);
  color:var(--text);
}

.panel-body{padding:10px 12px; overflow:auto; min-height:0}

.panel-talkgroups{grid-row:1 / span 2}
.panel-now{grid-column:2; grid-row:1}
.panel-scanlist{grid-column:3; grid-row:1}
.panel-calls{grid-column:2 / span 2; grid-row:2}

.system-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}
.system-row label{color:var(--muted); font-size:12px}
.system-row select{
  flex:1;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.25);
  color:var(--text);
}

.btn{
  border:1px solid var(--border);
  background:rgba(0,0,0,.25);
  color:var(--text);
  padding:9px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
}
.btn:hover{border-color:rgba(78,161,255,.6)}
.btn:active{transform:translateY(1px)}
.btn.small{padding:6px 10px; font-size:12px; border-radius:10px}
.btn.danger{border-color:rgba(255,77,77,.4)}
.btn.danger:hover{border-color:rgba(255,77,77,.85)}

.toggle{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--border);
  padding:6px 10px;
  border-radius:12px;
  background:rgba(0,0,0,.18);
  user-select:none;
}
.toggle input{accent-color: var(--accent2);}

.hint{margin-top:10px; color:var(--muted); font-size:12px}

.tg-list{display:flex; flex-direction:column; gap:8px}
.tg-item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 10px;
  background:rgba(0,0,0,.18);
  display:flex;
  justify-content:space-between;
  gap:10px;
  cursor:grab;
}
.tg-item:active{cursor:grabbing}
.tg-left{display:flex; flex-direction:column; gap:2px}
.tg-name{font-weight:800}
.tg-desc{color:var(--muted); font-size:12px; line-height:1.2}
.tg-badges{display:flex; gap:6px; align-items:center}
.badge{
  font-family:var(--mono);
  font-size:11px;
  padding:3px 7px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--muted);
}
.badge.good{color:var(--accent); border-color:rgba(61,220,151,.35)}
.badge.blue{color:var(--accent2); border-color:rgba(78,161,255,.35)}

.scan-list{
  min-height: 240px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.scan-item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 10px;
  background:rgba(0,0,0,.18);
  display:flex;
  justify-content:space-between;
  gap:10px;
  cursor:grab;
}
.scan-item.disabled{
  opacity:.45;
  filter:saturate(.5);
}
.scan-item:active{cursor:grabbing}
.scan-right{display:flex; gap:8px; align-items:center}
.scan-dot{
  width:10px; height:10px;
  border-radius:50%;
  background:var(--accent);
}
.scan-dot.off{background:rgba(147,164,184,.5)}

.now-body{display:flex; flex-direction:column; gap:12px}
.scanner-lines{
  border:1px solid var(--border);
  background:rgba(0,0,0,.22);
  border-radius:16px;
  padding:12px;
  font-family:var(--mono);
  letter-spacing:.3px;
}
.scanner-lines .line{padding:3px 0; color:var(--accent); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
#player{width:100%}
.now-meta{
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
  white-space:pre-wrap;
}

.call-grid-head{
  display:grid;
  grid-template-columns: 90px 120px 80px 1fr 110px 110px 90px;
  gap:8px;
  padding:8px 10px;
  border-radius:14px;
  background:rgba(0,0,0,.18);
  border:1px solid var(--border);
  color:var(--muted);
  font-size:12px;
  position:sticky; top:0; z-index:2;
}
.call-grid{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.call-row{
  display:grid;
  grid-template-columns: 90px 120px 80px 1fr 110px 110px 90px;
  gap:8px;
  padding:8px 10px;
  border-radius:14px;
  background:rgba(0,0,0,.18);
  border:1px solid var(--border);
  align-items:center;
}
.call-row:hover{border-color:rgba(78,161,255,.45)}
.call-row .smalltxt{color:var(--muted); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.call-row .name{font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.call-row button{
  padding:6px 10px;
  border-radius:10px;
}

.footer{
  padding:10px 16px;
  border-top:1px solid var(--border);
  color:var(--muted);
  font-size:12px;
}

.login-wrap{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}
.login-card{
  width: min(420px, 95vw);
  background:rgba(18,25,35,.75);
  border:1px solid var(--border);
  border-radius:20px;
  padding:16px;
  box-shadow:0 20px 45px var(--shadow);
}
.login-card h1{margin:0 0 12px 0}
.login-card label{display:block; margin:10px 0 6px 0; color:var(--muted); font-size:12px}
.login-card input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.22);
  color:var(--text);
}
.alert{
  border:1px solid rgba(255,77,77,.45);
  background:rgba(255,77,77,.12);
  padding:10px 12px;
  border-radius:14px;
  margin:10px 0;
}

.admin-wrap{padding:16px}
.admin-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:12px;
}
.admin-sub{color:var(--muted); font-size:12px}
.admin-actions{display:flex; gap:10px}
.admin-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}
.admin-card{
  border:1px solid var(--border);
  border-radius:16px;
  background:rgba(18,25,35,.65);
  box-shadow:0 12px 30px var(--shadow);
  padding:12px;
}
.admin-card h2{margin:0 0 10px 0}
.admin-card h3{margin:14px 0 10px 0}
.table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--border);
}
.table th,.table td{
  text-align:left;
  padding:8px 10px;
  border-bottom:1px solid rgba(33,48,66,.6);
  font-size:13px;
}
.table th{color:var(--muted); font-size:12px; background:rgba(0,0,0,.18)}
.table tr:last-child td{border-bottom:none}
.table td.mono{font-family:var(--mono); font-size:12px; word-break:break-all}

.form-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.form-row input, .form-row select{
  padding:9px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.22);
  color:var(--text);
}
.form-row input[type="file"]{padding:7px 10px}
@media (max-width: 1100px){
  .grid{
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .panel-talkgroups, .panel-now, .panel-scanlist, .panel-calls{
    grid-column:auto;
    grid-row:auto;
  }
}


/* Multi-system scan toggles + call filters */
.scan-systems-row{
  display:flex;
  gap:10px;
  align-items:center;
  padding:8px 0;
  border-bottom:1px solid rgba(255,255,255,0.08);
  margin-bottom:10px;
}
.scan-systems-label{
  font-size:12px;
  opacity:0.85;
  white-space:nowrap;
}
.scan-systems{
  display:flex;
  flex-wrap:wrap;
  gap:6px 10px;
}
.sys-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(255,255,255,0.05);
  cursor:pointer;
  user-select:none;
  font-size:12px;
}
.sys-chip input{ margin:0; }
.sys-chip.off{
  opacity:0.5;
  background:rgba(255,255,255,0.02);
}

.calls-filter-row{
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom:10px;
}
.calls-filter-row input[type="search"]{
  flex:1;
  min-width:180px;
}
.calls-filter-row select{
  width:200px;
}
@media (max-width: 900px){
  .calls-filter-row{
    flex-direction:column;
    align-items:stretch;
  }
  .calls-filter-row select{ width:100%; }
}

.tg-system-header{
  margin-top:10px;
  padding:6px 8px;
  font-weight:700;
  font-size:12px;
  letter-spacing:0.02em;
  text-transform:uppercase;
  opacity:0.9;
  border-top:1px solid rgba(255,255,255,0.08);
  border-bottom:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.03);
}

.hidden{ display:none !important; }

.setup-banner{
  margin:12px 14px 0 14px;
  padding:12px 14px;
  border:1px solid rgba(255,255,255,0.10);
  background:rgba(255,255,255,0.04);
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.setup-banner-title{
  font-weight:800;
  letter-spacing:0.01em;
  margin-bottom:4px;
}
.setup-banner-body{
  opacity:0.9;
  font-size:13px;
  line-height:1.35;
}

.empty{
  padding:10px 10px;
  opacity:0.9;
  font-size:13px;
  line-height:1.35;
  border:1px dashed rgba(255,255,255,0.14);
  border-radius:12px;
  background:rgba(255,255,255,0.02);
}
.empty a{
  color:inherit;
  font-weight:800;
  text-decoration:underline;
}
