.medication-plan-scan-dialog { box-sizing: border-box; width: min(900px, calc(100% - 20px)); max-width: calc(100% - 20px); max-height: calc(100dvh - 24px); padding: clamp(14px, 3vw, 28px); border: 1px solid #d9d3c9; border-radius: 22px; color: #252c2c; background: #faf8f3; overflow: auto; overscroll-behavior: contain; font-size: 1rem; }
.medication-plan-scan-dialog::backdrop { background: #182222b8; }
.medication-plan-scan-dialog *, .medication-plan-scan-dialog *::before, .medication-plan-scan-dialog *::after { box-sizing: border-box; }
.medication-plan-scan-dialog [hidden] { display: none !important; }
.medication-plan-scan-dialog h2 { min-width: 0; margin: 0; font-size: 1.45rem; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.medication-plan-scan-dialog h3 { font-size: 1.12rem; margin: 0 0 12px; overflow-wrap: anywhere; }
.medication-plan-scan-dialog p, .medication-plan-scan-dialog li, .medication-plan-scan-dialog strong, .medication-plan-scan-dialog span { overflow-wrap: anywhere; }
.medication-plan-scan-dialog button { min-height: 44px; max-width: 100%; border-radius: 12px; padding: 10px 14px; white-space: normal; font: inherit; font-weight: 650; line-height: 1.4; cursor: pointer; }
.medication-plan-scan-dialog button:disabled, .mps-file-label:has(input:disabled) { opacity: .5; cursor: default; }
.mps-heading, .mps-source-actions, .mps-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.mps-heading { justify-content: space-between; margin-bottom: 18px; align-items: start; }
.mps-heading h2 { flex: 1 1 220px; }
.mps-patient, .mps-patient-match { border: 1px solid #d1d9d0; border-radius: 14px; background: #edf3ed; padding: 14px; font-weight: 600; }
.mps-help { color: #4d5757; line-height: 1.55; font-size: 1rem; }
.mps-scan-help { margin: 10px 0; }
.mps-scan-help summary { min-height: 44px; padding: 10px 0; cursor: pointer; }
.mps-file-label { display: flex; flex: 1 1 230px; flex-direction: column; gap: 7px; min-width: 0; font-weight: 600; }
.mps-file-label input { min-width: 0; max-width: 100%; width: 100%; min-height: 44px; font: inherit; font-size: 1rem; background: white; border: 1px solid #bcc6c1; border-radius: 10px; padding: 8px; }
.mps-camera { padding: 12px; margin: 16px 0; border-radius: 16px; background: #e5ece6; }
.mps-camera video { display: block; width: 100%; max-height: 55dvh; border-radius: 10px; background: #18231e; object-fit: contain; margin-bottom: 12px; }
.mps-segments { list-style: none; margin: 0 0 18px; padding: 0; }
.mps-segment { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid #d5dbd5; padding: 10px 0; }
.mps-message { margin: 18px 0; line-height: 1.5; }
.mps-message:empty { display: none; }
.mps-error, .mps-blocking { color: #822719; background: #fff0e9; padding: 14px; border: 1px solid #e4b9aa; border-radius: 12px; }
.mps-preview { margin: 20px 0; }
.mps-warnings { padding: 14px; border: 1px solid #d7c997; background: #fff9e6; border-radius: 12px; margin: 14px 0; }
.mps-blocking ul, .mps-warnings ul { margin-bottom: 0; padding-left: 22px; }
.mps-patient-match p { margin: 0; line-height: 1.5; }
.mps-patient-match p + p { margin-top: 10px; }
.mps-pages { display: grid; gap: 20px; margin-top: 18px; min-width: 0; }
.mps-page { margin: 0; max-width: 100%; min-width: 0; overflow-x: auto; background: #fff; border: 1px solid #d1d7d2; border-radius: 12px; padding: 10px; }
.mps-page figcaption { font-weight: 600; margin-bottom: 8px; }
.mps-page button { margin-bottom: 10px; }
.mps-page img { display: block; width: 100%; max-width: 100%; height: auto; }
.mps-page.mps-page-zoom img { width: 1300px; min-width: 1300px; max-width: none; }
.mps-confirm { display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: #fff; border: 1px solid #c9d2ca; border-radius: 14px; line-height: 1.5; margin: 18px 0 12px; }
.mps-confirm input { width: 24px; height: 24px; flex: 0 0 24px; min-height: 24px; margin: 2px 0 0; accent-color: #476348; }
.mps-save { width: 100%; }
.mps-history { margin-top: 24px; border-top: 1px solid #d5dbd5; padding-top: 14px; }
.mps-history summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 650; }
.mps-documents { display: grid; gap: 12px; margin-top: 12px; }
.mps-document { display: grid; gap: 8px; background: #fff; border: 1px solid #d5dbd5; border-radius: 12px; padding: 14px; }
@media (max-width: 380px) { .mps-actions > button, .mps-source-actions > button { width: 100%; } .medication-plan-scan-dialog { border-radius: 14px; } }
@supports ((backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))) {
  .medication-plan-scan-dialog { background: rgba(250, 248, 243, .89); -webkit-backdrop-filter: blur(24px) saturate(1.12); backdrop-filter: blur(24px) saturate(1.12); box-shadow: 0 18px 72px #10261e38, inset 0 1px 0 #ffffffcf; }
  .medication-plan-scan-dialog::backdrop { background: #1826228c; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
}
@media (prefers-reduced-transparency: reduce) {
  .medication-plan-scan-dialog { background: #faf8f3; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .medication-plan-scan-dialog::backdrop { background: #182222; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (forced-colors: active) {
  .medication-plan-scan-dialog, .medication-plan-scan-dialog::backdrop { background: Canvas; color: CanvasText; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
  .medication-plan-scan-dialog { border-color: CanvasText; }
  .medication-plan-scan-dialog button, .mps-patient, .mps-patient-match, .mps-confirm, .mps-page { border: 1px solid ButtonText; }
}
