:root {
  --bg: #f3f4f6; --card: #ffffff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #1d4ed8; --talk: #dc2626; --rx: #16a34a;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f172a; --card: #1e293b; --text: #e5e7eb; --muted: #94a3b8; --line: #334155; --accent: #60a5fa; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
main, #login { max-width: 1100px; margin: 20px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
#login { max-width: 420px; }
label { display: block; margin-bottom: 10px; color: var(--muted); }
input { display: block; width: 100%; padding: 8px 10px; margin-top: 4px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
button { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); }
.error { color: var(--talk); min-height: 1.4em; }
.hint { color: var(--muted); font-size: 13px; }
#channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.channel { cursor: pointer; transition: border-color .15s; }
.channel.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.channel.rx { border-color: var(--rx); box-shadow: 0 0 0 3px var(--rx) inset; }
.channel.tx { border-color: var(--talk); box-shadow: 0 0 0 3px var(--talk) inset; }
.channel .top { display: flex; justify-content: space-between; align-items: center; }
.status { font-size: 13px; color: var(--muted); }
.speaker { min-height: 1.5em; font-weight: 600; margin: 8px 0; }
.channel.rx .speaker { color: var(--rx); }
.channel.tx .speaker { color: var(--talk); }
.members { list-style: none; padding: 0; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.members li.talking { color: var(--rx); font-weight: 600; }
.ptt { width: 100%; padding: 18px; font-size: 17px; font-weight: 600; background: var(--talk); border-color: var(--talk); user-select: none; touch-action: none; }
.ptt.active { filter: brightness(0.8); }
.row { display: flex; gap: 8px; margin-bottom: 8px; }
#log { margin: 0; padding-left: 20px; max-height: 260px; overflow: auto; font-size: 13px; color: var(--muted); }

/* ---------- noodmeldingen ---------- */
#emergencies .emergency { background: var(--talk); color: #fff; border-radius: 8px; padding: 12px 16px; margin-bottom: 10px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; animation: blink 1s step-start infinite; }
#emergencies .emergency.acked, #emergencies .emergency.cancelled { animation: none; opacity: .75; }
#emergencies .emergency b { font-size: 18px; }
#emergencies .emergency .grow { flex: 1; min-width: 200px; }
#emergencies .emergency button { background: #fff; color: var(--talk); border-color: #fff; }
@keyframes blink { 50% { filter: brightness(1.25); } }

/* ---------- tenant kiezen + beheer ---------- */
#tenantPick { max-width: 420px; margin: 20px auto; }
select { font: inherit; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
#tenantPick select { width: 100%; margin-bottom: 10px; }
#app { max-width: 1400px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tab { background: transparent; color: var(--accent); }
.tab.active { background: var(--accent); color: #fff; }
.layout2 { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
@media (max-width: 760px) { .layout2 { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 0 0 10px; padding: 0; }
.list li { padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.list li.active { background: var(--accent); color: #fff; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 12px; align-items: end; }
.grid label { margin: 0; }
.inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.inline input, .inline select { width: auto; display: inline-block; margin: 0; }
label.check { display: flex; gap: 6px; align-items: center; color: var(--text); }
label.check input { width: auto; margin: 0; }
button.danger { background: transparent; color: var(--talk); border-color: var(--talk); }
button.small { padding: 3px 8px; font-size: 13px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.ok { color: var(--rx); }
.grid input, .grid select { width: 100%; }
tr.stale td { color: #9ca3af; }
.inline.wrap { flex-wrap: wrap; }
.statusgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 900px; }
.statusgrid label { display: flex; gap: 6px; align-items: center; }
.statusgrid b { width: 1.2em; text-align: center; flex: none; }
.statusgrid select, .statusgrid input { flex: 1; min-width: 0; }
h4 { margin: 12px 0 4px; }

/* startpagina */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid #d1d5db; border-radius: 8px; color: inherit; text-decoration: none; background: #fff; }
.tile b { font-size: 1.1rem; color: #1d4ed8; }
.tile span { font-size: .9rem; color: #6b7280; }
a.tile:hover { border-color: #1d4ed8; background: #eff6ff; }
.tile.disabled { opacity: .55; }
.tile.disabled b { color: #6b7280; }

/* beheer: boom links, kruimelpad boven */
.beheer { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .beheer { grid-template-columns: 1fr; } }
#tree { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding: 12px 8px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; border-left: 1px solid var(--line); margin-left: 8px; }
.tree > li.group { margin-bottom: 10px; }
.tree > li.group > span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; padding: 2px 8px; }
.tree a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree a:hover { background: #eff6ff; }
.tree a.here { background: var(--accent); color: #fff; font-weight: 600; }
.tree a.add { color: var(--accent); font-size: 13px; }
.tree a.add.here { color: #fff; }
.crumb { font-size: 14px; color: #6b7280; margin: 4px 0 2px; }
.crumb a { color: var(--accent); }
.crumb b { color: var(--text); }
.linklist { list-style: none; padding: 0; margin: 0 0 10px; }
.linklist li { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.linklist li a { font-weight: 600; color: var(--accent); }
.addlink { display: inline-block; margin: 4px 0 8px; font-weight: 600; color: var(--accent); }
