/* ==========================================================================
   QUOTEMAKER MOBILE APP-STYLE EXPERIENCE (NATIVE FEEL FOR PHONE/TABLET)
   Strictly isolated to mobile viewports (<= 900px).
   DESKTOP (>= 901px) REMAINS 100% UNTOUCHED.
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. DESKTOP GUARD: Guarantee zero mobile elements render on desktop
   ------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .mobile-only,
  .mobile-bottom-nav,
  .mobile-sheet-backdrop,
  .mobile-sheet-modal,
  .mobile-stepper-bar,
  .mobile-sticky-bar,
  .mobile-sticky-action-bar,
  .mobile-item-card-list,
  .mobile-card-quote-item,
  .mobile-quotes-card-wrap,
  .mobile-quote-card,
  .ws-mob-dash-hero,
  .ws-mob-subhead-bar,
  .mob-browse-all-templates-btn,
  .btn-design-browse-more {
    display: none !important;
  }
}

/* Guided editing is the primary mobile experience; preview is the review step. */
@media (max-width:900px){
  body.page-generator .mobile-view-mode-inner{padding:4px;background:#eef0f5;border:1px solid #e4e7ee}
  body.page-generator .mob-view-tab-btn{min-height:44px;font-size:13px}
  body.page-generator .mobile-stepper-bar{scrollbar-width:none}
  body.page-generator .mobile-step-pill{min-height:44px;white-space:nowrap}
  body.page-generator .ct-mob-action-wa{background:#fff;color:#334155;border:1px solid #dfe3ea;box-shadow:none}
  body.page-generator .ct-mob-action-primary{box-shadow:0 10px 24px -14px rgba(124,58,237,.8)}
  body.page-generator input,body.page-generator select,body.page-generator textarea{font-size:16px}
}

/* -------------------------------------------------------------------------
   2. MOBILE VIEWPORTS (<= 767px) APP-STYLE SHELL
   ------------------------------------------------------------------------- */
@media (max-width: 767px) {

  /* Safe Area & Viewport Handling */
  body.has-mobile-nav {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 16px)) !important;
  }

  body.has-mobile-nav .main-content,
  body.has-mobile-nav .main-content-workspace {
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 16px)) !important;
  }

  /* Hide wide desktop tables on phone/tablet, show mobile cards instead */
  .ws-table-wrap {
    display: none !important;
  }

  /* Hide floating feedback trigger on mobile viewports so it does not obscure bottom navigation or buttons */
  #ct-floating-feedback-trigger {
    display: none !important;
  }

  /* -------------------------------------------------------------------------
     3. FIXED MOBILE BOTTOM NAVIGATION
     ------------------------------------------------------------------------- */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 990;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    user-select: none;
    font-family: var(--ct-font-display, 'Plus Jakarta Sans', 'Manrope', -apple-system, sans-serif);
  }

  [data-theme='dark'] .mobile-bottom-nav {
    background: rgba(18, 14, 26, 0.96);
    border-top-color: rgba(60, 49, 74, 0.85);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    padding: 4px 0;
    text-decoration: none;
    color: #64748B;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
  }

  [data-theme='dark'] .mobile-nav-item {
    color: #94A3B8;
  }

  .mobile-nav-item svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.9;
    transition: all 0.18s ease;
  }

  .mobile-nav-item.active {
    color: #7C3AED;
    font-weight: 750;
  }

  [data-theme='dark'] .mobile-nav-item.active {
    color: #C084FC;
  }

  .mobile-nav-item.active svg {
    stroke-width: 2.2;
    transform: translateY(-1px);
  }

  /* Center Floating '+' Button for New Quotation */
  .mobile-nav-fab-wrap {
    flex: 0 0 58px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: -18px;
  }

  .mobile-nav-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #7C3AED;
    border: 3px solid #FFFFFF;
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
    text-decoration: none;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, background 0.18s ease;
    -webkit-tap-highlight-color: transparent;
  }

  [data-theme='dark'] .mobile-nav-fab {
    border-color: #120E1A;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.5);
  }

  .mobile-nav-fab:active {
    transform: scale(0.92);
    background: #6D28D9;
  }

  .mobile-nav-fab svg {
    width: 24px;
    height: 24px;
    stroke: #FFFFFF;
    stroke-width: 2.5;
  }

  /* -------------------------------------------------------------------------
     4. MOBILE BOTTOM SHEET SYSTEM
     ------------------------------------------------------------------------- */
  .mobile-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
  }

  .mobile-sheet-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  .mobile-sheet-modal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    background: #FFFFFF;
    border-radius: 24px 24px 0 0;
    padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(105%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
  }

  [data-theme='dark'] .mobile-sheet-modal {
    background: #181324;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-sheet-backdrop.active .mobile-sheet-modal {
    transform: translateY(0);
  }

  .mobile-sheet-drag-handle {
    width: 42px;
    height: 4.5px;
    border-radius: 999px;
    background: #CBD5E1;
    margin: 4px auto 16px;
  }

  [data-theme='dark'] .mobile-sheet-drag-handle {
    background: #475569;
  }

  .mobile-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #F1F5F9;
  }

  [data-theme='dark'] .mobile-sheet-header {
    border-bottom-color: #261F32;
  }

  .mobile-sheet-title {
    font-size: 17px;
    font-weight: 750;
    color: #0F172A;
    margin: 0;
    letter-spacing: -0.02em;
  }

  [data-theme='dark'] .mobile-sheet-title {
    color: #F8FAFC;
  }

  .mobile-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F1F5F9;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748B;
    font-size: 16px;
    cursor: pointer;
  }

  [data-theme='dark'] .mobile-sheet-close {
    background: #261F32;
    color: #CBD5E1;
  }

  /* Sheet Navigation Rows (For "More" Sheet) */
  .mobile-sheet-group {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
  }

  [data-theme='dark'] .mobile-sheet-group {
    background: #1F192C;
    border-color: #332747;
  }

  .mobile-sheet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    color: #0F172A;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #E2E8F0;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    cursor: pointer;
    box-sizing: border-box;
    text-align: left;
    transition: background 0.15s ease;
  }

  [data-theme='dark'] .mobile-sheet-row {
    color: #F8FAFC;
    border-bottom-color: #332747;
  }

  .mobile-sheet-row:last-child {
    border-bottom: none;
  }

  .mobile-sheet-row:active {
    background: rgba(124, 58, 237, 0.08);
  }

  .mobile-sheet-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .mobile-sheet-row-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(124, 58, 237, 0.1);
    color: #7C3AED;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  [data-theme='dark'] .mobile-sheet-row-icon {
    background: rgba(124, 58, 237, 0.22);
    color: #C084FC;
  }

  .mobile-sheet-row-icon svg {
    width: 17px;
    height: 17px;
  }

  .mobile-sheet-row-chevron {
    color: #94A3B8;
    font-size: 16px;
  }

  /* -------------------------------------------------------------------------
     5. MOBILE APP HEADER (TOP BAR)
     ------------------------------------------------------------------------- */
  .mobile-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: sticky;
    top: 0;
    z-index: 850;
    box-sizing: border-box;
  }

  [data-theme='dark'] .mobile-app-header {
    background: rgba(18, 14, 26, 0.95);
    border-bottom-color: rgba(60, 49, 74, 0.8);
  }

  .mobile-app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
  }

  .mobile-app-logo img {
    height: 26px;
    width: auto;
  }

  .mobile-app-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-header-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
  }

  [data-theme='dark'] .mobile-header-btn {
    background: #261F32;
    border-color: #3C314A;
    color: #CBD5E1;
  }

  .mobile-header-btn svg {
    width: 17px;
    height: 17px;
  }

  /* -------------------------------------------------------------------------
     6. MOBILE TOUCH QUOTATION CARDS (REPLACES TABLES ON PHONE)
     ------------------------------------------------------------------------- */
  .mobile-quotes-card-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
  }

  .mobile-quote-card {
    background: #FFFFFF;
    border: 1px solid #E8EBF2;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    transition: transform 0.15s ease, border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  [data-theme='dark'] .mobile-quote-card {
    background: #14101F;
    border-color: #2A2139;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }

  .mobile-quote-card:active {
    transform: scale(0.985);
    border-color: #7C3AED;
  }

  .mobile-quote-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }

  .mobile-quote-num {
    font-size: 13px;
    font-weight: 750;
    color: #7C3AED;
    letter-spacing: -0.01em;
  }

  [data-theme='dark'] .mobile-quote-num {
    color: #C084FC;
  }

  .mobile-quote-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
  }

  .mobile-quote-status-badge.status-draft {
    background: #F1F5F9;
    color: #475569;
  }

  .mobile-quote-status-badge.status-sent {
    background: #EFF6FF;
    color: #1D4ED8;
  }

  .mobile-quote-status-badge.status-approved,
  .mobile-quote-status-badge.status-accepted {
    background: #ECFDF5;
    color: #047857;
  }

  .mobile-quote-status-badge.status-rejected {
    background: #FEF2F2;
    color: #B91C1C;
  }

  .mobile-quote-client {
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 6px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  [data-theme='dark'] .mobile-quote-client {
    color: #F8FAFC;
  }

  .mobile-quote-card-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #E2E8F0;
  }

  [data-theme='dark'] .mobile-quote-card-meta {
    border-top-color: #261F32;
  }

  .mobile-quote-amount {
    font-size: 16px;
    font-weight: 800;
    color: #0F172A;
  }

  [data-theme='dark'] .mobile-quote-amount {
    color: #FFFFFF;
  }

  .mobile-quote-date {
    font-size: 11.5px;
    color: #64748B;
  }

  /* -------------------------------------------------------------------------
     7. STICKY ACTION BAR FOR GENERATOR & DETAIL SCREENS (CONTIANT EDITORIAL)
     ------------------------------------------------------------------------- */
  .mobile-sticky-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 920;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid #E4E7EB;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 12px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
  }

  [data-theme='dark'] .mobile-sticky-action-bar {
    background: rgba(18, 14, 26, 0.98);
    border-top-color: #2A2139;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.4);
  }

  .mobile-sticky-total-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    min-width: 0;
  }

  .mobile-sticky-total-label {
    font-family: var(--ct-font-body, 'Inter', -apple-system, sans-serif);
    font-size: 10px;
    font-weight: 700;
    color: #78758C;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.1;
    margin: 0 0 3px 0;
  }

  [data-theme='dark'] .mobile-sticky-total-label {
    color: #9AA5B1;
  }

  .mobile-sticky-total-val {
    font-family: var(--ct-font-display, 'Manrope', 'Plus Jakarta Sans', sans-serif);
    font-size: 17px;
    font-weight: 800;
    color: #0D0D0C;
    letter-spacing: -0.025em;
    line-height: 1.1;
    white-space: nowrap;
    margin: 0;
  }

  [data-theme='dark'] .mobile-sticky-total-val {
    color: #F8FAFC;
  }

  .mobile-sticky-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  /* -------------------------------------------------------------------------
     7B. MOBILE VIEW MODE SWITCHER (LIVE CANVAS VS FORM STEPS)
     ------------------------------------------------------------------------- */
  .mobile-view-mode-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border-bottom: 1px solid #E8EBF2;
    padding: 8px 14px;
    position: sticky;
    top: 0;
    z-index: 875;
  }

  [data-theme='dark'] .mobile-view-mode-bar {
    background: #14101F;
    border-bottom-color: #2A2139;
  }

  .mobile-view-mode-inner {
    display: flex;
    align-items: center;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 999px;
    padding: 3px;
    width: 100%;
    max-width: 380px;
    gap: 4px;
  }

  [data-theme='dark'] .mobile-view-mode-inner {
    background: #1E182D;
    border-color: #332747;
  }

  .mob-view-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #64748B;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mob-view-tab-btn.active {
    background: #7C3AED;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.28);
  }

  [data-theme='dark'] .mob-view-tab-btn {
    color: #94A3B8;
  }

  [data-theme='dark'] .mob-view-tab-btn.active {
    background: #8B5CF6;
    color: #FFFFFF;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.35);
  }

  /* -------------------------------------------------------------------------
     8. GUIDED MOBILE STEPPER FOR GENERATOR
     ------------------------------------------------------------------------- */
  .mobile-stepper-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FFFFFF;
    border-bottom: 1px solid #E8EBF2;
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 870;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .qm-canvas-active .mobile-stepper-bar,
  .qm-canvas-active #generator-mobile-stepper {
    display: none !important;
  }

  .mobile-stepper-bar::-webkit-scrollbar {
    display: none;
  }

  [data-theme='dark'] .mobile-stepper-bar {
    background: #14101F;
    border-bottom-color: #2A2139;
  }

  .mobile-step-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 650;
    color: #64748B;
    background: transparent;
    border: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
  }

  .mobile-step-num {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #E2E8F0;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 750;
  }

  .mobile-step-pill.active {
    background: rgba(124, 58, 237, 0.1);
    color: #7C3AED;
  }

  .mobile-step-pill.active .mobile-step-num {
    background: #7C3AED;
    color: #FFFFFF;
  }

  .mobile-step-pill.completed .mobile-step-num {
    background: #10B981;
    color: #FFFFFF;
  }

  /* -------------------------------------------------------------------------
     9. MOBILE ITEM CARD (IN PLACE OF DESKTOP SPREADSHEET TABLE)
     ------------------------------------------------------------------------- */
  .mobile-item-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }

  .mobile-item-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 13px 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  }

  [data-theme='dark'] .mobile-item-card {
    background: #1B1528;
    border-color: #332747;
  }

  .mobile-item-card-row1 {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-item-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #0F172A;
    margin: 0;
  }

  [data-theme='dark'] .mobile-item-card-title {
    color: #F8FAFC;
  }

  .mobile-item-card-row2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12.5px;
    color: #64748B;
  }

  .mobile-item-card-total {
    font-size: 14.5px;
    font-weight: 750;
    color: #0F172A;
  }

  [data-theme='dark'] .mobile-item-card-total {
    color: #F8FAFC;
  }

  .mobile-item-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #F1F5F9;
  }

  [data-theme='dark'] .mobile-item-card-actions {
    border-top-color: #2A2139;
  }

  .mobile-item-action-btn {
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #475569;
    cursor: pointer;
  }

  [data-theme='dark'] .mobile-item-action-btn {
    background: #251D30;
    border-color: #3C314A;
    color: #CBD5E1;
  }

  .mobile-item-action-btn.btn-delete {
    color: #EF4444;
    border-color: #FEE2E2;
  }

  [data-theme='dark'] .mobile-item-action-btn.btn-delete {
    border-color: #451A1A;
    color: #F87171;
  }

  /* -------------------------------------------------------------------------
     10. GENERATOR 5-STEP MOBILE VIEW CONTROLS
     ------------------------------------------------------------------------- */
  body.page-generator .mobile-bottom-nav {
    display: none !important;
  }

  body.page-generator {
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 16px)) !important;
  }

  /* Hide desktop items table & swipe hint on phone */
  #doc-items-table,
  .mobile-table-hint,
  .mobile-editor-bottom-bar,
  .mobile-tabs {
    display: none !important;
  }

  /* Step 1: Client & Document Details */
  .generator-editor-panel[data-mob-step-active="1"] .editor-card:not([data-mob-step="1"]) {
    display: none !important;
  }
  .generator-editor-panel[data-mob-step-active="1"] .editor-card[data-mob-step="1"] {
    display: block !important;
  }

  /* Step 2: Line Items */
  .generator-editor-panel[data-mob-step-active="2"] .editor-card:not([data-mob-step="2"]) {
    display: none !important;
  }
  .generator-editor-panel[data-mob-step-active="2"] .editor-card[data-mob-step="2"] {
    display: block !important;
  }

  /* Step 3: Pricing & Calculations */
  .generator-editor-panel[data-mob-step-active="3"] .editor-card:not(#card-payment-terms):not([data-mob-step*="3"]) {
    display: none !important;
  }
  .generator-editor-panel[data-mob-step-active="3"] #card-payment-terms,
  .generator-editor-panel[data-mob-step-active="3"] [data-mob-step*="3"] {
    display: block !important;
  }
  .generator-editor-panel[data-mob-step-active="3"] .footer-left {
    display: none !important;
  }
  .generator-editor-panel[data-mob-step-active="3"] .footer-right {
    display: block !important;
    width: 100% !important;
  }

  /* Step 4: Terms & Signatures */
  .generator-editor-panel[data-mob-step-active="4"] .editor-card:not(#card-payment-terms):not([data-mob-step*="4"]) {
    display: none !important;
  }
  .generator-editor-panel[data-mob-step-active="4"] #card-payment-terms,
  .generator-editor-panel[data-mob-step-active="4"] [data-mob-step*="4"] {
    display: block !important;
  }
  .generator-editor-panel[data-mob-step-active="4"] .footer-right {
    display: none !important;
  }
  .generator-editor-panel[data-mob-step-active="4"] .footer-left {
    display: block !important;
    width: 100% !important;
  }

  /* Step 5: Executive Preview */
  .generator-editor-panel.mobile-hidden {
    display: none !important;
  }
  /* Mobile Canvas-Only View & Live Studio */
  .generator-workspace.canvas-only-mode {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  .generator-workspace.canvas-only-mode #generator-editor {
    display: none !important;
  }
  .generator-workspace.canvas-only-mode #generator-preview {
    display: block !important;
    width: 100% !important;
  }

  /* Hide mobile stepper pills when in Live Canvas mode */
  .qm-canvas-active #generator-mobile-stepper {
    display: none !important;
  }

  /* Mobile Live Canvas Template & Color Selection Toolbar */
  .preview-toolbar#form-preview-toolbar {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px 14px !important;
    background: #FFFFFF !important;
    border-radius: 16px !important;
    border: 1px solid #E2E8F0 !important;
    margin: 8px 12px 10px !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
  }

  [data-theme='dark'] .preview-toolbar#form-preview-toolbar {
    background: #191426 !important;
    border-color: #332747 !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3) !important;
  }

  .preview-toolbar#form-preview-toolbar .preview-toolbar-styling {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .preview-toolbar#form-preview-toolbar .preview-tool-item {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .preview-toolbar#form-preview-toolbar .preview-tool-item::-webkit-scrollbar {
    display: none !important;
  }

  .preview-toolbar#form-preview-toolbar .preview-tool-label {
    font-size: 10.5px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #64748B !important;
    flex-shrink: 0 !important;
  }

  body.page-generator .design-pill-group:not(.qm-form-templates-grid),
  .preview-toolbar#form-preview-toolbar .design-pill-group:not(.qm-form-templates-grid) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    grid-template-columns: none !important;
    gap: 6px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 2px !important;
    width: 100% !important;
  }

  body.page-generator .design-pill-group:not(.qm-form-templates-strip):not(.qm-form-templates-grid)::-webkit-scrollbar,
  .preview-toolbar#form-preview-toolbar .design-pill-group:not(.qm-form-templates-strip):not(.qm-form-templates-grid)::-webkit-scrollbar {
    display: none !important;
  }

  body.page-generator .design-pill-group:not(.qm-form-templates-strip):not(.qm-form-templates-grid) .btn-design,
  .preview-toolbar#form-preview-toolbar .design-pill-group:not(.qm-form-templates-strip):not(.qm-form-templates-grid) .btn-design {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 6px 14px !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-height: unset !important;
  }

  .preview-toolbar#form-preview-toolbar .color-swatch-group {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    align-items: center !important;
    padding-bottom: 2px !important;
  }

  /* Quick Browse All Templates button in toolbar */
  .mob-browse-all-templates-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 3px 10px !important;
    background: #F3F0FF !important;
    border: 1px solid #DDD6FE !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    color: #7C3AED !important;
    cursor: pointer !important;
    transition: all 0.18s ease !important;
  }

  .mob-browse-all-templates-btn:active {
    background: #7C3AED !important;
    color: #FFFFFF !important;
  }

  [data-theme='dark'] .mob-browse-all-templates-btn {
    background: #251B38 !important;
    border-color: #4C356A !important;
    color: #C4B5FD !important;
  }

  .btn-design-browse-more {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 12px !important;
    font-weight: 750 !important;
    padding: 6px 14px !important;
    border-radius: 9999px !important;
    background: #F5F3FF !important;
    border: 1.5px dashed #7C3AED !important;
    color: #7C3AED !important;
    cursor: pointer !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  [data-theme='dark'] .btn-design-browse-more {
    background: #201730 !important;
    border-color: #8B5CF6 !important;
    color: #C4B5FD !important;
  }

  /* Mobile Template Gallery Bottom Sheet Grid */
  .mob-templates-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-top: 12px !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 12px)) !important;
  }

  .mob-sheet-template-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 12px 14px !important;
    border-radius: 16px !important;
    background: #F8FAFC !important;
    border: 1.5px solid #E2E8F0 !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative !important;
    box-sizing: border-box !important;
  }

  .mob-sheet-template-card:active {
    transform: scale(0.97) !important;
  }

  .mob-sheet-template-card.active {
    background: #F5F3FF !important;
    border-color: #7C3AED !important;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18) !important;
  }

  [data-theme='dark'] .mob-sheet-template-card {
    background: #191426 !important;
    border-color: #332747 !important;
  }

  [data-theme='dark'] .mob-sheet-template-card.active {
    background: #251B38 !important;
    border-color: #A78BFA !important;
  }

  .mob-card-top-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-bottom: 5px !important;
  }

  .mob-card-name {
    font-size: 13.5px !important;
    font-weight: 800 !important;
    color: #0F172A !important;
  }

  [data-theme='dark'] .mob-card-name {
    color: #F8FAFC !important;
  }

  .mob-card-badge {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    padding: 2px 7px !important;
    border-radius: 999px !important;
    background: #E2E8F0 !important;
    color: #475569 !important;
  }

  [data-theme='dark'] .mob-card-badge {
    background: #2A2139 !important;
    color: #94A3B8 !important;
  }

  .mob-card-desc {
    font-size: 11px !important;
    color: #64748B !important;
    line-height: 1.35 !important;
  }

  [data-theme='dark'] .mob-card-desc {
    color: #94A3B8 !important;
  }

  /* Mobile Item Sheet Modal open state */
  .mobile-sheet-backdrop.open {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .mobile-sheet-modal.open {
    display: block !important;
    transform: translateY(0) !important;
  }

  /* =========================================================================
     11. MOBILE DASHBOARD HERO — WORKSPACE APP SCREEN
     Styles for ws-mob-dash-hero and all its children.
     These classes exist in workspace.php but were previously unstyled.
     ========================================================================= */

  /* Hide the desktop sidebar and topbar on mobile */
  .ws-sidebar {
    display: none !important;
  }

  .ws-topbar {
    display: none !important;
  }

  /* Workspace app frame becomes a single full-height column */
  .ws-app-frame {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100dvh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #F3F4F8 !important;
  }

  [data-theme='dark'] .ws-app-frame {
    background: #0B0813 !important;
  }

  /* Main canvas becomes full width, no left sidebar gap */
  .ws-main-canvas {
    width: 100% !important;
    padding: 0 0 calc(80px + env(safe-area-inset-bottom, 16px)) 0 !important;
    background: transparent !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1 !important;
  }

  /* Page workspace background */
  .page-workspace {
    padding: 0 !important;
    background-color: #F3F4F8 !important;
    background-image: none !important;
  }

  [data-theme='dark'] .page-workspace {
    background-color: #0B0813 !important;
  }

  /* ---- Mobile Dashboard Hero Wrapper (Apple App Header) ---- */
  .ws-mob-dash-hero {
    display: block !important;
    background: #FFFFFF;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  }

  [data-theme='dark'] .ws-mob-dash-hero {
    background: #14101F;
    border-bottom-color: rgba(42, 33, 57, 0.9);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
  }

  /* ---- Greeting Row ---- */
  .ws-mob-dash-greeting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
  }

  .ws-mob-greeting-sub {
    display: block;
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 11.5px;
    font-weight: 700;
    color: #7C3AED;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 2px;
  }

  [data-theme='dark'] .ws-mob-greeting-sub {
    color: #C084FC;
  }

  .ws-mob-greeting-title {
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #0F172A;
    margin: 0;
    line-height: 1.25;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  [data-theme='dark'] .ws-mob-greeting-title {
    color: #F8FAFC;
  }

  /* ---- User Avatar Badge ---- */
  .ws-mob-avatar-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #7C3AED;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
  }

  .ws-mob-avatar-badge:active {
    transform: scale(0.94);
  }

  [data-theme='dark'] .ws-mob-avatar-badge {
    border-color: #2D243B;
  }

  /* ---- Prominent Apple-Style Hero Action Card (Create Quotation) ---- */
  .ws-mob-hero-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border-radius: 16px;
    background: #7C3AED;
    color: #FFFFFF !important;
    text-decoration: none;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3), 0 1px 2px rgba(124, 58, 237, 0.15);
    transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), background 0.16s ease, box-shadow 0.16s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .ws-mob-hero-cta:active {
    transform: scale(0.98);
    background: #6D28D9;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
  }

  .ws-mob-cta-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #FFFFFF;
  }

  .ws-mob-cta-info {
    flex: 1;
    min-width: 0;
  }

  .ws-mob-cta-heading {
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #FFFFFF;
    line-height: 1.25;
  }

  .ws-mob-cta-caption {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ws-mob-cta-arrow {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #FFFFFF;
    color: #7C3AED;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  }

  /* ---- Apple-Style Clean KPI Cards Grid ---- */
  .ws-mob-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .ws-mob-kpi-card {
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, border-color 0.15s ease;
  }

  .ws-mob-kpi-card:active {
    transform: scale(0.97);
    background: #F8FAFC;
  }

  [data-theme='dark'] .ws-mob-kpi-card {
    background: #181324;
    border-color: #2D233D;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  [data-theme='dark'] .ws-mob-kpi-card:active {
    background: #201A30;
  }

  .ws-mob-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
  }

  .ws-mob-kpi-badge {
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 6px;
    line-height: 1.3;
  }

  .ws-kpi-badge-slate {
    background: #F1F5F9;
    color: #475569;
  }

  [data-theme='dark'] .ws-kpi-badge-slate {
    background: #251E33;
    color: #94A3B8;
  }

  .ws-kpi-badge-amber {
    background: #FEF3C7;
    color: #92400E;
  }

  [data-theme='dark'] .ws-kpi-badge-amber {
    background: #3B2A15;
    color: #FCD34D;
  }

  .ws-mob-kpi-glyph {
    color: #94A3B8;
    display: flex;
    align-items: center;
  }

  [data-theme='dark'] .ws-mob-kpi-glyph {
    color: #64748B;
  }

  .ws-mob-kpi-val {
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 17px;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-top: 2px;
  }

  [data-theme='dark'] .ws-mob-kpi-val {
    color: #F8FAFC;
  }

  .ws-mob-kpi-sub {
    font-size: 11.5px;
    font-weight: 600;
    color: #64748B;
    letter-spacing: -0.01em;
  }

  [data-theme='dark'] .ws-mob-kpi-sub {
    color: #94A3B8;
  }

  /* ---- Quick Actions Horizontal Chip Row (Authentic Apple Pill Buttons) ---- */
  .ws-mob-quick-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .ws-mob-quick-actions::-webkit-scrollbar {
    display: none;
  }

  .ws-mob-quick-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 6px;
    border-radius: 9999px;
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #1E293B;
    cursor: pointer;
    text-decoration: none;
    flex: 1 1 0px;
    min-width: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
    box-sizing: border-box;
  }

  .ws-mob-quick-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ws-mob-quick-chip svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    color: #64748B;
  }

  .ws-mob-quick-chip:active {
    transform: scale(0.96);
    background: #F1F5F9;
  }

  [data-theme='dark'] .ws-mob-quick-chip {
    background: #181324;
    border-color: #2D233D;
    color: #E2E8F0;
    box-shadow: none;
  }

  [data-theme='dark'] .ws-mob-quick-chip svg {
    color: #94A3B8;
  }

  [data-theme='dark'] .ws-mob-quick-chip:active {
    background: #251E33;
  }

  /* Primary chip (Solid Contiant Purple) */
  .ws-mob-quick-chip.ws-chip-primary {
    background: #7C3AED;
    border-color: #7C3AED;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.28);
  }

  .ws-mob-quick-chip.ws-chip-primary svg {
    color: #FFFFFF;
  }

  .ws-mob-quick-chip.ws-chip-primary:active {
    background: #6D28D9;
    border-color: #6D28D9;
  }

  [data-theme='dark'] .ws-mob-quick-chip.ws-chip-primary {
    background: #7C3AED;
    border-color: #7C3AED;
    color: #FFFFFF;
  }

  /* Active state for Quick Switch Chips */
  .ws-mob-quick-chip.active {
    background: #7C3AED !important;
    border-color: #7C3AED !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.28) !important;
  }

  .ws-mob-quick-chip.active svg {
    color: #FFFFFF !important;
  }

  @media (max-width: 360px) {
    .ws-mob-quick-actions {
      gap: 3px;
    }
    .ws-mob-quick-chip {
      padding: 5px 3px;
      font-size: 10px;
      gap: 3px;
    }
    .ws-mob-quick-chip svg {
      width: 10px;
      height: 10px;
    }
  }

  /* ---- Mobile Inside Subhead Bar (Back button + View badge + Quick Chips) ---- */
  .ws-mob-subhead-bar {
    display: block !important;
    background: #FFFFFF;
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
    margin-bottom: 10px;
  }

  [data-theme='dark'] .ws-mob-subhead-bar {
    background: #14101F;
    border-bottom-color: rgba(42, 33, 57, 0.9);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
  }

  /* Navigation Row with Apple-style Back Button */
  .ws-mob-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
  }

  .ws-mob-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 4px 8px 4px 0;
    border-radius: 8px;
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 13.5px;
    font-weight: 750;
    color: #7C3AED;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
  }

  .ws-mob-back-btn:active {
    transform: scale(0.96);
    opacity: 0.8;
  }

  [data-theme='dark'] .ws-mob-back-btn {
    color: #C084FC;
  }

  [data-theme='dark'] .ws-mob-back-btn:active {
    background: #251E33;
  }

  .ws-mob-back-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.8;
  }

  .ws-mob-view-badge {
    font-family: var(--ct-font-display, 'Manrope', sans-serif);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #F1F5F9;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    flex-shrink: 0;
  }

  [data-theme='dark'] .ws-mob-view-badge {
    background: #251E33;
    color: #94A3B8;
  }

  /* ---- Mobile Panes: proper spacing and padding ---- */
  .ws-pane {
    display: none;
    flex-direction: column;
    gap: 0;
  }

  .ws-pane:not([style*="display: none"]) {
    display: flex !important;
  }

  /* Dashboard pane: no top padding since hero has its own bg */
  #panel-dashboard:not([style*="display: none"]) {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  /* Desktop bento KPI section: hide on mobile (replaced by ws-mob-kpi-grid) */
  .ws-bento-kpi-row {
    display: none !important;
  }

  /* Usage card: show on mobile with Apple iOS widget styling */
  .ws-usage-card {
    margin: 12px 14px 0 !important;
    border-radius: 18px !important;
    padding: 16px 18px !important;
    flex-direction: column !important;
    gap: 14px !important;
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  }

  [data-theme='dark'] .ws-usage-card {
    background: #181324 !important;
    border-color: #2D233D !important;
  }

  .ws-usage-left,
  .ws-usage-right {
    width: 100% !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .ws-usage-right {
    justify-content: space-between !important;
    align-items: center !important;
  }

  .ws-usage-metric {
    min-width: 0 !important;
  }

  /* Recent activity / files card: Apple iOS card styling */
  .ws-files-card {
    margin: 12px 14px 20px !important;
    border-radius: 18px !important;
    padding: 18px 16px !important;
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  }

  [data-theme='dark'] .ws-files-card {
    background: #181324 !important;
    border-color: #2D233D !important;
  }

  /* Panel subhead (Quotes, Clients etc.) */
  .ws-panel-subhead {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 16px 14px 12px !important;
    margin: 0 !important;
  }

  .ws-panel-subhead > a,
  .ws-panel-subhead > button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Files/records container on mobile panels */
  .ws-records-container,
  .ws-files-table-container {
    padding: 0 14px !important;
  }

  /* Files section card inside quotes pane */
  #panel-quotes .ws-files-card {
    margin: 0 14px 14px !important;
    border-radius: 16px !important;
  }

  /* ========================================================================  /* ========================================================================  /* =========================================================================
     12. GENERATOR NATIVE MOBILE APP EXPERIENCE
     App-style layout for the quotation generator on mobile devices:
     - Sleek 50px mobile app top bar
     - Sticky segmented 5-step wizard (Client, Items, Pricing, Terms, Preview)
     - Compact, touch-friendly step cards (no excessive desktop padding)
     - Touch-card line item list with smooth bottom sheet modal
     - Full-width responsive A4 live preview with horizontal template swiping
     - Docked bottom action bar for one-tap progression and export
     ========================================================================= */

  /* Body & Layout on Mobile Generator */
  body.page-generator {
    background: #F8F9FC !important;
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 16px)) !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    display: block !important;
  }

  [data-theme='dark'] body.page-generator {
    background: #0B0813 !important;
  }

  /* Completely hide marketing footer on mobile generator — it is an app wizard */
  body.page-generator .site-footer {
    display: none !important;
  }

  /* Compact Native App Header for Generator (50px height) */
  body.page-generator #site-header.ct-header {
    border-bottom: 1px solid #E8EBF2 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 890 !important;
    background: #FFFFFF !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02) !important;
  }

  [data-theme='dark'] body.page-generator #site-header.ct-header {
    background: #14101F !important;
    border-bottom-color: #2A2139 !important;
  }

  body.page-generator #site-header.ct-header .header-inner {
    height: 50px !important;
    padding: 0 14px !important;
    gap: 10px !important;
  }

  body.page-generator #site-header.ct-header .brand-logo-img {
    height: 26px !important;
    width: auto !important;
  }

  /* Hide redundant sub-toolbar on mobile — eliminates 58px of wasted header space */
  body.page-generator .gen-editor-toolbar-wrap {
    display: none !important;
  }

  /* Main content container */
  body.page-generator .main-content {
    display: block !important;
    min-height: auto !important;
    padding-bottom: 0 !important;
    width: 100% !important;
  }

  /* Stepper bar: sticky directly below the 50px header in form steps mode */
  .mobile-stepper-bar {
    position: sticky !important;
    top: 50px !important;
    z-index: 880 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid #E8EBF2 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    padding: 8px 12px !important;
    gap: 6px !important;
    display: flex;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .qm-canvas-active .mobile-stepper-bar,
  .qm-canvas-active #generator-mobile-stepper {
    display: none !important;
  }

  .mobile-stepper-bar::-webkit-scrollbar {
    display: none !important;
  }

  [data-theme='dark'] .mobile-stepper-bar {
    background: rgba(20, 16, 31, 0.98) !important;
    border-bottom-color: #2A2139 !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4) !important;
  }

  .mobile-step-pill {
    padding: 7px 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 9999px !important;
    background: #F1F5F9 !important;
    color: #64748B !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    border: 1px solid transparent !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
  }

  [data-theme='dark'] .mobile-step-pill {
    background: #1F192C !important;
    color: #94A3B8 !important;
  }

  .mobile-step-pill.active {
    background: linear-gradient(135deg, #7C3AED 0%, #6366F1 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35) !important;
  }

  .mobile-step-pill.active .mobile-step-num {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #FFFFFF !important;
  }

  .mobile-step-pill.completed {
    background: #ECFDF5 !important;
    color: #065F46 !important;
    border-color: #A7F3D0 !important;
  }

  [data-theme='dark'] .mobile-step-pill.completed {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #34D399 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
  }

  .mobile-step-pill.completed .mobile-step-num {
    background: #10B981 !important;
    color: #FFFFFF !important;
  }

  /* Workspace & Containers */
  body.page-generator .refrens-app-container {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
  }

  body.page-generator .container-workspace {
    padding: 0 12px !important;
    max-width: 100% !important;
  }

  body.page-generator .generator-workspace {
    display: block !important;
    width: 100% !important;
    padding: 10px 0 24px !important;
  }

  body.page-generator .generator-editor-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  /* Editor Cards: Modern Tactile App Cards */
  body.page-generator .editor-card {
    border-radius: 18px !important;
    margin-bottom: 12px !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03) !important;
    background: #FFFFFF !important;
    overflow: hidden !important;
  }

  [data-theme='dark'] body.page-generator .editor-card {
    background: #14101F !important;
    border-color: #2A2139 !important;
  }

  body.page-generator .card-header-bar {
    padding: 12px 14px !important;
    background: rgba(248, 246, 252, 0.75) !important;
    border-bottom: 1px solid #E8EBF2 !important;
  }

  [data-theme='dark'] body.page-generator .card-header-bar {
    background: rgba(26, 20, 39, 0.75) !important;
    border-bottom-color: #2A2139 !important;
  }

  body.page-generator .card-body-content {
    padding: 14px !important;
  }

  /* Form Inputs inside Mobile Step Cards */
  body.page-generator .doc-input,
  body.page-generator .doc-select {
    font-size: 14px !important;
    padding: 9px 12px !important;
    border-radius: 10px !important;
    border: 1.5px solid #CBD5E1 !important;
    min-height: 40px !important;
    box-sizing: border-box !important;
  }

  body.page-generator .field-label {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    margin-bottom: 4px !important;
    color: #475569 !important;
  }

  [data-theme='dark'] body.page-generator .field-label {
    color: #94A3B8 !important;
  }

  body.page-generator .field-group {
    margin-bottom: 10px !important;
  }

  body.page-generator .doc-meta-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  body.page-generator .canvas-contacts {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  body.page-generator .contact-box {
    padding: 12px !important;
    border-radius: 14px !important;
    background: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
  }

  [data-theme='dark'] body.page-generator .contact-box {
    background: #1A1427 !important;
    border-color: #2E2440 !important;
  }

  /* Preview Review Panel on Mobile Phone only (Step 5) */
  @media (max-width: 767px) {
    body.page-generator .generator-preview-panel:not(.mobile-active) {
      display: none !important;
    }
  }

  body.page-generator .generator-preview-panel.mobile-active {
    display: block !important;
    position: static !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 0 100px !important;
  }

  /* Style selector as horizontal swipe carousel */
  body.page-generator .preview-toolbar {
    background: #FFFFFF !important;
    border-bottom: 1px solid #E8EBF2 !important;
    padding: 10px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  [data-theme='dark'] body.page-generator .preview-toolbar {
    background: #14101F !important;
    border-bottom-color: #2A2139 !important;
  }

  body.page-generator .preview-toolbar .ct-btn-secondary,
  body.page-generator .preview-toolbar .qm-tour-replay,
  body.page-generator .preview-toolbar .scale-switcher,
  body.page-generator .preview-toolbar .btn-scale-icon {
    display: none !important;
  }

  body.page-generator .design-pill-group {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 6px !important;
    padding: 2px 0 4px !important;
    grid-template-columns: none !important;
  }

  body.page-generator .design-pill-group:not(.qm-form-templates-strip)::-webkit-scrollbar {
    display: none !important;
  }

  body.page-generator .design-pill-group:not(.qm-form-templates-strip) .btn-design {
    flex-shrink: 0 !important;
    padding: 7px 14px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
    background: #F1F5F9 !important;
    border: 1px solid #E2E8F0 !important;
    color: #475569 !important;
  }

  body.page-generator .design-pill-group:not(.qm-form-templates-strip) .btn-design.active {
    background: #7C3AED !important;
    border-color: #7C3AED !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3) !important;
  }

  /* Document preview wrapper and A4 stage */
  body.page-generator .preview-wrapper {
    background: #F1F5F9 !important;
    padding: 12px 0 40px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: auto !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  [data-theme='dark'] body.page-generator .preview-wrapper {
    background: #0B0813 !important;
  }

  body.page-generator .preview-stage {
    margin: 0 auto !important;
    display: block !important;
    overflow: visible !important;
    box-sizing: content-box !important;
    max-width: 100% !important;
  }

  /* Mobile Canvas Footer Grid */
  body.page-generator .canvas-footer-grid {
    display: block !important;
    padding-top: 0 !important;
    border-top: none !important;
  }

  body.page-generator .footer-left,
  body.page-generator .footer-right {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.page-generator .a4-paper {
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08) !important;
    border-radius: 8px !important;
    background: #FFFFFF !important;
  }

  body.page-generator .mobile-preview-bottom-bar {
    display: none !important;
  }

  /* Mobile Sticky Action Bar: Anchored to Bottom with Clean SaaS Styling */
  .mobile-sticky-action-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 920 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-top: 1px solid #E2E8F0 !important;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 10px)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08) !important;
    box-sizing: border-box !important;
  }

  [data-theme='dark'] .mobile-sticky-action-bar {
    background: rgba(18, 14, 26, 0.98) !important;
    border-top-color: #2A2139 !important;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.4) !important;
  }

  .mobile-sticky-total-info {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    padding-right: 4px !important;
  }

  .mobile-sticky-total-label {
    font-size: 9px !important;
    font-weight: 700 !important;
    color: #64748B !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    line-height: 1 !important;
    margin: 0 0 2px 0 !important;
  }

  [data-theme='dark'] .mobile-sticky-total-label {
    color: #94A3B8 !important;
  }

  .mobile-sticky-total-val {
    font-size: 14.5px !important;
    font-weight: 800 !important;
    color: #0F172A !important;
    letter-spacing: -0.02em !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    margin: 0 !important;
  }

  [data-theme='dark'] .mobile-sticky-total-val {
    color: #F8FAFC !important;
  }

  .mobile-sticky-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .ct-mob-action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    font-family: inherit !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    padding: 7px 10px !important;
    min-height: 38px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    transition: all 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .ct-mob-action-btn:active {
    transform: scale(0.97) !important;
  }

  /* Edit Form Button */
  .ct-mob-action-outline,
  #mobile-sticky-edit-btn {
    background: #FFFFFF !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  }
  .ct-mob-action-outline:hover,
  #mobile-sticky-edit-btn:hover {
    background: #F8FAFC !important;
    border-color: #94A3B8 !important;
    color: #0F172A !important;
  }
  [data-theme='dark'] .ct-mob-action-outline,
  [data-theme='dark'] #mobile-sticky-edit-btn {
    background: #201930 !important;
    border-color: #3D3255 !important;
    color: #E2E8F0 !important;
  }

  /* Share Button */
  .ct-mob-action-wa,
  #mobile-sticky-wa-btn {
    background: #ECFDF5 !important;
    color: #065F46 !important;
    border: 1px solid #A7F3D0 !important;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.08) !important;
    font-weight: 700 !important;
  }
  .ct-mob-action-wa:hover,
  #mobile-sticky-wa-btn:hover {
    background: #D1FAE5 !important;
    border-color: #6EE7B7 !important;
    color: #047857 !important;
  }
  [data-theme='dark'] .ct-mob-action-wa,
  [data-theme='dark'] #mobile-sticky-wa-btn {
    background: rgba(6, 78, 59, 0.4) !important;
    border-color: #065F46 !important;
    color: #6EE7B7 !important;
  }

  /* Primary Download PDF Button */
  .ct-mob-action-primary,
  #mobile-sticky-pdf-btn,
  #mobile-stepper-next-btn {
    background: linear-gradient(135deg, #7C3AED, #6D28D9) !important;
    color: #FFFFFF !important;
    border: 1px solid #7C3AED !important;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.28) !important;
    font-weight: 700 !important;
  }

  .ct-mob-action-primary:hover,
  #mobile-sticky-pdf-btn:hover {
    background: linear-gradient(135deg, #6D28D9, #5B21B6) !important;
  }

  .ct-mob-action-btn .ct-mob-arrow {
    transition: transform 0.2s ease !important;
  }

  .ct-mob-action-btn:hover .ct-mob-arrow,
  .ct-mob-action-btn:active .ct-mob-arrow {
    transform: translateX(3px) !important;
  }

  /* Ensure hidden states are strictly honored when controlled by JS */
  #mobile-stepper-next-btn[style*="display: none"],
  #mobile-sticky-wa-btn[style*="display: none"],
  #mobile-sticky-pdf-btn[style*="display: none"] {
    display: none !important;
  }
}



