/* =============================================================================
   UNO KICK Admin — Stream Operations Console
   Design: sidebar-first control room layout with card-based live matches.
   ============================================================================= */

:root {
  /* Surfaces */
  --bg: #060a12;
  --sidebar-bg: #07091b;
  --surface: #0c1524;
  --surface-2: #111f36;
  --elevated: #172540;
  --line: #1d2f4a;
  --line-soft: #152238;

  /* Text — brighter for readability */
  --text: #f0f4fa;
  --text-2: #9bb3d4;
  --muted: #6882a4;
  --dim: #3d5878;

  /* Brand — electric blue */
  --brand: #2563eb;
  --brand-b: #3b82f6;
  --brand-glow: rgba(37, 99, 235, 0.28);
  --brand-soft: rgba(59, 130, 246, 0.1);

  /* Status */
  --live: #f43f5e;
  --live-glow: rgba(244, 63, 94, 0.38);
  --live-soft: rgba(244, 63, 94, 0.09);

  --up: #06b6d4;
  --up-soft: rgba(6, 182, 212, 0.1);

  --ended: #475569;
  --ended-soft: rgba(71, 85, 105, 0.12);

  --pin: #f59e0b;
  --pin-soft: rgba(245, 158, 11, 0.1);

  --ok: #10b981;
  --ok-glow: rgba(16, 185, 129, 0.3);
  --ok-soft: rgba(16, 185, 129, 0.09);

  --err: #f43f5e;
  --warn: #f59e0b;
  --vod: #a855f7;
  --vod-soft: rgba(168, 85, 247, 0.1);

  /* Typography */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Geometry */
  --r: 10px;
  --r-sm: 7px;
  --r-xs: 5px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Layout */
  --sidebar-w: 232px;
  --topbar-h: 54px;

  /* Shadows */
  --shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 14px 44px -8px rgba(0, 0, 0, 0.75);
}

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code,
pre {
  font-family: var(--mono);
}

/* ---- Utilities ------------------------------------------------------------ */
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.inline {
  display: inline;
}
.mono {
  font-family: var(--mono);
}

.sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  flex-shrink: 0;
}

.hide-sm {
}
@media (max-width: 640px) {
  .hide-sm {
    display: none !important;
  }
}

/* ---- Scrollbar ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #1e3256;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #28406e;
}

/* ---- Focus ----------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--brand-b);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s,
    opacity 0.15s,
    transform 0.1s;
  text-decoration: none;
}
.btn:hover {
  background: var(--elevated);
  border-color: #253d60;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px -4px var(--brand-glow);
}
.btn-primary:hover {
  background: var(--brand-b);
  border-color: transparent;
  box-shadow: 0 6px 20px -4px var(--brand-glow);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-block {
  width: 100%;
  justify-content: center;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}
.btn-xs {
  padding: 3px 9px;
  font-size: 11.5px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition:
    color 0.15s,
    background 0.15s,
    border-color 0.15s;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--elevated);
  border-color: #253d60;
}

/* ============================================================================
   BADGES
   ============================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2.5px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.live {
  color: var(--live);
  background: var(--live-soft);
  border-color: rgba(244, 63, 94, 0.2);
}
.badge.up {
  color: var(--up);
  background: var(--up-soft);
  border-color: rgba(6, 182, 212, 0.2);
}
.badge.ended {
  color: var(--ended);
  background: var(--ended-soft);
  border-color: rgba(71, 85, 105, 0.2);
}
.badge.pin {
  color: var(--pin);
  background: var(--pin-soft);
  border-color: rgba(245, 158, 11, 0.2);
}
.badge.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(16, 185, 129, 0.2);
}
.badge.solid {
  background: var(--surface-2);
}
.badge.app {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}
.badge.vod {
  color: var(--vod);
  background: var(--vod-soft);
  border-color: rgba(168, 85, 247, 0.2);
}

/* ---- Live pulse dot ------------------------------------------------------- */
.dot-live {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 var(--live-glow);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--live-glow);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(244, 63, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dot-live {
    animation: none;
  }
}

