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

body {
  font-family: system-ui, sans-serif;
  color: #111;
  background: #fff;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 200px;
  min-height: 100vh;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888;
}

.nav-list { list-style: none; }

.nav-item {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  color: #555;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-item:hover { color: #111; }

.nav-item.active {
  color: #111;
  border-left-color: #111;
  font-weight: 500;
}

/* Content */
.content {
  flex: 1;
  padding: 40px 48px;
  max-width: 860px;
}

.question {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
}

.why {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 24px;
}

.sql-block {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 32px;
}

.sql-block code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  color: #222;
}

.chart-wrapper {
  margin-bottom: 16px;
  max-width: 700px;
}

.insight {
  font-size: 13px;
  color: #555;
  font-style: italic;
}

.error-state {
  color: #c00;
  font-size: 14px;
  padding: 20px 0;
}

.hidden { display: none; }

/* Home panel */
.home-hero {
  margin-bottom: 28px;
}

.home-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 10px;
}

.home-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: #111;
}

.home-desc {
  font-size: 15px;
  color: #555;
  line-height: 1.7;
  max-width: 520px;
}

.home-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 36px;
}

.tag {
  font-size: 12px;
  font-family: 'Menlo', 'Consolas', monospace;
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
  color: #555;
}

.home-queries {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.query-card {
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.query-card:hover {
  border-color: #111;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.query-badge {
  display: inline-block;
  font-size: 11px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-weight: 600;
  background: #111;
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 10px;
}

.query-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #111;
}

.query-desc {
  font-size: 13px;
  color: #777;
  line-height: 1.5;
}

.home-db-link {
  font-size: 13px;
  color: #777;
}

.home-db-link a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-db-link a:hover { opacity: 0.6; }

/* Loading indicator */
.loading {
  font-size: 13px;
  color: #999;
  padding: 40px 0;
}

/* Sidebar divider */
.sidebar-divider {
  border-top: 1px solid #e5e5e5;
  margin: 8px 0;
}

/* DATABASE tab — table nav buttons */
.table-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.table-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-family: 'Menlo', 'Consolas', monospace;
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  transition: border-color 0.15s, color 0.15s;
}

.table-btn:hover { color: #111; border-color: #999; }

.table-btn.active {
  border-color: #111;
  color: #111;
  font-weight: 600;
}

/* Data table */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 16px;
}

#data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#data-table th {
  text-align: left;
  padding: 8px 12px;
  background: #f5f5f5;
  border-bottom: 2px solid #e5e5e5;
  font-family: 'Menlo', 'Consolas', monospace;
  font-weight: 600;
  white-space: nowrap;
  color: #444;
}

#data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  white-space: nowrap;
}

#data-table tr:last-child td { border-bottom: none; }
#data-table tr:hover td { background: #fafafa; }

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: none;
  border: 1px solid #ddd;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
}

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

/* Mobile */
@media (max-width: 640px) {
  body { display: block; }

  .hamburger { display: block; }

  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    z-index: 100;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    min-height: unset;
  }

  .sidebar.open { transform: translateX(0); }

  .overlay.open { display: block; }

  .content {
    padding: 64px 20px 32px;
  }

  .home-queries {
    grid-template-columns: 1fr;
  }
}
