.database-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(2, 6, 23, .86);
  backdrop-filter: blur(4px);
}

.database-modal.open { display: flex; }

.database-dialog {
  display: flex;
  flex-direction: column;
  width: calc(100% - 48px);
  height: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}

.database-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.database-header h2 { margin: 0; font-size: 1.05rem; color: #f8fafc; }
.database-header .database-meta { color: #64748b; font-size: .78rem; }
.database-close {
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid #475569;
  border-radius: 6px;
  color: #cbd5e1;
  background: transparent;
  cursor: pointer;
}
.database-close:hover { background: #334155; color: #fff; }

.database-body { display: flex; flex: 1; min-height: 0; }
.database-sidebar {
  width: 260px;
  flex-shrink: 0;
  padding: 12px;
  overflow-y: auto;
  background: #172033;
  border-right: 1px solid #334155;
}
.database-search {
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 10px;
  padding: 8px 10px;
  color: #e2e8f0;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 6px;
  outline: none;
}
.database-search:focus { border-color: #38bdf8; }
.database-table-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  color: #cbd5e1;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
}
.database-table-button:hover { background: #263449; }
.database-table-button.active { color: #7dd3fc; background: #1e3a5f; }
.database-table-button small { color: #64748b; }

.database-content { flex: 1; min-width: 0; padding: 16px; overflow: auto; }
.database-empty { padding: 36px; color: #64748b; text-align: center; }
.database-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.database-toolbar strong { color: #7dd3fc; }
.database-toolbar .database-count { color: #64748b; font-size: .78rem; }
.database-toolbar label { color: #94a3b8; font-size: .78rem; }
.database-toolbar button {
  padding: 5px 10px;
  color: #cbd5e1;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 6px;
  cursor: pointer;
}
.database-toolbar button:disabled { opacity: .4; cursor: default; }
.database-toolbar .database-spacer { flex: 1; }

.database-grid-wrap { max-width: 100%; overflow: auto; border: 1px solid #334155; border-radius: 7px; }
.database-grid { width: max-content; min-width: 100%; border-collapse: collapse; font-size: .76rem; }
.database-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  color: #7dd3fc;
  background: #1e293b;
  border-right: 1px solid #334155;
  border-bottom: 1px solid #475569;
  text-align: left;
  white-space: nowrap;
}
.database-grid td {
  max-width: 420px;
  padding: 7px 10px;
  color: #cbd5e1;
  border-right: 1px solid #1e293b;
  border-bottom: 1px solid #1e293b;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-all;
}
.database-grid tr:hover td { background: rgba(30, 58, 95, .32); }
.database-null { color: #64748b; font-style: italic; }
.database-error { padding: 14px; color: #fca5a5; background: #450a0a; border-radius: 6px; }

@media (max-width: 768px) {
  .database-dialog { width: 100%; height: 100%; margin: 0; border-radius: 0; }
  .database-body { flex-direction: column; }
  .database-sidebar { width: auto; max-height: 180px; border-right: 0; border-bottom: 1px solid #334155; }
}