/* ---- Switch toggle -------------------------------------------------------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.switch input {
  accent-color: var(--brand-b);
  cursor: pointer;
}

/* ---- Form ----------------------------------------------------------------- */
.input {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  width: 100%;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--brand-b);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 5px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* ---- Alert ---------------------------------------------------------------- */
.alert {
  padding: 10px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 14px;
}
.alert-error {
  background: var(--live-soft);
  border-color: rgba(244, 63, 94, 0.3);
  color: #ffc8d0;
}

/* ============================================================================
   AUTH PAGE  (login)
   ============================================================================ */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  background-image:
    radial-gradient(
      800px 500px at 70% -5%,
      rgba(37, 99, 235, 0.12),
      transparent 60%
    ),
    radial-gradient(
      600px 400px at -5% 100%,
      rgba(6, 182, 212, 0.07),
      transparent 55%
    );
}
.auth-shell {
  width: 100%;
  max-width: 380px;
}
.auth-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 28px;
}
.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 24px -6px rgba(37, 99, 235, 0.65);
  flex-shrink: 0;
}
.logo-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
  color: var(--text);
}
.logo-name .accent {
  color: var(--brand-b);
}
.logo-sub {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  margin-top: 4px;
}
.auth-title {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 700;
}
.auth-hint {
  margin: 0 0 22px;
  color: var(--text-2);
  font-size: 13px;
}
.auth-form {
  display: grid;
  gap: 15px;
}
.auth-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line-soft);
  overflow: hidden;
  z-index: 20;
}

/* Logo row */
.sidebar-logo {
  padding: 16px 15px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 16px -4px rgba(37, 99, 235, 0.6);
}
.sidebar-logo .logo-name {
  font-size: 17px;
}
.sidebar-logo .logo-sub {
  font-size: 9.5px;
}

/* Health strip */
.sidebar-health {
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.01);
  flex-shrink: 0;
}
.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  flex-shrink: 0;
  transition:
    background 0.3s,
    box-shadow 0.3s;
}
.health-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 7px var(--ok-glow);
}
.health-dot.warn {
  background: var(--warn);
  box-shadow: 0 0 7px rgba(245, 158, 11, 0.5);
}
.health-dot.err {
  background: var(--err);
  box-shadow: 0 0 7px var(--live-glow);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 6px;
}

.nav-section-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--dim);
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8.5px 10px;
  border-radius: var(--r-sm);
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition:
    background 0.15s,
    color 0.15s;
  margin-bottom: 1px;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.nav-item.is-active {
  background: var(--brand-soft);
  color: #b8d0ff;
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.15s;
}
.nav-item:hover .nav-icon {
  color: var(--text-2);
}
.nav-item.is-active .nav-icon {
  color: var(--brand-b);
}

.nav-item .nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.7;
  color: var(--muted);
  transition:
    background 0.15s,
    color 0.15s;
}
.nav-item.is-active .nav-count {
  background: rgba(59, 130, 246, 0.18);
  color: var(--brand-b);
}

/* Live nav item special treatment */
.nav-item.live-item .nav-count {
  background: var(--live-soft);
  color: var(--live);
}
.nav-item.live-item.is-active {
  background: rgba(244, 63, 94, 0.08);
  color: #ffb0bc;
}
.nav-item.live-item.is-active .nav-icon {
  color: var(--live);
}
.nav-item.live-item.is-active .nav-count {
  background: rgba(244, 63, 94, 0.18);
  color: var(--live);
}

/* Sidebar footer */
.sidebar-foot {
  border-top: 1px solid var(--line-soft);
  flex-shrink: 0;
}

.key-status {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  text-align: left;
  transition: background 0.15s;
}
.key-status:hover {
  background: rgba(255, 255, 255, 0.03);
}

