:root {
  color-scheme: dark;
  --bg: #0d1014;
  --panel: #151a20;
  --panel-2: #1c232b;
  --line: #29323c;
  --text: #e3e8ee;
  --muted: #8a96a3;
  --accent: #f5a524;          /* Uniden-oranje */
  --ok: #3ccf7a;
  --warn: #f5a524;
  --bad: #ef4f4f;
  --lcd-bg: #05080a;
  --lcd-text: #d8f3ff;
  --lcd-dim: #6f8a96;
  --lcd-sys: #7fd3ff;
  --lcd-dept: #b5f28a;
  --lcd-chan: #ffffff;
  --rx: #3ccf7a;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); }
body { min-height: 100dvh; padding: 0 16px env(safe-area-inset-bottom, 0); }
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }

.wrap { max-width: 760px; margin: 0 auto; padding-block: 12px 32px; }

/* ------------------------------------------------------------------ header */
header.top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-block: calc(env(safe-area-inset-top, 0px) + 6px) 10px;
}
.brand { font-weight: 700; letter-spacing: .04em; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.brand .logo { width: 22px; height: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.chip.ok .dot { background: var(--ok); }
.chip.warn .dot { background: var(--warn); }
.chip.ok { color: var(--text); }
.btn-link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; font-size: 13px; }
.btn-link:hover { color: var(--text); }

/* ------------------------------------------------------------------ LCD */
.lcd {
  position: relative; background: var(--lcd-bg); border-radius: var(--radius);
  border: 2px solid #222a31; padding: 12px 14px 14px; font-family: var(--mono);
  color: var(--lcd-text); box-shadow: inset 0 0 40px rgba(127, 211, 255, .04);
  transition: border-color .15s, box-shadow .15s;
}
.lcd.rx { border-color: var(--rx); box-shadow: 0 0 0 1px var(--rx), 0 0 24px rgba(60, 207, 122, .25), inset 0 0 40px rgba(60, 207, 122, .06); }
.lcd.offline { opacity: .55; }

.lcd-status {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--lcd-dim); border-bottom: 1px solid #1a232b; padding-bottom: 8px;
}
.lcd-status .mode { color: var(--lcd-text); }
.tag { padding: 1px 6px; border-radius: 4px; background: #13202a; color: var(--lcd-text); }
.tag.hold { background: var(--accent); color: #111; font-weight: 700; }
.tag.rx { background: var(--rx); color: #06210f; font-weight: 700; }
.spacer { flex: 1; }

.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 4px; background: #24323d; border-radius: 1px; }
.bars i:nth-child(1) { height: 20%; } .bars i:nth-child(2) { height: 40%; }
.bars i:nth-child(3) { height: 60%; } .bars i:nth-child(4) { height: 80%; }
.bars i:nth-child(5) { height: 100%; }
.bars i.on { background: var(--rx); }

.lcd-rows { display: grid; gap: 2px; margin-top: 10px; }
.row { display: grid; grid-template-columns: 56px 1fr; align-items: baseline; gap: 10px; min-width: 0; }
.row .lbl { font-size: 10px; letter-spacing: .1em; color: var(--lcd-dim); text-transform: uppercase; }
.row .val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.sys .val { color: var(--lcd-sys); font-size: 16px; }
.row.dept .val { color: var(--lcd-dept); font-size: 16px; }
.row.chan .val { color: var(--lcd-chan); font-size: clamp(22px, 6vw, 30px); font-weight: 700; line-height: 1.2; }
.row.site .val { color: var(--lcd-dim); font-size: 13px; }

.lcd-freq {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; padding-top: 8px;
  border-top: 1px solid #1a232b; font-size: 14px;
}
.lcd-freq .big { font-size: 20px; color: var(--lcd-text); }
.lcd-freq span { color: var(--lcd-dim); }
.lcd-freq b { color: var(--lcd-text); font-weight: 600; }

.meter { margin-top: 10px; display: grid; grid-template-columns: 56px 1fr 64px; gap: 10px; align-items: center; font-size: 12px; color: var(--lcd-dim); }
.meter .track { height: 8px; background: #13202a; border-radius: 4px; overflow: hidden; }
.meter .fill { height: 100%; width: 0; background: linear-gradient(90deg, #2fae67, #3ccf7a 60%, #f5d524); transition: width .2s; }
.meter .num { text-align: right; color: var(--lcd-text); }

.lcd-msg { margin-top: 8px; font-size: 12px; color: var(--accent); min-height: 1.2em; }

/* ------------------------------------------------------------------ audio */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 14px; }
.audio { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.play {
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: var(--accent); color: #111; display: grid; place-items: center;
  box-shadow: 0 4px 18px rgba(245, 165, 36, .25);
}
.play:disabled { opacity: .5; cursor: default; }
.play svg { width: 26px; height: 26px; }
.play.playing { background: var(--panel-2); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.audio-info { flex: 1; min-width: 180px; }
.audio-info .title { font-weight: 600; }
.audio-info .sub { color: var(--muted); font-size: 13px; }
.vol { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 4px; }
.vol svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }

.foot { color: var(--muted); font-size: 12px; margin-top: 12px; text-align: center; }

/* ------------------------------------------------------------------ login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; }
.login { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.login h1 { margin: 0 0 4px; font-size: 20px; }
.login p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login input { width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login button { margin-top: 18px; width: 100%; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: #111; font-weight: 700; cursor: pointer; }
.login .err { color: var(--bad); font-size: 14px; min-height: 1.4em; margin-top: 10px; }

@media (max-width: 420px) {
  .row { grid-template-columns: 44px 1fr; }
  .meter { grid-template-columns: 44px 1fr 56px; }
}

/* ------------------------------------------------------------------ nav */
.nav { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.nav a { color: var(--muted); text-decoration: none; padding: 3px 12px; border-radius: 999px; font-size: 13px; }
.nav a.active { background: var(--panel-2); color: var(--text); }
.nav a:hover { color: var(--text); }
.top .brand { margin-right: 4px; }
.top .nav { margin-right: auto; }

/* ------------------------------------------------------------------ hits */
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.panel-head h2 { font-size: 15px; margin: 0; }
.panel-head a { font-size: 13px; text-decoration: none; }
.hits { list-style: none; margin: 0; padding: 0; }
.hits .empty { color: var(--muted); font-size: 14px; padding: 10px 0; }
.hit {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 36px; gap: 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.hit:first-child { border-top: 0; }
.hit .when { display: grid; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.hit .when .date { font-family: var(--sans); font-size: 11px; }
.hit .what { min-width: 0; }
.hit .chan { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit .meta, .hit .tech { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit .tech { font-family: var(--mono); font-size: 11px; }
.hit .dur { font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.hit.live { background: linear-gradient(90deg, rgba(60, 207, 122, .10), transparent 70%); }
.hit.live .chan { color: var(--rx); }
.hit.live .dur { color: var(--rx); }
.clip {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2);
  display: grid; place-items: center; cursor: pointer; color: var(--text); padding: 0;
}
.clip svg { width: 16px; height: 16px; }
.clip:disabled { cursor: default; background: transparent; }
.clip.playing { background: var(--accent); color: #111; border-color: var(--accent); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ------------------------------------------------------------------ filters */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.filters input, .filters select {
  width: 100%; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; min-height: 38px;
}
.filters .check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); align-self: end; min-height: 38px; }
.filters .check input { width: auto; min-height: 0; }
.filter-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.btn.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
.summary { color: var(--muted); font-size: 13px; margin-left: auto; }
.more { display: block; margin: 12px auto 0; }
.day-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 0 4px; border-top: 0 !important; display: block !important; }

@media (max-width: 480px) {
  .hit { grid-template-columns: 50px minmax(0, 1fr) auto 34px; gap: 8px; }
  .hit .when { font-size: 11px; }
  .hit .chan { font-size: 14px; }
  .chip { padding: 3px 8px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
