@font-face { font-family: 'Heebo'; src: url('/heebo.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #f4f7f7; --card: #ffffff; --ink: #17302f; --soft: #5d7270; --line: #dbe5e4;
  --accent: #1f7a78; --accent-ink: #ffffff; --accent-soft: #e2f1f0;
  --red: #d93a3a; --red-soft: #fde8e8; --orange: #d9822b; --orange-soft: #fdf0e1;
  --green: #2f9e5b; --green-soft: #e3f5ea; --blue: #2f73c9; --blue-soft: #e5eefb; --gray-soft: #eef2f2;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(20,60,60,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1716; --card: #17221f; --ink: #e5efed; --soft: #95aaa7; --line: #29393a;
    --accent: #3fb3ad; --accent-ink: #0b1514; --accent-soft: #1b3533;
    --red: #f0605e; --red-soft: #3a1d1d; --orange: #f0a35a; --orange-soft: #3a2a17;
    --green: #4cc27d; --green-soft: #18321f; --blue: #6aa5f0; --blue-soft: #18263a; --gray-soft: #1d2a28;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: 'Heebo', system-ui, sans-serif; font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.mt { margin-top: 12px; } .mt-s { margin-top: 8px; } .m0 { margin: 0; } .mb { margin-bottom: 12px; } .mb-s { margin-bottom: 6px; }
.card.flat { box-shadow: none; margin: 12px 0 0; background: var(--bg); }

header { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar { max-width: 760px; margin: 0 auto; padding: 10px 16px 0; display: flex; align-items: center; gap: 12px; }
.bar h1 { font-size: 20px; margin: 0; font-weight: 700; }
.dot-live { width: 10px; height: 10px; border-radius: 50%; background: var(--soft); display: inline-block; }
.dot-live.on { background: var(--red); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
nav { max-width: 760px; margin: 0 auto; padding: 6px 12px 0; display: flex; gap: 4px; overflow-x: auto; }
nav button { border: 0; background: none; padding: 10px 14px; border-bottom: 3px solid transparent; cursor: pointer; color: var(--soft); white-space: nowrap; font-weight: 500; }
nav button.on { color: var(--ink); border-color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; margin: 0 0 12px; font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--soft); font-size: 14px; }
.small { font-size: 13px; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: none; }
.btn.sm { padding: 5px 11px; font-size: 14px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.big { width: 100%; padding: 13px; font-size: 17px; }

/* status */
.status { border-radius: 14px; padding: 18px; margin-bottom: 14px; background: var(--gray-soft); }
.status .label { font-size: 24px; font-weight: 800; }
.status .sub { color: var(--soft); margin-top: 2px; }
.status.live { background: var(--red-soft); } .status.live .label { color: var(--red); }
.status.slate { background: var(--orange-soft); } .status.slate .label { color: var(--orange); }
.status.waiting, .status.arming, .status.preview { background: var(--blue-soft); } .status.waiting .label, .status.arming .label, .status.preview .label { color: var(--blue); }
.status .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

.preview { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview .empty { color: #8aa; font-size: 15px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { background: var(--gray-soft); border-radius: 999px; padding: 3px 11px; font-size: 13.5px; }
.chip.warn { background: var(--orange-soft); color: var(--orange); font-weight: 600; }
.chip.bad { background: var(--red-soft); color: var(--red); font-weight: 600; }
.chip.ok { background: var(--green-soft); color: var(--green); }

.dests { list-style: none; margin: 0; padding: 0; }
.dests li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); }
.dests li:first-child { border-top: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--line); }
.dot.ok { background: var(--green); } .dot.slate { background: var(--orange); } .dot.connecting { background: var(--blue); }
.dot.error, .dot.nokey, .dot.missing { background: var(--red); } .dot.off, .dot.disabled { background: var(--line); }
.plat { width: 24px; height: 24px; border-radius: 6px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; }
.plat.youtube { background: #e62117; } .plat.facebook { background: #1877f2; } .plat.instagram { background: #c13584; } .plat.rtmp { background: #6b7c7a; }
.dests .state { font-size: 14px; color: var(--soft); text-align: left; }
.dests .err { font-size: 12.5px; color: var(--red); }

.alerts { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.alerts li { padding: 7px 0; border-top: 1px solid var(--line); white-space: pre-line; }
.alerts li:first-child { border-top: 0; }
.alerts time { color: var(--soft); font-size: 12.5px; margin-left: 8px; }

/* forms */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 14px; color: var(--soft); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.ltr { direction: ltr; text-align: left; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.seg { display: flex; gap: 8px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; font-size: 16px; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); }
.checks { display: grid; gap: 6px; margin-bottom: 14px; }
.checks label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
.copy { display: flex; gap: 6px; }
.copy input { flex: 1; }

/* broadcasts */
.ev { padding: 12px 0; border-top: 1px solid var(--line); }
.ev:first-child { border-top: 0; padding-top: 0; }
.ev .t { font-weight: 700; }
.badge { font-size: 12.5px; border-radius: 999px; padding: 2px 9px; background: var(--gray-soft); font-weight: 600; }
.badge.live { background: var(--red-soft); color: var(--red); } .badge.scheduled { background: var(--blue-soft); color: var(--blue); }
.badge.ended { background: var(--green-soft); color: var(--green); }
.links { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; }
.links li { display: flex; gap: 8px; align-items: center; padding: 3px 0; flex-wrap: wrap; }
.links a { direction: ltr; word-break: break-all; }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; user-select: none; }
.switch input { width: 17px; height: 17px; accent-color: var(--accent); }
.drow { padding: 12px 0; border-top: 1px solid var(--line); }
.drow:first-child { border-top: 0; padding-top: 0; }
.drow img { width: 28px; height: 28px; border-radius: 50%; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px;
  border-radius: 10px; z-index: 20; max-width: calc(100% - 32px); box-shadow: 0 4px 18px rgba(0,0,0,.2); }
.toast.bad { background: var(--red); color: #fff; }

.login { max-width: 360px; margin: 12vh auto 0; }
body.note main { max-width: 480px; margin: 14vh auto 0; text-align: center; }
