/* Shared Smart Phrase dialogs only. Clinical text and actions are unchanged. */
.spw .spw-footer,
.spw .spw-actions,
.spw .spw-custom-entry,
.spw .spw-selection-bar { min-width: 0; max-width: 100%; }
.spw .spw-footer { flex-shrink: 0; }
.spw .spw-picker-heading { flex-shrink: 1; min-height: 0; overflow-y: auto; }
.spw .spw-options { min-height: 48px; }
.spw .spw-actions { flex-wrap: wrap; gap: 8px; }
.spw .spw-actions > * { min-width: 0; max-width: 100%; }
.spw .spw-actions > button {
  min-height: 44px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.spw .spw-actions .spw-confirm {
  min-width: 0;
  min-height: 48px;
  height: auto;
  padding: 12px 16px;
  white-space: normal;
}
.spw .spw-actions[aria-label="Detail navigation"] {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}
.spw .spw-actions[aria-label="Detail navigation"] > .sp-outcome {
  grid-column: 1 / 3;
  grid-row: 1;
  margin: 0;
  align-self: stretch;
}
.spw .spw-actions[aria-label="Detail navigation"] > .spw-skip[aria-label="Skip this detail"] {
  grid-column: 3;
  grid-row: 1;
  margin: 0 !important;
  padding: 4px 0;
}
.spw .spw-actions[aria-label="Detail navigation"] > .spw-skip[aria-label^="Skip remaining "] {
  grid-column: 4 / -1;
  grid-row: 1;
  margin: 0 !important;
  padding: 6px;
  font-size: 12px;
}
.spw .spw-actions[aria-label="Detail navigation"] > .spw-back {
  grid-column: 1 / 3;
  grid-row: 2;
  justify-content: flex-start;
  padding: 8px 4px;
}
.spw .spw-actions[aria-label="Detail navigation"] > .spw-confirm {
  grid-column: 3 / -1;
  grid-row: 2;
  width: 100%;
  margin: 0;
}
.spw .sp-outcome > summary {
  min-height: 44px;
  height: 100%;
  padding: 6px 0;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
.spw .sp-outcome > div {
  left: 0;
  right: auto;
  width: min(240px, calc(100vw - 32px));
  min-width: 0;
  max-width: calc(100vw - 32px);
}
.spw .spw-selection-bar { flex-wrap: wrap; gap: 4px 12px; }
.spw .spw-selection-bar button { min-width: 44px; }
.spw .spw-icon { width: 44px; min-width: 44px; }
.spw .spw-hide-keyboard[style*="hidden"] { display: none; }
.spw .spw-selection-bar > button:last-child { margin-left: auto; }
.spw .spw-custom-entry { display: grid; grid-template-columns: minmax(0, 1fr) 64px; }
.spw .spw-custom-entry input,
.spw .spw-custom-entry button { width: 100%; min-width: 0; min-height: 46px; }
.spw .spw-selected-list button { max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.spw .spw-selected-list button svg,
.spw .spw-actions button svg { flex-shrink: 0; }
.spw .spw-choice-label,
.spw .spw-question > div { min-width: 0; }
.spw .spw-question h2 { overflow-wrap: anywhere; }
.spw .spw-teaching-fast .spw-actions { flex-wrap: nowrap; }
.spw .spw-teaching-fast .spw-actions > .spw-back { flex: 0 0 auto; min-width: 64px; }
.spw .spw-teaching-fast .spw-actions > .spw-confirm,
.spw .spw-teaching-fast .spw-actions > .spw-skip { flex: 1 1 0; max-width: 320px; margin-left: auto; }
[role="dialog"]:has(.mp-sp-full-preview) button { min-height: 44px; min-width: 44px; }
[role="dialog"]:has(.mp-sp-full-preview) [role="group"][aria-label^="Stability and control for"] button {
  height: auto;
  padding: 8px;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
@media (max-width: 600px) {
  .spw .spw-footer {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .spw .spw-actions > button { font-size: 13px; }
  .spw .spw-actions .spw-confirm { font-size: 15px; }
  .spw .spw-actions[aria-label="Detail navigation"] > .spw-skip[aria-label^="Skip remaining "] { font-size: 12px; }
  .spw .spw-question h2 { font-size: 20px; line-height: 1.25; }
  .spw .spw-mode { flex-shrink: 0; }
  .spw .spw-teaching-fast .grid-cols-3 > .spw-choice { padding: 10px 8px; font-size: 14px; }
  [role="dialog"]:has(.mp-sp-full-preview) [role="group"][aria-label^="Stability and control for"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}
