:root {
  --bg: #f8f9fa;
  --sidebar: #1a1a2e;
  --sidebar-text: #e0e0e0;
  --sidebar-active: #4361ee;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6c757d;
  --accent: #4361ee;
  --green: #06d6a0;
  --red: #ef476f;
  --border: #e9ecef;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

html, body { height: 100%; font-family: var(--sans); color: var(--text); background: var(--bg); }

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; width: 220px; height: 100vh;
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 100;
}
.logo {
  padding: 24px 20px 20px; font-size: 20px; font-weight: 800;
  letter-spacing: 2px; color: #fff;
}
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.sidebar nav a {
  display: block; padding: 10px 16px; border-radius: 8px; cursor: pointer;
  color: var(--sidebar-text); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background 0.15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); }
.sidebar nav a.active { background: var(--sidebar-active); color: #fff; }
.bigboard-link {
  display: block; padding: 16px 20px; color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; border-top: 1px solid rgba(255,255,255,0.1); text-align: center;
}
.bigboard-link:hover { color: #fff; }

/* Content */
.content { margin-left: 220px; padding: 20px 28px; min-height: 100vh; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.topbar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text); cursor: pointer;
}

/* Metric cards */
.metric-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.metric-card { text-align: center; padding: 24px 16px; }
.metric-value { display: block; font-size: 36px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.metric-label { display: block; font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

/* Grid rows */
.charts-row, .cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-card { min-height: 280px; }
.chart-card canvas { width: 100% !important; max-height: 240px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 10px 12px; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: rgba(67,97,238,0.03); }
.data-table .num { text-align: right; font-family: var(--mono); font-size: 13px; }
.sortable { cursor: pointer; }
.sortable:hover { text-decoration: underline; }

/* Bars */
.bar {
  display: inline-block; height: 8px; border-radius: 4px;
  background: var(--accent); min-width: 2px; transition: width 0.3s;
}
.engagement-bar {
  display: inline-block; height: 8px; border-radius: 4px;
  background: var(--green); min-width: 2px;
}

/* Date range */
.date-range { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.date-range input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px;
}
.date-range span { color: var(--text-muted); font-size: 14px; }

/* Forms */
form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
input[type="text"], input[type="date"] {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; min-width: 180px;
}
button {
  padding: 8px 20px; background: var(--accent); color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
button:hover { background: #3451d1; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.badge.active { background: #d4edda; color: #155724; }
.badge.paused { background: #fff3cd; color: #856404; }
.badge.completed { background: #e2e3e5; color: #383d41; }

/* Significance */
.significance { margin-top: 12px; font-size: 14px; }
.sig-yes { color: var(--green); font-weight: 600; }
.sig-no { color: var(--text-muted); }

/* Sites */
.site-card .domain { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.api-key { margin-bottom: 12px; }
.api-key label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.api-key code {
  display: block; padding: 8px 12px; background: var(--bg); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; word-break: break-all;
}
.embed-code label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.embed-code pre {
  padding: 12px; background: var(--bg); border-radius: 6px;
  font-family: var(--mono); font-size: 11px; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all; line-height: 1.5;
}

/* Compare controls */
.compare-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.compare-controls select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; }
.compare-controls span { color: var(--text-muted); font-weight: 600; }

/* Empty state */
.empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .logo { font-size: 12px; padding: 16px 8px; letter-spacing: 0; }
  .sidebar nav a { font-size: 0; padding: 12px; text-align: center; }
  .content { margin-left: 60px; padding: 16px; }
  .metric-cards { grid-template-columns: 1fr; }
  .charts-row, .cards-row { grid-template-columns: 1fr; }
}

/* ═══ Big Board Styles ═══ */
.bb-body { background: #0a0a0f; color: #fff; margin: 0; overflow: hidden; height: 100vh; font-family: var(--sans); }
.bb-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; }
.bb-site { font-size: 18px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; opacity: 0.7; }
.bb-clock { font-size: 18px; font-family: var(--mono); opacity: 0.5; }

.bb-panels { position: relative; height: calc(100vh - 120px); }
.bb-panel {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 40px;
  opacity: 0; transition: opacity 0.8s ease;
}
.bb-panel.active { opacity: 1; }

.bb-giant { font-size: 140px; font-weight: 800; font-family: var(--mono); line-height: 1; }
.bb-giant-label { font-size: 24px; color: rgba(255,255,255,0.5); margin-top: 12px; }
.bb-sparkline { margin-top: 30px; }

.bb-articles { width: 100%; max-width: 900px; }
.bb-article {
  display: flex; align-items: center; gap: 20px; padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 18px;
}
.bb-article-url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.9; }
.bb-article-bar { height: 12px; border-radius: 6px; background: var(--accent); transition: width 0.5s; }
.bb-article-count { font-family: var(--mono); font-weight: 700; font-size: 24px; min-width: 60px; text-align: right; }

.bb-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px; max-width: 800px; }
.bb-metric { text-align: center; }
.bb-metric-value { font-size: 64px; font-weight: 700; font-family: var(--mono); }
.bb-metric-label { font-size: 16px; opacity: 0.5; margin-top: 8px; }

.bb-dots {
  display: flex; justify-content: center; gap: 8px; padding: 20px;
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
}
.bb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.2); transition: background 0.3s;
}
.bb-dot.active { background: var(--accent); }
