:root {
  --bg-canvas: #090d16;
  --bg-surface: #0f172a;
  --bg-surface-alt: #131d33;
  --bg-input: #070b13;
  --border-subtle: #1e293b;
  --border-strong: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.14);
  --emerald: #10b981;
  --emerald-dim: rgba(16, 185, 129, 0.14);
  --sky: #38bdf8;
  --sky-dim: rgba(56, 189, 248, 0.14);
  --rose: #f43f5e;
  --rose-dim: rgba(244, 63, 94, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.tv-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background-image: radial-gradient(rgba(51, 65, 85, 0.35) 1px, transparent 1px);
  background-size: 24px 24px;
}

@media (min-width: 1120px) {
  .tv-shell {
    height: 100vh;
    overflow: hidden;
  }
}

/* HEADER */
.tv-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.tv-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.tv-logo-box {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  flex-shrink: 0;
}

.tv-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tv-title-wrap {
  min-width: 0;
}

.tv-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background-color: var(--emerald);
  display: inline-block;
  animation: pulseStatus 2s infinite;
}

.live-dot.offline {
  background-color: var(--rose);
  animation: none;
}

@keyframes pulseStatus {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

.tv-main-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2.15rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.tv-sub-title {
  margin: 4px 0 0;
  font-size: clamp(1rem, 1.45vw, 1.25rem);
  font-weight: 600;
  color: var(--text-secondary);
}

.tv-header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.tv-clock-wrap {
  text-align: right;
  padding-right: 16px;
  border-right: 1px solid var(--border-subtle);
}

.tv-clock-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.35rem, 2.2vw, 1.95rem);
  font-weight: 800;
  color: var(--amber);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tv-clock-date {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.tv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tv-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tv-btn:hover {
  background-color: #1e293b;
  border-color: #475569;
  color: var(--text-primary);
}

.tv-btn-amber {
  background-color: var(--amber);
  border-color: #d97706;
  color: #090d16;
}

.tv-btn-amber:hover {
  background-color: #fbbf24;
  border-color: var(--amber);
  color: #090d16;
}

.tv-btn-xs {
  padding: 6px 11px;
  font-size: 13px;
}

/* MAIN SPLIT GRID */
.tv-main {
  display: grid;
  grid-template-columns: 1.38fr 1fr;
  gap: 18px;
  padding: 18px 24px;
  min-height: 0;
}

@media (max-width: 1119px) {
  .tv-main {
    grid-template-columns: 1fr;
  }
  .tv-clock-wrap {
    border-right: none;
    padding-right: 0;
    text-align: left;
  }
}

.tv-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tv-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  background-color: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-subtle);
}

.tv-panel-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tv-panel-title-group h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.tv-accent-icon {
  color: var(--amber);
  font-size: 19px;
}

.tv-video-icon {
  color: var(--rose);
  font-size: 20px;
}

.tv-panel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv-metric-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 6px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.tv-metric-pill.ongoing {
  background-color: var(--emerald-dim);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.tv-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 3px 8px;
}

.tv-pager-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  font-size: 13px;
}

.tv-pager-btn:hover {
  color: var(--amber);
}

.tv-pager-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* SCHEDULE TABLE (FLAT DIVIDE ROWS, NO NESTED CARDS) */
.tv-schedule-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tv-table {
  width: 100%;
  border-collapse: collapse;
}

.tv-table th {
  text-align: left;
  padding: 13px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 2;
}

.tv-table td {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.85);
  vertical-align: middle;
}

.tv-table tr:last-child td {
  border-bottom: none;
}

.tv-table tr.is-ongoing {
  background-color: rgba(16, 185, 129, 0.07);
}

.tv-table tr.is-completed {
  opacity: 0.58;
}

.tv-time-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.tv-progress-track {
  margin-top: 6px;
  width: 100%;
  max-width: 120px;
  height: 4px;
  border-radius: 999px;
  background-color: #1e293b;
  overflow: hidden;
}

.tv-progress-fill {
  height: 100%;
  background-color: var(--emerald);
}

.tv-room-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 7px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--sky);
}

