:root {
  color-scheme: dark;
  --bg: #11121e;
  --panel: #1c2032;
  --panel2: #171a2b;
  --line: #3a4261;
  --text: #f6f3ff;
  --muted: #b3bad5;
  --accent: #c2aeff;
  --sky: #9bd4ff;
  --peach: #ffc196;
  --warn: #ffd48a;
  --bad: #ff9b93;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); }
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
aside { background: #15182a; border-right: 1px solid var(--line); padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; gap: 10px; align-items: center; margin: 0 3px 27px; font-size: 16px; font-weight: 750; line-height: 1.15; }
.brand-mark { width: 48px; height: 48px; display: block; object-fit: cover; background: #13274d; border: 1px solid #799de4; border-radius: 12px; }
.brand .mini { display: block; margin-top: 4px; }
.mini, .muted { color: var(--muted); font-size: .83rem; font-weight: 400; }
.nav { display: grid; gap: 4px; }
.nav button { border: 0; border-left: 2px solid transparent; background: transparent; color: var(--muted); text-align: left; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-weight: 600; }
.nav button:hover, .nav button.active { background: #352c57; color: var(--text); }
.nav button.active { border-left-color: var(--accent); }
main { padding: 26px clamp(17px, 3vw, 44px) 44px; min-width: 0; }
.top, .top-left { display: flex; gap: 12px; align-items: center; }
.top { justify-content: space-between; margin-bottom: 24px; }
.topbtn { padding: 7px 9px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 7px; cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.5rem, 3.6vw, 2.15rem); line-height: 1.1; margin-bottom: 0; letter-spacing: -.035em; }
h2 { font-size: 1.08rem; margin-bottom: 12px; }
h3 { font-size: .99rem; margin-bottom: 7px; }
.section { display: none; }
.section.active { display: block; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span12 { grid-column: span 12; }
.span8 { grid-column: span 8; }
.span7 { grid-column: span 7; }
.span6 { grid-column: span 6; }
.span5 { grid-column: span 5; }
.span4 { grid-column: span 4; }
.span3 { grid-column: span 3; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 18px; min-width: 0; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .kpi { font-size: 1.72rem; line-height: 1.15; font-variant-numeric: tabular-nums; font-weight: 730; overflow-wrap: anywhere; }
.stat h2 { font-size: .88rem; color: var(--muted); margin: 0; }
.stat p { margin: 0; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: block; color: #c0cfd1; font-size: .83rem; font-weight: 650; margin: 11px 0 5px; }
input, select, textarea { width: 100%; padding: 9px 10px; border-radius: 7px; border: 1px solid var(--line); background: #11191e; color: var(--text); font: inherit; }
input[type="checkbox"] { width: auto; margin-right: 5px; accent-color: var(--accent); }
textarea { min-height: 75px; resize: vertical; }
button { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary, .secondary, .danger, .good, .liveStart, .liveStop { display: inline-block; border: 1px solid transparent; border-radius: 7px; padding: 8px 13px; font-weight: 700; cursor: pointer; text-decoration: none; }
.primary, .good, .liveStart { background: var(--accent); color: #21163c; }
.good { background: var(--sky); color: #11233a; }
.liveStart { background: var(--peach); color: #382014; }
.secondary { background: #243038; border-color: #394851; color: var(--text); }
.danger, .liveStop { background: #43282a; border-color: #6c4343; color: #ffd0cb; }
button:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.note, .status-box { padding: 11px 13px; border: 1px solid var(--line); background: var(--panel2); border-radius: 7px; color: var(--muted); font-size: .86rem; }
.statusdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #829095; margin-right: 5px; }
.statusdot.on { background: var(--sky); box-shadow: 0 0 8px #9bd4ff80; }
.rule, .audioItem, .activityItem, .giftItem { padding: 11px 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; margin: 7px 0; }
.ruleTop, .audioItem, .activityItem, .giftItem { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.pill { font-size: .72rem; padding: 3px 7px; border-radius: 5px; background: #34305a; color: var(--accent); white-space: nowrap; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.mediaCard { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel2); }
.thumb { height: 110px; display: grid; place-items: center; background: #10171b; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.mediaBody { padding: 10px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
audio { width: 100%; height: 36px; }
.dangerbar, .liveControl { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.dangerbar { background: #2d2023; border: 1px solid #5c3638; border-radius: 7px; padding: 12px; }
.liveControl { min-height: 88px; }
.liveState { font-size: 1.34rem; font-weight: 760; }
.liveState.on { color: var(--accent); }
.liveState.off { color: var(--muted); }
.preview { min-height: 180px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; background: #10171b; }
pre { white-space: pre-wrap; }
.fileDrop { border: 1px dashed var(--line); border-radius: 7px; padding: 13px; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head select { width: auto; }
.feed { max-height: 335px; overflow: auto; list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.feed time { font-size: .77rem; color: var(--muted); }
.feed p { margin: 3px 0 0; }
.obs-frame { width: 100%; display: block; aspect-ratio: 16/9; border: 1px solid var(--line); border-radius: 7px; background: #0d1418; }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-shell .card { width: min(100%, 440px); }
.auth-shell h1 { margin-bottom: 16px; }
.auth-shell .actions { align-items: stretch; flex-direction: column; }
.auth-shell .brand-mark { margin-bottom: 14px; }
.launch-card { background: linear-gradient(112deg, #292442, #1e2c48 66%, #2c2641); border-color: #55547b; }
.stat:nth-child(2) .kpi { color: var(--sky); }
.stat:nth-child(3) .kpi { color: var(--accent); }
.stat:nth-child(4) .kpi { color: var(--peach); }
.inline-help { margin: 12px 0; color: var(--muted); }
.inline-help summary { color: var(--sky); cursor: pointer; font-weight: 650; }
.inline-help ol { padding-left: 20px; }
.inline-help li { margin-bottom: 7px; }
.account-settings { margin-top: 14px; }
.myinstants { background: linear-gradient(125deg, #242041, #202d46); border-color: #536190; }
.myinstants iframe { width: 130px; height: 200px; border: 0; border-radius: 8px; background: #fff; }
@media (max-width: 940px) {
  .layout { grid-template-columns: 179px minmax(0, 1fr); }
  .span3 { grid-column: span 6; }
  .span7, .span5 { grid-column: span 12; }
}
@media (max-width: 700px) {
  .layout { display: block; }
  aside { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  .brand { margin: 0 0 12px; }
  .nav { display: flex; overflow: auto; }
  .nav button { white-space: nowrap; }
  .top { align-items: flex-start; }
  .topbtn { display: none; }
  .span8, .span6, .span4 { grid-column: span 12; }
}
@media (max-width: 420px) { .row { grid-template-columns: 1fr; } .top { flex-direction: column; } audio { min-width: 140px; } }
