.medical-order-source-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: Montserrat, Arial, sans-serif;
}

.medical-order-source-modal[hidden] {
  display: none;
}

.medical-order-source-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 32, 42, 0.72);
  backdrop-filter: blur(4px);
}

.medical-order-source-modal__dialog {
  position: relative;
  width: min(100%, 620px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(0, 142, 169, 0.2);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(2, 32, 42, 0.34);
}

.medical-order-source-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 12px;
}

.medical-order-source-modal__eyebrow {
  margin: 0 0 6px;
  color: #008ea9;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.medical-order-source-modal__title {
  margin: 0;
  color: #123744;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.2;
}

.medical-order-source-modal__close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #eef7f9;
  color: #07566a;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.medical-order-source-modal__body {
  padding: 12px 24px 24px;
}

.medical-order-source-modal__copy,
.medical-order-source-modal__status {
  margin: 0 0 18px;
  color: #526b74;
  font-size: 14px;
  line-height: 1.55;
}

.medical-order-source-modal__status {
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef7f9;
  color: #07566a;
}

.medical-order-source-modal__status--error {
  background: #fff0f0;
  color: #a12626;
}

.medical-order-source-modal__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.medical-order-source-modal__option {
  min-height: 132px;
  padding: 20px;
  border: 1px solid #cce5ea;
  border-radius: 18px;
  background: #f7fbfc;
  color: #123744;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.medical-order-source-modal__option:hover,
.medical-order-source-modal__option:focus-visible {
  border-color: #008ea9;
  box-shadow: 0 12px 30px rgba(0, 142, 169, 0.14);
  outline: none;
  transform: translateY(-2px);
}

.medical-order-source-modal__option-icon {
  display: block;
  margin-bottom: 12px;
  color: #008ea9;
  font-size: 28px;
}

.medical-order-source-modal__option strong,
.medical-order-source-modal__option span {
  display: block;
}

.medical-order-source-modal__option span:last-child {
  margin-top: 6px;
  color: #607780;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.medical-order-source-modal__camera {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: #061a21;
}

.medical-order-source-modal__video,
.medical-order-source-modal__preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.medical-order-source-modal__preview[hidden],
.medical-order-source-modal__video[hidden] {
  display: none;
}

.medical-order-source-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.medical-order-source-modal__button {
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid #b8dbe2;
  border-radius: 12px;
  background: #fff;
  color: #07566a;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
}

.medical-order-source-modal__button--primary {
  border-color: #008ea9;
  background: #008ea9;
  color: #fff;
}

.medical-order-source-modal__button:disabled {
  cursor: wait;
  opacity: 0.58;
}

body.medical-order-source-modal-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .medical-order-source-modal {
    padding: 12px;
  }

  .medical-order-source-modal__dialog {
    max-height: calc(100vh - 24px);
    border-radius: 18px;
  }

  .medical-order-source-modal__options {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .medical-order-source-modal__option {
    transition: none;
  }
}

.bu-ocr-send,
.step1-universal-ocr-send,
.lab-order-ocr__send-button,
.convenios-order-send {
  display: block;
  width: min(100%, 320px);
  min-height: 46px;
  margin: 14px 0 0 auto;
  padding: 11px 18px;
  border: 1px solid #008ea9;
  border-radius: 13px;
  background: #008ea9;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.bu-ocr-send.hidden,
.step1-universal-ocr-send.hidden,
.lab-order-ocr__send-button.hidden,
.convenios-order-send[hidden] {
  display: none;
}

.bu-ocr-send:disabled,
.step1-universal-ocr-send:disabled,
.lab-order-ocr__send-button:disabled,
.convenios-order-send:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.medical-order-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #d8e8ec;
  border-radius: 13px;
  background: #f8fbfc;
}

.medical-order-file-row + .medical-order-file-row {
  margin-top: 8px;
}

.medical-order-file-row__name,
.medical-order-file-row__status {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medical-order-file-row__name {
  color: #173e4a;
  font-size: 13px;
  font-weight: 750;
}

.medical-order-file-row__status {
  margin-top: 4px;
  color: #607780;
  font-size: 12px;
}

.medical-order-file-row__remove {
  border: 0;
  background: transparent;
  color: #a12626;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
}

.medical-order-file-row__progress {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcecef;
}

.medical-order-file-row__progress[hidden] {
  display: none;
}

.medical-order-file-row__progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #008ea9;
  transition: width 160ms ease;
}
