:root {
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 11px;
}

/* Charcoal Bento (Default Classic Theme) */
[data-theme="dark"] {
  --bg: #131110;
  --bg-card: rgba(34, 30, 28, 0.92);
  --bg-card-hover: rgba(45, 39, 36, 0.96);
  --bg-input: rgba(20, 18, 17, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(224, 134, 79, 0.55);
  --text: #f5f2ef;
  --text-muted: #a69d95;
  --accent-cyan: #e5925e;
  --accent-purple: #d97742;
  --accent-blue: #f5f2ef;
  --green: #4ade80;
  --amber: #f59e0b;
  --red: #fb7185;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  --orb-opacity: 0.22;
}

[data-theme="light"] {
  --bg: #f3efe9;
  --bg-card: rgba(255, 253, 250, 0.96);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: rgba(242, 237, 230, 0.96);
  --border: rgba(28, 25, 23, 0.16);
  --border-glow: rgba(217, 119, 66, 0.55);
  --text: #1c1917;
  --text-muted: #6b6259;
  --accent-cyan: #c8642d;
  --accent-purple: #a84e1e;
  --accent-blue: #1c1917;
  --green: #16a34a;
  --amber: #d97706;
  --red: #e11d48;
  --shadow: 0 10px 30px rgba(40, 30, 20, 0.08);
  --orb-opacity: 0.14;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Warm ambient charcoal orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  pointer-events: none;
  z-index: 0;
  opacity: var(--orb-opacity);
}
.orb-1 {
  width: 540px; height: 540px;
  top: -180px; right: -100px;
  background: radial-gradient(circle, #d97742, #7c3a1d);
}
.orb-2 {
  width: 480px; height: 480px;
  bottom: -160px; left: -120px;
  background: radial-gradient(circle, #9a5b3c, #2d221c);
}
.orb-3 {
  width: 360px; height: 360px;
  top: 40%; left: 45%;
  background: radial-gradient(circle, rgba(229, 146, 94, 0.22), transparent);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 20px 28px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.main-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: border-color 0.25s ease, transform 0.2s ease, background 0.25s ease;
}

/* Header */
.top-bar {
  position: relative;
  z-index: 200;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-orb {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(217, 119, 66, 0.35);
}
.brand-orb svg { width: 22px; height: 22px; }
.brand-title { font-size: 18px; font-weight: 700; letter-spacing: 0.3px; }
.brand-sub { font-size: 10px; letter-spacing: 1.6px; color: var(--accent-cyan); font-weight: 600; }

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.nav-pill {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.2s ease;
}
.nav-pill svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-pill:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-pill.active {
  background: rgba(229, 146, 94, 0.16);
  color: var(--text);
  border-color: var(--border-glow);
  box-shadow: 0 4px 14px rgba(217, 119, 66, 0.16);
}
[data-theme="light"] .nav-pill:hover {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .nav-pill.active {
  color: #1c1917;
  background: rgba(217, 119, 66, 0.14);
}

.badge-count {
  background: rgba(244, 63, 94, 0.2);
  color: var(--red);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.header-right { display: flex; align-items: center; gap: 10px; }

.api-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}
.api-status-pill.ok .status-dot {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { transform: scale(1.06); border-color: var(--border-glow); }

/* Progress Banner */
.progress-banner {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-color: var(--border-glow);
}
.progress-info { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan);
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
.progress-track {
  height: 6px; border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  box-shadow: 0 0 12px var(--accent-cyan);
  transition: width 0.3s ease;
}

/* Views */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }

/* Search View */
.search-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
  align-items: start;
}

.sub-tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.sub-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sub-tab.active {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: none;
}

/* Remove ugly number input spinner arrows everywhere */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

.mode-panel { display: none; }
.mode-panel.active { display: block; }

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.muted { color: var(--text-muted); font-size: 13px; }

.glass-textarea, .glass-input, .glass-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.glass-textarea:focus, .glass-input:focus, .glass-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.glass-textarea {
  min-height: 290px;
  resize: vertical;
  line-height: 1.55;
}
.glass-select option {
  background: #0f172a;
  color: #f1f5f9;
}
[data-theme="light"] .glass-select option {
  background: #ffffff;
  color: #0f172a;
}

.insight-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  display: flex;
  gap: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.insight-box strong { color: var(--text); }
.insight-icon { font-size: 20px; }

.action-row {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.btn-neon {
  border: none;
  background: #f5f2ef;
  color: #161413;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}
[data-theme="light"] .btn-neon {
  background: #1c1917;
  color: #fff;
}
.btn-neon svg { width: 16px; height: 16px; }
.btn-neon:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(229, 146, 94, 0.32); }
.btn-neon:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.btn-ghost:hover { border-color: var(--border-glow); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-danger-ghost {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--red);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* Filters */
.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field label, .pill-group-block label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.pill-group-block { margin-top: 14px; }
.pill-selector {
  display: flex;
  gap: 8px;
}
.pill-selector.wrap { flex-wrap: wrap; }
.pill-opt {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pill-opt:hover { color: var(--text); border-color: var(--border-glow); }
.pill-opt.active {
  background: rgba(217, 119, 66, 0.2);
  color: var(--text);
  border-color: var(--accent-purple);
  box-shadow: none;
}

/* KPI Row (Reference style with sparkline bars) */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.kpi-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.kpi-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 24px;
}
.kpi-bar {
  flex: 1;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent-cyan), var(--accent-purple));
  opacity: 0.75;
}

/* Report Toolbar & Cards */
.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.report-toolbar .sub-tabs { margin-bottom: 0; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.glass-select.compact { width: auto; padding: 7px 12px; font-size: 13px; border-radius: 999px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.channel-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  height: 100%;
}
.channel-card:hover { border-color: var(--border-glow); transform: translateY(-2px); }

.ch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ch-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ch-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-glow);
  flex-shrink: 0;
}
.ch-name {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.ch-name:hover { color: var(--accent-cyan); }
.ch-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.heart-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.heart-btn:hover { border-color: var(--red); color: var(--red); transform: scale(1.06); }
.heart-btn.saved {
  background: rgba(244, 63, 94, 0.16);
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.3);
}

.badges-row { display: flex; flex-wrap: wrap; gap: 8px; }
.metric-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
}
.pill-green { background: rgba(16, 185, 129, 0.16); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); }
.pill-amber { background: rgba(245, 158, 11, 0.16); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.pill-cyan { background: rgba(34, 211, 238, 0.14); color: var(--accent-cyan); border: 1px solid rgba(34, 211, 238, 0.3); }
.pill-purple { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.32); }
[data-theme="light"] .pill-purple { color: var(--accent-purple); }

.best-video-link {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  cursor: pointer;
}
.best-video-link:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

.ch-actions { display: flex; gap: 10px; margin-top: auto; }
.ch-actions .btn-neon { flex: 1; justify-content: center; padding: 9px 14px; font-size: 13px; }

/* Table for Competitors & Videos */
.table-wrap { overflow-x: auto; padding: 0; }
table.glass-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.glass-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.glass-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.glass-table tr:hover td { background: rgba(56, 189, 248, 0.05); }
.link-text {
  color: var(--accent-cyan);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.link-text:hover { text-decoration: underline; }

/* Library & Keys */
.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
}
.compact-input { max-width: 280px; }

.keys-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 18px;
}
.add-key-form {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr auto;
  gap: 10px;
  margin: 16px 0 20px;
}
.keys-list { display: flex; flex-direction: column; gap: 10px; }
.key-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  gap: 12px;
}
.key-quota-bar {
  width: 160px;
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.key-quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--accent-cyan));
}
.key-item.exhausted .key-quota-fill { background: var(--red); }