.tv-lab-tag {
  margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tv-activity-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.tv-activity-meta {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14.5px;
  color: var(--text-muted);
}

.tv-activity-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tv-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.tv-status-pill.ongoing {
  background-color: var(--emerald-dim);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.tv-status-pill.upcoming {
  background-color: var(--amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.tv-status-pill.scheduled {
  background-color: var(--sky-dim);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.tv-status-pill.completed {
  background-color: rgba(100, 116, 139, 0.16);
  border: 1px solid rgba(100, 116, 139, 0.35);
  color: #94a3b8;
}

.tv-loading-state,
.tv-empty-state {
  height: 100%;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

.tv-empty-state i,
.tv-loading-state i {
  font-size: 32px;
  color: var(--amber);
}

.tv-empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.tv-empty-sub {
  margin: 0;
  font-size: 15.5px;
  max-width: 440px;
  color: var(--text-muted);
}

/* VIDEO YOUTUBE PANEL */
.tv-video-stage {
  flex: 1;
  min-height: 260px;
  background-color: #05080f;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-video-mute-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  background-color: rgba(15, 23, 42, 0.85);
}

.tv-video-iframe,
.tv-video-host {
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: none;
  display: block;
}

.tv-video-host iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.tv-video-empty {
  padding: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.tv-video-empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  font-size: 24px;
}

.tv-video-empty-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
}

.tv-video-empty-sub {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.5;
}

/* RUNNING TEXT BAR */
.tv-ticker-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  height: 56px;
  overflow: hidden;
}

.tv-ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 20px;
  background-color: var(--amber);
  color: #090d16;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.tv-ticker-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.tv-ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: tvTickerScroll var(--ticker-duration, 28s) linear infinite;
}

.tv-ticker-viewport:hover .tv-ticker-track {
  animation-play-state: paused;
}

.tv-ticker-item {
  display: inline-block;
  padding-right: 80px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

@keyframes tvTickerScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.tv-ticker-edit-btn {
  height: 100%;
  padding: 0 18px;
  border: none;
  border-left: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  color: var(--amber);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.tv-ticker-edit-btn:hover {
  background-color: #1e293b;
}

/* MODAL */
.tv-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(4, 7, 15, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tv-modal {
  width: 100%;
  max-width: 680px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.tv-modal-head {
  padding: 16px 20px;
  background-color: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tv-modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
}

.tv-modal-head h3 i {
  color: var(--amber);
}

.tv-modal-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.tv-modal-close {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.tv-modal-close:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.tv-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 74vh;
  overflow-y: auto;
}

.tv-live-icon {
  color: var(--rose);
  margin-right: 5px;
}

.tv-queue-add-row {
  display: flex;
  gap: 8px;
}

.tv-queue-add-row .tv-input {
  flex: 1;
  min-width: 0;
}

.tv-queue-list {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background-color: var(--bg-input);
  max-height: 210px;
  overflow-y: auto;
}

.tv-queue-empty {
  padding: 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

.tv-queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.tv-queue-row:last-child {
  border-bottom: none;
}

.tv-queue-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.tv-queue-order {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tv-queue-order.is-first {
  background-color: var(--amber-dim);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--amber);
}

.tv-queue-url-wrap {
  min-width: 0;
  flex: 1;
}

.tv-queue-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-queue-first-tag {
  font-size: 11px;
  color: var(--amber);
  font-weight: 600;
  margin-top: 2px;
}

.tv-queue-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.tv-queue-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
}

.tv-queue-btn:hover:not(:disabled) {
  border-color: var(--amber);
  color: var(--amber);
}

.tv-queue-btn.danger:hover:not(:disabled) {
  border-color: var(--rose);
  color: var(--rose);
}

.tv-queue-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tv-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tv-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tv-field-head label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.tv-link-clear {
  background: transparent;
  border: none;
  color: #fb7185;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.tv-link-clear:hover {
  text-decoration: underline;
}

.tv-char-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.tv-input,
.tv-textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
}

.tv-input:focus,
.tv-textarea:focus {
  outline: none;
  border-color: var(--amber);
}

.tv-textarea {
  resize: vertical;
  line-height: 1.5;
}

.tv-field-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  min-height: 16px;
}

.tv-field-status.valid {
  color: #34d399;
}

.tv-field-status.invalid {
  color: #fb7185;
}

.tv-field-status.neutral {
  color: var(--text-muted);
}

.tv-modal-foot {
  padding: 14px 20px;
  background-color: var(--bg-surface-alt);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* TOAST */
.tv-toast-box {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tv-toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border-radius: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

.tv-toast.success i {
  color: var(--emerald);
}

.tv-toast.error i {
  color: var(--rose);
}

@media (max-width: 720px) {
  .tv-header {
    padding: 12px 14px;
  }
  .tv-main {
    padding: 12px 14px;
  }
  .tv-table th:nth-child(4),
  .tv-table td:nth-child(4) {
    display: none;
  }
}

