/*
  DataMedic frontend safe override layer.
  Prompt 3 styles only the soft-delete confirmation modal.
*/

.dm-soft-delete-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.52);
}

.dm-soft-delete-dialog {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 32px));
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  padding: 22px;
  color: #172033;
}

.dm-soft-delete-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dm-soft-delete-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #b91c1c;
}

.dm-soft-delete-dialog h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #111827;
}

.dm-soft-delete-icon {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 900;
  cursor: pointer;
}

.dm-soft-delete-warning {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  background: #fff7f7;
  color: #7f1d1d;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
}

.dm-soft-delete-patient {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.dm-soft-delete-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: #475569;
}

.dm-soft-delete-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  outline: none;
}

.dm-soft-delete-input:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.dm-soft-delete-status {
  min-height: 20px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 800;
}

.dm-soft-delete-status-error {
  color: #b91c1c;
}

.dm-soft-delete-status-success {
  color: #047857;
}

.dm-soft-delete-status-loading {
  color: #475569;
}

.dm-soft-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.dm-soft-delete-secondary,
.dm-soft-delete-danger {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.dm-soft-delete-secondary {
  background: #f1f5f9;
  color: #334155;
}

.dm-soft-delete-danger {
  background: #dc2626;
  color: #fff;
}

.dm-soft-delete-danger:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 560px) {
  .dm-soft-delete-actions {
    flex-direction: column-reverse;
  }

  .dm-soft-delete-secondary,
  .dm-soft-delete-danger {
    width: 100%;
  }
}

.dm-profile-extension {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #dbe5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #172033;
}

.dm-profile-extension-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
}

.dm-profile-extension-head strong {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  color: #111827;
}