.guide-steps {
  margin-top: 14px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}
.guide-steps strong { color: var(--text); }

/* Empty state & Toast */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.metrics-legend {
  margin-top: 18px;
  padding: 16px 20px;
}
.legend-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 18px;
}
.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}
.legend-item strong { color: var(--text); }
.legend-item .metric-pill { flex-shrink: 0; margin-top: 2px; }
.empty-orb { font-size: 46px; margin-bottom: 12px; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border: 1px solid var(--border-glow);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Info tooltip icon & floating popup */
.field label, .pill-group-block label, .kpi-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.38);
  cursor: help;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.info-tip:hover {
  background: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

.tooltip-popup {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  padding: 10px 13px;
  border-radius: 12px;
  background: rgba(10, 16, 36, 0.96);
  color: #f1f5f9;
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.48;
  pointer-events: none;
  backdrop-filter: blur(12px);
}
[data-theme="light"] .tooltip-popup {
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
}

/* Library snapshot, icon buttons & history modal */
.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn-with-icon.spinning svg { animation: spin 0.9s linear infinite; }

.icon-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.icon-action-btn svg { width: 17px; height: 17px; }
.icon-action-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); transform: scale(1.04); }
.icon-action-btn.spinning svg { animation: spin 0.9s linear infinite; }
.icon-action-btn.spinning { pointer-events: none; color: var(--accent-cyan); }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(5, 8, 22, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-card {
  width: 100%;
  max-width: 760px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border-color: var(--border-glow);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-body {
  overflow-y: auto;
  max-height: 56vh;
}
.history-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.history-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mini-date {
  width: auto;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 10px;
}
.ch-refresh-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.mini-select {
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
}

/* Header new controls: Subscription pill, Support, Bell, Style Popover */
.sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(139, 92, 246, 0.16));
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.sub-pill svg { width: 14px; height: 14px; flex-shrink: 0; }

.header-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.header-icon-btn svg { width: 17px; height: 17px; }
.header-icon-btn:hover, .header-icon-btn.active {
  border-color: var(--border-glow);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}
.header-icon-btn.active {
  background: rgba(56, 189, 248, 0.14);
}

/* FAQ Page */
.faq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.faq-item {
  padding: 16px 20px;
}
.faq-item summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 18px;
  color: var(--accent-cyan);
  font-weight: 700;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after {
  content: '−';
}
.faq-answer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq-answer ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.faq-answer strong { color: var(--text); }
.faq-answer code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--accent-cyan);
  font-size: 12px;
}

