.material-database-overlay { z-index: 85; padding: 18px; font-size: 12px; }
.mdb-window { width: min(1450px, calc(100vw - 36px)); height: calc(100vh - 36px); max-height: 960px; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; background: #e7ebef; border: 1px solid #7b858f; box-shadow: 0 16px 48px #16233466; }
.mdb-window h2, .mdb-editor h2 { font-size: 15px; margin: 0; }
.mdb-window .edge-band-library-header > div { min-width: 0; }
.mdb-path { margin-top: 5px; font-size: 11px; color: #475566; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdb-toolbar, .mdb-record-actions, .mdb-group-actions, .mdb-footer, .mdb-pagination, .mdb-editor-footer { display: flex; align-items: center; gap: 7px; padding: 8px; }
.mdb-toolbar { border-bottom: 1px solid #a1abb9; flex-wrap: wrap; }
.mdb-toolbar-spacer { flex: 1; }
.mdb-toolbar input, .mdb-toolbar select { border: 1px solid #9da9b8; border-radius: 2px; padding: 6px 8px; min-width: 0; background: white; }
.mdb-toolbar select { max-width: 235px; }
#mdbSearch { width: min(300px, 30vw); }
.mdb-body { display: grid; grid-template-rows: minmax(0,1fr); grid-template-columns: minmax(200px, 25%) minmax(0,1fr); min-height: 0; gap: 8px; padding: 8px; }
.mdb-groups { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; min-height: 0; min-width: 0; border: 1px solid #a1abb9; background: #f7f9fb; }
.mdb-section-title { padding: 8px 10px; font-weight: bold; background: #dce3ec; border-bottom: 1px solid #b5bfcc; }
.mdb-tree { overflow: auto; background: white; border-block: 1px solid #b5bfcc; padding-block: 4px; }
.mdb-tree-row { display: flex; min-width: max-content; padding-left: calc(var(--level) * 14px); }
.mdb-tree button { font-size: 12px; border: 0; background: transparent; color: inherit; cursor: pointer; min-height: 27px; }
.mdb-tree [data-db-expand] { flex: 0 0 23px; padding: 0; color: #536478; }
.mdb-tree [data-db-group] { text-align: left; display: flex; align-items: center; gap: 7px; padding: 4px 7px; flex: 1; }
.mdb-tree small { color: #66778b; margin-left: auto; padding-left: 8px; }
.mdb-tree-row:hover, .mdb-all:hover { background: #f0f5fb; }
.mdb-tree .active { background: #d7e8ff; color: #0e4179; }
.mdb-all { width: 100%; font-weight: bold; }
.mdb-group-type-icon { display: block; width: 16px; height: 16px; flex: 0 0 16px; }
.mdb-group-type-field { display: flex; align-items: end; gap: 7px; min-width: 0; }
.mdb-group-type-field .mdb-group-type-icon { margin-bottom: 7px; }
.mdb-group-type-field .mdb-field { flex: 1; }
.mdb-subgroups { padding: 8px; display: flex; align-items: center; gap: 5px; }
.mdb-materials { display: grid; grid-template-rows: auto minmax(100px,1fr) auto minmax(130px, 25%); min-height: 0; min-width: 0; border: 1px solid #a1abb9; background: #f7f9fb; }
.mdb-record-actions { flex-wrap: wrap; }
.mdb-group-actions .tool-button { flex: 1; min-width: 0; padding-inline: 6px; }
.mdb-group-actions [data-db-action="group-new"] { flex: 0 0 28px; }

.mdb-table-scroll { overflow: auto; background: #fff; border-block: 1px solid #b5bfcc; }
.mdb-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
.mdb-table th { position: sticky; top: 0; background: #dfe5ec; z-index: 1; text-align: left; border-bottom: 1px solid #9aa8b9; padding: 6px; }
.mdb-table th button { background: none; border: 0; padding: 0; font: inherit; font-weight: bold; cursor: pointer; color: inherit; }
.mdb-table td { padding: 6px; border-bottom: 1px solid #e4e9ef; border-right: 1px solid #eef1f5; }
.mdb-table td:nth-child(3) { max-width: 400px; overflow: hidden; text-overflow: ellipsis; }
.mdb-table td:nth-child(2) { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.mdb-table tr:nth-child(even) { background: #f7f9fb; }
.mdb-table tr:hover { background: #edf4ff; }
.mdb-table tr.selected { background: #cee3ff; color: #15395e; }
.mdb-table tr.current td { border-bottom-color: #7da5d4; }
.mdb-table tr:focus { outline: 2px solid #4d80bb; outline-offset: -2px; }
.mdb-number { text-align: right; font-variant-numeric: tabular-nums; }
.mdb-swatch { width: 12px; height: 12px; display: inline-block; vertical-align: -2px; border: 1px solid #0003; margin-right: 7px; }
.mdb-pagination { justify-content: space-between; padding-block: 5px; border-bottom: 1px solid #b5bfcc; }
.mdb-pagination .tool-button { min-width: 28px; padding: 2px 7px; }
.mdb-details { display: flex; gap: 14px; min-height: 0; padding: 10px; overflow: auto; }
.mdb-preview { width: 150px; min-height: 100px; flex: 0 0 150px; border: 1px solid #a2adbb; position: relative; display: grid; place-items: center; }
.mdb-preview img { width: 100%; height: 100%; position: absolute; object-fit: contain; background: #eef1f5; }
.mdb-preview img[hidden] { display: none; }
#mdbPreviewNote { padding: 8px; background: #ffffffb8; z-index: 1; }
#mdbPreviewNote:empty { display: none; }
.mdb-details-text { min-width: 0; overflow: auto; }
.mdb-details dl { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 5px 14px; margin: 10px 0 0; }
.mdb-details dt { color: #667384; }
.mdb-details dd { margin: 0; overflow-wrap: anywhere; }
.mdb-footer { justify-content: space-between; border-top: 1px solid #a1abb9; background: #dce3eb; min-height: 48px; }
.mdb-footer .tool-button { flex: none; }
#mdbStatus { line-height: 1.5; }
.material-database-overlay .error { color: #a02a22; }
.mdb-empty { padding: 24px; color: #6c7888; text-align: center; }
.mdb-editor-backdrop { position: absolute; inset: 0; background: #182a4266; display: grid; grid-template-rows: minmax(0,1fr); place-items: center; padding: 24px; z-index: 2; }
.mdb-editor { width: min(760px, 100%); max-height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; background: #eef2f6; border: 1px solid #78899e; box-shadow: 0 12px 35px #10223b66; }
.mdb-form { overflow: auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 16px; }
.mdb-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mdb-field input, .mdb-field select { width: 100%; min-width: 0; border: 1px solid #9da9b8; padding: 6px 7px; background: white; border-radius: 2px; }
.mdb-field input[type=color] { min-height: 32px; padding: 2px; }
.mdb-form .wide { grid-column: 1 / -1; }
.mdb-check { display: flex; align-items: center; gap: 5px; }
.mdb-form-divider { padding-top: 10px; border-top: 1px solid #bbc5d1; font-weight: bold; }
.mdb-texture-path { display: flex; align-items: end; gap: 8px; }
.mdb-texture-path .mdb-field { flex: 1; }
.mdb-editor-footer { border-top: 1px solid #aab7c6; }
.mdb-editor-footer > div { flex: 1; }
.mdb-editor-footer .tool-button { flex: none; }
.edge-band-list-actions { flex-wrap: wrap; }
@media (max-width: 850px) {
  .material-database-overlay { padding: 8px; }
  .mdb-window { width: calc(100vw - 16px); height: calc(100vh - 16px); }
  .mdb-body { grid-template-columns: 190px minmax(0,1fr); gap: 5px; padding: 5px; }
  .mdb-toolbar-spacer { display: none; }
  #mdbSearch { flex: 1; width: auto; min-width: 150px; }
  .mdb-preview { width: 90px; flex-basis: 90px; }
  .mdb-details dl { grid-template-columns: 1fr; gap: 3px; }
  .mdb-details dt { margin-top: 4px; }
}
