:root {
  --bg: #f4f5f9; --card: #fff; --text: #1b1d29; --muted: #6b7083;
  --accent: #5b4cf5; --accent-2: #ece9ff; --live: #e5384f; --ok: #1fa363; --border: #e3e5ee;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12131a; --card: #1c1e28; --text: #eceef5; --muted: #9a9fb3;
    --accent: #8b80ff; --accent-2: #2a2752; --border: #2c2f3d; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45; }
main { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
input, select { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 1rem; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 12px 16px;
  background: var(--accent); color: #fff; font-weight: 600; }
button.secondary { background: var(--accent-2); color: var(--accent); }
button.danger { background: var(--live); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.big { width: 100%; padding: 16px; font-size: 1.1rem; margin-top: 14px; }
.chan { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left;
  background: var(--card); color: var(--text); border: 2px solid var(--border); margin-bottom: 10px; padding: 16px; }
.chan.active { border-color: var(--accent); background: var(--accent-2); }
.chan:disabled { opacity: .55; }
.badge { font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--border); color: var(--muted); }
.badge.live { background: var(--live); color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--live); margin-right: 6px;
  animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.meter { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.meter > div { height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.muted { color: var(--muted); font-size: .9rem; }
.link { word-break: break-all; font-family: ui-monospace, monospace; font-size: .85rem; background: var(--bg);
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
#qr { display: flex; justify-content: center; margin: 14px 0 6px; }
#qr img, #qr svg { background: #fff; padding: 10px; border-radius: 12px; width: 200px; height: 200px; }
.state { text-align: center; padding: 26px 10px; }
.state .icon { font-size: 2.6rem; }
.hidden { display: none !important; }
.chk { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: .95rem; margin: 8px 0 0; }
.chk input { width: auto; }
main.wide { max-width: 980px; }
.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.brand-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand-row .brand { margin: 0; }
button.small, .btn.small { padding: 7px 11px; font-size: .85rem; border-radius: 9px; }
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 600;
  border-radius: 12px; padding: 12px 16px; background: var(--accent); color: #fff; }
.btn.secondary { background: var(--accent-2); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.ev-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ev-head h2 { margin: 0 0 2px; font-size: 1.25rem; }
.access { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--bg);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
.access-label { font-size: .85rem; color: var(--muted); }
.access-code { font-size: 1.6rem; font-weight: 800; letter-spacing: .1em; color: var(--accent); margin-right: auto; }
.chan-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.chan-table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.chan-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.chan-table tr:last-child td { border-bottom: 0; }
.chan-table td.btn-row { justify-content: flex-end; }
code.spk { font-family: ui-monospace, monospace; font-size: 1rem; font-weight: 700; letter-spacing: .05em;
  background: var(--bg); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; }
@media (max-width: 720px) {
  .chan-table thead { display: none; }
  .chan-table, .chan-table tbody, .chan-table tr, .chan-table td { display: block; width: 100%; }
  .chan-table tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .chan-table td { border: 0; padding: 4px 0; }
  .chan-table td.btn-row { justify-content: flex-start; }
}
.chan-edit { display: flex; gap: 8px; margin-bottom: 8px; }
.chan-edit input { flex: 1; }
.card.editing { border-color: var(--accent); }
dialog { border: 0; border-radius: 18px; padding: 22px; width: min(440px, calc(100vw - 32px));
  background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(10, 10, 20, .55); }
.share-body { text-align: center; }
.share-body h2 { margin: 2px 0 6px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
@media print {
  body.printing main { display: none; }
  body.printing dialog { box-shadow: none; width: 100%; position: static; }
  body.printing .no-print { display: none; }
  body.printing .code-big { color: #000; }
}
.code-input { font-size: 1.8rem; text-align: center; letter-spacing: .15em; font-weight: 700; }
.code-big { text-align: center; font-size: 2.6rem; font-weight: 800; letter-spacing: .12em; color: var(--accent); margin: 4px 0; }
.err { color: var(--live); font-size: .9rem; margin-top: 10px; }