.bell-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}
#supportDot {
  position: static;
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.75);
}
.pay-opt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.pay-opt-card {
  border: 1px solid rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.22);
}
.pay-opt-card svg { color: #38bdf8; }
.pay-opt-card:hover {
  background: rgba(56, 189, 248, 0.14);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.38);
  transform: translateY(-1px);
}
.pay-opt-crypto {
  border: 1px solid rgba(245, 158, 11, 0.65);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.22);
}
.pay-opt-crypto svg { color: #f59e0b; }
.pay-opt-crypto:hover {
  background: rgba(245, 158, 11, 0.14);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.38);
  transform: translateY(-1px);
}

.multi-select {
  position: relative;
  width: 100%;
}
.multi-select-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 26px;
}
.multi-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-card, #181412);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  z-index: 60;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.multi-select-menu.hidden { display: none; }
.ms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text);
}
.ms-item:hover { background: rgba(255, 255, 255, 0.06); }
.ms-item input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

#supportDot.hidden { display: none !important; }
.rail-util-btn.has-unread {
  border-color: rgba(239, 68, 68, 0.6) !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

.popover-anchor { position: relative; }
.header-popover {
  position: absolute;
  top: 48px;
  right: 0;
  width: 290px;
  padding: 14px;
  z-index: 1500;
  border-color: var(--border-glow);
  background: rgba(11, 17, 38, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .header-popover {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
}
.popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.notif-item {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.notif-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }

.theme-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mode-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mode-chip svg { width: 14px; height: 14px; }
.mode-chip.active {
  border-color: var(--accent-cyan);
  color: var(--text);
  background: rgba(56, 189, 248, 0.14);
}

.style-list { display: flex; flex-direction: column; gap: 6px; }
.style-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.style-option:hover { color: var(--text); border-color: var(--border-glow); }
.style-option.active {
  border-color: var(--accent-cyan);
  color: var(--text);
  background: rgba(56, 189, 248, 0.12);
}
.style-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.swatch-cosmic { background: linear-gradient(135deg, #22d3ee, #8b5cf6); }
.swatch-lotus { background: linear-gradient(135deg, #5eead4, #fbbf24, #f472b6); }
.swatch-tactical { background: linear-gradient(135deg, #ff7b00, #1e293b); }
.swatch-emerald { background: linear-gradient(135deg, #2dd4bf, #059669); }
.swatch-ruby { background: linear-gradient(135deg, #fb7185, #be123c); }

.snapshot-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.snapshot-head {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
}
.snapshot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.delta-badge {
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--green);
}
.delta-badge.neutral {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
}

.left-col-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Interactive Hybrid Clock Widget */
.clock-widget {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
}
.clock-widget:hover { border-color: var(--border-glow); }

.clock-dial-wrap {
  width: 78px;
  height: 78px;
  flex-shrink: 0;
}
.clock-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.25));
}
[data-style="tactical"] .clock-svg {
  filter: drop-shadow(0 0 10px rgba(255, 107, 0, 0.35));
}
[data-style="lotus"] .clock-svg {
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.28));
}
.clock-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 5.5;
}
.clock-progress {
  fill: none;
  stroke: url(#clockRingGrad);
  stroke-width: 5.5;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.35s linear;
}
[data-style="tactical"] .clock-progress {
  stroke-linecap: butt;
}
.hand-hour {
  stroke: var(--text);
  stroke-width: 3.2;
  stroke-linecap: round;
}
.hand-min {
  stroke: var(--accent-cyan);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.hand-sec {
  stroke: var(--accent-purple);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.hand-center { fill: var(--accent-cyan); }
.clock-widget.minimal-hands #clockHands { display: none; }

.clock-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.clock-time-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.clock-digital {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--text), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .clock-digital {
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: #1c1917 !important;
  color: #1c1917 !important;
}
.clock-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.clock-quota-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  width: fit-content;
}
.clock-quota-row strong { color: var(--accent-cyan); font-variant-numeric: tabular-nums; }
.quota-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* Responsive layouts: 4K/2K -> 13" laptops (1280x720 / 1366x768) -> narrow windows */
@media (min-width: 1700px) {
  .app-shell { max-width: 1580px; }
  .glass-textarea { min-height: 330px; }
}

@media (max-width: 1300px), (max-height: 780px) {
  .app-shell { padding: 12px 16px 20px; gap: 12px; }
  .glass-card { padding: 16px; }
  .glass-textarea { min-height: 195px; }
  .top-bar { padding: 10px 14px; }
  .nav-pill { padding: 7px 12px; font-size: 13px; }
  .clock-digital { font-size: 24px; }
}

@media (max-width: 1120px) {
  .top-bar { flex-wrap: wrap; justify-content: center; }
  .brand { margin-right: auto; }
}

@media (max-width: 960px) {
  .search-grid, .keys-layout, .cards-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .add-key-form { grid-template-columns: 1fr; }
  .header-popover { max-width: calc(100vw - 32px); }
}

@media (max-width: 560px) {
  .filters-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr; }
}

.swatch-rdr2 { background: linear-gradient(135deg, #dc2626 50%, #0a0506 50%); }

/* =========================================================
   THEME SKIN: RED DEAD REDEMPTION II (Wild West Grunge)
   ========================================================= */
[data-style="rdr2"] {
  --bg: #070506;
  --bg-card: rgba(14, 8, 9, 0.8);
  --bg-card-hover: rgba(24, 13, 14, 0.9);
  --bg-input: rgba(8, 5, 6, 0.92);
  --border: rgba(220, 38, 38, 0.3);
  --border-glow: rgba(239, 68, 68, 0.78);
  --text: #f5efe6;
  --text-muted: #a6968f;
  --accent-cyan: #ef4444;
  --accent-blue: #b91c1c;
  --accent-purple: #991b1b;
  --green: #d97706;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius-lg: 4px;
  --radius-md: 3px;
  --radius-sm: 2px;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.75);
}

[data-style="rdr2"] .bg-orb { display: none; }

[data-style="rdr2"] body {
  background-color: #070506;
  background-image:
    linear-gradient(180deg, rgba(7, 5, 6, 0.35), rgba(7, 5, 6, 0.65)),
    url("../assets/rdr2_bg.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

[data-style="rdr2"] h2,
[data-style="rdr2"] h3,
[data-style="rdr2"] .brand-title,
[data-style="rdr2"] .clock-digital,
[data-style="rdr2"] .kpi-value {
  font-family: 'Rockwell', 'Georgia', 'Times New Roman', serif;
  letter-spacing: 0.8px;
}

[data-style="rdr2"] h2,
[data-style="rdr2"] .brand-title {
  text-transform: uppercase;
}

[data-style="rdr2"] .brand-sub {
  color: #dc2626;
  letter-spacing: 2.2px;
}

[data-style="rdr2"] .brand-orb {
  border-radius: 3px;
  background: #b91c1c;
  box-shadow: 0 0 16px rgba(220, 38, 38, 0.45);
  border: 1px solid rgba(245, 239, 230, 0.25);
}

[data-style="rdr2"] .glass-card {
  backdrop-filter: blur(8px);
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-top: 2px solid #b91c1c;
  background-image: linear-gradient(180deg, rgba(185, 28, 28, 0.08), transparent 28%);
}

[data-style="rdr2"] .top-bar {
  background: rgba(8, 5, 6, 0.94);
  border-top: none;
  border-bottom: 1px solid rgba(220, 38, 38, 0.32);
}

[data-style="rdr2"] .main-nav {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  gap: 8px;
}

[data-style="rdr2"] .nav-pill {
  border-radius: 2px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 9px 14px;
  background: rgba(18, 10, 11, 0.72);
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-bottom: 2px solid rgba(220, 38, 38, 0.22);
}

[data-style="rdr2"] .nav-pill:hover {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(185, 28, 28, 0.14);
  color: #f5efe6;
}

[data-style="rdr2"] .nav-pill.active {
  background: rgba(185, 28, 28, 0.24);
  border: 1px solid rgba(239, 68, 68, 0.6);
  border-bottom: 2px solid #ef4444;
  box-shadow: 0 0 14px rgba(185, 28, 28, 0.25);
  color: #f5efe6;
}

[data-style="rdr2"] .btn-neon {
  border-radius: 2px;
  background: #b91c1c;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  box-shadow: 0 4px 16px rgba(185, 28, 28, 0.4);
  border: 1px solid rgba(245, 239, 230, 0.2);
}
[data-style="rdr2"] .btn-neon:hover {
  background: #dc2626;
  box-shadow: 0 6px 22px rgba(220, 38, 38, 0.55);
}

[data-style="rdr2"] .btn-ghost,
[data-style="rdr2"] .sub-tabs,
[data-style="rdr2"] .sub-tab,
[data-style="rdr2"] .pill-opt,
[data-style="rdr2"] .sub-pill,
[data-style="rdr2"] .api-status-pill,
[data-style="rdr2"] .header-icon-btn,
[data-style="rdr2"] .icon-action-btn,
[data-style="rdr2"] .heart-btn,
[data-style="rdr2"] .glass-select.compact {
  border-radius: 2px;
}

[data-style="rdr2"] .sub-tab.active,
[data-style="rdr2"] .pill-opt.active {
  background: #b91c1c;
  border-color: #ef4444;
  color: #fff;
  box-shadow: none;
}

[data-style="rdr2"] .clock-digital {
  background: none;
  -webkit-text-fill-color: #f5efe6;
  color: #f5efe6;
  text-shadow: 0 2px 10px rgba(220, 38, 38, 0.45);
}
[data-style="rdr2"] .clock-svg {
  filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.4));
}
[data-style="rdr2"] .clock-track {
  stroke: rgba(245, 239, 230, 0.16);
  stroke-dasharray: 2 4;
}
[data-style="rdr2"] .header-popover {
  background: rgba(12, 7, 8, 0.98);
  border-color: #b91c1c;
}

/* ============================================================
   CHARCOAL BENTO SIDEBAR, MINI RADIO & CIRCULAR QUOTA RING
   ============================================================ */
.side-rail {
  position: sticky;
  top: 16px;
  width: 66px;
  min-height: calc(100vh - 36px);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  flex-shrink: 0;
  z-index: 300;
  transition: width 0.24s cubic-bezier(0.22, 1, 0.36, 1), padding 0.24s ease;
}

.side-rail.expanded {
  width: 214px;
  padding: 14px 12px;
}

.rail-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.18s ease, width 0.2s ease;
}

.side-rail.expanded .rail-label {
  opacity: 1;
  width: auto;
}

.side-rail:not(.expanded) .badge-count {
  display: none;
}

.rail-toggle-btn {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.rail-toggle-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.rail-toggle-btn:hover { border-color: var(--border-glow); }

.rail-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail-util-btn {
  width: 100%;
  height: auto;
  padding: 10px 12px;
  border-radius: 14px;
  justify-content: flex-start;
  gap: 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
}
.rail-util-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.rail-util-btn:hover,
.rail-util-btn.active { color: var(--text); }

.side-rail .rail-popover {
  top: auto;
  bottom: 0;
  left: calc(100% + 12px);
  right: auto;
}

/* Mini Radio in Top Bar */
.radio-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}
.radio-pill.playing {
  border-color: var(--border-glow);
  box-shadow: 0 0 18px rgba(229, 146, 94, 0.22);
}

.radio-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--accent-cyan);
  color: #141210;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.radio-play-btn:hover { transform: scale(1.06); }
.radio-play-btn svg { width: 14px; height: 14px; }

.radio-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 70px;
}
.radio-title { font-size: 12px; font-weight: 700; color: var(--text); }
.radio-status { font-size: 10px; color: var(--text-muted); }

.radio-vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.radio-slider {
  width: 74px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

/* Circular Quota Ring in Header */
.quota-ring-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.quota-ring-pill:hover { border-color: var(--border-glow); }

.quota-ring-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quota-ring-svg {
  width: 36px;
  height: 36px;
  transform: rotate(-90deg);
}
.quota-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 3.5;
}
[data-theme="light"] .quota-ring-bg {
  stroke: rgba(28, 25, 23, 0.12);
}
.quota-ring-fill {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 100.53;
  stroke-dashoffset: 100.53;
  transition: stroke-dashoffset 0.35s ease, stroke 0.25s ease;
}
.quota-ring-pct {
  position: absolute;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--text);
}

.quota-ring-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.quota-ring-nums {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.quota-ring-sub {
  font-size: 10px;
  color: var(--text-muted);
}

/* Swatch preview in theme menu */
.swatch-cosmic {
  background: linear-gradient(135deg, #221f1d 0%, #d97742 100%);
}

.id-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.id-pill strong { color: var(--text); font-family: Consolas, monospace; }
.id-pill:hover { border-color: var(--border-glow); }

.activate-key-btn {
  padding: 8px 16px !important;
  font-size: 12.5px !important;
}

.btn-locked {
  opacity: 0.48 !important;
  cursor: not-allowed !important;
  filter: grayscale(0.4);
}

#view-library.library-locked .library-header select,
#view-library.library-locked .library-header button,
#view-library.library-locked .library-header input {
  opacity: 0.42;
  filter: grayscale(1);
  pointer-events: none;
  cursor: not-allowed;
}

#view-library.library-locked #libraryGrid {
  filter: grayscale(1);
  opacity: 0.42;
  pointer-events: none;
  user-select: none;
}

#view-library.library-locked #libraryGrid .ch-head,
#view-library.library-locked #libraryGrid .snapshot-box,
#view-library.library-locked #libraryGrid .badges-row,
#view-library.library-locked #libraryGrid .best-video-link {
  filter: blur(4px);
}

#view-report.report-locked #reportContent {
  filter: grayscale(1);
  opacity: 0.42;
  pointer-events: none;
  user-select: none;
}

#view-report.report-locked #reportContent .kpi-row,
#view-report.report-locked #reportContent .report-toolbar,
#view-report.report-locked #reportContent #reportBody,
#view-report.report-locked #reportContent .metrics-legend {
  filter: blur(4px);
}

.library-lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-secondary);
  font-size: 13px;
}

