/* Streamcast — dark broadcast console theme */
:root {
  --bg: #0b1120;
  --bg-2: #0e1628;
  --panel: #131c2f;
  --panel-2: #182238;
  --panel-3: #1d2944;
  --line: #233049;
  --line-2: #2c3a57;
  --text: #e6eaf3;
  --muted: #8892a8;
  --dim: #5d6882;
  --purple: #8b5cf6;
  --purple-2: #7c3aed;
  --purple-soft: rgba(139, 92, 246, .14);
  --green: #22c55e;
  --green-2: #16a34a;
  --red: #ef4444;
  --pink: #f43f5e;
  --orange: #f59e0b;
  --cyan: #22d3ee;
  --sky: #38bdf8;
  --blue: #3b82f6;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--purple); }
a.link:hover { text-decoration: underline; }
.ic { width: 16px; height: 16px; stroke-width: 2; flex: none; vertical-align: -3px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 700; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3754; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--purple) 0%, #ec4899 100%); box-shadow: 0 4px 14px rgba(139,92,246,.35); }
.brand-mark .ic { width: 17px; height: 17px; color: #fff; }
.brand b { background: linear-gradient(90deg, #a78bfa, #f472b6); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.nav { padding: 8px 10px 20px; flex: 1; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .9px; color: var(--dim); text-transform: uppercase; padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; color: #b7bfd2; font-size: 13.5px; margin: 2px 0; }
.nav a .ic { color: #7f8aa3; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--purple); color: #fff; box-shadow: 0 4px 16px rgba(139,92,246,.35); }
.nav a.active .ic { color: #fff; }
.sidebar-foot { padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--bg-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); padding: 6px; cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; color: #c6cde0; white-space: nowrap; }
.pill .ic { width: 14px; height: 14px; color: var(--purple); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.live { background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.2); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 6px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; position: relative; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--purple); color: #fff; font-weight: 700; font-size: 13px; }
.user-chip .who { line-height: 1.15; }
.user-chip .who b { display: block; font-size: 12.5px; }
.user-chip .who small { font-size: 11px; color: var(--muted); }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; display: none; box-shadow: 0 16px 40px rgba(0,0,0,.45); z-index: 50; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--panel-3); }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.footer { text-align: center; color: var(--dim); font-size: 12px; padding: 26px 0 30px; border-top: 1px solid var(--line); margin-top: 30px; }
.footer a { color: var(--purple); }

/* ---------- Cards / panels ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-h { display: flex; align-items: center; gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13.5px; }
.card-h .ic { color: var(--purple); }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.split > *, .grid > * { min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 34px 16px; color: var(--muted); font-size: 12.5px; }
.empty .ic { width: 28px; height: 28px; color: var(--dim); }

.stat { display: flex; align-items: center; gap: 13px; padding: 16px; }
.stat .sq { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat .sq .ic { width: 20px; height: 20px; }
.stat b { display: block; font-size: 21px; line-height: 1.1; }
.stat small { color: var(--muted); font-size: 12px; }
.sq.purple { background: rgba(139,92,246,.18); color: #a78bfa; }
.sq.green { background: rgba(34,197,94,.15); color: #4ade80; }
.sq.blue { background: rgba(59,130,246,.16); color: #60a5fa; }
.sq.orange { background: rgba(245,158,11,.16); color: #fbbf24; }
.sq.pink { background: rgba(236,72,153,.16); color: #f472b6; }
.sq.cyan { background: rgba(34,211,238,.14); color: #67e8f9; }

/* ---------- Forms ---------- */
label.lbl { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=url], select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 13.5px; outline: none; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,.2); }
input[type=color] { width: 44px; height: 32px; padding: 2px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 7px; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--purple); }
input[type=checkbox] { accent-color: var(--purple); width: 15px; height: 15px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 46px; text-align: right; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; }
.switch .tr { width: 36px; height: 20px; background: #334160; border-radius: 20px; position: relative; transition: .2s; flex: none; }
.switch .tr::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .tr { background: var(--purple); }
.switch input:checked + .tr::after { left: 19px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent;
  background: var(--purple); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--purple-2); }
.btn .ic { width: 15px; height: 15px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.btn.ghost { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { background: var(--panel-3); }
.btn.outline { background: transparent; border-color: var(--purple); color: #c4b5fd; }
.btn.outline:hover { background: var(--purple-soft); }
.btn.green { background: var(--green-2); }
.btn.green:hover { background: #15803d; }
.btn.red { background: transparent; border-color: rgba(239,68,68,.45); color: #fca5a5; }
.btn.red:hover { background: rgba(239,68,68,.12); }
.btn.icon { width: 34px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--panel-3); color: #c6cde0; border: 1px solid var(--line-2); }
.badge.green { background: rgba(34,197,94,.14); color: #4ade80; border-color: rgba(34,197,94,.3); }
.badge.red { background: rgba(239,68,68,.14); color: #fca5a5; border-color: rgba(239,68,68,.3); }
.badge.orange { background: rgba(245,158,11,.14); color: #fcd34d; border-color: rgba(245,158,11,.3); }
.badge.purple { background: var(--purple-soft); color: #c4b5fd; border-color: rgba(139,92,246,.35); }
.flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; display: flex; gap: 9px; align-items: center; }
.flash.ok { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #bbf7d0; }
.flash.err { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.32); color: #fecaca; }
.info { display: flex; gap: 10px; padding: 12px 14px; border-radius: 9px; background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.28); font-size: 12.5px; color: #cdd3e3; margin-bottom: 16px; }
.info .ic { color: #a78bfa; margin-top: 1px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .val { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 11px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Tables / lists ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255,255,255,.015); }
.thumb { width: 72px; aspect-ratio: 16/9; border-radius: 5px; object-fit: cover; background: #0a0f1c; display: block; }
.thumb.sm { width: 56px; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button, .tabs a { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 11px 14px; cursor: pointer; border-bottom: 2px solid transparent; display: inline-flex; gap: 7px; align-items: center; flex: 1; justify-content: center; }
.tabs .active { color: #f0abfc; border-bottom-color: var(--pink); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg a { padding: 6px 11px; font-size: 12px; color: #c6cde0; border-right: 1px solid var(--line-2); }
.seg a:last-child { border-right: 0; }
.seg a.active { background: var(--purple); color: #fff; }
.seg a:hover:not(.active) { background: var(--panel-2); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(3,6,14,.7); display: none; place-items: center; z-index: 100; padding: 16px; backdrop-filter: blur(3px); }
.modal.open { display: grid; }
.modal .card { width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal .x { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at top, rgba(139,92,246,.18), transparent 55%), var(--bg); }
.auth { width: 100%; max-width: 400px; }
.auth .brand { justify-content: center; margin-bottom: 22px; font-size: 24px; }

/* ---------- Schedule ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); }
.week .day { border-right: 1px solid var(--line); min-height: 150px; }
.week .day:last-child { border-right: 0; }
.week .dh { text-align: center; padding: 9px 4px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.week .dh small { display: block; font-size: 10px; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.week .dh b { font-size: 12px; }
.week .dh.today { background: var(--purple-soft); }
.week .dh.today b { color: #c4b5fd; }
.week .slots { padding: 8px 6px; display: grid; gap: 6px; }
.slot { background: var(--purple-soft); border: 1px solid rgba(139,92,246,.35); border-left: 3px solid var(--purple); border-radius: 6px; padding: 6px 7px; font-size: 11.5px; }
.slot b { display: block; color: #ddd6fe; }
.slot.now { border-color: var(--green); border-left-color: var(--green); background: rgba(34,197,94,.1); }
.week .none { display: grid; place-items: center; gap: 4px; padding: 24px 0; color: var(--dim); font-size: 11px; }

/* ---------- Upload ---------- */
.drop { border: 2px dashed var(--line-2); border-radius: 12px; padding: 44px 20px; text-align: center; color: var(--muted); transition: .15s; cursor: pointer; }
.drop.over, .drop:hover { border-color: var(--purple); background: var(--purple-soft); color: var(--text); }
.drop .ic { width: 40px; height: 40px; color: var(--purple); }
.uprow { display: grid; grid-template-columns: 1fr 120px 70px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.bar { height: 6px; background: var(--panel-3); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), #ec4899); transition: width .2s; }

/* ---------- Targets ---------- */
.tcard { display: flex; flex-direction: column; }
.tcard .top { display: flex; gap: 11px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tlogo { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.tlogo .ic { width: 18px; height: 18px; }
.tcard .mid { padding: 12px 16px; font-size: 12px; font-family: var(--mono); color: #c6cde0; flex: 1; }
.tcard .bot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); }
.tadd { border: 2px dashed var(--line-2); border-radius: var(--radius); display: grid; place-items: center; min-height: 170px; color: var(--muted); text-align: center; gap: 6px; cursor: pointer; background: none; font: inherit; }
.tadd:hover { border-color: var(--purple); color: var(--text); }

/* ---------- Public player ---------- */
.pub { max-width: 1100px; margin: 0 auto; padding: 22px 18px 40px; }
.player { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .ov { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; background: radial-gradient(ellipse, #131c2f, #000); }
.unmute { position: absolute; left: 14px; bottom: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .g6 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; z-index: 60; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .menu-btn { display: inline-flex; }
  .split, .g2, .g3 { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(7, 140px); overflow-x: auto; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .g6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar .pill.hide-sm, .user-chip .who { display: none; }
}
