/* ── RESET & BASE ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0B0E14;
  color: #E6E6E6;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input { font-family: inherit; }
img { vertical-align: middle; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1a1d23; }
::-webkit-scrollbar-thumb { background: #4a4f5c; border-radius: 3px; }

/* ── LOGIN SCREEN ──────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }
.login-container {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0B0E14 0%, #1a1d23 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 48px 40px;
  background: #14171C;
  border-radius: 16px;
  border: 1px solid #2a2e38;
  text-align: center;
}
.login-logo { margin-bottom: 24px; }
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-subtitle { color: #8a8fa0; font-size: 14px; margin-bottom: 32px; }
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #8a8fa0; margin-bottom: 8px; }
.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  color: #E6E6E6;
  font-size: 14px;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: #E50914; outline: none; }
.form-group textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 16px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  color: #E6E6E6;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.form-group textarea:focus { border-color: #E50914; outline: none; }
.btn-primary {
  width: 100%;
  padding: 14px;
  background: #E50914;
  color: white;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}
.btn-primary:hover { background: #b2070f; }
.btn-primary .btn-loader svg { animation: spin 1s linear infinite; }
.error-msg { color: #ff4444; font-size: 13px; margin-top: 12px; }

/* ── LAYOUT ────────────────────────────────────────────────────────── */
#adminScreen { display: none; flex-direction: row; min-height: 100vh; }
#adminScreen.active { display: flex; }

