/* Mobile form navigation moves existing controls; desktop restores their original DOM. */
@media (max-width: 980px) {
  #app .campaign-create__root { padding: 8px; --campaign-create-card-padding: 12px; --campaign-create-gap: 12px; }
  .campaign-create__root .campaign-create__page-header { flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; padding-bottom: 10px; margin-bottom: 12px; }
  .campaign-create__root .campaign-create__header-copy { text-align: right; }
  .campaign-create__root .campaign-create__header-copy h3 { font-size: 18px; }
  :is(#campaignForm, #campaignEditForm, #assetUploadForm).mobile-stepped-form { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto minmax(0, 1fr) auto; height: var(--mobile-form-height, 70dvh); min-height: 220px; max-height: calc(100dvh - 16px); min-width: 0; overflow: hidden; gap: 0; }
  .mobile-form-nav { grid-row: 1; display: flex; gap: 6px; margin-block: 0 14px; }
  .mobile-form-nav button { flex: 1; min-width: 0; min-height: 48px; padding: 8px 4px; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); }
  form .mobile-form-nav button[aria-current="step"] { border-color: var(--primary); color: var(--primary); font-weight: 800; }
  .mobile-form-section { grid-row: 2; overflow-y: auto; overscroll-behavior: contain; padding: 0 2px 16px; align-content: start; display: grid; gap: 14px; min-width: 0; scroll-margin-block: 16px; }
  .mobile-form-section[hidden] { display: none !important; }
  .mobile-form-section:has(> .campaign-create__information, > .campaign-create__actions) > h4 { display: none; }
  .mobile-form-section .campaign-create__section-number { display: none; }
  .mobile-form-section > h4 { margin: 0; }
  .mobile-form-section :is(label, fieldset, .full-field, .form-actions) { min-width: 0; max-width: 100%; }
  .mobile-form-section :is(.campaign-create__information-grid, .campaign-form-subgrid, .action-head, .game-row, .campaign-edit-general-info, .campaign-edit-ad-grid, .asset-creative-workspace) { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; width: 100%; }
  .mobile-form-section :is(.action-row-wrap, .game-row-wrap, .campaign-create__action-title) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
  .mobile-form-section button { min-height: 44px; }
  .mobile-form-section .action-type-menu { position: static; width: 100%; min-width: 0; max-height: 50dvh; overflow-y: auto; }
  .mobile-form-section .mobile-row-label { display: grid; gap: 6px; }
  .mobile-form-section .action-block { padding: 12px; min-width: 0; }
  .mobile-form-section .game-row-wrap { padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-block: 12px; }
  .mobile-form-section :is(.remove-action-block, .remove-game-row, .add-game-row-btn, .add-action-top-btn) { width: auto; min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .mobile-form-section :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { min-width: 0; max-width: 100%; font-size: 16px; min-height: 44px; }
  .mobile-form-section input:is([type="checkbox"], [type="radio"]) { width: 18px; height: 18px; min-height: 18px; min-width: 18px; }
  .mobile-form-section .asset-purpose-toggle label { position: relative; min-width: 0; }
  .mobile-form-section .asset-purpose-toggle span { min-height: 44px; }
  .mobile-form-section .asset-purpose-toggle input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
  .mobile-form-section input[type="file"] { width: 100%; padding: 8px; }
  .mobile-form-section :is(.form-actions, .campaign-create__review) { display: flex; flex-wrap: wrap; gap: 10px; position: static; padding: 12px 0; }
  .mobile-form-section .form-error { flex-basis: 100%; width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .mobile-form-section .form-actions button { min-height: 48px; flex: 1 1 140px; }
  .mobile-form-toolbar { grid-row: 3; flex-wrap: wrap; display: flex; justify-content: space-between; gap: 12px; padding-block: 14px max(14px, env(safe-area-inset-bottom)); }
  .mobile-form-toolbar .form-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin: 0; padding: 0; }
  .mobile-form-toolbar .campaign-create__review-copy { display: none; }
  .mobile-form-toolbar .form-error { width: 100%; flex: 0 0 100%; flex-basis: 100%; max-height: 80px; overflow-y: auto; margin: 0; font-size: 13px; }
  .mobile-form-toolbar .form-actions button { min-height: 48px; flex: 1 1 130px; }
  .mobile-form-toolbar button { min-height: 48px; flex: 1; }
  .modal #campaignEditForm { scroll-margin-block-start: 64px; }
  .mobile-form-review { display: grid; grid-template-columns: minmax(80px, .4fr) minmax(0, 1fr); gap: 12px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .mobile-form-review dt { color: var(--muted); }
  .mobile-form-review dd { margin: 0; overflow-wrap: anywhere; }
  .mobile-form-review-modal { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden !important; }
  .mobile-form-review-modal .modal-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
  .mobile-form-review-modal .campaign-review-layout { grid-template-columns: minmax(0, 1fr); }
  .mobile-form-review-modal .campaign-review-main { display: block; }
  .mobile-form-review-modal .campaign-review-offer { min-width: 0; padding: 12px; background: var(--surface); color: var(--ink); }
  .mobile-form-review-modal .campaign-offer-summary { display: grid; grid-template-columns: minmax(0, 1fr); white-space: normal; }
  .mobile-form-review-modal .campaign-offer-preview-table { max-height: none; overflow: visible !important; }
  .mobile-form-review-modal .campaign-review-offer .mobile-record-table :is(td, th) { width: auto !important; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .mobile-form-review-modal .campaign-offer-recipient-option { min-height: 44px; font-size: 14px; }
  .mobile-review-footer { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 12px max(12px, env(safe-area-inset-bottom)); }
  .mobile-review-footer > button { flex: 1 1 140px; min-height: 48px; }
  .mobile-review-footer > p { flex: 0 0 100%; width: 100%; margin: 0; max-height: 80px; overflow-y: auto; }
  .mobile-review-footer .mobile-review-return { margin: 0; }
  .mobile-review-return { min-height: 44px; margin-block-end: 14px; }
  /* Inline calendars scroll with the section rather than covering inputs/actions. */
  :is(#campaignForm, #campaignEditForm) .campaign-date-range-panel { position: static !important; inset: auto !important; transform: none !important; width: 100%; min-width: 0; max-width: 100%; max-height: none; overflow: visible; margin-block: 8px; }
  .mobile-form-section .topbar-range-months { display: grid; grid-template-columns: minmax(0, 1fr); }
  .mobile-form-section :is(.campaign-range-datetime-fields, .campaign-edit-range-datetime-fields) { grid-template-columns: minmax(0, 1fr); }
  .mobile-form-section .topbar-range-days button { min-height: 40px; min-width: 0; }
  .mobile-form-section .topbar-range-footer { flex-wrap: wrap; gap: 12px; }
  .jalali-picker { inset: max(8px, env(safe-area-inset-top)) 8px auto !important; width: auto !important; max-width: 420px; max-height: calc(100dvh - 16px); overflow-y: auto; z-index: 100000; }
  .jalali-picker :is(button, select) { min-height: 40px; }
  /* The original upload preview, resize tool, progress and retry buttons stay intact. */
  .mobile-form-section .asset-creative-workspace { direction: rtl; padding: 10px; }
  .mobile-form-section :is(.asset-live-preview-panel, .asset-upload-control-panel) { grid-column: 1; order: initial; width: 100%; }
  .mobile-form-section .asset-upload-control-panel { grid-row: 1; }
  .mobile-form-section .asset-live-preview-panel { grid-row: 2; }
  .mobile-form-section :is(.asset-resize-tool, .asset-placement-preview, canvas, img, video) { min-width: 0; max-width: 100%; }
  .mobile-form-section .asset-game-menu { position: static; width: 100%; max-height: 50dvh; overflow-y: auto; }
  .mobile-form-section .asset-game-grid { grid-template-columns: minmax(0, 1fr); }
  .mobile-form-section .asset-game-option { min-height: 44px; }
  .mobile-form-section .asset-upload-progress { width: 100%; }
  .mobile-form-section .asset-file-pill { grid-template-columns: minmax(0, 1fr); }
  /* Keep focused fields above the keyboard, with controls in normal document flow. */
  .mobile-form-section :is(input, select, textarea) { scroll-margin-block: 90px; }
}