.dm-profile-extension-head span {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.dm-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dm-patient-inline-grid,
.dm-patient-integrated-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dm-patient-integrated-fields {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.dm-patient-integrated-fallback {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.dm-profile-field {
  display: block;
}

.dm-profile-field span {
  display: block;
  margin: 0 0 5px 4px;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  color: #64748b;
}

.dm-profile-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  outline: none;
}

.dm-profile-field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  outline: none;
}

.dm-profile-field input:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.dm-profile-field select:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.dm-profile-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.dm-profile-actions span {
  margin-right: auto;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.dm-profile-actions button,
.dm-work-location-item button {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #059669;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.dm-profile-actions button[data-dm-clear-location],
.dm-work-location-item button {
  background: #e2e8f0;
  color: #334155;
}

.dm-work-locations {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.dm-work-location-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.dm-work-location-item strong,
.dm-work-location-item span {
  display: block;
}

.dm-work-location-item strong {
  font-size: 13px;
  color: #111827;
}

.dm-work-location-item span,
.dm-empty {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.dm-work-location-item div:last-child {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dm-profile-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: #334155;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-agenda-new-panel {
  margin-top: -4px;
  padding: 14px;
  border: 1px solid #dbe5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.dm-agenda-new-panel[hidden] {
  display: none;
}

.dm-agenda-new-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dm-agenda-new-head strong,
.dm-agenda-new-head span {
  display: block;
}

.dm-agenda-new-head strong {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: #111827;
}

.dm-agenda-new-head span {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

.dm-agenda-new-head button {
  flex-shrink: 0;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #059669;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.dm-agenda-new-name {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.dm-agenda-followup-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.dm-agenda-followup-box p {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: #334155;
}

.dm-agenda-followup-box label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 14px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.dm-agenda-duplicate-warning {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
}

.dm-agenda-duplicate-warning strong,
.dm-agenda-duplicate-warning p,
.dm-agenda-duplicate-warning div {
  display: block;
  margin: 0 0 4px;
}

.dm-agenda-new-status {
  min-height: 18px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 900;
}

.dm-agenda-new-status-error {
  color: #b91c1c;
}

.dm-agenda-new-status-loading {
  color: #475569;
}

.dm-transcription-pipeline {
  box-sizing: border-box;
  width: min(100%, 680px);
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid #dbe5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #172033;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  font-size: 12px;
}

.dm-transcription-pipeline-floating {
  position: fixed;
  right: 16px;
  bottom: 84px;
  z-index: 9998;
  max-width: min(420px, calc(100vw - 32px));
}

.dm-transcription-pipeline-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}

.dm-transcription-pipeline-head strong {
  color: #0f172a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-transcription-pipeline-head span[data-dm-transcription-provider] {
  margin-left: auto;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-transcription-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.dm-transcription-pipeline[data-state="processing"] .dm-transcription-dot {
  animation: dm-transcription-pulse 1.2s ease-in-out infinite;
}

.dm-transcription-pipeline[data-state="partial"] {
  border-color: #f59e0b;
  background: #fffbeb;
}

.dm-transcription-pipeline[data-state="partial"] .dm-transcription-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.dm-transcription-pipeline[data-state="error"] {
  border-color: #fecaca;
  background: #fff7f7;
}

.dm-transcription-pipeline[data-state="error"] .dm-transcription-dot {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.dm-transcription-pipeline p {
  margin: 5px 0 0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.dm-transcription-pipeline details {
  margin-top: 8px;
}

.dm-transcription-pipeline summary {
  cursor: pointer;
  color: #0f766e;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-transcription-pipeline dl {
  display: grid;
  grid-template-columns: minmax(110px, 0.55fr) minmax(0, 1fr);
  gap: 5px 10px;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.32);
}

.dm-transcription-pipeline dt,
.dm-transcription-pipeline dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.dm-transcription-pipeline dt {
  color: #64748b;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-transcription-pipeline dd {
  color: #1f2937;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dm-transcription-pipeline [data-dm-transcription-actions] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.dm-transcription-pipeline button[data-dm-copy-partial] {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #0f766e;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.dm-clinical-consistency {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: min(420px, 100%);
  margin: 6px 0 0;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  z-index: 9998;
}

.dm-clinical-consistency-floating {
  position: fixed;
  right: 16px;
  bottom: 144px;
}

.dm-clinical-consistency-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dm-clinical-consistency-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  flex: 0 0 auto;
}

.dm-clinical-consistency-level-1 .dm-clinical-consistency-dot {
  background: #eab308;
}

.dm-clinical-consistency-level-2 .dm-clinical-consistency-dot {
  background: #f97316;
}

.dm-clinical-consistency-level-3 .dm-clinical-consistency-dot {
  background: #dc2626;
}

.dm-clinical-consistency details {
  display: inline-block;
  position: relative;
}

.dm-clinical-consistency summary {
  cursor: pointer;
  list-style: none;
  color: #475569;
  font-size: 10px;
}

.dm-clinical-consistency summary::-webkit-details-marker {
  display: none;
}

.dm-clinical-consistency ul {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(320px, 82vw);
  margin: 0;
  padding: 8px 10px 8px 22px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.dm-transcription-suggestions {
  width: 100%;
}

.dm-transcription-suggestions ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.dm-speaker-estimated-warning {
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
}

[data-dm-audio-legacy-neutralized="1"] {
  display: none !important;
}

.dm-global-recording-panel {
  box-sizing: border-box;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  width: min(420px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid #dbe5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 12px 38px rgba(15, 23, 42, 0.18);
  font-size: 12px;
}

.dm-global-recording-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.dm-global-recording-head strong {
  color: #0f172a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-global-recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.dm-global-recording-time {
  margin-left: auto;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 900;
}

.dm-global-recording-panel[data-state="recording"] .dm-global-recording-dot {
  animation: dm-transcription-pulse 1.2s ease-in-out infinite;
}

.dm-global-recording-panel[data-state="paused"] {
  border-color: #fde68a;
  background: #fffbeb;
}

.dm-global-recording-panel[data-state="paused"] .dm-global-recording-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.dm-global-recording-panel[data-state="processing"],
.dm-global-recording-panel[data-state="stopping"],
.dm-global-recording-panel[data-state="requesting_permission"] {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.dm-global-recording-panel[data-state="processing"] .dm-global-recording-dot,
.dm-global-recording-panel[data-state="stopping"] .dm-global-recording-dot,
.dm-global-recording-panel[data-state="requesting_permission"] .dm-global-recording-dot {
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.dm-global-recording-panel[data-state="error"] {
  border-color: #fecaca;
  background: #fff7f7;
}

.dm-global-recording-panel[data-state="error"] .dm-global-recording-dot {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.dm-global-recording-patient,
.dm-global-recording-status,
.dm-global-recording-warning,
.dm-global-recording-error {
  margin: 5px 0 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.dm-global-recording-patient {
  color: #334155;
}

.dm-global-recording-status {
  color: #64748b;
}

.dm-global-recording-warning {
  color: #92400e;
}

.dm-global-recording-error {
  color: #b91c1c;
}

.dm-global-recording-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dm-global-recording-actions button {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #0f766e;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.dm-global-recording-actions button[data-dm-global-stop] {
  background: #b91c1c;
}

.dm-live-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.78);
}

.dm-live-preview summary {
  cursor: pointer;
  color: #0f766e;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-live-preview p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.dm-live-preview textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 90px;
  max-height: 180px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  resize: vertical;
}

.dm-live-preview button {
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #0f766e;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.dm-live-preview button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.dm-live-preview-empty {
  color: #64748b !important;
}

.dm-global-recording-details {
  margin-top: 8px;
}

.dm-global-recording-details summary {
  cursor: pointer;
  color: #0f766e;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-global-recording-details dl {
  display: grid;
  grid-template-columns: minmax(110px, 0.55fr) minmax(0, 1fr);
  gap: 5px 10px;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.32);
}

.dm-global-recording-details dt,
.dm-global-recording-details dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.dm-global-recording-details dt {
  color: #64748b;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-global-recording-details dd {
  color: #1f2937;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dm-lme-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  overflow: auto;
}

.dm-lme-dialog {
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  box-sizing: border-box;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.dm-lme-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.dm-lme-header p,
.dm-lme-header span {
  margin: 0;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.35;
  text-transform: uppercase;
}

.dm-lme-header h2 {
  margin: 2px 0;
  color: #0f172a;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
}

.dm-lme-header button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.dm-lme-status,
.dm-lme-missing {
  margin: 14px 20px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.dm-lme-status-success,
.dm-lme-missing-ok {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.dm-lme-status-error,
.dm-lme-missing {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.dm-lme-missing.dm-lme-missing-ok {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.dm-lme-status-loading {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.dm-lme-missing ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.dm-lme-section {
  margin: 16px 20px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fbfdff;
}

.dm-lme-section h3 {
  margin: 0 0 12px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-lme-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dm-lme-section-head h3 {
  margin: 0;
}

.dm-lme-section-head span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.dm-lme-grid,
.dm-lme-med-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dm-lme-field,
.dm-lme-med-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.dm-lme-field span,
.dm-lme-med-grid span {
  color: #64748b;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-lme-field input,
.dm-lme-field textarea,
.dm-lme-field select,
.dm-lme-med-grid input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.dm-lme-field textarea {
  min-height: 72px;
  resize: vertical;
}

.dm-lme-wide,
.dm-lme-med-wide,
.dm-lme-field:has(textarea) {
  grid-column: span 2;
}

.dm-lme-med-row {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
}

.dm-lme-section button,
.dm-lme-actions button,
.dm-lme-remove-med {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  background: #0f766e;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.dm-lme-remove-med {
  margin-top: 10px;
  background: #b91c1c;
}

.dm-lme-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.dm-lme-actions button:last-child {
  background: #475569;
}

[data-dm-lme-button] {
  margin-left: 8px;
}

[data-dm-lme-button][data-dm-lme-loading="1"] {
  cursor: wait;
  opacity: 0.68;
}

.dm-lme-preview-wrap {
  background: #e5e7eb;
  overflow: auto;
}

.dm-lme-a4-page {
  box-sizing: border-box;
  width: min(100%, 210mm);
  min-height: 297mm;
  margin: 0 auto;
  padding: 10mm;
  border: 1px solid #111827;
  background: #fff;
  color: #111827;
  font-family: Arial, sans-serif;
}

.dm-lme-a4-header {
  margin-bottom: 8px;
  border-bottom: 2px solid #111827;
  text-align: center;
}

.dm-lme-a4-header h2 {
  margin: 0;
  font-size: 12px;
}

.dm-lme-a4-header h1 {
  margin: 4px 0;
  font-size: 14px;
}

.dm-lme-a4-header p {
  margin: 4px 0 8px;
  font-size: 10px;
  font-weight: 900;
}

.dm-lme-a4-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 6px 0;
}

.dm-lme-a4-grid > div {
  min-height: 34px;
  padding: 4px;
  border: 1px solid #111827;
}

.dm-lme-a4-grid .wide {
  grid-column: 1 / -1;
}

.dm-lme-a4-grid b {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
}

.dm-lme-a4-grid span {
  display: block;
  font-size: 11px;
  white-space: pre-wrap;
}

.dm-lme-a4-page h3 {
  margin: 8px 0 2px;
  font-size: 10px;
  text-transform: uppercase;
}

.dm-lme-a4-table {
  width: 100%;
  margin: 4px 0 8px;
  border-collapse: collapse;
}

.dm-lme-a4-table th,
.dm-lme-a4-table td {
  border: 1px solid #111827;
  padding: 3px;
  font-size: 9px;
  vertical-align: top;
}

.dm-lme-signature-space {
  min-height: 24px;
}

.dm-lme-a4-note {
  font-size: 9px;
  font-weight: 900;
}

.dm-lme-missing,
.dm-lme-missing-warning {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.dm-lme-missing.dm-lme-missing-ok {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.dm-lme-status-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.dm-lme-a4-page {
  width: min(100%, 194mm);
  min-height: 281mm;
  padding: 3.5mm;
  border: 1.5px solid #000;
  color: #000;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.dm-lme-a4-header {
  margin: 0 0 2mm;
  border: 0;
}

.dm-lme-a4-sus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1mm;
  color: #000;
  font-size: 8px;
}

.dm-lme-a4-sus strong {
  font-size: 10px;
}

.dm-lme-a4-black {
  padding: 1.5mm;
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-lme-a4-gray {
  padding: 1.3mm;
  border: 1px solid #000;
  border-top: 0;
  background: #d9d9d9;
  color: #000;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-lme-a4-header h1 {
  margin: 1.5mm 0 0.5mm;
  color: #000;
  font-size: 13px;
  text-transform: uppercase;
}

.dm-lme-a4-header p {
  margin: 0;
  color: #000;
  font-size: 8.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.dm-lme-a4-top-grid {
  display: grid;
  grid-template-columns: 28mm 1fr 30mm;
  grid-auto-rows: minmax(11mm, auto);
  border-top: 1px solid #000;
  border-left: 1px solid #000;
}

.dm-lme-a4-cell {
  box-sizing: border-box;
  min-height: 9mm;
  padding: 1.2mm;
  overflow: hidden;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  background: #fff;
}

.dm-lme-a4-cell b {
  display: block;
  color: #000;
  font-size: 7.4px;
  line-height: 1.15;
  text-transform: uppercase;
}

.dm-lme-a4-cell span {
  display: block;
  min-height: 5mm;
  color: #000;
  font-size: 9px;
  line-height: 1.25;
  white-space: pre-wrap;
}

.dm-lme-a4-estab,
.dm-lme-a4-patient,
.dm-lme-a4-mother {
  grid-column: span 2;
}

.dm-lme-a4-weight,
.dm-lme-a4-height {
  text-align: center;
}

.dm-lme-a4-med-section {
  margin-top: 1.5mm;
}

.dm-lme-a4-med-title {
  padding: 1mm;
  border: 1px solid #000;
  border-bottom: 0;
  color: #000;
  font-size: 8px;
  text-align: center;
}

.dm-lme-a4-table {
  table-layout: fixed;
}

.dm-lme-a4-table th,
.dm-lme-a4-table td {
  border-color: #000;
  color: #000;
  font-size: 7.5px;
  line-height: 1.2;
}

.dm-lme-a4-table th {
  background: #f2f2f2;
  text-align: center;
}

.dm-lme-a4-med-index {
  width: 7mm;
  text-align: center;
}

.dm-lme-a4-meds td {
  height: 8.5mm;
}

.dm-lme-a4-meds th:nth-child(2),
.dm-lme-a4-meds td:nth-child(2) {
  width: 76mm;
}

.dm-lme-a4-clinical-grid {
  display: grid;
  grid-template-columns: 32mm 1fr 38mm;
  margin-top: 1.5mm;
  border-top: 1px solid #000;
  border-left: 1px solid #000;
}

.dm-lme-a4-diagnosis {
  grid-column: 2 / span 2;
}

.dm-lme-a4-textblock,
.dm-lme-a4-treatment,
.dm-lme-a4-capacity,
.dm-lme-a4-filled,
.dm-lme-a4-race,
.dm-lme-a4-final-sign {
  grid-column: 1 / -1;
}

.dm-lme-a4-textblock {
  min-height: 26mm;
}

.dm-lme-a4-treatment {
  min-height: 20mm;
}

.dm-lme-a4-capacity {
  min-height: 22mm;
}

.dm-lme-a4-cell p {
  margin: 1mm 0;
  color: #000;
  font-size: 7.2px;
  line-height: 1.25;
}

.dm-lme-a4-choice-line {
  display: flex;
  flex-wrap: wrap;
  gap: 3mm;
  margin: 1mm 0;
}

.dm-lme-a4-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1mm 3mm;
  margin-top: 1mm;
}

.dm-lme-a4-choice {
  display: inline-flex;
  align-items: center;
  gap: 1mm;
  color: #000;
  font-size: 8px;
  line-height: 1.2;
}

.dm-lme-a4-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2mm;
  height: 3.2mm;
  border: 1px solid #000;
  color: #000;
  font-size: 7px;
  font-weight: 900;
}

.dm-lme-a4-inline-value {
  display: grid;
  grid-template-columns: 34mm 1fr;
  gap: 2mm;
  margin-top: 1.5mm;
}

.dm-lme-a4-doctor {
  grid-column: 1 / span 2;
}

.dm-lme-a4-doctor-cns {
  grid-column: 3;
}

.dm-lme-a4-date {
  grid-column: 1;
}

.dm-lme-a4-sign {
  grid-column: 2 / span 2;
}

.dm-lme-a4-phone {
  grid-column: 1;
}

.dm-lme-a4-document {
  grid-column: 2;
}

.dm-lme-a4-email {
  grid-column: 3;
}

.dm-lme-a4-extra {
  grid-column: span 3;
}

.dm-lme-signature-space {
  min-height: 12mm;
}

.dm-lme-a4-note {
  padding: 1mm;
  border: 1px solid #000;
  border-top: 0;
  color: #000;
  font-size: 7px;
  font-weight: 900;
  text-align: left;
}

.dm-lme-a4-page {
  width: min(100%, 210mm);
  height: 297mm;
  min-height: 297mm;
  padding: 7mm;
  overflow: hidden;
  border: 0;
  box-shadow: inset 0 0 0 1.4px #000, 0 12px 32px rgba(15, 23, 42, 0.18);
}

.dm-lme-a4-header {
  margin: 0 0 1.4mm;
}

.dm-lme-a4-sus {
  margin-bottom: 0.8mm;
  font-size: 7.2px;
}

.dm-lme-a4-sus strong {
  font-size: 9px;
}

.dm-lme-a4-black {
  padding: 1.05mm;
  font-size: 9px;
}

.dm-lme-a4-gray {
  padding: 0.9mm;
  font-size: 8.7px;
}

.dm-lme-a4-header h1 {
  margin: 1mm 0 0.2mm;
  font-size: 12px;
}

.dm-lme-a4-header p {
  font-size: 7.8px;
}

.dm-lme-a4-top-grid {
  grid-template-columns: 27mm 1fr 27mm;
}

.dm-lme-a4-cell {
  min-height: 7.6mm;
  padding: 0.85mm;
}

.dm-lme-a4-cell b {
  font-size: 6.7px;
  line-height: 1.08;
}

.dm-lme-a4-cell span {
  min-height: 4mm;
  font-size: 8.2px;
  line-height: 1.14;
  overflow: hidden;
}

.dm-lme-a4-med-section {
  margin-top: 1mm;
}

.dm-lme-a4-med-title {
  display: none;
}

.dm-lme-a4-table th,
.dm-lme-a4-table td {
  padding: 0.65mm;
  font-size: 6.9px;
  line-height: 1.1;
  overflow: hidden;
}

.dm-lme-a4-med-index {
  width: 6mm;
}

.dm-lme-a4-meds td {
  height: 7.2mm;
}

.dm-lme-a4-meds th:nth-child(2),
.dm-lme-a4-meds td:nth-child(2) {
  width: 82mm;
}

.dm-lme-a4-clinical-grid {
  grid-template-columns: 30mm 1fr 36mm;
  margin-top: 1mm;
}

.dm-lme-a4-textblock {
  height: 24mm;
}

.dm-lme-a4-treatment {
  height: 17mm;
}

.dm-lme-a4-capacity {
  height: 20mm;
}

.dm-lme-a4-cell p {
  margin: 0.6mm 0;
  font-size: 6.5px;
  line-height: 1.12;
}

.dm-lme-a4-choice-line {
  gap: 2.4mm;
  margin: 0.6mm 0;
}

.dm-lme-a4-choice-grid {
  gap: 0.5mm 2mm;
  margin-top: 0.5mm;
}

.dm-lme-a4-choice {
  gap: 0.8mm;
  font-size: 7.2px;
  line-height: 1.05;
}

.dm-lme-a4-box {
  width: 2.8mm;
  height: 2.8mm;
  font-size: 6px;
}

.dm-lme-a4-inline-value {
  grid-template-columns: 32mm 1fr;
  gap: 1.5mm;
  margin-top: 0.8mm;
}

.dm-lme-signature-space {
  min-height: 8mm;
}

.dm-lme-a4-final-sign {
  height: 13mm;
}

.dm-lme-a4-note {
  padding: 0.7mm;
  font-size: 6.6px;
}

@keyframes dm-transcription-pulse {
  0% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 0.45; transform: scale(0.92); }
}

@media (max-width: 680px) {
  .dm-profile-grid {
    grid-template-columns: 1fr;
  }

  .dm-patient-inline-grid,
  .dm-patient-integrated-grid {
    grid-template-columns: 1fr;
  }

  .dm-work-location-item,
  .dm-profile-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dm-profile-actions span {
    margin-right: 0;
  }

  .dm-agenda-new-head {
    align-items: stretch;
    flex-direction: column;
  }

  .dm-agenda-followup-box label {
    display: flex;
    margin: 8px 0 0;
  }

  .dm-transcription-pipeline,
  .dm-transcription-pipeline-floating {
    width: auto;
    max-width: none;
  }

  .dm-transcription-pipeline-floating {
    left: 12px;
    right: 12px;
    bottom: 72px;
  }

  .dm-global-recording-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  .dm-transcription-pipeline dl {
    grid-template-columns: 1fr;
  }

  .dm-global-recording-details dl {
    grid-template-columns: 1fr;
  }

  .dm-lme-backdrop {
    padding: 10px;
  }

  .dm-lme-dialog {
    max-height: calc(100vh - 20px);
  }

  .dm-lme-grid,
  .dm-lme-med-grid {
    grid-template-columns: 1fr;
  }

  .dm-lme-wide,
  .dm-lme-med-wide,
  .dm-lme-field:has(textarea) {
    grid-column: auto;
  }

  .dm-lme-a4-page {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    padding: 7mm;
  }

  .dm-lme-a4-grid {
    grid-template-columns: 1fr 1fr;
  }
}
