.order-entry-panel {
  --order-control-height: 40px;
  --order-entry-columns: 48px minmax(130px, 1.1fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(84px, 0.7fr) minmax(80px, 0.6fr) minmax(130px, 1fr) minmax(150px, 1.2fr) minmax(130px, 1fr) 72px;
  display: grid;
  gap: 12px;
  max-width: 100%;
  min-width: 0;
}

.order-entry-head,
.order-entry-section-title,
.order-entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-entry-head h3 {
  font-size: 20px;
  margin-top: 2px;
}

.order-entry-head > span {
  color: var(--muted);
  font-size: 13px;
}

.order-entry-form,
.order-entry-section {
  display: grid;
  gap: 12px;
  max-width: 100%;
  min-width: 0;
}

.order-entry-section {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  box-sizing: border-box;
}

.order-entry-section-title {
  color: var(--blue-950);
  font-weight: 800;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.order-basic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 100%;
  min-width: 0;
}

.order-entry-field {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  align-content: start;
}

.order-entry-field.wide {
  grid-column: span 2;
}

.order-entry-field:has(input[name="documentNoPreview"]) {
  grid-column: span 2;
}

.order-entry-field label,
.order-entry-field > span,
.order-entry-field > label {
  color: var(--blue-950);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  min-height: 16px;
}

.order-entry-field input,
.order-entry-field select,
.quick-select-trigger {
  width: 100%;
  height: var(--order-control-height);
  min-height: var(--order-control-height);
  border: 1px solid var(--line-dark);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: calc(var(--order-control-height) - 2px);
  text-align: left;
  border-radius: 0;
  box-sizing: border-box;
  vertical-align: middle;
}

.quick-select-trigger::after {
  content: "⌄";
  float: right;
  color: var(--muted);
  font-size: 12px;
  line-height: calc(var(--order-control-height) - 4px);
}

.quick-select-trigger [data-choice-label] {
  display: inline-block;
  max-width: calc(100% - 18px);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

.quick-select-trigger.has-value {
  color: var(--blue-950);
  font-weight: 700;
}

.required-mark {
  color: var(--danger);
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 1;
  margin-left: 2px;
}

.quick-select-panel {
  position: absolute;
  z-index: 120;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: none;
  border: 1px solid var(--line-dark);
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  box-sizing: border-box;
}

.quick-select-panel.is-floating {
  position: fixed;
  display: grid;
  z-index: 5000;
  top: var(--quick-panel-top);
  left: var(--quick-panel-left);
  right: auto;
  width: var(--quick-panel-width);
  max-height: var(--quick-panel-max-height);
  overflow: hidden;
}

.quick-select-panel.is-floating .quick-select-options {
  max-height: min(170px, calc(var(--quick-panel-max-height) - 112px));
}

.order-entry-field.open .quick-select-panel {
  display: grid;
}

.quick-select-search {
  border: 0;
  border-bottom: 1px solid var(--line);
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  font-size: 14px;
  line-height: 36px;
  box-sizing: border-box;
}

.quick-select-options {
  max-height: 170px;
  overflow: auto;
  display: grid;
}

.quick-select-add-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
}

.quick-select-add-row input {
  height: 36px;
  min-height: 36px;
  border: 1px solid var(--line-dark);
  background: #fff;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  line-height: 36px;
  box-sizing: border-box;
}

.quick-select-options button,
.quick-select-add,
.quick-select-clear {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.quick-select-options button {
  display: grid;
  gap: 2px;
}

.quick-select-option-main {
  color: var(--ink);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-select-option-detail {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-select-options button:hover,
.quick-select-add:hover,
.quick-select-clear:hover {
  background: #eff6ff;
  color: var(--blue-950);
}

.quick-select-add {
  border: 1px solid var(--blue-700);
  color: var(--blue-700);
  font-weight: 800;
  text-align: center;
}

.quick-select-add-row .quick-select-add {
  border-bottom: 1px solid var(--blue-700);
  height: 36px;
  min-height: 36px;
  padding: 0 8px;
  line-height: 34px;
  text-align: center;
}

.quick-select-clear {
  color: var(--muted);
  text-align: center;
}

.order-entry-table {
  display: grid;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
  position: relative;
}

.order-entry-table-head,
.order-entry-row {
  display: grid;
  grid-template-columns: var(--order-entry-columns);
  gap: 8px;
  align-items: center;
}

.order-entry-table-head {
  align-items: center;
  background: #eef6ff;
  border: 1px solid var(--line);
  color: var(--blue-950);
  font-size: 12px;
  font-weight: 800;
  padding: 8px;
}

.order-entry-row {
  border: 1px solid var(--line);
  background: #fbfdff;
  padding: 8px;
  align-items: center;
  min-height: 58px;
}

.order-entry-row .order-entry-field > label,
.order-entry-row .order-entry-field > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.order-entry-row .order-entry-field {
  gap: 0;
}

.order-entry-row .order-size-line-no {
  display: grid;
  place-items: center;
  height: var(--order-control-height);
  min-height: var(--order-control-height);
  border: 1px solid var(--blue-700);
  color: var(--blue-950);
  font-weight: 900;
  box-sizing: border-box;
}

.order-entry-row > .btn {
  height: var(--order-control-height);
  min-height: var(--order-control-height);
  line-height: calc(var(--order-control-height) - 2px);
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}

.order-entry-actions {
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .order-basic-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .order-entry-table {
    overflow-x: auto;
  }

  .order-entry-table-head,
  .order-entry-row {
    min-width: 1180px;
  }
}

@media (max-width: 760px) {
  .order-basic-grid {
    grid-template-columns: 1fr;
  }

  .order-entry-field.wide,
  .order-entry-field:has(input[name="documentNoPreview"]) {
    grid-column: auto;
  }
}
