:root {
  --bg: #0f1420;
  --panel: #161d2e;
  --panel-2: #1d2740;
  --border: #2a3552;
  --text: #e6ebf5;
  --muted: #8b96b3;
  --accent: #4f7cff;
  --accent-2: #37d67a;
  --danger: #ff5d6c;
  --warn: #ffb84f;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 340px;
}
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 13px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}
input, select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 10px;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.small { padding: 4px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* App shell */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#sidebar h2 { font-size: 15px; margin: 0; }
#channelList { display: flex; flex-direction: column; gap: 4px; }
.channel-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.channel-item:hover { background: var(--panel-2); }
.channel-item.active { background: var(--panel-2); border: 1px solid var(--accent); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.live-dot.on { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

#main { flex: 1; padding: 24px 32px; max-width: 980px; }
#topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
#topbar .userinfo { font-size: 13px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs button { border: none; background: none; border-radius: 0; padding: 10px 14px; color: var(--muted); }
.tabs button.active { color: var(--text); border-bottom: 2px solid var(--accent); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h3 { margin-top: 0; font-size: 15px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 10px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.live { background: rgba(255,93,108,.15); color: var(--danger); }
.badge.scheduled { background: rgba(79,124,255,.15); color: var(--accent); }
.badge.off { background: rgba(139,150,179,.15); color: var(--muted); }

.progress-outer { background: var(--panel-2); border-radius: 6px; height: 8px; overflow: hidden; width: 100%; }
.progress-inner { background: var(--accent-2); height: 100%; width: 0%; transition: width .2s; }

pre.snippet { background: #0a0e18; border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

.empty { color: var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px;
  font-size: 13px; z-index: 100;
}