.key-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  flex-shrink: 0;
  transition:
    background 0.3s,
    box-shadow 0.3s;
}
.key-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok-glow);
}
.key-dot.stale {
  background: var(--pin);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.key-dot.err {
  background: var(--err);
  box-shadow: 0 0 8px var(--live-glow);
}

.key-status-text {
  flex: 1;
  min-width: 0;
}
.key-status-label {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.key-status-value {
  display: block;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.key-prefix {
  color: var(--text-2);
}
.key-suffix {
  color: var(--brand-b);
  font-weight: 800;
}
.key-status-arrow {
  color: var(--dim);
  flex-shrink: 0;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-logout {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  transition:
    color 0.15s,
    background 0.15s;
}
.user-logout:hover {
  color: var(--err);
  background: var(--live-soft);
}

/* ============================================================================
   APP BODY
   ============================================================================ */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ============================================================================
   TOP BAR
   ============================================================================ */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(6, 10, 18, 0.92);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  border-bottom: 1px solid var(--line-soft);
  z-index: 10;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 200px;
}

.topbar-spacer {
  flex: 1;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  color: var(--muted);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    color 0.15s;
  min-width: 200px;
}
.search-wrap:focus-within {
  border-color: var(--brand-b);
  box-shadow: 0 0 0 3px var(--brand-soft);
  color: var(--brand-b);
}
.search-wrap input {
  font: inherit;
  font-size: 13px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  width: 180px;
}
.search-wrap input::placeholder {
  color: var(--muted);
}
@media (max-width: 640px) {
  .search-wrap {
    min-width: 0;
  }
  .search-wrap input {
    width: 110px;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Hamburger (mobile) */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.menu-toggle:hover {
  background: var(--surface-2);
}

/* ============================================================================
   CONTENT AREA
   ============================================================================ */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 60px;
}
@media (max-width: 500px) {
  .content {
    padding: 14px 14px 60px;
  }
}

/* ============================================================================
   STATS ROW
   ============================================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--r) 0 0 var(--r);
  background: var(--line);
}
.stat-card.is-live::before {
  background: var(--live);
  box-shadow: 2px 0 10px var(--live-glow);
}
.stat-card.is-upcoming::before {
  background: var(--up);
}
.stat-card.is-ok::before {
  background: var(--ok);
  box-shadow: 2px 0 10px var(--ok-glow);
}
.stat-card.is-pin::before {
  background: var(--pin);
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.stat-card.is-live .stat-num {
  color: var(--live);
}
.stat-card.is-upcoming .stat-num {
  color: var(--up);
}
.stat-card.is-ok .stat-num {
  color: var(--ok);
}
.stat-card.is-pin .stat-num {
  color: var(--pin);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================
   ACTION BAR
   ============================================================================ */
.action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  margin-bottom: 18px;
  flex-wrap: wrap;
  row-gap: 6px;
}
.action-bar-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.action-bar-spacer {
  flex: 1;
}
.last-sync {
  font-size: 11.5px;
  color: var(--dim);
  font-family: var(--mono);
  white-space: nowrap;
}

/* ============================================================================
   BANNER
   ============================================================================ */
.banner {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
}
.banner.error {
  background: var(--live-soft);
  border-color: rgba(244, 63, 94, 0.3);
  color: #ffc8d0;
}

/* ============================================================================
   SECTION HEADER
   ============================================================================ */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.section-head h2 {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.section-head .s-count {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1.5px 8px;
  border-radius: 999px;
}
.section-head .spacer {
  flex: 1;
}

/* Group header (for categories/sections within a tab) */
.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 2px 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
}
.group-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* ============================================================================
   MATCH CARDS  (live + upcoming use a card grid)
   ============================================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
@media (max-width: 640px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.2s,
    transform 0.15s,
    box-shadow 0.2s;
  position: relative;
}
.match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px -8px rgba(0, 0, 0, 0.55);
}
.match-card:active {
  transform: translateY(0);
}
.match-card.is-live {
  border-color: rgba(244, 63, 94, 0.2);
}
.match-card.is-live:hover {
  border-color: rgba(244, 63, 94, 0.38);
  box-shadow: 0 10px 36px -6px rgba(244, 63, 94, 0.18);
}
.match-card.is-upcoming:hover {
  border-color: rgba(6, 182, 212, 0.3);
}
.match-card.is-pinned {
  border-color: rgba(245, 158, 11, 0.2);
}
.match-card.is-pinned:hover {
  border-color: rgba(245, 158, 11, 0.38);
}

/* Gradient status bar at top of card */
.card-strip {
  height: 3px;
  background: var(--line);
}
.match-card.is-live .card-strip {
  background: linear-gradient(90deg, var(--live), #ff8098);
}
.match-card.is-upcoming .card-strip {
  background: linear-gradient(90deg, var(--up), #67e8f9);
}
.match-card.is-pinned .card-strip {
  background: linear-gradient(90deg, var(--pin), #fde68a);
}

/* Card content */
.card-body {
  padding: 12px 14px 10px;
}

.card-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.pin-star {
  color: var(--pin);
  font-size: 12px;
}

/* Teams display */
.card-teams {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.card-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.card-team-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  display: block;
}
.card-team-logo[src*="team-default"] {
  padding: 4px;
  opacity: 0.7;
}
.card-team-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-vs {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  padding: 1px 0;
  letter-spacing: 1px;
  flex-shrink: 0;
  padding-left: 50px;
}

/* Card footer */
.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.12);
}
.card-tourn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  min-width: 0;
  flex: 1;
}
.card-tourn img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
}
.card-tourn-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.card-time {
  font-size: 12.5px;
  font-family: var(--mono);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text-2);
}
.card-time.is-live {
  color: var(--live);
}
.card-time.is-soon {
  color: var(--up);
}
.card-stream-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-b);
  border: 1px solid rgba(59, 130, 246, 0.2);
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.match-card:hover .card-stream-chip {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.35);
}
.card-stream-chip.zero {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

/* Traveling highlight on live cards */
.match-card.is-live::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -60%;
  height: 50%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(244, 63, 94, 0.04),
    transparent
  );
  animation: card-sweep 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes card-sweep {
  0% {
    top: -60%;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    top: 120%;
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .match-card.is-live::before {
    display: none;
  }
}

/* ============================================================================
   LIST ROWS  (ended matches, channels, highlights)
   ============================================================================ */
.rows-list {
  display: grid;
  gap: 5px;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 3px minmax(72px, auto) 1fr minmax(0, 160px) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  cursor: pointer;
  overflow: hidden;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;
}
.row:hover {
  background: var(--surface-2);
  border-color: var(--line);
}
.row:active {
  transform: translateY(1px);
}
.row.is-live {
  border-color: rgba(244, 63, 94, 0.18);
}
.row.is-ended {
  opacity: 0.72;
}
.row.is-pinned {
  border-color: rgba(245, 158, 11, 0.18);
}

.row-stripe {
  width: 3px;
  align-self: stretch;
  border-radius: var(--r) 0 0 var(--r);
  background: var(--ended);
}
.row.is-live .row-stripe {
  background: var(--live);
  box-shadow: 2px 0 8px var(--live-glow);
}
.row.is-upcoming .row-stripe {
  background: var(--up);
}
.row.is-pinned .row-stripe {
  background: var(--pin);
}
.row.is-ch .row-stripe {
  background: var(--brand-b);
}
.row.is-vod .row-stripe {
  background: var(--vod);
}

.row-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
}
.row-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.row-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.row-team.right {
  justify-content: flex-end;
  flex-direction: row-reverse;
}
.row-team img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 5px;
  padding: 2px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.row-team .nm {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.row-team.right .nm {
  text-align: right;
}
.row-vs {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.row-meta {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.row-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-2);
  line-height: 1.4;
}
.row-time .t-cd {
  font-weight: 700;
}
.row-time .t-cd.live {
  color: var(--live);
}
.row-time .t-cd.soon {
  color: var(--up);
}

.row-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}
.row:hover .row-action {
  color: var(--brand-b);
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--brand-soft);
}
.row-action.zero {
  color: var(--dim);
}
.row:hover .row-action.zero {
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-2);
}
.row-action svg {
  transition: transform 0.15s;
}
.row:hover .row-action svg {
  transform: translateX(2px);
}

