* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #e0e0e0;
  background: #1a1a1a;
}

#app {
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
  min-height: 100%;
}

/* Right-click context menu — matches platform .platform-context-menu (shell.css) */
.dbeditor-context-menu {
  position: fixed;
  z-index: 10001;
  min-width: 200px;
  padding: 0.25rem 0;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.dbeditor-context-menu.hidden {
  display: none;
}

.dbeditor-context-menu [role="menuitem"] {
  display: block;
  width: 100%;
  padding: 0.4rem 1rem;
  text-align: left;
  border: none;
  background: none;
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
}

.dbeditor-context-menu [role="menuitem"]:hover {
  background: #0a5;
  color: #000;
}

.dbeditor-context-menu .ctx-separator {
  height: 1px;
  margin: 0.25rem 0;
  background: #444;
  padding: 0;
  cursor: default;
}

header {
  margin-bottom: 1rem;
}

#auth-status {
  color: #888;
  font-size: 12px;
}

#main {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
}

aside h2, section h2 {
  font-size: 14px;
  margin: 0 0 0.5rem 0;
  color: #aaa;
}

#entity-list {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.25rem;
}

#entity-list .entity {
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  border-radius: 3px;
}

#entity-list .entity:hover {
  background: #2a2a2a;
}

#entity-list .entity.selected {
  background: #0a5;
  color: #000;
}

#seeds-list {
  min-height: 120px;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

#seeds-list .seed {
  padding: 0.35rem 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 13px;
}

#seeds-list .seed:last-child {
  border-bottom: none;
}

#audit-box {
  padding: 0.75rem;
  background: #252525;
  border-radius: 4px;
  font-size: 13px;
  white-space: pre-wrap;
}

#audit-box.empty {
  color: #666;
}

#mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

#mode-tabs button {
  padding: 0.35rem 0.75rem;
  font-size: 13px;
  background: #333;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
}

#mode-tabs button:hover {
  background: #404040;
}

#mode-tabs button.active {
  background: #0a5;
  color: #000;
  border-color: #0a5;
}

#mode-tabs button.active:hover {
  background: #0c6;
  border-color: #0c6;
}

.mode-panel {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.mode-panel.hidden {
  display: none !important;
}

#mode-tables #tables-list-aside {
  width: 180px;
}

#mode-tables #tables-list .table-item {
  padding: 0.4rem;
  cursor: pointer;
  border-radius: 3px;
}

#mode-tables #tables-list .table-item:hover {
  background: #2a2a2a;
}

#mode-tables #tables-list .table-item.selected {
  background: #0a5;
  color: #000;
}

#table-rows .row-item {
  padding: 0.35rem 0;
  cursor: pointer;
  border-bottom: 1px solid #2a2a2a;
}

.audit-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.audit-filters label { display: flex; align-items: center; gap: 0.35rem; }
.audit-filters input { padding: 0.25rem 0.5rem; width: 8rem; background: #252525; border: 1px solid #444; color: #e0e0e0; border-radius: 4px; }

#audit-changelog .audit-entry {
  padding: 0.35rem 0;
  font-size: 13px;
  border-bottom: 1px solid #2a2a2a;
}

/* Platform toolbar buttons (match Discussions / Files) */
#app button {
  padding: 0.35rem 0.75rem;
  font-size: 13px;
  background: #0a5;
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#app button:hover {
  background: #0c6;
}

#app button#table-delete {
  background: #a33;
  color: #fff;
}

#app button#table-delete:hover {
  background: #c44;
}

/* Mode tabs already styled above; exclude from default button so they keep tab style */
#mode-tabs button {
  background: #333;
  color: #e0e0e0;
  border: 1px solid #444;
}

#mode-tabs button.active {
  background: #0a5;
  color: #000;
  border-color: #0a5;
}

/* Form controls in table row / new row panels (platform default) */
#table-row-form input,
#table-row-form select,
#table-row-form textarea,
#table-new-form input,
#table-new-form select,
#table-new-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: #111;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 14px;
  font-family: inherit;
}

#table-row-form label,
#table-new-form label {
  display: block;
  margin-bottom: 0.25rem;
  color: #aaa;
  font-size: 13px;
}
