/* SlideCV builder mobile rescue layout */
@media (max-width: 820px) {
  html,
  body,
  #root {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    background: #f3f6fb !important;
  }

  body * {
    box-sizing: border-box !important;
  }

  body .app-shell {
    min-height: 100dvh !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  body .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    width: 100% !important;
    min-height: 62px !important;
    height: auto !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    padding: 9px 10px !important;
    background: rgba(255,255,255,.96) !important;
    border-bottom: 1px solid rgba(226,232,240,.95) !important;
    box-shadow: 0 10px 28px rgba(15,23,42,.08) !important;
    backdrop-filter: blur(18px) !important;
  }

  body .brand-mark {
    min-width: 0 !important;
    gap: 8px !important;
  }

  body .brand-mark span {
    width: 34px !important;
    height: 34px !important;
    border-radius: 12px !important;
    flex: 0 0 auto !important;
  }

  body .brand-mark strong {
    font-size: 16px !important;
  }

  body .brand-mark small,
  body .top-center {
    display: none !important;
  }

  body .top-actions {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
  }

  body .top-actions .soft-btn {
    display: none !important;
  }

  body .top-actions .primary-btn {
    min-width: 112px !important;
    width: auto !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 12px !important;
    border-radius: 13px !important;
    font-size: 12px !important;
    box-shadow: none !important;
  }

  body .top-actions .primary-btn svg {
    width: 15px !important;
    height: 15px !important;
  }

  body .workspace {
    height: auto !important;
    min-height: calc(100dvh - 62px) !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    padding-bottom: 92px !important;
  }

  body .rail {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    top: auto !important;
    z-index: 80 !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    padding: 7px !important;
    border: 1px solid rgba(203,213,225,.95) !important;
    border-radius: 22px !important;
    background: rgba(255,255,255,.97) !important;
    box-shadow: 0 20px 52px rgba(15,23,42,.2) !important;
    backdrop-filter: blur(18px) !important;
    overflow: hidden !important;
  }

  body .rail button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 50px !important;
    border-radius: 16px !important;
    padding: 6px 2px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
  }

  body .rail button svg {
    width: 17px !important;
    height: 17px !important;
  }

  body .left-panel,
  body .preview-stage,
  body .right-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body .left-panel {
    order: 1 !important;
    border-right: 0 !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: rgba(255,255,255,.88) !important;
    overflow: visible !important;
  }

  body .right-panel {
    display: none !important;
  }

  body .panel-inner {
    padding: 16px 12px 14px !important;
  }

  body .panel-heading {
    margin-bottom: 12px !important;
  }

  body .panel-heading h2 {
    font-size: 24px !important;
    line-height: 1.08 !important;
    letter-spacing: -.045em !important;
  }

  body .panel-heading span {
    font-size: 13px !important;
    line-height: 1.45 !important;
  }

  body .section-tabs {
    display: flex !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding-bottom: 4px !important;
    margin-bottom: 12px !important;
    scrollbar-width: none !important;
  }

  body .section-tabs::-webkit-scrollbar {
    display: none !important;
  }

  body .section-tabs button {
    flex: 0 0 auto !important;
    min-width: 126px !important;
    min-height: 42px !important;
    padding: 9px 10px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  body .editor-card,
  body .collapse-card,
  body .template-card,
  body .right-card,
  body .hint-box {
    border-radius: 18px !important;
  }

  body .field input,
  body .field textarea,
  body .field select,
  body .control-field select,
  body .search-box input,
  body .tag-pill-edit input,
  body .add-inline input {
    min-height: 46px !important;
    font-size: 16px !important;
  }

  body .field textarea {
    min-height: 104px !important;
  }

  body .two-col-inputs,
  body .quick-grid,
  body .add-inline {
    grid-template-columns: 1fr !important;
  }

  body .template-card {
    grid-template-columns: 72px minmax(0, 1fr) !important;
    gap: 10px !important;
    min-height: auto !important;
    padding: 10px !important;
  }

  body .template-thumb {
    width: 72px !important;
    height: 96px !important;
    padding: 8px !important;
  }

  body .template-meta p {
    display: none !important;
  }

  body .preview-stage {
    order: 2 !important;
    min-height: 620px !important;
    overflow: hidden !important;
    padding: 16px 0 28px !important;
    background: linear-gradient(180deg, #eef2f7, #e8edf4) !important;
  }

  body .canvas-toolbar {
    width: calc(100% - 22px) !important;
    margin: 0 auto 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
  }

  body .canvas-toolbar h1 {
    font-size: 20px !important;
    line-height: 1.1 !important;
    letter-spacing: -.04em !important;
  }

  body .crumb {
    font-size: 10px !important;
  }

  body .zoom-tools {
    padding: 4px !important;
    gap: 5px !important;
    flex: 0 0 auto !important;
  }

  body .zoom-tools button {
    width: 30px !important;
    height: 30px !important;
  }

  body .zoom-tools span {
    min-width: 42px !important;
    font-size: 12px !important;
  }

  body .page-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 540px !important;
    overflow: visible !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding: 18px 0 0 !important;
  }

  body .resume-page {
    width: 794px !important;
    min-width: 794px !important;
    transform: scale(.43) !important;
    transform-origin: top center !important;
    box-shadow: 0 18px 44px rgba(15,23,42,.20) !important;
    border-radius: 10px !important;
  }
}

@media (max-width: 430px) {
  body .top-actions .primary-btn {
    min-width: 104px !important;
    font-size: 11px !important;
  }

  body .rail {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    padding: 6px !important;
  }

  body .panel-inner {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  body .preview-stage {
    min-height: 560px !important;
  }

  body .resume-page {
    transform: scale(.395) !important;
  }
}

@media (max-width: 375px) {
  body .resume-page {
    transform: scale(.365) !important;
  }
}
