.admin-modal {
  overflow-x: hidden;
  overflow-y: auto;
}

.admin-modal.wide {
  width: min(1040px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
}

.implant-form,
.implant-form > *,
.plate-geometry-editor,
.geometry-editor-body,
.geometry-group {
  min-width: 0;
  max-width: 100%;
}

.plate-geometry-editor {
  container-type: inline-size;
  margin: 22px 0 0;
  padding: 18px;
  overflow: hidden;
}

.plate-geometry-editor > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 0;
}

.plate-geometry-editor > header small {
  line-height: 1.5;
}

.geometry-status-badge {
  border: 1px solid #b9cbe3;
  background: #eef5ff;
  color: #315c8f;
  padding: 5px 9px;
  font-size: 10px;
  white-space: nowrap;
}

.geometry-enable,
.geometry-verified {
  margin: 0 !important;
}

.geometry-editor-body {
  margin-top: 16px;
}

.geometry-runtime-error {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #f0b7b2;
  background: #fff0ee;
  color: #a83d35;
  font-size: 11px;
  line-height: 1.6;
}

.geometry-group {
  padding: 16px 0;
  border-top: 1px solid #d9e3ef;
}

.geometry-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.geometry-group h3 {
  margin: 0;
  font-size: 13px;
  color: #24384d;
}

.geometry-group > p {
  margin: 5px 0 12px;
  color: #71839b;
  font-size: 10px;
  line-height: 1.6;
}

.geometry-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.geometry-grid label {
  min-width: 0;
  margin: 0;
}

.geometry-grid input {
  width: 100%;
  min-width: 0;
}

.geometry-safety-grid .geometry-verified {
  grid-column: 1 / -1;
  display: flex !important;
  width: fit-content;
  padding: 10px 12px;
  border: 1px solid #d7e0eb;
  background: #fff;
}

.geometry-generate {
  margin: 14px 0 0;
}

.geometry-hole-table {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.geometry-hole-head,
.geometry-hole-row {
  grid-template-columns: minmax(54px, .65fr) repeat(3, minmax(90px, 1fr)) 36px;
  min-width: 610px;
  gap: 8px;
}

.geometry-hole-row input {
  width: 100%;
}

.geometry-preview-wrap {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: stretch;
}

.geometry-preview-wrap svg {
  width: 100%;
  max-width: 360px;
}

.geometry-preview-wrap p {
  min-width: 0;
  overflow-wrap: anywhere;
  align-self: center;
}

.three-upload img,
.version-view-strip img,
.large-view img {
  max-width: 100%;
}

.view-unavailable {
  display: grid !important;
  place-items: center;
  min-height: 58px;
  padding: 8px;
  background: #fff4f2;
  border: 1px dashed #dca8a2;
  color: #a6483f !important;
  font-size: 9px !important;
  line-height: 1.5;
  text-align: center;
  font-style: normal;
}

@container (max-width: 700px) {
  .plate-geometry-editor > header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .geometry-status-badge {
    grid-column: 2;
    grid-row: 1;
  }

  .geometry-enable {
    grid-column: 1 / -1;
  }

  .geometry-preview-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}
