/* Reinforce capture-phase lock on the dashboard only — config must stay clickable during tab tours. */
body.guided-flow-locked .dashboard-section,
body.guided-flow-locked #dashboard-layout {
    pointer-events: none;
}

/* Config page (tabs, + Add finder/category, lists) stays interactive under guided-flow-locked. */
body.guided-flow-locked .config-section,
body.guided-flow-locked #config-main {
    pointer-events: auto;
}

body.guided-flow-locked .onboarding-overlay,
body.guided-flow-locked .feature-tour-overlay {
    pointer-events: none;
}

body.guided-flow-locked .onboarding-card,
body.guided-flow-locked .feature-tour-card,
body.guided-flow-locked .feature-spotlight,
body.guided-flow-locked [class$="-tour-card"],
body.guided-flow-locked .modal.whats-new-modal,
body.guided-flow-locked .config-settings-search-promo {
    pointer-events: auto;
}

/* Config tour portal (legacy marker — cards live on body for reliable clicks). */
#config-tour-portal {
    display: none;
}

/* Transparent click shield — real element below tour card (not body::before). */
.config-tour-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147482000;
    pointer-events: none !important;
    background: transparent;
}

/* Config tour card always above highlight cutout (12550) and clickable. */
body.guided-flow-locked [data-config-tour-card],
body.guided-flow-locked [class$="-tour-card"] {
    z-index: 2147483000 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

body.guided-flow-locked [data-config-tour-card] .config-general-tour-btn,
body.guided-flow-locked [class$="-tour-card"] .config-general-tour-btn {
    pointer-events: auto !important;
    cursor: pointer;
}

/* Highlighted controls stay clickable during config tab tours (e.g. + Add finder). */
body.guided-flow-locked [class$="-tour-highlight"] {
    pointer-events: auto !important;
}

/* AppModal above tour backdrop (2147482000), tour card (2147483000), and highlight (12550). */
body.guided-flow-locked #app-modal.modal-overlay.show,
body.guided-flow-modal-open #app-modal.modal-overlay.show {
    z-index: 2147483100 !important;
    pointer-events: auto !important;
}

body.guided-flow-locked #app-modal.modal-overlay.show .modal,
body.guided-flow-modal-open #app-modal.modal-overlay.show .modal,
body.guided-flow-locked #app-modal.modal-overlay.show .modal-button,
body.guided-flow-modal-open #app-modal.modal-overlay.show .modal-button {
    pointer-events: auto !important;
}

/* AppModal open: JS blocks non-modal clicks; keep tour card visible for when modal closes. */
body.guided-flow-modal-open #app-modal.modal-overlay.show {
    align-items: center;
    justify-content: center;
}

/* Bookmarks tour + quick-add: tour card in its own strip below the modal */
body.guided-flow-companion-active .config-tour-backdrop,
body.guided-flow-locked.config-bookmarks-tour-interactive-modal .config-tour-backdrop {
    pointer-events: none !important;
    z-index: 2147482700 !important;
}

body.guided-flow-companion-active [class$="-tour-card"],
body.guided-flow-locked.config-bookmarks-tour-interactive-modal [class$="-tour-card"],
body.guided-flow-locked.guided-flow-companion-active .config-bookmarks-tour-card {
    visibility: visible !important;
    z-index: 2147483200 !important;
    pointer-events: auto !important;
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)) !important;
    transform: translateX(-50%) !important;
    max-width: min(640px, calc(100vw - 2rem));
}

body.guided-flow-companion-active .config-bookmarks-tour-card.is-docked,
body.guided-flow-locked.config-bookmarks-tour-interactive-modal .config-bookmarks-tour-card.is-docked {
    top: auto !important;
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)) !important;
}

body.guided-flow-companion-active #new-bookmark-modal.modal-overlay.show,
body.guided-flow-locked.config-bookmarks-tour-interactive-modal #new-bookmark-modal.modal-overlay.show {
    z-index: 2147482800 !important;
    pointer-events: none !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: max(2.5rem, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: min(42vh, 280px) !important;
    box-sizing: border-box !important;
}

body.guided-flow-companion-active #new-bookmark-modal.modal-overlay.show .modal-new-bookmark,
body.guided-flow-locked.config-bookmarks-tour-interactive-modal
    #new-bookmark-modal.modal-overlay.show
    .modal-new-bookmark {
    pointer-events: none !important;
    max-height: calc(100vh - min(42vh, 280px) - 5rem) !important;
    margin-bottom: 0 !important;
}