.update-rail-btn {
  color: var(--text-muted);
  opacity: 0.58;
}
.update-rail-btn:hover {
  opacity: 0.9;
}
.update-rail-btn.has-update {
  opacity: 1;
  color: var(--green) !important;
  border-color: rgba(74, 222, 128, 0.55) !important;
  background: rgba(74, 222, 128, 0.14) !important;
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.35);
}

/* Wild West II (rdr2) sidebar & radio compatibility */
[data-style="rdr2"] .side-rail {
  background: linear-gradient(180deg, rgba(22, 12, 13, 0.94), rgba(14, 8, 9, 0.94));
  border-radius: 4px;
  border-color: rgba(220, 38, 38, 0.4);
}
[data-style="rdr2"] .rail-toggle-btn,
[data-style="rdr2"] .rail-util-btn,
[data-style="rdr2"] .radio-pill,
[data-style="rdr2"] .quota-ring-pill {
  border-radius: 2px;
}
[data-style="rdr2"] .radio-play-btn {
  background: #dc2626;
  color: #fff;
}

@media (max-width: 980px) {
  .app-shell {
    flex-direction: column;
  }
  .side-rail {
    position: relative;
    top: 0;
    width: 100% !important;
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .main-nav {
    flex-direction: row;
    width: auto;
    flex: 1;
  }
  .rail-bottom {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-direction: row;
    width: auto;
  }
  .rail-util-btn { width: auto; }
  .side-rail .rail-popover {
    left: auto;
    right: 0;
    top: 48px;
    bottom: auto;
  }
  .radio-pill { display: none; }
}