/* ── SIDEBAR ───────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: #14171C;
  border-right: 1px solid #1e2229;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid #1e2229;
  color: white;
}
.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #8a8fa0;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: #E6E6E6; background: rgba(255,255,255,0.03); }
.nav-item.active {
  color: #E50914;
  background: rgba(229,9,20,0.08);
  border-left-color: #E50914;
}
.nav-item svg { flex-shrink: 0; }

.nav-dropdown-toggle .nav-item-label { flex: 1; }

.nav-dropdown-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.nav-dropdown.open .nav-dropdown-chevron { transform: rotate(180deg); }

.nav-submenu {
  display: none;
  padding: 4px 0 8px;
  background: rgba(0,0,0,0.12);
}

.nav-dropdown.open .nav-submenu { display: block; }

.nav-subitem {
  display: block;
  padding: 8px 16px 8px 51px;
  color: #73798a;
  font-size: 12px;
  line-height: 1.3;
  border-left: 3px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.nav-subitem:hover {
  color: #E6E6E6;
  background: rgba(255,255,255,0.03);
}

.nav-subitem.active {
  color: #E50914;
  background: rgba(229,9,20,0.06);
  border-left-color: #E50914;
}

.settings-section[id] { scroll-margin-top: 24px; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1e2229;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; }
.user-email { font-size: 12px; color: #8a8fa0; }
.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  color: #8a8fa0;
  font-size: 13px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.08); color: #E6E6E6; }

/* ── MAIN CONTENT ────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
  min-height: 100vh;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-header { margin-bottom: 28px; display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.tab-header h2 { font-size: 28px; font-weight: 700; color: white; }
.tab-subtitle { color: #8a8fa0; font-size: 14px; margin-top: 4px; }
.tab-actions { display: flex; align-items: center; gap: 12px; }

/* ── STATS GRID ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: #2a2e38; }
.stat-card.loading { opacity: 0.6; }
.stat-icon {
  width: 48px;
  height: 48px;
  background: rgba(229,9,20,0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #E50914;
  flex-shrink: 0;
}
.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 12px; color: #8a8fa0; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 28px; font-weight: 700; color: white; margin-top: 4px; }

/* ── CHARTS ────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.chart-card {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 12px;
  padding: 24px;
}
.chart-card h3 { font-size: 15px; font-weight: 600; color: white; margin-bottom: 20px; }
.chart-container { min-height: 200px; position: relative; }
.chart-loading { color: #8a8fa0; font-size: 14px; text-align: center; padding: 40px 0; }
.chart-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #1e2229;
}
.chart-bar:last-child { border-bottom: none; }
.chart-bar-label { font-size: 13px; color: #8a8fa0; min-width: 80px; }
.chart-bar-fill-wrap { flex: 1; height: 8px; background: #1e2229; border-radius: 4px; overflow: hidden; }
.chart-bar-fill { height: 100%; background: #E50914; border-radius: 4px; transition: width 0.5s ease; }
.chart-bar-count { font-size: 13px; font-weight: 600; color: white; min-width: 40px; text-align: right; }

/* ── SEARCH & ACTIONS ──────────────────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 8px;
  padding: 0 12px;
  color: #8a8fa0;
}
.search-box input {
  background: none;
  border: none;
  color: #E6E6E6;
  font-size: 14px;
  padding: 10px 0;
  width: 280px;
}
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: #4a4f5c; }
.clear-btn { background: none; color: #8a8fa0; padding: 4px; display: flex; align-items: center; }
.clear-btn:hover { color: #E6E6E6; }
.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 8px;
  color: #8a8fa0;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-refresh:hover { border-color: #E50914; color: #E50914; }

/* ── USERS TABLE ───────────────────────────────────────────────────── */
.users-table-wrapper {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
}
.users-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8fa0;
  background: #1a1d23;
  border-bottom: 1px solid #1e2229;
  white-space: nowrap;
}
.users-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: #E6E6E6;
  border-bottom: 1px solid #1e2229;
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: rgba(255,255,255,0.02); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-cell-name { font-weight: 500; }
.user-cell-uid { font-size: 11px; color: #4a4f5c; font-family: monospace; }
.provider-badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(229,9,20,0.15);
  color: #E50914;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.btn-email-user {
  padding: 6px 12px;
  background: rgba(34,197,94,0.12);
  color: #7ddf96;
  border: 1px solid rgba(34,197,94,0.28);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-email-user:hover {
  background: rgba(34,197,94,0.2);
  border-color: rgba(34,197,94,0.5);
  color: #9ff0b2;
}
.email-unavailable {
  display: inline-block;
  color: #4a4f5c;
  font-size: 12px;
  white-space: nowrap;
}
.btn-view {
  padding: 6px 12px;
  background: rgba(229,9,20,0.1);
  color: #E50914;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-view:hover { background: #E50914; color: white; }
.table-loading { text-align: center; color: #8a8fa0; padding: 40px; }

/* ── PAGINATION ────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.btn-page {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 8px;
  color: #8a8fa0;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-page:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-page:not(:disabled):hover { border-color: #E50914; color: #E50914; }
.page-info { font-size: 13px; color: #8a8fa0; }

/* ── RECENT SECTION ────────────────────────────────────────────────── */
.recent-section { margin-top: 32px; }
.recent-section h3 { font-size: 18px; font-weight: 600; color: white; margin-bottom: 16px; }
.recent-table {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 12px;
  overflow: hidden;
}
.table-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #1e2229;
  gap: 16px;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: rgba(255,255,255,0.02); }

/* ── MODAL ─────────────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background: #14171C;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #1e2229;
}
.modal-user-info { display: flex; align-items: center; gap: 14px; }
.detail-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.modal-user-info h3 { font-size: 18px; font-weight: 600; }
.detail-email { font-size: 13px; color: #8a8fa0; }
.modal-close { background: none; color: #8a8fa0; padding: 8px; border-radius: 8px; transition: all 0.2s; }
.modal-close:hover { background: rgba(255,255,255,0.06); color: #E6E6E6; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #1e2229;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.modal-footer .btn-primary {
  width: auto;
  padding: 10px 16px;
  font-size: 13px;
}

/* ── DETAIL TABS ───────────────────────────────────────────────────── */
.detail-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid #1e2229;
  padding-bottom: 1px;
  flex-wrap: wrap;
}
.detail-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #8a8fa0;
  background: none;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s;
  position: relative;
}
.detail-tab:hover { color: #E6E6E6; }
.detail-tab.active { color: #E50914; background: rgba(229,9,20,0.08); }
.detail-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #E50914;
}
.detail-loading { text-align: center; color: #8a8fa0; padding: 40px; }
.detail-content { min-height: 200px; }
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.media-item {
  background: #1a1d23;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}
.media-item:hover { transform: scale(1.02); }
.media-item img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #2a2e38;
}
.media-item-info { padding: 8px; }
.media-item-title { font-size: 12px; font-weight: 600; color: white; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.media-item-meta { font-size: 11px; color: #8a8fa0; margin-top: 4px; }
.media-item-badge {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(229,9,20,0.15);
  color: #E50914;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
.channel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #1a1d23;
  border-radius: 8px;
  margin-bottom: 8px;
}
.channel-item img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #2a2e38; }
.channel-item-name { font-size: 14px; font-weight: 500; }
.channel-item-group { font-size: 12px; color: #8a8fa0; }
.cast-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #1a1d23;
  border-radius: 8px;
  margin-bottom: 8px;
}
.cast-item img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #2a2e38; }
.cast-item-name { font-size: 14px; font-weight: 500; }
.cast-item-character { font-size: 12px; color: #8a8fa0; }
.btn-danger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255,68,68,0.12);
  color: #ff4444;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-danger:hover { background: #ff4444; color: white; }

/* ── ANALYTICS ──────────────────────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}
.analytics-card {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 12px;
  padding: 24px;
}
.analytics-card h4 { font-size: 15px; font-weight: 600; color: white; margin-bottom: 16px; }
.analytics-list { max-height: 300px; overflow-y: auto; }
.analytics-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #1e2229;
}
.analytics-item:last-child { border-bottom: none; }
.analytics-item-name { font-size: 13px; color: #E6E6E6; }
.analytics-item-count { font-size: 13px; font-weight: 600; color: #E50914; }

/* ── SETTINGS ──────────────────────────────────────────────────────── */
.settings-section {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  overflow: visible;
}
.settings-section h3 { font-size: 16px; font-weight: 600; color: white; margin-bottom: 12px; }
.settings-desc { font-size: 13px; color: #8a8fa0; margin-bottom: 20px; }
.settings-desc code { background: #1a1d23; padding: 2px 6px; border-radius: 4px; color: #E50914; }
.settings-info { display: flex; flex-direction: column; gap: 12px; }
.info-item { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.info-label { color: #8a8fa0; }
.info-item code { background: #1a1d23; padding: 4px 8px; border-radius: 4px; color: #E50914; font-size: 12px; }
.email-recipients-info { margin-bottom: 20px; }
.email-send-summary {
  margin-bottom: 20px;
  padding: 12px 14px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.28);
  border-radius: 8px;
  color: #8ee6a3;
  font-size: 13px;
}
.email-send-summary.error {
  background: rgba(255,68,68,0.12);
  border-color: rgba(255,68,68,0.28);
  color: #ff9a9a;
}
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge.ok { background: rgba(34,197,94,0.15); color: #22c55e; }
.status-badge.error { background: rgba(255,68,68,0.15); color: #ff4444; }
.settings-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.settings-actions .btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #E50914;
  color: white;
  border: 1px solid #E50914;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s, background 0.2s;
}
.settings-actions .btn-primary:hover { background: #c50712; border-color: #c50712; }
.settings-actions .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #8a8fa0;
}
.form-hint.error { color: #ff4444; }
.apk-links-preview { color: #7ddf96; }

/* Toggle switch (used for boolean config fields like Enable Test Ads) */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  color: #E6E6E6;
  margin: 0;
}
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #2a2e38;
  border-radius: 24px;
  transition: background-color 0.2s;
}
.toggle-slider::before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: #E6E6E6;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background-color: #E50914; }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 2px rgba(229,9,20,0.4); }

.settings-desc code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  padding: 1px 6px;
  border-radius: 4px;
  color: #E50914;
}

/* Stream provider rows */
.provider-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.provider-card {
  background: #1a1d23;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.provider-card:hover { border-color: #3a3f4c; }
.provider-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #2a2e38;
}
.provider-toggle-wrap { flex-shrink: 0; }
.provider-main-info { flex: 1; min-width: 0; }
.provider-card-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #E6E6E6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.provider-card-url {
  display: block;
  font-size: 12px;
  color: #8a8fa0;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.provider-card-delete { margin-left: auto; }
.provider-card-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.provider-card-urls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.provider-url-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-right: 1px solid #2a2e38;
}
.provider-url-field:last-child { border-right: none; }
.provider-url-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #E50914;
  flex-shrink: 0;
  min-width: 32px;
}
.provider-url-template {
  flex: 1;
  font-size: 11px;
  color: #8a8fa0;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: transparent;
  border: 1px solid #2a2e38;
  border-radius: 6px;
  color: #8a8fa0;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-icon:hover { border-color: #ff4444; color: #ff4444; }
.btn-icon-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: transparent;
  border: 1px solid #2a2e38;
  border-radius: 4px;
  color: #8a8fa0;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-icon-sm:hover { border-color: #E50914; color: #E50914; }

.empty-state {
  padding: 24px;
  text-align: center;
  color: #8a8fa0;
  font-size: 13px;
  background: #1a1d23;
  border: 1px dashed #2a2e38;
  border-radius: 8px;
}

/* Two-column config grid */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.config-sub-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8fa0;
  margin-bottom: 12px;
  border-bottom: 1px solid #1e2229;
  padding-bottom: 6px;
}

/* Toggle rows in a side-by-side grid */
.config-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Add provider form */
.add-provider-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  margin-bottom: 12px;
}
.provider-add-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.add-provider-form .form-group { margin-bottom: 0; }
.add-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 20px;
  background: #E50914;
  color: white;
  border: 1px solid #E50914;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  align-self: end;
}
.add-provider-btn:hover { background: #c50712; border-color: #c50712; }
.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  color: #8a8fa0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: #E50914; color: #E50914; }
.about-info p { font-size: 13px; color: #8a8fa0; margin-bottom: 4px; }
.about-info strong { color: #E6E6E6; }

/* ── TOAST ─────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: slideIn 0.3s ease;
}
.toast.success { border-color: #22c55e; }
.toast.error { border-color: #ff4444; }
.toast.info { border-color: #3b82f6; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── DIALOG ──────────────────────────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-box {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
}
.dialog-box h3 { font-size: 20px; font-weight: 600; color: white; margin-bottom: 12px; }
.dialog-box p { font-size: 14px; color: #8a8fa0; margin-bottom: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; }
.dialog-actions .btn-secondary:hover { background: rgba(255,255,255,0.08); }

/* ── RESPONSIVE ────────────────────────────────────────────────────── */

/* Tablet / iPad */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .sidebar-header span { display: none; }
  .sidebar-header { justify-content: center; }
  .main-content { padding: 24px 28px; }
  .charts-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .users-table { min-width: 960px; }
  .modal-content { max-width: 95vw; }
  .detail-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .detail-tab { white-space: nowrap; flex-shrink: 0; }
}

/* Mobile landscape / small tablet */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100vh;
    width: 240px;
    z-index: 500;
    transition: left 0.3s ease;
    border-right: none;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { left: 0; }
  .sidebar-header { justify-content: flex-start; padding: 20px 16px; }
  .sidebar-header span { display: inline; }

  /* Hamburger menu button — injected via JS */
  .sidebar-toggle {
    display: flex;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 501;
    width: 40px;
    height: 40px;
    background: #14171C;
    border: 1px solid #2a2e38;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #E6E6E6;
    transition: background 0.2s;
  }
  .sidebar-toggle:hover { background: #1e2229; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 499;
  }
  .sidebar-backdrop.active { display: block; }

  .main-content { padding: 60px 16px 24px; }
  .tab-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .tab-actions { width: 100%; flex-direction: column; }
  .search-box { width: 100%; }
  .search-box input { width: 100%; }
  .users-table-wrapper { overflow-x: auto; }
  .users-table { min-width: 880px; font-size: 12px; }
  .users-table th, .users-table td { padding: 10px 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }
  .charts-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .tab-header h2 { font-size: 22px; }

  /* Settings sections stack */
  .settings-section { padding: 16px; }
  .settings-actions { flex-wrap: wrap; }
  .settings-actions .btn-primary,
  .settings-actions .btn-secondary { flex: 1; justify-content: center; }

  /* Modal */
  .modal { padding: 12px; }
  .modal-content { max-width: 100%; border-radius: 12px; max-height: 95vh; }
  .modal-header { padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Toast */
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { width: 100%; }

  /* Login card */
  .login-card { margin: 16px; padding: 32px 24px; }

  /* Add provider form */
  .add-provider-form {
    flex-direction: column;
  }
  .provider-add-fields {
    grid-template-columns: 1fr;
  }

  /* Config grids */
  .config-grid { grid-template-columns: 1fr; }
  .config-toggle-grid { grid-template-columns: 1fr; }
}

/* Mobile portrait */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-icon { width: 40px; height: 40px; }
  .users-table { min-width: 820px; }
  .user-cell-uid { display: none; }
  .tab-header h2 { font-size: 20px; }

  /* Dashboard charts — full width */
  .chart-card { padding: 16px; }
  .chart-card h3 { font-size: 14px; }
  .chart-bar-label { min-width: 60px; font-size: 12px; }

  /* Settings — full width inputs */
  .form-group input { font-size: 16px; } /* prevent iOS zoom */

  /* Provider rows */
  .provider-card-urls { grid-template-columns: 1fr; }
  .provider-url-field { border-right: none; border-bottom: 1px solid #2a2e38; }
  .provider-url-field:last-child { border-bottom: none; }
  .provider-edit-btn { display: none; }
  .provider-card-header { cursor: default; }
  .provider-card-header:hover { background: transparent; }
  .provider-platform-card-header { align-items: flex-start; }
  .provider-platform-card-toggles {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  /* Pagination */
  .pagination { flex-wrap: wrap; gap: 8px; }
  .btn-page { flex: 1; justify-content: center; }

  /* Detail tabs */
  .detail-tab { padding: 8px 12px; font-size: 12px; }

  /* Media grid in modal */
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }

  /* Recent table */
  .table-row { padding: 12px 14px; flex-wrap: wrap; }
  .table-row > div:last-child { display: none; }
}

/* ── LOGIN DIVIDER & GOOGLE BUTTON ─────────────────────────── */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  color: #E6E6E6;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-top: 4px;
  cursor: pointer;
}
.btn-google:hover { background: #22252d; border-color: #3a3f4a; }
.divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: #8a8fa0;
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2a2e38;
}
.divider span { padding: 0 12px; }

/* ── CURRENT SETTINGS (read-only) ─────────────────────────────── */
.settings-readonly-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-readonly-section {
  background: #14171C;
  border: 1px solid #1e2229;
  border-radius: 12px;
  padding: 20px;
}
.settings-readonly-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: #E50914;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1e2229;
}
.settings-readonly-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid #1e2229;
}
.settings-readonly-row:last-child { border-bottom: none; }
.settings-readonly-key {
  font-size: 12px;
  color: #8a8fa0;
  font-weight: 500;
  flex-shrink: 0;
  min-width: 140px;
}
.settings-readonly-val {
  font-size: 12px;
  color: #E6E6E6;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  word-break: break-all;
  text-align: right;
}
.settings-readonly-val.masked { color: #6a7080; font-style: italic; font-family: inherit; }
.badge-enabled  { color: #22c55e; font-weight: 600; }
.badge-disabled { color: #6a7080; }
.provider-readonly-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #1a1d23;
  border: 1px solid #1e2229;
  border-radius: 8px;
  margin-bottom: 8px;
}
.provider-readonly-card:last-child { margin-bottom: 0; }
.provider-readonly-name { font-size: 13px; font-weight: 600; color: #E6E6E6; }
.provider-readonly-template { font-size: 11px; color: #6a7080; font-family: monospace; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-readonly-loading { text-align: center; color: #8a8fa0; font-size: 14px; padding: 40px; }
.settings-readonly-error  { text-align: center; color: #ff4444; font-size: 13px; padding: 20px; }
.settings-readonly-empty  { text-align: center; color: #8a8fa0; font-size: 13px; padding: 20px; }

/* ── PROVIDER EDIT MODAL ─────────────────────────────────── */
.modal textarea {
  width: 100%;
  padding: 10px 12px;
  background: #1a1d23;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  color: #E6E6E6;
  font-size: 13px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  resize: vertical;
  line-height: 1.6;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.modal textarea:focus { border-color: #E50914; outline: none; }

/* ── PROVIDER CARD UPDATES ────────────────────────────────── */
.provider-url-field .provider-url-display {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.2s;
}
.provider-url-field .provider-url-display:hover { background: #2a2e38; }
.provider-url-edit-icon { flex-shrink: 0; color: #8a8fa0; }
.provider-url-field .provider-url-display:hover .provider-url-edit-icon { color: #E50914; }
.provider-url-template { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Collapsible params row in provider card */
.provider-params-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 11px;
  color: #8a8fa0;
  cursor: pointer;
  border-top: 1px solid #2a2e38;
  transition: color 0.2s;
}
.provider-params-toggle:hover { color: #E50914; }
.provider-params-toggle svg { transition: transform 0.2s; }
.provider-params-toggle.open svg { transform: rotate(180deg); }
.provider-params-content {
  display: none;
  padding: 8px 14px 12px;
  border-top: 1px solid #2a2e38;
  font-size: 11px;
  color: #8a8fa0;
  font-family: monospace;
  line-height: 1.8;
}
.provider-params-content.open { display: block; }
.provider-param-row { display: flex; gap: 8px; }
.provider-param-key { color: #E50914; font-weight: 600; }
.provider-param-val { color: #E6E6E6; }

.provider-platform-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-group-label {
  font-size: 12px;
  font-weight: 600;
  color: #8a8fa0;
}
.provider-platform-toggle {
  margin: 0;
  padding: 10px 12px;
  background: #14171C;
  border: 1px solid #2a2e38;
  border-radius: 8px;
}
.provider-platform-card-header {
  border-top: 1px solid #2a2e38;
  border-bottom: none;
  cursor: default;
}
.provider-platform-card-header:hover { background: transparent; }
.provider-platform-card-toggles {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}
.provider-platform-card-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #E6E6E6;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Collapsible iframe attrs row */
.provider-iframe-section {
  display: none;
  padding: 8px 14px 12px;
  border-top: 1px solid #2a2e38;
  font-size: 11px;
  color: #8a8fa0;
  font-family: monospace;
  line-height: 1.8;
}
.provider-iframe-section.open { display: block; }

/* Provider card header row: toggle + name + edit/delete */
.provider-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.provider-card-header:hover { background: rgba(255,255,255,0.02); }
.provider-card-header.provider-platform-card-header { cursor: default; }
.provider-card-header.provider-platform-card-header:hover { background: transparent; }
.provider-edit-btn {
  padding: 4px 10px;
  background: rgba(229,9,20,0.1);
  color: #E50914;
  border: 1px solid rgba(229,9,20,0.2);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.provider-edit-btn:hover { background: #E50914; color: white; border-color: #E50914; }

@media (max-width: 768px) {
  .settings-readonly-row { flex-direction: column; gap: 4px; }
  .settings-readonly-key  { min-width: unset; }
  .settings-readonly-val  { text-align: left; }
}
