.db-view {
  display: grid;
  grid-template-columns: minmax(185px, 218px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.db-view .field { min-width: 0; margin-bottom: 0; }
.db-view .field .err:empty { display: none; }
.db-view .db-directory, .db-view .db-panel { min-width: 0; overflow: hidden; }
.db-directory { padding: 8px; }
.db-directory-title, .db-directory-title > span:first-child, .db-panel-heading p, .db-mode {
  display: flex;
  align-items: center;
  gap: 7px;
}
.db-directory-title { justify-content: space-between; margin: 0 4px 5px; padding: 8px 5px 12px; font-weight: 750; border-bottom: 1px solid var(--line); }
.db-directory-title svg { color: var(--accent); }
.db-directory-count { padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 11px; }
.db-directory-group { margin-top: 7px; }
.db-directory-group h2 { margin: 0; padding: 4px 9px; color: var(--muted); font-size: 11px; }
.db-directory ul { list-style: none; margin: 0; padding: 0; }
.db-directory a { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-height: 31px; padding: 4px 9px; text-decoration: none; color: var(--ink-2); border-radius: 7px; }
.db-directory a:hover { background: var(--soft); color: var(--ink); }
.db-directory a[aria-current] { color: var(--gold-ink); background: var(--gold-soft); font-weight: 750; }
.db-directory a:focus-visible { outline-offset: -2px; }
.db-table-choice { display: none; }

.db-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; padding: 20px 20px 16px; }
.db-panel-heading h2 { margin: 0; font-size: 22px; }
.db-panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.db-panel-heading code { padding: 1px 6px; border-radius: 5px; background: var(--soft); color: var(--ink-2); }
.db-mode { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; white-space: nowrap; }
.db-filters { display: grid; align-items: end; grid-template-columns: repeat(auto-fit, minmax(min(100%, 138px), 1fr)); gap: 10px; padding: 14px 20px 16px; background: var(--soft); border-block: 1px solid var(--line); }
.db-filters .inp { background: var(--card); }
.db-query { grid-column: span 2; }
.db-actions { gap: 6px; flex-wrap: wrap; }
.db-actions :is(a,button) { min-height: 39px; }
.db-mobile-sort, .db-cell-label { display: none; }

.db-table :is(th,td) { padding: 11px 14px; }
.db-table th { white-space: nowrap; }
.db-table th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.db-table th a:hover { text-decoration: underline; }
.db-sort-arrow { color: var(--accent); }
.db-table tbody tr:hover { background: var(--gold-wash); }
.db-row-key { font-weight: 700; color: var(--ink); }
.db-numeric { text-align: right; font-variant-numeric: tabular-nums; }
.db-row-action { text-align: right; }
.db-row-open { white-space: nowrap; }
.db-preview { display: block; max-width: 33ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-empty { text-align: center; padding-top: 24px; }
.db-empty > svg { color: var(--accent); }
.db-empty .empty { padding-top: 8px; }
.db-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--line); }
.db-page-buttons { gap: 8px; }
.db-page-current { padding: 4px 7px; color: var(--ink); font-size: 12px; font-weight: 650; white-space: nowrap; }

.db-record h3 { margin: 10px 0; }
.db-fields { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 3fr); gap: 0 14px; margin: 0 0 16px; }
.db-fields :is(dt,dd) { min-width: 0; overflow-wrap: anywhere; margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); }
.db-fields dt { color: var(--muted); }
.db-objects details { margin-bottom: 7px; border: 1px solid var(--line); border-radius: 8px; }
.db-objects summary { padding: 8px 10px; cursor: pointer; overflow-wrap: anywhere; }
.db-objects summary span { color: var(--muted); font-size: 12px; margin-left: 8px; }
.db-objects pre { max-height: 250px; margin: 0; padding: 8px 10px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--soft); border-radius: 0 0 8px 8px; }

@media (max-width: 920px) {
  .db-view { grid-template-columns: minmax(0, 1fr); }
  .db-directory { display: none; }
  .db-table-choice { display: block; padding: 14px 20px 0; }
}

@media (max-width: 620px) {
  .db-table-choice, .db-panel-heading, .db-filters, .db-pager { padding-inline: 12px; }
  .db-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
  .db-actions { grid-column: 1 / -1; }
  .db-actions :is(a,button), .db-page-buttons :is(a,button), .db-row-open { min-height: 44px; }
  .db-panel .db-scroll { overflow: visible; }
  .db-view .db-scroll table.db-table { display: block !important; width: 100% !important; min-width: 0 !important; }
  .db-mobile-sort { display: block; }
  .db-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .db-table thead a { visibility: hidden; }
  .db-table tbody { display: grid; gap: 10px; padding: 12px; }
  .db-table tbody tr { display: grid; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; }
  .db-table tbody tr:hover { background: var(--card); }
  .db-table tbody td { display: grid; grid-template-columns: minmax(85px, 37%) minmax(0, 1fr); gap: 8px; padding: 7px 0; text-align: left; align-items: baseline; }
  .db-table tbody td:last-child { border-bottom: 0; }
  .db-table tbody .db-row-action { display: flex; justify-content: flex-end; }
  .db-table .db-preview { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .db-cell-label { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
  .db-pager { justify-content: center; }
  .db-pager > span { flex-basis: 100%; text-align: center; }
  .db-fields { display: block; }
  .db-fields dt { border: 0; padding-bottom: 0; }
}