@media (max-width: 900px) {
  .row {
    grid-template-columns: 3px auto 1fr auto;
  }
  .row-meta,
  .row-time {
    display: none;
  }
}
@media (max-width: 500px) {
  .row {
    grid-template-columns: 3px 1fr auto;
    gap: 8px;
  }
  .row-status {
    padding-left: 6px;
  }
  .row-team img {
    width: 20px;
    height: 20px;
  }
  .row-team .nm {
    font-size: 12.5px;
  }
}

/* ============================================================================
   DRAWERS  (key + detail)
   ============================================================================ */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 15, 0.68);
  backdrop-filter: blur(4px);
  z-index: 40;
  animation: scrimIn 0.2s ease;
}
@keyframes scrimIn {
  from {
    opacity: 0;
  }
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 50;
  background: var(--surface);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px -10px rgba(0, 0, 0, 0.7);
}
.drawer.open {
  transform: translateX(0);
}
@media (prefers-reduced-motion: reduce) {
  .drawer {
    transition: none;
  }
}

.key-drawer {
  width: 400px;
  max-width: 93vw;
}
.detail-drawer {
  width: 540px;
  max-width: 96vw;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.drawer-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--brand-b);
  margin-bottom: 4px;
}
.drawer-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.drawer-head-info {
  min-width: 0;
  flex: 1;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 40px;
  display: grid;
  gap: 16px;
  align-content: start;
  word-wrap: break-word;
}

