:root {
  --db-bg: #f3f5fb;
  --db-surface: #ffffff;
  --db-surface-2: #f8f9ff;
  --db-text: #1d2433;
  --db-muted: #6e7687;
  --db-primary: #3d63ff;
  --db-primary-soft: #e8edff;
  --db-success: #1d9b5f;
  --db-warning: #d08700;
  --db-danger: #c0392b;
  --db-border: #e5e8f2;
  --db-readonly-bg: #f0f2f8;
  --db-system-badge: #6e7687;
}

.db-studio-app {
  background: var(--db-bg);
  min-height: calc(100vh - 120px);
  padding: 1rem;
}

.db-studio-context {
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.db-studio-layout {
  display: flex;
  gap: 1rem;
  min-height: 480px;
}

.db-studio-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: 8px;
  padding: 0.75rem;
  overflow-y: auto;
  max-height: 70vh;
}

.db-studio-sidebar.collapsed {
  width: 120px;
  max-height: none;
}

.db-studio-main {
  flex: 1;
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: 8px;
  padding: 1rem;
  overflow: auto;
}

.db-studio-object-item {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.db-studio-object-item.active {
  background: var(--db-primary-soft);
  color: var(--db-primary);
  font-weight: 600;
}

.db-studio-grid-wrap {
  overflow: auto;
  max-height: 55vh;
}

.db-studio-grid table {
  width: 100%;
  font-size: 0.85rem;
}

.db-studio-grid thead th {
  position: sticky;
  top: 0;
  background: var(--db-surface-2);
  z-index: 1;
  cursor: pointer;
  white-space: nowrap;
}

.db-studio-readonly {
  background: var(--db-readonly-bg);
  padding: 1rem;
  border-radius: 8px;
  color: var(--db-muted);
}

.db-studio-badge-system {
  background: var(--db-system-badge);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

@media (max-width: 1199px) {
  .db-studio-layout { flex-direction: column; }
  .db-studio-sidebar { width: 100%; max-height: 200px; }
}
