:root {
  --purple: #111111;
  --purple2: #000000;
  --purple-soft: #2b2b2b;
  --purple-light: #f2f2f2;
  --purple-light2: #f8f8f8;
  --purple-border: #d4d4d4;
  --red: #f43f5e;
  --red2: #ef4444;
  --pink: #6b6b6b;
  --pink2: #3f3f3f;
  --blue: #6b6b6b;
  --blue2: #3f3f3f;
  --green: #6b6b6b;
  --green2: #3f3f3f;
  --bg: #fafafa;
  --card: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --border: #e5e5e5;
}

* { box-sizing: border-box; }

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

a { text-decoration: none; color: inherit; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 0 6px;
}
.brand-logo {
  width: 38px; height: 38px; flex-shrink: 0;
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 17px; font-weight: 800; color: var(--purple2); letter-spacing: 0.3px; }
.brand-sub { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 1.5px; }

.new-stream-btn {
  background: var(--purple2);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.nav-item:hover { background: var(--purple-light2); }
.nav-item.active { background: var(--purple-light); color: var(--purple); border: 1px solid var(--purple-border); }

.sidebar-bottom {
  margin-top: auto;
  background: var(--purple-light);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.sidebar-bottom p { font-weight: 700; margin: 0 0 10px; }
.upgrade-pill {
  background: var(--purple2);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
}

.main { flex: 1; padding: 28px 32px; max-width: 1400px; }

.top-stats { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.stat-card {
  flex: 1 1 180px;
  min-width: 180px;
  border-radius: 16px;
  padding: 22px 24px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card.purple, .stat-card.gold, .stat-card.red, .stat-card.pink, .stat-card.blue, .stat-card.green {
  background: var(--card);
}
.stat-card .stat-progress {
  margin-top: 6px; height: 5px; border-radius: 999px; background: var(--purple-light); overflow: hidden;
}
.stat-card .stat-progress > div { height: 100%; background: var(--purple2); border-radius: 999px; }
.stat-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--purple-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.stat-card .stat-value { font-size: 26px; font-weight: 800; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); letter-spacing: 0.5px; }

.banner {
  background: var(--purple2);
  color: #fff;
  border-radius: 16px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.banner h3 { margin: 0 0 4px; }
.banner p { margin: 0; opacity: 0.85; font-size: 13px; }
.banner button {
  background: #fff;
  border: none; color: var(--purple2); font-weight: 700;
  border-radius: 20px; padding: 10px 18px; cursor: pointer;
}

.panel {
  background: var(--card);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 24px;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.panel-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs-row .tabs { margin-bottom: 0; border-bottom: none; }
.search-input {
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 13px; min-width: 220px; background: #fff;
}
.search-input:focus { outline: none; border-color: var(--purple); }

.btn {
  border: none; border-radius: 999px; padding: 10px 18px;
  font-weight: 700; cursor: pointer; font-size: 14px;
}
.btn-primary { background: var(--purple2); color: #fff; }
.btn-secondary { background: var(--purple-light); color: var(--purple2); }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.video-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.video-thumb {
  aspect-ratio: 9/13;
  background: linear-gradient(160deg, #2a2a3d, #14141f);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 40px;
  overflow: hidden;
}
.video-thumb img, .video-thumb video {
  display: none;
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.video-duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 12px; padding: 2px 8px; border-radius: 6px;
}
.live-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--red2); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  padding: 4px 10px; border-radius: 999px;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.live-elapsed {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 12px; font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 6px;
}
.live-channel-pill {
  position: absolute; bottom: 8px; left: 8px;
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.live-channel-pill[data-channel="youtube"] { background: #FF0000; }
.live-channel-pill[data-channel="facebook"] { background: #1877F2; }
.live-channel-pill[data-channel="twitch"] { background: #9146FF; }
.live-channel-pill[data-channel="tiktok"] { background: #010101; }
.live-channel-pill[data-channel="rtmp"] { background: #333; }
.center-play-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(0,0,0,0.5); border: 2px solid rgba(255,255,255,0.8);
  color: #fff; font-size: 20px;
  align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(2px);
  transition: background 0.15s, transform 0.1s;
}
.center-play-btn:hover { background: rgba(0,0,0,0.7); }
.center-play-btn:active { transform: translate(-50%, -50%) scale(0.92); }
.live-account { color: var(--purple2); font-weight: 600; font-size: 12px; margin-top: 2px; }
.live-count-badge {
  display: inline-block; background: var(--red2); color: #fff;
  font-size: 12px; font-weight: 800; min-width: 22px; text-align: center;
  padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle;
}
.video-info { padding: 10px 12px; font-size: 13px; font-weight: 600; word-break: break-word; }
.video-info .meta { color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 4px; }

.preview-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.preview-toggle .switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.preview-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.preview-toggle .switch-track {
  position: absolute; inset: 0; background: #d8d8e0; border-radius: 999px; transition: background 0.15s;
}
.preview-toggle .switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.preview-toggle input:checked + .switch-track { background: var(--purple); }
.preview-toggle input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.preview-toggle input:disabled + .switch-track { opacity: 0.5; cursor: not-allowed; }

.upload-drop {
  border: 2px dashed var(--purple-border);
  border-radius: 14px;
  padding: 40px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: var(--purple-light2);
}
.upload-drop:hover { border-color: var(--purple); }

.form-row { margin-bottom: 20px; }
.form-row label { display: block; font-weight: 700; margin-bottom: 8px; }
.form-row .req { color: var(--red2); }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=password] {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border);
  font-size: 14px; background: #fff;
}
.password-field { position: relative; }
.form-row .password-field input { padding-right: 48px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 17px;
  padding: 8px; line-height: 1; opacity: 0.6;
}
.password-toggle:hover { opacity: 1; }

.radio-group { display: flex; gap: 24px; align-items: center; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }

.dest-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--purple-light); border: 1px solid var(--purple-border); border-radius: 20px;
  padding: 8px 14px; margin: 4px 8px 4px 0; font-weight: 600; font-size: 13px;
}
.dest-chip button { background: none; border: none; color: #999; cursor: pointer; font-size: 14px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,20,30,0.55);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 18px; padding: 28px 30px;
  width: 480px; max-width: 92vw;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { margin: 0; }
.modal-head .close { cursor: pointer; font-size: 20px; color: var(--muted); background: none; border: none; }

.channel-row { display: flex; gap: 12px; margin-bottom: 20px; }
.channel-btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid transparent; background: #ccc;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
}
.channel-btn[data-channel="youtube"] { background: #FF0000; }
.channel-btn[data-channel="facebook"] { background: #1877F2; }
.channel-btn[data-channel="twitch"] { background: #9146FF; }
.channel-btn[data-channel="tiktok"] { background: #010101; }
.channel-btn[data-channel="rtmp"] {
  background: #111; color: #fff; font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
}
.channel-btn.active { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-border); }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data-table td { padding: 14px 12px; border-bottom: 1px solid #f0f0f4; font-size: 14px; }
table.data-table tr:hover td { background: var(--purple-light2); }

.status-pill { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-live { background: #dcfce7; color: #16a34a; }
.status-ended { background: #f1f1f5; color: #6b7280; }
.status-error { background: #fee2e2; color: #dc2626; }
.status-stopping { background: #fef3c7; color: #b45309; }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-card {
  background: #fff; border-radius: 20px; padding: 40px; width: 380px; max-width: 90vw;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.auth-logo { display: block; width: 90px; height: 90px; object-fit: contain; margin: 0 auto 8px; }
.auth-card h1 { text-align: center; margin-top: 0; font-size: 22px; }
.auth-card .btn-primary { width: 100%; padding: 14px; margin-top: 8px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--purple); font-weight: 700; }
.error-text { color: #dc2626; font-size: 13px; margin-top: 8px; min-height: 18px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

.tabs { display: flex; gap: 24px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 2px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--purple); border-color: var(--purple); }

.select-video-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.select-video-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f4; }
.select-video-item:hover { background: var(--purple-light2); }
.select-video-item.selected { background: var(--purple-light); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.plan-card {
  border: 1px solid var(--border); border-radius: 18px; padding: 26px 22px;
  display: flex; flex-direction: column; gap: 6px; background: #fff;
}
.plan-card.current { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-border); }
.plan-card .plan-name { font-size: 18px; font-weight: 800; }
.plan-card .plan-price { font-size: 30px; font-weight: 800; margin: 6px 0; }
.plan-card .plan-price span { font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-card .plan-feature { color: var(--muted); font-size: 13px; padding: 4px 0; }
.plan-card .btn { margin-top: 16px; width: 100%; padding: 12px; }
.plan-note { color: var(--muted); font-size: 12px; margin-top: 18px; }
.select-video-item .thumb-mini { width: 34px; height: 46px; border-radius: 6px; background-color: #14141f; background-size: cover; background-position: center; flex-shrink: 0; }