/* Key card */
.keycard {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}
.keycard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.keycard-phrase {
  display: block;
  font-size: 15px;
  font-weight: 700;
  word-break: break-all;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  font-family: var(--mono);
}
.keycard-phrase .key-prefix {
  color: var(--text-2);
}
.keycard-phrase .key-suffix {
  color: var(--brand-b);
  font-weight: 800;
}
.keycard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-2);
}
.keycard-meta code {
  color: var(--brand-b);
}

.lead {
  line-height: 1.65;
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
}

.manual {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px 12px 12px;
  background: var(--bg);
}
.manual summary {
  cursor: pointer;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  list-style: none;
}
.manual summary::marker {
  display: none;
}
.manual summary:hover {
  color: var(--text);
}
.manual-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.sync-result {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px;
  font-size: 12px;
}
.sync-result h4 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.kv {
  display: grid;
  grid-template-columns: minmax(100px, 40%) 1fr;
  gap: 4px 10px;
}
.kv .k {
  color: var(--text-2);
  word-break: break-word;
}
.kv .v {
  color: var(--text);
  word-break: break-all;
  font-family: var(--mono);
  font-size: 11.5px;
}

/* Detail drawer info header */
.detail-info {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px;
  display: grid;
  gap: 10px;
}
.info-matchup {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
}
.info-vs {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 2px;
  text-transform: uppercase;
}
.info-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.info-item {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.info-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 1px;
}
.info-id {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--dim);
}
.t-live {
  font-weight: 700;
  color: var(--live);
}

.detail-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.detail-section-head h3 {
  margin: 0;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.detail-section-head .count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
}
.detail-section-head .spacer {
  flex: 1;
}

.streams-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.no-streams {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
}

.stream {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 14px;
  transition: border-color 0.15s;
}
.stream:hover {
  border-color: #253d60;
}
.stream-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stream-num {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--brand-soft);
  color: var(--brand-b);
  border-radius: 6px;
  flex-shrink: 0;
}
.stream-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.chip.pos {
  background: var(--surface);
  color: var(--text-2);
}
.chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
}
.stream-top .grow {
  flex: 1;
}

