/* Project records use one workspace surface at a time: ledger or editor. */
.project-record-workspace {
  width: 100%;
  max-width: 1320px;
  min-width: 0;
  margin-inline: auto;
}

.project-record-workspace-title {
  align-items: center;
}

body[data-ui-theme="macos-workspace-v3"] .project-record-workspace-title > .project-record-title-actions,
body[data-ui-theme="macos-workspace-v3"] .project-document-library-title > .project-document-title-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

body[data-ui-theme="macos-workspace-v3"] .project-record-workspace-title > .project-record-title-actions > .table-action,
body[data-ui-theme="macos-workspace-v3"] .project-document-library-title > .project-document-title-actions > .table-action {
  width: auto;
}

.project-record-title-actions .material-project-select {
  min-width: 0;
}

.project-record-title-actions .material-project-select select {
  width: min(380px, 34vw);
  max-width: 380px;
}

.project-record-workspace-body {
  min-width: 0;
  padding: 16px;
  background: #ffffff;
}

.project-record-tabs {
  display: flex;
  min-width: 0;
  align-items: end;
  gap: 0;
  padding-inline: 16px;
  border-bottom: 1px solid var(--macos-separator-soft, #e4e7ed);
  background: #fafafd;
}

.project-record-tabs > button {
  min-height: 38px;
  padding: 8px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--macos-label-secondary, #5f6875);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.project-record-tabs > button:hover {
  color: var(--macos-label, #1d2129);
  background: #f2f5f9;
}

.project-record-tabs > button:focus-visible {
  outline: 2px solid var(--macos-accent, #0f3476);
  outline-offset: -2px;
}

.project-record-tabs > button.is-active {
  border-bottom-color: var(--macos-accent, #0f3476);
  color: var(--macos-accent, #0f3476);
  background: #ffffff;
}

.material-ledger-content {
  min-width: 0;
  padding: 12px 16px 16px;
}

.material-ledger-section,
.material-entry-workspace .material-movement-entry {
  min-width: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.material-ledger-section .material-inventory-heading {
  min-height: 40px;
  margin-bottom: 8px;
  padding: 0 0 8px;
}

.material-ledger-section .material-inventory-heading > div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.material-ledger-section .material-inventory-heading strong {
  color: var(--macos-label, #1d2129);
  font-size: 13px;
  font-weight: 650;
}

.material-ledger-section .material-inventory-heading span {
  color: var(--macos-label-secondary, #6e7681);
  font-size: 12px;
}

.material-entry-workspace .material-movement-form,
.material-entry-workspace .project-record-form {
  display: grid;
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.material-entry-workspace .project-record-form > label,
.material-entry-workspace .project-record-form > fieldset {
  width: 100%;
  max-width: none;
}

.material-entry-workspace .project-record-form > .material-direction-segmented {
  grid-column: span 2;
}

.material-entry-workspace .project-record-form > :is(.field-wide, .material-contract-reference, .material-movement-actions, .queued-attachment-control) {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
}

.material-entry-workspace .material-contract-reference {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.material-entry-workspace .material-movement-actions {
  justify-content: flex-end;
  padding-top: 4px;
}

.project-document-editor-panel .project-document-inline-form,
.project-document-editor-panel .project-document-upload-form {
  width: 100%;
  max-width: none;
  border: 0;
  padding: 0;
  background: transparent;
}

.project-document-editor-panel .project-document-inline-form {
  grid-template-columns: minmax(260px, 640px) max-content;
  justify-content: start;
}

.project-document-editor-panel .project-document-upload-form {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.project-document-editor-panel .project-document-file-picker,
.project-document-editor-panel .project-document-upload-form > div {
  grid-column: 1 / -1;
}

.project-document-editor-panel .project-document-file-picker input[type="file"]:invalid {
  border-color: var(--visual-border-strong, #cfd6df);
  box-shadow: none;
}

.project-document-editor-panel .project-document-upload-form > div {
  justify-content: flex-end;
}

.change-order-editor-panel #change-order-form {
  width: 100%;
  max-width: none;
  padding: 16px;
}

.change-order-editor-panel .change-order-form-grid {
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.change-order-editor-panel .change-order-form-grid > label {
  width: 100%;
  max-width: none;
}

.change-order-editor-panel .change-order-form-grid > label.field-wide,
.change-order-editor-panel .change-order-form-grid > .change-order-attachment-control {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
}

.change-order-editor-panel .form-actions {
  justify-content: flex-end;
  padding: 4px 0 0;
}

@media (max-width: 1100px) {
  .material-entry-workspace .material-movement-form,
  .material-entry-workspace .project-record-form,
  .change-order-editor-panel .change-order-form-grid,
  .project-document-editor-panel .project-document-upload-form {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .material-entry-workspace .project-record-form > .material-direction-segmented {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .project-record-workspace-title,
  .project-record-title-actions,
  .project-document-title-actions {
    align-items: stretch;
  }

  .project-record-workspace-title,
  body[data-ui-theme="macos-workspace-v3"] .project-record-workspace-title > .project-record-title-actions,
  body[data-ui-theme="macos-workspace-v3"] .project-document-library-title > .project-document-title-actions {
    flex-direction: column;
  }

  body[data-ui-theme="macos-workspace-v3"] .project-record-workspace-title > .project-record-title-actions .material-project-select,
  body[data-ui-theme="macos-workspace-v3"] .project-record-workspace-title > .project-record-title-actions .material-project-select select,
  body[data-ui-theme="macos-workspace-v3"] .project-record-workspace-title > .project-record-title-actions > .table-action,
  body[data-ui-theme="macos-workspace-v3"] .project-document-library-title > .project-document-title-actions > .table-action {
    width: 100%;
    max-width: none;
  }

  .project-record-workspace-body,
  .material-ledger-content {
    padding: 12px;
  }

  .project-record-tabs {
    padding-inline: 12px;
  }

  .project-record-tabs > button {
    flex: 1 1 50%;
    min-height: 44px;
    padding-inline: 8px;
  }

  .material-entry-workspace .material-movement-form,
  .material-entry-workspace .project-record-form,
  .change-order-editor-panel .change-order-form-grid,
  .project-document-editor-panel .project-document-upload-form,
  .project-document-editor-panel .project-document-inline-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .material-entry-workspace .material-contract-reference {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-document-editor-panel .project-document-inline-form > .table-action,
  .project-document-editor-panel .project-document-upload-form > div,
  .project-document-editor-panel .project-document-upload-form > div > .table-action {
    width: 100%;
  }
}
