/* ============ UltraKey Dashboard ============ */
.dash-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.dash-sidebar {
  background: rgba(13, 13, 19, 0.85);
  border-right: 1px solid var(--border-subtle);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.dash-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}
.dash-logo .logo-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gradient-signature);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #000;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}
.dash-logo span:last-child { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; }

.dash-nav { list-style: none; padding: 0; margin: 0; flex: 1; }
.dash-nav li { margin-bottom: 0.15rem; }
.dash-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  color: var(--text-secondary);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}
.dash-nav a:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.dash-nav a.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), transparent);
  color: var(--accent-cyan);
}
.dash-nav a.active::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: var(--gradient-signature);
  border-radius: 0 3px 3px 0;
}
.dash-nav-section {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-tertiary);
  padding: 1.25rem 0.85rem 0.5rem;
}
.dash-user {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1rem;
}
.dash-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-signature);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #000;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.dash-user-info { min-width: 0; flex: 1; }
.dash-user-info .name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-user-info .role { font-size: 0.72rem; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-user button {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  padding: 0.3rem;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
}
.dash-user button:hover { color: var(--accent-magenta); background: rgba(255, 45, 126, 0.1); }

/* Main */
.dash-main { padding: 1.75rem 2rem 3rem; min-width: 0; }
.dash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.dash-title h1 { font-size: 1.75rem; margin-bottom: 0.25rem; letter-spacing: -0.02em; }
.dash-title p { color: var(--text-secondary); font-size: 0.92rem; margin: 0; }
.dash-actions { display: flex; align-items: center; gap: 0.75rem; }
.dash-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  width: 280px;
  max-width: 100%;
}
.dash-search input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  flex: 1;
  outline: none;
}
.dash-search input::placeholder { color: var(--text-tertiary); }
.dash-search svg { color: var(--text-tertiary); flex-shrink: 0; }

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.kpi-card {
  background: rgba(19, 19, 26, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.kpi-card:hover { border-color: rgba(0, 240, 255, 0.3); transform: translateY(-2px); }
.kpi-card .kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 1rem;
}
.kpi-card .kpi-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-cyan);
  display: flex; align-items: center; justify-content: center;
}
.kpi-card .kpi-icon svg { width: 16px; height: 16px; }
.kpi-card .kpi-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.4rem;
  line-height: 1;
}
.kpi-card .kpi-trend {
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.kpi-card .kpi-trend.up { color: #00FF9D; }
.kpi-card .kpi-trend.down { color: var(--accent-magenta); }
.kpi-card.live .kpi-value { color: var(--accent-cyan); }

/* Panel */
.panel {
  background: rgba(19, 19, 26, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.panel-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.panel-sub { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; }

/* Tables */
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table thead th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.dash-table tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-table tbody tr:hover td { background: rgba(255,255,255,0.02); color: var(--text-primary); }
.dash-table .row-title { color: var(--text-primary); font-weight: 600; }

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', monospace;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-live { background: rgba(255, 0, 60, 0.15); color: #ff5d7a; }
.pill-live .dot { background: #ff0044; box-shadow: 0 0 8px #ff0044; animation: pulse-dot 1.6s infinite; }
.pill-scheduled { background: rgba(0, 240, 255, 0.12); color: var(--accent-cyan); }
.pill-scheduled .dot { background: var(--accent-cyan); }
.pill-ended { background: rgba(160, 160, 176, 0.12); color: var(--text-secondary); }
.pill-ended .dot { background: var(--text-secondary); }
.pill-draft { background: rgba(255, 200, 0, 0.12); color: #ffcc44; }
.pill-draft .dot { background: #ffcc44; }
.pill-active { background: rgba(0, 255, 157, 0.12); color: #00ff9d; }
.pill-active .dot { background: #00ff9d; }

/* Score bar */
.score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.score-bar {
  width: 60px;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  background: var(--gradient-signature);
  border-radius: 3px;
}
.score-val { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--text-primary); font-weight: 600; }

/* System status */
.sys-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.sys-status-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}
.sys-status-item .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #00ff9d;
  box-shadow: 0 0 8px #00ff9d;
  flex-shrink: 0;
}
.sys-status-item .label { font-size: 0.85rem; color: var(--text-primary); font-weight: 500; }
.sys-status-item .meta { font-size: 0.72rem; color: var(--text-tertiary); margin-left: auto; font-family: 'JetBrains Mono', monospace; }

/* Live broadcast page */
.live-stage {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.preview-window {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
}
.preview-split {
  position: absolute;
  inset: 0;
  display: flex;
}
.preview-side {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0a2438 0%, #1a0f2e 100%);
}
.preview-side.before {
  background: radial-gradient(circle at 50% 60%, rgba(0, 220, 100, 0.6) 0%, rgba(0, 180, 80, 0.35) 35%, #0a3818 70%);
}
.preview-side.before::after, .preview-side.after::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32%;
  height: 75%;
  background: radial-gradient(ellipse 60% 30% at 50% 12%, #2a1f1a 0%, transparent 70%),
              linear-gradient(180deg, transparent 0%, transparent 18%, #1a1418 25%, #0d0d12 100%);
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
}
.preview-side.after {
  background: linear-gradient(135deg, #1a0f3e 0%, #3a0a4e 50%, #0a1a4e 100%);
}
.preview-side.after::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(255, 45, 126, 0.4), transparent 40%),
              radial-gradient(circle at 20% 80%, rgba(0, 240, 255, 0.3), transparent 40%);
}
.preview-side .label {
  position: absolute;
  top: 12px; left: 12px;
  padding: 0.25rem 0.6rem;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  letter-spacing: 0.1em;
  z-index: 5;
}
.preview-divider {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan);
  z-index: 4;
}

.live-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.go-live-btn {
  width: 100%;
  padding: 1.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff0044, #ff2d7e);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(255, 0, 60, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all 0.25s;
}
.go-live-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(255, 0, 60, 0.5); }
.go-live-btn.broadcasting {
  background: linear-gradient(135deg, #4a4a55, #2a2a35);
  box-shadow: none;
}
.go-live-btn.broadcasting:hover { background: linear-gradient(135deg, #5a5a65, #3a3a45); }

.live-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.live-metric {
  padding: 0.8rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}
.live-metric .label { font-size: 0.7rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.3rem; }
.live-metric .value { font-family: 'JetBrains Mono', monospace; font-size: 1.1rem; font-weight: 700; color: var(--accent-cyan); }
.live-metric .value.magenta { color: var(--accent-magenta); }

/* Sliders */
.slider-row { margin-bottom: 1rem; }
.slider-row label {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.slider-row label span:last-child { font-family: 'JetBrains Mono', monospace; color: var(--accent-cyan); font-weight: 600; }
.slider-row input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-strong);
  border-radius: 3px;
  outline: none;
}
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
  border: 2px solid var(--bg-primary);
}
.slider-row input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}

/* Camera switcher */
.cam-switch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.cam-btn {
  aspect-ratio: 16/9;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
}
.cam-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.cam-btn.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 12px rgba(0, 240, 255, 0.15);
}
.cam-btn.active::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* AI suggestions */
.ai-suggestion {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(255, 45, 126, 0.05));
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}
.ai-suggestion .ai-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gradient-signature);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; color: #000;
}
.ai-suggestion .text { font-size: 0.85rem; color: var(--text-primary); line-height: 1.45; }
.ai-suggestion .text small { color: var(--text-tertiary); display: block; margin-top: 0.2rem; }
.ai-suggestion button {
  margin-left: auto;
  padding: 0.3rem 0.7rem;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.ai-suggestion button:hover { background: rgba(0, 240, 255, 0.25); }

/* Charts container */
.chart-wrap { position: relative; height: 280px; }

/* Preset cards */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.preset-card {
  background: rgba(19, 19, 26, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.3s;
}
.preset-card:hover { transform: translateY(-3px); border-color: var(--accent-cyan); }
.preset-thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #0a2438 0%, #1a0f2e 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.preset-thumb.sports { background: linear-gradient(135deg, #1a3a0a 0%, #0a3838 100%); }
.preset-thumb.news { background: linear-gradient(135deg, #1a0a3a 0%, #0a1838 100%); }
.preset-thumb.concert { background: linear-gradient(135deg, #3a0a2a 0%, #1a0a3a 100%); }
.preset-thumb.corporate { background: linear-gradient(135deg, #1a1a2a 0%, #2a2a3a 100%); }
.preset-thumb.esports { background: linear-gradient(135deg, #0a3a1a 0%, #3a0a3a 100%); }
.preset-body { padding: 1rem; }
.preset-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.3rem; }
.preset-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; color: var(--text-tertiary); }

/* Mobile sidebar */
.dash-mobile-toggle {
  display: none;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: 8px;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
}

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .live-stage { grid-template-columns: 1fr; }
  .sys-status-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .dash-sidebar.open { transform: translateX(0); }
  .dash-main { padding: 1.25rem; }
  .dash-mobile-toggle { display: flex; }
  .kpi-grid { grid-template-columns: 1fr; }
  .sys-status-grid { grid-template-columns: 1fr; }
  .dash-search { width: 100%; }
  .dash-table thead { display: none; }
  .dash-table tbody td { display: block; padding: 0.4rem 0; border: none; }
  .dash-table tbody tr { display: block; padding: 0.85rem 0; border-bottom: 1px solid var(--border-subtle); }
}

/* Backdrop for mobile sidebar */
.dash-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 150;
}
.dash-backdrop.show { display: block; }
