/* The Database editor's Admin (db/admin.js) and the record fields it uses (shared/recfields.js: .orf-*). */
.dba { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dba-body { flex: 1; min-height: 0; display: flex; }
.dba-main { flex: 1; min-width: 0; overflow: auto; padding: 0 0 32px; container-type: inline-size; container-name: dba; }
.dba-setup { width: 340px; flex: none; border-left: 1px solid var(--line); overflow: auto; background: var(--panel); }
.dba-crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; margin: 0 6px; font-size: 13px; overflow: hidden; }
.dba-crumb { border: 0; background: none; padding: 4px 6px; border-radius: var(--radius-s); font: inherit; color: var(--text-2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.dba-crumb:hover { background: var(--hover); color: var(--text); }
.dba-crumb.here { color: var(--text); font-weight: 600; cursor: default; }
.dba-crumb.here:hover { background: none; }
.dba-sep { color: var(--muted); }
.dba-q { width: 220px; height: 32px; margin-right: 6px; }

/* home: a card a table */
.dba-home { padding: 18px 20px; max-width: 1100px; }
.dba-intro { margin: 0 0 16px; color: var(--text-2); font-size: var(--fs); max-width: 70ch; }
.dba-note { margin: 16px 0 0; font-size: 12.5px; }
.dba-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.dba-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.dba-card:hover { border-color: var(--prog); background: var(--hover-soft); }
.dba-card:focus-visible { outline: 2px solid var(--prog); outline-offset: 1px; }
.dba-card > .material-symbols-outlined { grid-row: 1 / 3; font-size: 28px; color: var(--prog); }
.dba-card-l { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dba-card-n { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; min-height: 1em; }

/* a list */
.dba-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px 6px; }
.dba-fsel { width: auto; height: 30px; font-size: 12.5px; }
.dba-count { margin-left: auto; }
.dba-tablebox { padding: 0 16px; overflow-x: auto; }
.dba-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dba-table th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.dba-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.dba-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dba-table td .material-symbols-outlined { font-size: 18px; color: var(--ok); vertical-align: middle; }
.dba-row { cursor: pointer; }
.dba-row:hover td { background: var(--hover-soft); }
.dba-row:focus-visible { outline: 2px solid var(--prog); outline-offset: -2px; }
.dba-first { font-weight: 500; color: var(--text); }
.dba-tagcell { white-space: normal; }
.dba-tagcell .orf-tag { margin: 1px 3px 1px 0; }

/* a record */
.dba-record { padding: 16px 20px; max-width: 980px; }
.dba-rhead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.dba-ricon { font-size: 32px; color: var(--prog); }
.dba-rtitles { flex: 1; min-width: 160px; }
.dba-rtitle { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.dba-rsub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.dba-racts { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dba-racts .btn { height: 32px; }
.dba-ro { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.dba-sec { margin: 0 0 14px; padding: 6px 0 4px; border-top: 1px solid var(--line-soft); }
.dba-sech { margin: 10px 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.dba-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); column-gap: 24px; }
.dba-field { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; align-items: start; padding: 4px 0; min-height: 38px; }
.dba-flabel { padding-top: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.dba-fvalue { min-width: 0; }
.dba-help { color: var(--muted); font-size: 12px; margin-top: 3px; }
/* the lists under a record: one under another – side by side only when each has room for its columns; a list wider than
   its card scrolls sideways (nothing cut off) */
.dba-related { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(640px, 100%), 1fr)); gap: 14px; margin-top: 8px; }
.dba-relscroll { overflow-x: auto; }
.dba-rel { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); overflow: hidden; }
.dba-relh { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line-soft); }
.dba-relh > .material-symbols-outlined { color: var(--prog); font-size: 20px; }
.dba-relname { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 2px 6px 2px 0; font: inherit; color: var(--text); cursor: pointer; border-radius: var(--radius-s); min-width: 0; }
.dba-relname:hover h3 { text-decoration: underline; }
.dba-relname > .material-symbols-outlined { color: var(--prog); font-size: 20px; }
.dba-relh h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.dba-relvia { padding: 6px 14px 0; font-size: 12px; }
.dba-untie { width: 1%; padding: 2px 6px !important; }
.dba-reln { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dba-relh .btn { height: 28px; padding: 0 8px; font-size: 12.5px; }
.dba-relnone { padding: 12px 14px; font-size: 13px; }
.dba-table-s td { padding: 7px 14px; }
.dba-table-s tr:last-child td { border-bottom: 0; }
/* the new-record dialog */
.dba-new { display: flex; flex-direction: column; gap: 2px; max-height: 64vh; overflow: auto; }
.dba-new .dba-field { grid-template-columns: 130px minmax(0, 1fr); }

/* Set up */
.dba-setup-in { padding: 12px 14px 24px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.dba-setup h3 { margin: 6px 0 0; font-size: 13px; font-weight: 600; }
.dba-setup .db-mute { font-size: 12px; }
.dba-sform { display: flex; flex-direction: column; gap: 8px; }
.dba-sform .field { margin: 0; }
.dba-srow { display: flex; align-items: center; gap: 6px; }
.dba-srow > .inp { flex: 1; min-width: 0; height: 30px; }
.dba-scols { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.dba-scol { border-bottom: 1px solid var(--line-soft); }
.dba-scol:last-child { border-bottom: 0; }
.dba-scol > summary { display: flex; align-items: center; gap: 6px; padding: 6px 8px; cursor: pointer; list-style: none; }
.dba-scol > summary::-webkit-details-marker { display: none; }
.dba-scol > summary .material-symbols-outlined { font-size: 18px; color: var(--muted); }
.dba-scol-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dba-scol-k { color: var(--muted); font-size: 11.5px; }
.dba-scol-off .dba-scol-n { color: var(--muted); text-decoration: line-through; }
.dba-scol-body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.dba-slist { display: flex; flex-direction: column; gap: 2px; }
.dba-slist-i { display: flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: var(--radius-s); }
.dba-slist-i:hover { background: var(--hover-soft); }
.dba-slist-i label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.dba-slist-i .icon-btn { width: 26px; height: 26px; }
.dba-srel { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.dba-srel .db-mute { font-size: 11.5px; }
.dba-sas { width: auto; height: 26px; font-size: 12px; padding: 0 22px 0 6px; }
.dba-sugg { padding: 8px 10px; border-radius: var(--radius); background: var(--info-soft); color: var(--text); display: flex; align-items: center; gap: 8px; }
.dba-sugg .grow { min-width: 0; }
.dba-act { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.dba-act span { flex: 1; min-width: 0; }

/* narrow – a phone, or the Admin beside the AI assistant and Set up: a field's label over it, one column */
@container dba (max-width: 520px) {
  .dba-field { grid-template-columns: 1fr; gap: 2px; }
  .dba-flabel { padding-top: 4px; }
  .dba-fields, .dba-related { grid-template-columns: 1fr; }
  .dba-home, .dba-record { padding: 12px; }
  .dba-tablebox { padding: 0 8px; }
  .dba-filters { padding: 10px 8px 6px; }
}
@media (max-width: 760px) {
  .dba-setup { position: absolute; right: 0; top: 0; bottom: 0; z-index: 5; box-shadow: var(--pop-shadow); width: min(340px, 100%); }
  .dba-body { position: relative; }
  .dba-new .dba-field { grid-template-columns: 1fr; gap: 2px; }
  .dba-q { width: 140px; }
}

/* the record fields (shared/recfields.js) */
.orf-in { width: 100%; min-width: 0; height: 34px; }
textarea.orf-in { height: auto; resize: vertical; line-height: 1.45; padding-top: 6px; }
.orf-mono { font-family: var(--font-mono); font-size: 12.5px; }
.orf-ro { padding: 7px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.orf-none, .orf-ro.orf-none { color: var(--muted); }
.orf-bool { display: inline-flex; align-items: center; gap: 8px; padding: 7px 0; cursor: pointer; }
.orf-with { display: flex; align-items: center; gap: 4px; }
.orf-with .orf-in { flex: 1; }
.orf-link { display: flex; align-items: center; gap: 4px; min-width: 0; }
.orf-link-btn { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.orf-link-btn:hover { background: var(--hover-soft); }
.orf-link-btn:focus-visible { outline: 2px solid var(--prog); outline-offset: -1px; }
.orf-link-btn:disabled { cursor: default; border-color: transparent; background: none; padding-left: 0; }
.orf-link-btn > .material-symbols-outlined { color: var(--muted); font-size: 18px; }
.orf-link-empty { color: var(--muted); }
.orf-pill { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--prog-soft); color: var(--prog-strong); font-size: 13px; }
.orf-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 34px; padding: 3px 0; }
.orf-tag { display: inline-flex; align-items: center; max-width: 100%; border-radius: var(--radius-pill); background: var(--prog-soft); color: var(--prog-strong); font-size: 12.5px; }
.orf-tag-l { border: 0; background: none; color: inherit; font: inherit; padding: 3px 4px 3px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
span.orf-tag-l, .orf-tag-s { padding: 2px 10px; }
button.orf-tag-l { cursor: pointer; }
button.orf-tag-l:hover { text-decoration: underline; }
.orf-tag-x { border: 0; background: none; color: inherit; padding: 0 6px 0 0; height: 22px; display: inline-flex; align-items: center; cursor: pointer; }
.orf-tag-x .material-symbols-outlined { font-size: 15px; }
.orf-tag-add { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 10px 0 6px; border: 1px dashed var(--line-strong); border-radius: var(--radius-pill); background: none; color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.orf-tag-add:hover { border-color: var(--prog); color: var(--prog-strong); }
.orf-tag-add .material-symbols-outlined { font-size: 16px; }
.orf-pick { width: 320px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.orf-pick-q { height: 32px; }
.orf-pick-list { max-height: 300px; overflow: auto; display: flex; flex-direction: column; }
.orf-pick-opt { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 8px; border-radius: var(--radius-s); font: inherit; font-size: 13px; cursor: pointer; text-align: left; color: var(--text); }
.orf-pick-opt:hover, .orf-pick-opt.hi { background: var(--hover); }
.orf-pick-opt.sel { font-weight: 600; }
.orf-pick-opt .material-symbols-outlined { font-size: 18px; color: var(--prog); }
.orf-pick-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orf-pick-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; text-align: right; }
.orf-pick-cmd { color: var(--prog-strong); }
.orf-pick-none { padding: 8px; color: var(--muted); font-size: 13px; }
