/**
 * PrintPosters Collage Maker — mobile UX layer (max-width: 767px)
 * Desktop ≥768px unchanged.
 */

@media (max-width: 767px) {
  body.pp-cm-mobile #ppMobileShell {
    display: flex;
  }

  /* When wizard is on select/layout/print, hide legacy chrome */
  body.pp-cm-mobile.pp-cm-step-select #app-container,
  body.pp-cm-mobile.pp-cm-step-layout #app-container,
  body.pp-cm-mobile.pp-cm-step-print #app-container {
    visibility: hidden;
    pointer-events: none;
  }

  body.pp-cm-mobile.pp-cm-step-edit #app-container {
    visibility: visible;
    pointer-events: auto;
  }

  /* Edit: restyle legacy shell lightly; hide redundant chrome */
  body.pp-cm-mobile.pp-cm-step-edit #app-container {
    background: #f8fafc !important;
  }
  body.pp-cm-mobile.pp-cm-step-edit .app-header {
    background: #fff !important;
    border-bottom: 1px solid #e5e7eb !important;
    color: #111827;
  }
  body.pp-cm-mobile.pp-cm-step-edit .brand-logo {
    color: #111827 !important;
    font-size: 15px !important;
  }
  body.pp-cm-mobile.pp-cm-step-edit .header-actions .btn-action.btn-primary,
  body.pp-cm-mobile.pp-cm-step-edit #floatingOrderBtn,
  body.pp-cm-mobile.pp-cm-step-edit #changeDesignLink {
    display: none !important;
  }
  body.pp-cm-mobile.pp-cm-step-edit .sidebar-tools {
    display: none !important;
  }
  /* workspace height for edit is set with .pp-cm-edit-top rules below */
  body.pp-cm-mobile.pp-cm-step-edit .settings-panel.open {
    height: min(42%, 320px) !important;
  }
  body.pp-cm-mobile.pp-cm-step-edit .stage-area {
    background: #f1f5f9 !important;
  }

  body.pp-cm-mobile #ppMobileShell {
    position: fixed;
    inset: 0;
    z-index: 10050;
    flex-direction: column;
    background: #f7f8fa;
    color: #111827;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Light-theme typography reset (body uses white --text-main on collage page) */
  body.pp-cm-mobile #ppMobileShell,
  body.pp-cm-mobile #ppMobileShell .pp-cm-scroll,
  body.pp-cm-mobile #ppMobileShell .pp-cm-engine {
    -webkit-text-fill-color: currentColor;
  }
  body.pp-cm-mobile #ppMobileShell .pp-cm-title,
  body.pp-cm-mobile #ppMobileShell .pp-cm-header h1,
  body.pp-cm-mobile #ppMobileShell .pp-cm-section-row h2,
  body.pp-cm-mobile #ppMobileShell .pp-cm-section-label,
  body.pp-cm-mobile #ppMobileShell .pp-cm-engine-hero-title,
  body.pp-cm-mobile #ppMobileShell .pp-cm-engine-hero-sub,
  body.pp-cm-mobile #ppMobileShell .pp-cm-sheet h3 {
    color: #111827;
    -webkit-text-fill-color: #111827;
  }
  body.pp-cm-mobile #ppMobileShell .pp-cm-engine-hero-sub {
    color: #4b5563;
    -webkit-text-fill-color: #4b5563;
  }
  body.pp-cm-mobile #ppMobileShell .pp-cm-pill-btn,
  body.pp-cm-mobile #ppMobileShell .pp-cm-designer,
  body.pp-cm-mobile #ppMobileShell .pp-cm-designer strong,
  body.pp-cm-mobile #ppMobileShell .pp-cm-mat,
  body.pp-cm-mobile #ppMobileShell .pp-cm-mat strong,
  body.pp-cm-mobile #ppMobileShell .pp-cm-style-card,
  body.pp-cm-mobile #ppMobileShell .pp-cm-autofit,
  body.pp-cm-mobile #ppMobileShell .pp-cm-loading,
  body.pp-cm-mobile #ppMobileShell .pp-cm-loading span,
  body.pp-cm-mobile #ppMobileShell .pp-cm-layout-card .name {
    color: #111827;
    -webkit-text-fill-color: #111827;
  }
  body.pp-cm-mobile #ppMobileShell .pp-cm-btn-primary,
  body.pp-cm-mobile #ppMobileShell .pp-cm-btn-order,
  body.pp-cm-mobile #ppMobileShell .pp-cm-chip.active,
  body.pp-cm-mobile #ppMobileShell .pp-cm-cart-badge,
  body.pp-cm-mobile #ppMobileShell .pp-cm-badge {
    -webkit-text-fill-color: currentColor;
  }

  /* Hide site FABs during focused collage wizard (they sit above the shell) */
  body.pp-cm-mobile .watsapp_btn,
  body.pp-cm-mobile #whatsappLink,
  body.pp-cm-mobile #watsappLink,
  body.pp-cm-mobile #ppChatbot.pp-chatbot {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.pp-cm-mobile.pp-cm-step-edit #ppMobileShell {
    background: transparent;
    pointer-events: none;
  }
  body.pp-cm-mobile.pp-cm-step-edit #ppMobileShell .pp-cm-step:not([data-step="edit"]),
  body.pp-cm-mobile.pp-cm-step-edit #ppMobileShell .pp-cm-edit-chrome,
  body.pp-cm-mobile.pp-cm-step-edit #ppMobileShell .pp-cm-edit-top,
  body.pp-cm-mobile.pp-cm-step-edit #ppMobileShell .pp-cm-sheet {
    pointer-events: auto;
  }

  .pp-cm-step { display: none; flex: 1; flex-direction: column; min-height: 0; }
  .pp-cm-step.is-active { display: flex; }

  .pp-cm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    min-height: 52px;
  }
  .pp-cm-header h1 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #111827;
  }
  .pp-cm-header .pp-cm-pill { flex-shrink: 0; margin-left: 8px; }
  .pp-cm-icon-btn {
    width: 44px; height: 44px; border: 0; background: transparent;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; color: #111827; cursor: pointer;
  }
  .pp-cm-logo { height: 28px; object-fit: contain; }
  .pp-cm-cart-wrap { position: relative; }
  .pp-cm-cart-badge {
    position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff;
    font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  }
  .pp-cm-pill {
    font-size: 12px; font-weight: 500; padding: 6px 10px; border-radius: 999px;
    background: #f3f4f6; color: #4b5563;
  }

  .pp-cm-scroll {
    flex: 1;
    overflow-x: clip;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: 24px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .pp-cm-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 4px 0 0;
    color: #111827;
  }
  .pp-cm-section-label {
    font-size: 15px;
    font-weight: 600;
    margin: 20px 0 0;
    color: #111827;
  }
  .pp-cm-sub { font-size: 14px; color: #6b7280; margin: 8px 0 0; line-height: 1.4; }

  .pp-cm-btn-primary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 52px; border: 0; border-radius: 16px;
    background: #2F6BFF; color: #fff; font-size: 16px; font-weight: 600;
    box-shadow: 0 8px 20px rgba(47, 107, 255, 0.25); cursor: pointer;
  }
  .pp-cm-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
  .pp-cm-btn-primary.soft { background: #4F7FFF; }
  .pp-cm-sticky .pp-cm-btn-primary {
    background: #2F6BFF;
    box-shadow: 0 10px 24px rgba(47, 107, 255, 0.3);
  }
  .pp-cm-hint { text-align: center; font-size: 12px; color: #9ca3af; margin-top: 8px; }

  #ppCmStepSelect .pp-cm-scroll { background: #f7f8fa; }
  #ppCmStepSelect .pp-cm-header,
  #ppCmStepLayout .pp-cm-header { background: #f7f8fa; border-bottom-color: #eef0f3; }
  #ppCmStepSelect .pp-cm-section-row { margin-top: 28px; }
  #ppCmCountBlock { margin-top: 8px; }
  #ppCmDesignerPick { margin-top: 24px; margin-bottom: 8px; }

  .pp-cm-pills { display: flex; gap: 8px; margin-top: 12px; }
  .pp-cm-pill-btn {
    flex: 1; min-height: 44px; border-radius: 999px; border: 1px solid #e5e7eb;
    background: #fff; font-size: 13px; font-weight: 500; color: #374151; cursor: pointer;
  }

  .pp-cm-section-row {
    display: flex; align-items: center; justify-content: space-between; margin-top: 24px;
  }
  .pp-cm-section-row h2 { font-size: 16px; font-weight: 600; margin: 0; color: #111827; }
  .pp-cm-link {
    border: 0; background: transparent; color: #2F6BFF; font-size: 13px; font-weight: 600; cursor: pointer;
  }

  .pp-cm-thumbs {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px;
  }
  .pp-cm-thumb {
    aspect-ratio: 1; border-radius: 12px; overflow: hidden; position: relative; background: #f3f4f6;
  }
  .pp-cm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pp-cm-thumb-x {
    position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0;
    border-radius: 999px; background: rgba(0,0,0,0.55); color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px;
  }

  .pp-cm-chips {
    display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .pp-cm-chips::-webkit-scrollbar { display: none; }
  .pp-cm-chip {
    flex: 0 0 auto;
    min-width: max-content;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 0;
    background: #eceff3;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
  }
  .pp-cm-chip.active { background: #2F6BFF; color: #fff; }

  #ppCmLayoutCats {
    flex-shrink: 0;
    margin-top: 0 !important;
  }

  .pp-cm-engine {
    background: #fff;
    border: 1px solid #e8eaee;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    max-width: 100%;
    box-sizing: border-box;
  }
  .pp-cm-engine-hero-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #2F6BFF;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
  }
  .pp-cm-engine-hero-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 8px;
    color: #111827;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }
  .pp-cm-engine-hero-sub {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.45;
    margin: 0 0 12px;
    overflow-wrap: anywhere;
  }
  .pp-cm-autofit-bullets {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
  }
  .pp-cm-autofit-bullets li::before {
    content: '·';
    margin-right: 6px;
    color: #2F6BFF;
    font-weight: 700;
  }
  .pp-cm-advanced {
    margin-top: 14px;
    border-top: 1px solid #eef0f3;
    padding-top: 12px;
  }
  .pp-cm-advanced summary {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .pp-cm-advanced summary::-webkit-details-marker { display: none; }
  .pp-cm-advanced summary::after {
    content: '+';
    font-size: 18px;
    font-weight: 400;
    color: #9ca3af;
  }
  .pp-cm-advanced[open] summary::after { content: '−'; }
  .pp-cm-advanced-body { padding-top: 12px; }
  .pp-cm-engine-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 8px;
  }
  .pp-cm-engine-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: -4px 0 10px;
    line-height: 1.35;
  }
  body.pp-cm-mobile #ppMobileShell button.pp-cm-autofit {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    display: block;
    box-sizing: border-box;
    text-align: left;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    background: linear-gradient(135deg, #eef2ff 0%, #eff6ff 100%);
    padding: 12px 14px;
    cursor: pointer;
    color: #111827;
    white-space: normal !important;
  }
  .pp-cm-autofit {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    background: linear-gradient(135deg, #eef2ff 0%, #eff6ff 100%);
    padding: 12px 14px;
    cursor: pointer;
    color: #111827;
  }
  .pp-cm-autofit[aria-pressed="true"],
  .pp-cm-autofit.is-active {
    border-color: #2F6BFF;
    box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.18);
  }
  .pp-cm-autofit-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 6px 12px;
    width: 100%;
    min-width: 0;
  }
  .pp-cm-autofit-icon {
    grid-row: 1 / span 2;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #2F6BFF);
    color: #fff;
    -webkit-text-fill-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    align-self: start;
  }
  .pp-cm-autofit-title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
  }
  .pp-cm-autofit-title-row strong {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #111827;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .pp-cm-autofit-desc {
    grid-column: 2;
    margin: 0;
    font-size: 12px;
    color: #4b5563;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .pp-cm-autofit-check {
    color: #2F6BFF;
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
    display: none;
  }
  .pp-cm-autofit.is-active .pp-cm-autofit-check { display: block; }

  .pp-cm-style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  body.pp-cm-mobile #ppMobileShell button.pp-cm-style-card {
    min-height: 64px;
    height: auto !important;
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    white-space: normal !important;
    box-sizing: border-box;
  }
  .pp-cm-style-card {
    min-height: 64px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
  }
  .pp-cm-style-card i { font-size: 16px; color: #6b7280; }
  .pp-cm-style-card.active {
    border-color: #2F6BFF;
    background: #eff6ff;
    color: #1d4ed8;
  }
  .pp-cm-style-card.active i { color: #2F6BFF; }

  .pp-cm-engine-divider {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    margin: 18px 0 12px;
    position: relative;
  }
  .pp-cm-engine-divider::before,
  .pp-cm-engine-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 28%;
    height: 1px;
    background: #e5e7eb;
  }
  .pp-cm-engine-divider::before { left: 0; }
  .pp-cm-engine-divider::after { right: 0; }

  .pp-cm-designer {
    margin-top: 20px; display: flex; align-items: center; gap: 12px;
    padding: 16px; border-radius: 16px; background: #f3e8ff; text-decoration: none; color: inherit; border: 0; width: 100%; text-align: left; cursor: pointer;
  }
  .pp-cm-designer-icon {
    width: 40px; height: 40px; border-radius: 999px; background: rgba(255,255,255,0.85);
    display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
  }
  .pp-cm-designer strong { display: block; font-size: 15px; }
  .pp-cm-designer span { display: block; font-size: 12px; color: #4b5563; margin-top: 2px; line-height: 1.35; }

  .pp-cm-sticky {
    flex-shrink: 0; background: #fff; border-top: 1px solid #f3f4f6;
    padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .pp-cm-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }
  .pp-cm-layout-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    text-align: left;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    font: inherit;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .pp-cm-layout-card.selected {
    border-color: #2F6BFF;
    box-shadow: 0 0 0 2px rgba(47,107,255,0.2);
  }
  /* Height is set in JS to offsetWidth (bulletproof square). Fallbacks below. */
  .pp-cm-layout-preview-wrap {
    position: relative;
    width: 100%;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    min-height: 148px;
    background: #cfd5de;
    overflow: hidden;
    border-radius: 0;
  }
  .pp-cm-layout-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  .pp-cm-slot {
    position: absolute;
    overflow: hidden;
    background: #9aa3b2;
    box-sizing: border-box;
    border: 2px solid #fff;
    border-radius: 2px;
  }
  .pp-cm-slot img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    pointer-events: none;
  }
  .pp-cm-layout-meta {
    display: block;
    padding: 10px 10px 12px;
    background: #fff;
    border-top: 1px solid #eef0f3;
    flex: 0 0 auto;
  }
  .pp-cm-layout-meta .name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
  }
  .pp-cm-layout-meta .name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .pp-cm-layout-meta .name-row > span:first-child {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .pp-cm-layout-meta .desc {
    font-size: 12px;
    color: #6b7280;
    margin-top: 3px;
    line-height: 1.3;
  }
  .pp-cm-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 999px;
    background: #2F6BFF;
    color: #fff;
    white-space: nowrap;
    display: inline-block;
  }

  .pp-cm-layout-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 16px;
    color: #6b7280;
    font-size: 14px;
  }

  /* Edit chrome overlays top + bottom of viewport */
  .pp-cm-edit-top {
    display: none;
    position: fixed;
    left: 0; right: 0; top: 0;
    z-index: 10060;
    pointer-events: auto;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 6px 8px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
  }
  .pp-cm-edit-top h1 { font-size: 16px; font-weight: 600; margin: 0; color: #111827; }
  .pp-cm-edit-actions { display: flex; align-items: center; gap: 2px; }
  .pp-cm-edit-actions .pp-cm-icon-btn { color: #111827; -webkit-text-fill-color: #111827; }
  .pp-cm-save-btn {
    height: 36px; padding: 0 12px; border-radius: 999px; border: 0;
    background: #f3f4f6; color: #111827; -webkit-text-fill-color: #111827;
    font-size: 13px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
  }
  .pp-cm-edit-chrome {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10060;
    pointer-events: auto;
  }
  body.pp-cm-mobile.pp-cm-step-edit .pp-cm-edit-chrome { display: block; }
  body.pp-cm-mobile.pp-cm-step-edit .pp-cm-edit-top { display: flex; }
  body.pp-cm-mobile.pp-cm-step-edit .app-header { display: none !important; }
  body.pp-cm-mobile.pp-cm-step-edit .workspace {
    height: calc(100dvh - 52px - 56px - 58px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    margin-top: calc(52px + env(safe-area-inset-top, 0px));
  }

  .pp-cm-tools {
    display: flex; justify-content: space-around; align-items: center;
    background: #fff; border-top: 1px solid #e5e7eb; padding: 6px 4px;
  }
  .pp-cm-tool {
    flex: 1; min-height: 48px; border: 0; background: transparent; color: #6b7280;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 11px; cursor: pointer;
  }
  .pp-cm-tool.active { color: #2F6BFF; font-weight: 600; }
  .pp-cm-tool i { font-size: 18px; }

  .pp-cm-edit-cta {
    display: flex; gap: 8px; background: #fff;
    padding: 8px 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #f3f4f6;
  }
  .pp-cm-btn-outline {
    flex: 1; min-height: 48px; border-radius: 12px; border: 2px solid #2F6BFF;
    background: #fff; color: #2F6BFF; font-weight: 600; font-size: 14px;
    display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  }
  .pp-cm-btn-order {
    flex: 1.25; min-height: 48px; border-radius: 12px; border: 0;
    background: #2F6BFF; color: #fff; font-weight: 600; font-size: 14px;
    display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
    box-shadow: 0 6px 16px rgba(47,107,255,0.28);
  }

  /* Soft print preview */
  .pp-cm-print-hero {
    margin-top: 8px; background: #f8fafc; border-radius: 16px; padding: 16px;
    display: flex; align-items: center; justify-content: center;
  }
  .pp-cm-print-stage {
    width: 100%; max-width: 260px; background: #fff; border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15,23,42,0.1); overflow: hidden;
  }
  .pp-cm-print-stage img { width: 100%; display: block; }
  .pp-cm-mat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
    align-items: stretch;
  }
  body.pp-cm-mobile #ppMobileShell button.pp-cm-mat {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    width: 100%;
    min-width: 0;
    min-height: 76px;
    height: auto !important;
    box-sizing: border-box;
    text-align: left;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    white-space: normal !important;
    overflow: hidden;
    color: #111827;
    -webkit-text-fill-color: #111827;
  }
  body.pp-cm-mobile #ppMobileShell button.pp-cm-mat.selected {
    border-color: #2F6BFF !important;
    border-width: 2px !important;
    background: #eff6ff !important;
    box-shadow: 0 0 0 1px rgba(47, 107, 255, 0.25);
  }
  body.pp-cm-mobile #ppMobileShell button.pp-cm-mat[aria-pressed="true"] {
    border-color: #2F6BFF !important;
  }
  .pp-cm-mat.selected { border-color: #2F6BFF; border-width: 2px; background: #eff6ff; }
  body.pp-cm-mobile #ppMobileShell button.pp-cm-mat strong {
    display: block !important;
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    color: #111827;
    -webkit-text-fill-color: #111827;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  body.pp-cm-mobile #ppMobileShell button.pp-cm-mat span {
    display: block !important;
    width: 100%;
    font-size: 11px;
    color: #6b7280;
    -webkit-text-fill-color: #6b7280;
    margin-top: 4px;
    line-height: 1.3;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  .pp-cm-warn {
    margin-top: 16px; padding: 12px; border-radius: 16px;
    background: #fffbeb; border: 1px solid #fde68a;
  }
  .pp-cm-warn strong { display: block; font-size: 13px; color: #78350f; }
  .pp-cm-warn-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
  .pp-cm-warn-actions button {
    min-height: 40px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer;
  }
  .pp-cm-warn-actions .alt { background: #fff; border: 1px solid #fcd34d; color: #78350f; }
  .pp-cm-warn-actions .go { background: #78350f; border: 0; color: #fff; }

  .pp-cm-empty {
    margin-top: 28px; text-align: center; color: #6b7280; font-size: 14px; line-height: 1.45;
  }

  .pp-cm-loading {
    display: none; position: absolute; inset: 0; background: rgba(255,255,255,0.82);
    z-index: 20; align-items: center; justify-content: center; flex-direction: column; gap: 10px;
    color: #111827;
  }
  .pp-cm-loading span { color: #374151; }

  /* Edit step: legacy settings bottom sheet stays dark-themed */
  body.pp-cm-mobile.pp-cm-step-edit .settings-panel .panel-title,
  body.pp-cm-mobile.pp-cm-step-edit .settings-panel .control-label,
  body.pp-cm-mobile.pp-cm-step-edit .settings-panel .panel-inner {
    color: #fafafa;
    -webkit-text-fill-color: #fafafa;
  }
  .pp-cm-loading.is-on { display: flex; }

  /* More sheet */
  .pp-cm-sheet {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10070;
    background: #fff; border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.12);
    max-height: 55vh; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .pp-cm-sheet.is-open { display: block; }
  .pp-cm-sheet-handle {
    width: 40px; height: 4px; border-radius: 999px; background: #d1d5db; margin: 6px auto 12px;
  }
  .pp-cm-sheet h3 { margin: 0 0 12px; font-size: 16px; color: #111827; }
  .pp-cm-sheet-list { display: grid; gap: 8px; }
  .pp-cm-sheet-list button {
    min-height: 48px; border-radius: 12px; border: 1px solid #e5e7eb; background: #fff;
    text-align: left; padding: 0 14px; font-size: 14px; font-weight: 600; cursor: pointer;
    color: #111827 !important; /* page body is white text — force readable labels */
    display: flex; align-items: center; gap: 10px; width: 100%;
    -webkit-text-fill-color: #111827;
  }
  .pp-cm-sheet-list button i {
    width: 22px; text-align: center; color: #2F6BFF; font-size: 15px;
  }

  /* Global engine progress must sit above mobile wizard (z-index 10050) */
  body.pp-cm-mobile #loadingOverlay {
    z-index: 10180 !important;
    background: rgba(15, 23, 42, 0.88);
  }
  body.pp-cm-mobile #loadingText {
    color: #f9fafb !important;
    font-size: 15px !important;
    font-weight: 600;
    text-align: center;
    max-width: 85vw;
    line-height: 1.4;
    padding: 0 12px;
  }
}

@media (min-width: 768px) {
  #ppMobileShell { display: none !important; }
}
