/* Short quote decisions float above the editor; the editor keeps its own layout. */
body.mobile-ui-active #quoteActionModal.preview-modal {
  --quote-dialog-height: var(--mq-visible-height, 100dvh);
  position: fixed;
  inset: auto 0;
  top: var(--mq-visible-top, 0px);
  height: var(--quote-dialog-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px max(16px, calc(var(--quote-dialog-height) * .12));
  overflow: hidden;
  overscroll-behavior: contain;
}
body.mobile-ui-active #quoteActionModal.preview-modal > .preview-modal-backdrop {
  background: rgba(15, 23, 42, .46);
}
body.mobile-ui-active #quoteActionModal.preview-modal > .quote-action-dialog-card {
  flex: 0 1 360px;
  width: 100%;
  min-width: 0;
  max-width: 360px;
  max-height: calc(var(--quote-dialog-height) - 16px - max(16px, var(--quote-dialog-height) * .12));
  margin: 0;
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border: 1px solid #e1e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, .22);
}
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-header {
  align-items: center;
  gap: 10px;
  margin: 0;
}
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-header h3 {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
}
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-header .preview-modal-close {
  position: static;
  order: -1;
  flex: none;
  width: auto;
  min-width: 40px;
  min-height: 32px;
  height: 32px;
  margin: 0;
  padding: 4px 6px;
  font-size: 12px;
  color: #60758a;
  background: transparent;
  border-color: transparent;
}
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-message {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
/* Keep the original form/handlers; let the sticky actions use the card's scroll area. */
body.mobile-ui-active #quoteActionModal.preview-modal #quoteActionForm { display: contents; }
body.mobile-ui-active #quoteActionModal.preview-modal #quoteActionFields { gap: 10px; margin-top: 12px; }
body.mobile-ui-active #quoteActionModal.preview-modal #quoteActionFields:empty { display: none; }
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-field { font-size: 12px; }
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-field input {
  min-height: 36px;
  height: 36px;
  padding: 6px 8px;
  font-size: 14px;
}
body.mobile-ui-active #quoteActionModal.preview-modal .quote-action-preview {
  margin-top: 12px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-error {
  margin-top: 10px;
  padding: 7px 8px;
  font-size: 12px;
}
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-actions {
  position: sticky;
  bottom: -14px;
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: stretch;
  gap: 8px;
  margin: 0 0 -14px;
  padding: 16px 0 14px;
  background: #fff;
}
body.mobile-ui-active #quoteActionModal.preview-modal .system-dialog-actions button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  height: auto;
  margin: 0;
  padding: 8px;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  border-radius: 7px;
}
body.mobile-ui-active #quoteActionModal.preview-modal #quoteActionConfirm {
  color: #fff;
  background: #175fc6;
  border-color: #175fc6;
}
@media (max-height: 360px) {
  body.mobile-ui-active #quoteActionModal.preview-modal {
    padding: 12px 16px;
  }
  body.mobile-ui-active #quoteActionModal.preview-modal > .quote-action-dialog-card {
    max-height: calc(var(--quote-dialog-height) - 24px);
  }
}

/* Original export settings and preview keep separate scrolling inside the visible window. */
body.mobile-ui-active #quoteExportModal.preview-modal {position:fixed;inset:auto 0;top:var(--mq-visible-top,0px);height:var(--mq-visible-height,100dvh);box-sizing:border-box;padding:8px;}
body.mobile-ui-active #quoteExportModal.preview-modal .quote-export-modal-card {display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:8px;box-sizing:border-box;width:100%;height:100%;max-height:100%!important;min-width:0;min-height:0;margin:0!important;padding:8px 10px!important;overflow:hidden!important;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportClose {position:static;inset:auto;grid-column:1;grid-row:1;min-width:0;width:auto;min-height:34px!important;height:34px;margin:0;padding:5px 8px;font-size:12px;line-height:22px;color:#175fc6;background:#fff;border:1px solid #dce5ee;}
body.mobile-ui-active #quoteExportModal.preview-modal .quote-export-modal-card>h3 {grid-column:2;grid-row:1;align-self:center;min-width:0;margin:0;padding:0;font-size:15px;line-height:22px;}
body.mobile-ui-active #quoteExportModal.preview-modal .quote-export-layout {grid-column:1/-1;grid-row:2;min-width:0;min-height:0;overflow:auto;gap:8px;scroll-padding-top:8px;scroll-padding-bottom:8px;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportForm {min-width:0;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportForm>div {min-width:0;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportForm label {margin:0 0 3px;font-size:12px;line-height:18px;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportForm select {height:34px;min-height:34px!important;margin:0;padding:5px 7px;font-size:14px!important;line-height:22px;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportHint {margin:0;font-size:11px;line-height:17px;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportForm .modal-actions {display:flex;flex-direction:row;flex-wrap:nowrap;gap:6px;margin:0;}
body.mobile-ui-active #quoteExportModal.preview-modal #quoteExportForm .modal-actions>button {flex:1;min-width:0;width:auto;min-height:36px!important;margin:0;padding:6px 8px;font-size:12px;line-height:22px;}
body.mobile-ui-active #quoteExportModal.preview-modal .quote-export-preview-shell {box-sizing:border-box;width:100%;max-width:100%;min-width:0;height:clamp(180px,calc(var(--mq-visible-height,100dvh) - 250px),480px);padding:0;border-radius:6px;overflow:auto;}
body.mobile-ui-active #quoteExportModal.preview-modal .quote-export-preview-head {padding:6px 8px;font-size:12px;line-height:18px;}