.cipher-hint {
  margin-top: 6px;
  font-size: 10px;
  color: var(--dim);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* DRM row inside stream card */
.drm-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  flex-wrap: wrap;
}
.drm-select {
  width: 120px;
  min-width: 100px;
  flex-shrink: 0;
  font-size: 12px;
  padding: 5px 8px;
}
.drm-license-input {
  flex: 1;
  min-width: 160px;
  font-size: 12px;
  padding: 5px 8px;
  font-family: var(--mono);
}
.drm-chip {
  font-weight: 700;
  text-transform: uppercase;
}
.drm-chip.drm-clearkey {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}
.drm-chip.drm-widevine {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.3);
}
.drm-chip.drm-playready {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

.result {
  margin-top: 10px;
  display: none;
  animation: revealDown 0.22s ease;
}
.result.show {
  display: block;
}
@keyframes revealDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.url-line {
  font-size: 12.5px;
  word-break: break-all;
  background: var(--ok-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--r-xs);
  padding: 10px 12px;
  color: #a7f3d0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--mono);
  line-height: 1.5;
}
.url-line.err {
  background: var(--live-soft);
  border-color: rgba(244, 63, 94, 0.25);
  color: #ffc8d0;
}
.url-line code {
  flex: 1;
  user-select: all;
}

.url-headers {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}
.hdr {
  font-size: 11.5px;
  color: var(--text-2);
  word-break: break-all;
  font-family: var(--mono);
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--r-xs);
  border-left: 2px solid var(--brand-b);
  line-height: 1.4;
}
.hdr b {
  color: var(--text);
}

.copy-btn {
  background: transparent;
  border: 0;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
}
.copy-btn:hover {
  opacity: 1;
}

/* Channel / highlight detail */
.channel-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.channel-info img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: var(--surface);
  border-radius: 11px;
  padding: 6px;
  border: 1px solid var(--line);
}
.channel-info .nm {
  font-size: 18px;
  font-weight: 700;
}
.channel-info .meta {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
}

/* ============================================================================
   EMPTY STATE  /  SKELETON
   ============================================================================ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--dim);
}
.empty .big {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 600;
}
.empty .hint {
  font-size: 13px;
}

.skeleton {
  height: 62px;
  border-radius: var(--r);
  background: linear-gradient(
    90deg,
    var(--surface) 30%,
    var(--surface-2) 50%,
    var(--surface) 70%
  );
  background-size: 200% 100%;
  animation: sh 1.3s infinite;
  border: 1px solid var(--line-soft);
  margin-bottom: 5px;
}
.skeleton.card-h {
  height: 200px;
  border-radius: var(--r-lg);
}
@keyframes sh {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* ============================================================================
   TOASTS
   ============================================================================ */
.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: 90vw;
}
.toast {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-b);
  border-radius: var(--r-sm);
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: rise 0.2s ease;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.ok {
  border-left-color: var(--ok);
}
.toast.err {
  border-left-color: var(--err);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    z-index: 30;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 15, 0.6);
    backdrop-filter: blur(3px);
    z-index: 29;
    display: none;
    animation: scrimIn 0.2s ease;
  }
  .sidebar-scrim.is-open {
    display: block;
  }
  .menu-toggle {
    display: grid;
  }
}

@media (max-width: 500px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }
}

