/* Structured TMC entry cards used by inventory and document forms. */
.document-line {
  padding: 0 !important;
  overflow: visible;
  background: #fff !important;
}

.tmc-line-header {
  margin: 0 !important;
  padding: 12px 18px;
  min-height: 46px;
  border-bottom: 0;
  border-radius: 17px 17px 0 0;
  background: #3b3b40;
  cursor: pointer;
  user-select: none;
}

.tmc-line-header strong {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: .9rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmc-line-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.tmc-collapse-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.72);
  transition: transform .18s ease, color .18s ease;
}

.tmc-line-header:hover .tmc-collapse-icon { color: #fff; }
.document-line.is-collapsed .tmc-collapse-icon { transform: rotate(180deg); }
.document-line.is-collapsed .tmc-line-header { border-radius: 17px; }
.document-line.is-collapsed > .tmc-section,
.document-line.is-collapsed > .help { display: none !important; }

.tmc-line-header .icon-button {
  color: rgba(255, 255, 255, .78);
}

.tmc-line-header .icon-button:hover {
  color: #fff;
}

.tmc-section {
  padding: 14px 18px;
}

.tmc-section + .tmc-section {
  border-top: 1px solid #ececf0;
}

.tmc-primary-section {
  padding-top: 16px;
  padding-bottom: 16px;
}

.tmc-section-row {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tmc-section-side-title {
  padding-top: 27px;
  color: #77777d;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.tmc-section-content {
  min-width: 0;
}

.tmc-primary-grid {
  display: grid;
  grid-template-columns: 230px minmax(260px, 1.55fr) 125px 115px;
  gap: 12px;
  align-items: start;
}

.tmc-primary-grid.is-existing-item {
  grid-template-columns: 250px 150px;
  justify-content: start;
}

.tmc-storage-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1.25fr) minmax(135px, .75fr) minmax(135px, .75fr);
  gap: 12px;
}

.tmc-supplier-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(175px, .9fr) minmax(175px, .9fr);
  gap: 12px;
}

.tmc-notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.tmc-primary-grid .field,
.tmc-storage-grid .field,
.tmc-supplier-grid .field,
.tmc-notes-grid .field {
  margin-bottom: 0;
}

.barcode-control {
  margin-bottom: 0 !important;
}

.barcode-input {
  width: 195px;
  min-width: 195px;
  max-width: 195px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .045em;
  text-align: center;
}

.material-combobox {
  position: relative;
}

.material-search-results {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  width: min(700px, calc(100vw - 72px));
  max-width: none;
  max-height: 390px;
  overflow-y: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid #d9d9df;
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .15);
}

.material-search-option {
  width: 100%;
  display: block;
  min-height: 64px;
  padding: 12px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #252529;
  text-align: left;
  cursor: pointer;
}

.material-search-option + .material-search-option {
  margin-top: 2px;
}

.material-search-option:hover,
.material-search-option.is-active {
  background: #f0f4fa;
  box-shadow: inset 0 0 0 1px #dde6f2;
}

.material-search-option strong {
  display: block;
  min-width: 0;
  color: #252529;
  font-size: .9rem;
  font-weight: 780;
  line-height: 1.35;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.material-search-meta {
  display: block;
  max-width: none;
  margin-top: 5px;
  overflow: visible;
  color: #7d7d84;
  font-size: .74rem;
  line-height: 1.35;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.material-search-empty {
  padding: 14px;
  color: #8a8a90;
  font-size: .8rem;
}

.unit-field .help {
  margin-top: 5px;
  font-size: .68rem;
}

.future-price-fields {
  display: none !important;
}

.tmc-comment {
  min-height: 112px;
  height: 112px;
}

.tmc-photo-zone {
  min-height: 112px !important;
}

.add-tmc-button {
  display: flex !important;
  width: max-content;
  margin-left: auto !important;
  margin-right: auto !important;
  background: #3273dc !important;
  border-color: #3273dc !important;
  color: #fff !important;
}

.add-tmc-button:hover {
  background: #2866c2 !important;
  border-color: #2866c2 !important;
  color: #fff !important;
}

.tmc-entry-actions {
  justify-content: center !important;
}

.inventory-submit-button,
.document-form .button.is-success {
  color: #fff !important;
}

.inventory-journal-table .table-sub {
  display: block;
}

@media (max-width: 1100px) {
  .tmc-primary-grid {
    grid-template-columns: 210px minmax(230px, 1fr) 120px 105px;
  }

  .tmc-supplier-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .tmc-primary-grid {
    grid-template-columns: 205px minmax(220px, 1fr);
  }

  .tmc-section-row {
    grid-template-columns: 125px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .tmc-section-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .tmc-section-side-title {
    padding-top: 0;
  }

  .tmc-primary-grid,
  .tmc-primary-grid.is-existing-item,
  .tmc-storage-grid,
  .tmc-supplier-grid,
  .tmc-notes-grid {
    grid-template-columns: 1fr;
  }

  .barcode-input {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .tmc-section {
    padding: 14px;
  }

  .tmc-line-header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .material-search-results {
    left: 0;
    right: 0;
    width: 100%;
    max-height: 340px;
  }

  .tmc-entry-actions {
    flex-wrap: wrap;
  }
}