/* Workspace choices remain their own original dialog and do not inherit full editor height. */
body.mobile-ui-active #quoteWorkspaceChoice.bf-modal {position:fixed;inset:auto 0;top:var(--mq-visible-top,0px);height:var(--mq-visible-height,100dvh);box-sizing:border-box;display:flex;align-items:center;justify-content:center;padding:12px;}
body.mobile-ui-active #quoteWorkspaceChoice .bf-shell {width:min(440px,100%);height:auto;max-height:100%;min-height:0;}
body.mobile-ui-active #quoteWorkspaceChoice .bf-header {flex:none;justify-content:flex-start;align-items:center;padding:10px 12px 0;gap:8px;}
body.mobile-ui-active #quoteWorkspaceChoice .bf-header>div {flex:1;min-width:0;}
body.mobile-ui-active #quoteWorkspaceChoice .bf-header h2 {font-size:15px;line-height:22px;}
body.mobile-ui-active #quoteWorkspaceChoice .bf-header>button {order:-1;position:static;inset:auto;flex:none;min-width:0;min-height:34px;margin:0;padding:5px 8px;font-size:12px;line-height:22px;}
body.mobile-ui-active #quoteWorkspaceChoice .bf-content {min-height:0;overflow:auto;padding:10px 12px 12px;}
body.mobile-ui-active #quoteWorkspaceChoice .system-dialog-message {margin:0 0 10px;font-size:12px;line-height:18px;}
/* The saved-draft delete confirmation is a separate original WorkflowUI window. */
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] {position:fixed;inset:auto 0;top:var(--mq-visible-top,0px);height:var(--mq-visible-height,100dvh);box-sizing:border-box;z-index:1600;display:flex;align-items:center;justify-content:center;padding:12px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .bf-shell {width:min(440px,100%);height:auto;min-height:0;max-height:100%;margin:0;overflow:hidden;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .bf-header {display:flex;flex:none;align-items:center;gap:8px;padding:8px 10px;min-height:0;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .bf-header > div {flex:1;min-width:0;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .bf-header h2 {margin:0;font-size:15px;line-height:22px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .bf-header > button {order:-1;flex:none;width:auto;min-height:32px;height:32px;margin:0;padding:4px 8px;font-size:12px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .bf-content {min-height:0;overflow:auto;padding:10px 12px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .system-dialog-message {margin:0 0 10px;font-size:13px;line-height:20px;overflow-wrap:anywhere;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .system-dialog-actions {display:flex;flex-direction:row!important;flex-wrap:nowrap;gap:8px;margin:0;padding:0;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .bf-modal[id^="systemConfirm-"] .system-dialog-actions > button {flex:1;min-width:0;width:auto;min-height:36px;height:36px;margin:0;padding:5px 10px;font-size:13px;}
/* Historical quote images use the original shared attachment viewer. */
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal {box-sizing:border-box;inset:auto 0;top:var(--mq-visible-top,0px);height:var(--mq-visible-height,100dvh);padding:8px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal .af-dialog {min-height:0;max-height:100%;border-radius:9px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal .af-header {flex:none;justify-content:flex-start;gap:8px;padding:8px 10px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal .af-header h3 {flex:1;min-width:0;font-size:14px;line-height:20px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal [data-af-close] {order:-1;flex:none;min-width:0;min-height:34px;margin:0;padding:5px 8px;font-size:12px;line-height:22px;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal .af-body {min-height:0;padding:10px;overflow:auto;}
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal .af-body img {max-height:calc(var(--mq-visible-height,100dvh) - 126px);}
body.mobile-ui-active:has(#content .mobile-quote-compact) .af-modal .af-footer {margin-top:8px;font-size:12px;line-height:20px;}