/* Full-width drawers on small phones */
@media (max-width: 540px) {
  .key-drawer,
  .detail-drawer {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
    border-top: 1px solid var(--line);
    top: auto;
    bottom: 0;
    right: 0;
    height: 92dvh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .key-drawer.open,
  .detail-drawer.open {
    transform: translateY(0);
  }
  .detail-info {
    padding: 14px;
  }
  .info-matchup {
    font-size: 15px;
  }
  .drawer-body {
    padding-bottom: 60px;
  }
  .stream {
    padding: 12px;
  }
  .stream-num {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
}

/* Compact action bar on narrow screens */
@media (max-width: 560px) {
  .action-bar {
    gap: 6px;
    flex-wrap: wrap;
    padding: 9px 12px;
  }
  .action-bar-label {
    display: none;
  }
  .action-bar .sep {
    display: none;
  }
  .last-sync {
    display: none;
  }
  .action-bar-spacer {
    display: none;
  }
  #lastSync {
    display: none;
  }
}

/* Better touch targets */
@media (max-width: 768px) {
  .btn-xs {
    min-height: 36px;
    padding: 0 10px;
  }
  .row-action {
    min-height: 36px;
    padding: 6px 12px;
  }
  .nav-item {
    min-height: 44px;
  }
}

/* Very small screens */
@media (max-width: 380px) {
  .stat-num {
    font-size: 22px;
  }
  .topbar-title {
    display: none;
  }
  .search-wrap {
    flex: 1;
  }
  .cards-grid {
    gap: 8px;
  }
}

/* =============================================================================
   Add/Remove curation buttons & ID badges
   ============================================================================= */

.btn-add, .btn-added {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
}
.btn-add {
  background: var(--brand-soft);
  color: var(--brand-b);
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.btn-add:hover {
  background: var(--brand);
  color: #fff;
}
.btn-added {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.btn-added:hover {
  background: rgba(244, 63, 94, 0.12);
  color: var(--err);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-added:hover::after {
  content: " ×";
}

.card-ids, .row-ids {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.id-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.id-badge.up-id {
  background: rgba(168, 85, 247, 0.1);
  color: var(--vod);
}

.is-curated > .card-strip,
.is-curated > .row-stripe {
  background: var(--ok) !important;
}

.group-head {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  padding: 16px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.group-head span {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text-2);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}
.group-head.added-head {
  color: var(--ok);
}
.group-head.added-head span {
  background: var(--ok-soft);
  color: var(--ok);
}

/* ============================================================================
   CHANNEL & HIGHLIGHT CARD GRID (2 columns)
   ============================================================================ */
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 900px) {
  .media-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 500px) {
  .media-grid {
    grid-template-columns: 1fr;
  }
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  position: relative;
}
.media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px -6px rgba(0,0,0,0.5);
  border-color: var(--line);
}
.media-card:active {
  transform: translateY(0);
}

.media-card-strip {
  height: 3px;
  background: var(--line);
}
.media-card.is-ch .media-card-strip {
  background: linear-gradient(90deg, var(--brand), var(--brand-b));
}
.media-card.is-vod .media-card-strip {
  background: linear-gradient(90deg, var(--vod), #c084fc);
}
.media-card.is-curated .media-card-strip {
  background: linear-gradient(90deg, var(--ok), #6ee7b7) !important;
}

.media-card-body {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.media-card-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
  flex-shrink: 0;
}

.media-card-info {
  flex: 1;
  min-width: 0;
}

.media-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-card-meta {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0,0,0,0.1);
}

.media-card-footer .badge {
  flex-shrink: 0;
}

.media-card-footer .spacer {
  flex: 1;
}

.media-card-streams {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-b);
  border: 1px solid rgba(59, 130, 246, 0.2);
  white-space: nowrap;
  flex-shrink: 0;
}
.media-card:hover .media-card-streams {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.35);
}
.media-card-streams.zero {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

/* Highlight card teams row */
.media-card-teams {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.media-card-teams img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--surface-2);
  padding: 2px;
  flex-shrink: 0;
}
.media-card-teams .mc-vs {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
}
.media-card-teams .mc-team-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ============================================================================
   STREAM ACTIVE/HIDDEN TOGGLE
   ============================================================================ */
.btn-stream-active {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.btn-stream-active:hover {
  background: rgba(244, 63, 94, 0.12);
  color: var(--err);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-stream-inactive {
  background: rgba(244, 63, 94, 0.08);
  color: var(--err);
  border: 1px solid rgba(244, 63, 94, 0.2);
}
.btn-stream-inactive:hover {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: rgba(16, 185, 129, 0.25);
}
/* Edit form in detail drawer */
.edit-form {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 540px) {
  .edit-row { grid-template-columns: 1fr; }
}
.edit-form select.input {
  padding: 8px 10px;
  appearance: auto;
}

.stream.is-hidden-stream {
  opacity: 0.45;
  border-style: dashed;
}
.stream.is-hidden-stream:hover {
  opacity: 0.7;
}

/* Fix detail-meta grid layout */
.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.detail-meta .k {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-meta .v {
  color: var(--text);
}
