/* Profile Settings (dashboard) */

/* Profile shell — sidebar tab focus / border flash during SPA swaps */
#profile-sidebar-slot a:focus,
#profile-sidebar-slot a:focus-visible {
    outline: none;
    box-shadow: none;
}

#profile-sidebar-slot aside nav a {
    border: 1px solid transparent;
}

html.spa-navigating #profile-sidebar-slot a {
    transition: none !important;
}

.field-label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: .5rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.field-value {
    width: 100%;
    padding: .75rem 1rem;
    background: #0c0c12;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: .75rem;
    color: #cbd5e1;
    font-size: .875rem;
}

.field-input {
    width: 100%;
    padding: .75rem 1rem;
    background: #0c0c12;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: .75rem;
    color: #fff;
    font-size: .875rem;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.field-input::placeholder {
    color: #475569;
}

.field-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .15);
}

.field-input-wrap {
    position: relative;
}

.field-input-wrap .field-input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #475569;
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 1;
}

.field-input-wrap .field-input.has-icon {
    padding-left: 2.625rem;
}

.section-card {
    background: #111118;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 1.25rem;
    padding: 1.75rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-bottom: 1.5rem;
}

.section-title i {
    font-size: .875rem;
}

/* My Library modal */
#promptModal.library-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: auto;
}

#promptModal.library-modal.hidden {
    display: none !important;
}

.library-modal-backdrop {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: auto;
}

#promptModal.library-modal.is-visible .library-modal-backdrop {
    opacity: 1;
}

#promptModal > .library-modal-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
    min-height: 0;
}

#modalPanel.library-modal-panel {
    display: flex;
    flex-direction: column;
    width: 700px;
    height: 560px;
    max-width: calc(100vw - 2rem);
    max-height: calc(100dvh - 2rem);
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.96) translateY(14px);
    transition:
        opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
    pointer-events: auto;
}

#modalPanel.library-modal-panel.modal-panel--with-vars {
    width: 900px;
}

#promptModal.library-modal.is-visible #modalPanel.library-modal-panel {
    opacity: 1;
    transform: scale(1) translateY(0);
}

#modalBody {
    display: flex;
    flex: 1 1 0%;
    min-height: 0;
    height: 0;
    overflow: hidden;
}

#modalVarsPanel {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.library-modal-content {
    flex: 1 1 0%;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

/* ~1 line below content preview (scroll end), not extra large gap */
#modalPanel .library-modal-content {
    padding-bottom: calc(1.25rem + 1.55em);
}

#modalActionDock {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

@media (min-width: 1024px) {
    #modalActionDock {
        display: none !important;
    }

    /* Desktop: don't let wrapper change spacing/layout */
    #promptModal .prompt-tabs-bar-scroll {
        display: contents !important;
        margin-bottom: 0 !important;
    }

    /* Desktop customize padding */
    #modalVarsPanel.library-vars-panel:not(.hidden) {
        padding: 1rem !important; /* ~p-4 (Tailwind) */
    }

    .library-vars-panel__toggle {
        display: none !important;
    }

    .library-vars-panel--collapsed-mobile .library-vars-panel__body,
    .library-vars-panel .library-vars-panel__body {
        display: contents;
    }

    .library-vars-panel__hint {
        display: block;
        margin-bottom: 0.75rem;
    }

    /* Desktop: place multi-prompt badge above title line */
    #promptModal .library-modal-header__title-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        min-height: auto;
        max-height: none;
        row-gap: 0.2rem;
    }

    #promptModal #modalMultiPromptBadge {
        order: -1;
        width: 100%;
    }

    /* Desktop modal tabs: make them feel like real tabs */
    #promptModal #modalPromptTabsBar:not(.prompt-tabs-bar--modal-mobile) {
        gap: 0.3rem;
        flex-wrap: nowrap;
        align-items: flex-end;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 0;
        margin-bottom: 0;
    }

    #promptModal #modalPromptTabsBar:not(.prompt-tabs-bar--modal-mobile) .prompt-tab-btn {
        border-radius: 0.75rem 0.75rem 0 0;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom-color: transparent;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
        color: #a6b0c1;
        padding: 0.5rem 0.88rem;
        transform: translateY(1px);
    }

    #promptModal #modalPromptTabsBar:not(.prompt-tabs-bar--modal-mobile) .prompt-tab-btn.is-active {
        color: #f3e8ff;
        background: linear-gradient(180deg, rgba(139, 92, 246, 0.34), rgba(139, 92, 246, 0.16));
        border-color: rgba(167, 139, 250, 0.5);
        border-bottom-color: #111117;
        box-shadow: 0 -1px 0 rgba(196, 181, 253, 0.2) inset, 0 0 0 1px rgba(139, 92, 246, 0.14);
        transform: translateY(1px);
    }

    /* Desktop: give content text a little top breathing room */
    #promptModal #modalContent {
        padding-top: 0.4rem;
    }
}

#modalContent {
    display: block;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

html.library-modal-open,
html.prompt-modal-open,
body.library-modal-open,
body.prompt-modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

#modalVarsPanel,
.library-modal-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, .4) transparent;
}

#modalVarsPanel::-webkit-scrollbar,
.library-modal-content::-webkit-scrollbar {
    width: 5px;
}

#modalVarsPanel::-webkit-scrollbar-track,
.library-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

#modalVarsPanel::-webkit-scrollbar-thumb,
.library-modal-content::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, .4);
    border-radius: 99px;
}

#modalVarsPanel::-webkit-scrollbar-thumb:hover,
.library-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, .65);
}

@media (max-width: 1023px) {
    #promptModal > .library-modal-stage {
        padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
    }

    #modalPanel.library-modal-panel,
    #modalPanel.library-modal-panel.modal-panel--with-vars {
        width: 100%;
        height: min(92dvh, calc(100dvh - 1.5rem));
        max-height: min(92dvh, calc(100dvh - 1.5rem));
        border-radius: 1rem;
    }

    #modalBody {
        flex-direction: column !important;
    }

    #modalBody .library-modal-content {
        order: 1;
        flex: 1 1 0%;
        min-height: 0;
    }

    #modalVarsPanel.library-vars-panel:not(.hidden) {
        order: 2;
        width: 100% !important;
        max-height: none;
        overflow: visible;
        border-right: none !important;
        border-bottom: none;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        flex-shrink: 0;
        padding: 0;
    }

    .library-vars-panel__toggle {
        padding: 0.75rem 1rem;
        background: rgba(255, 255, 255, 0.02);
        border: none;
        color: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .library-vars-panel__toggle:active {
        background: rgba(255, 255, 255, 0.04);
    }

    .library-vars-panel__chevron {
        transition: transform 0.2s ease;
    }

    .library-vars-panel:not(.library-vars-panel--collapsed-mobile) .library-vars-panel__chevron {
        transform: rotate(180deg);
    }

    .library-vars-panel--collapsed-mobile .library-vars-panel__body,
    .library-vars-panel--collapsed-mobile .library-vars-panel__hint {
        display: none;
    }

    .library-vars-panel:not(.library-vars-panel--collapsed-mobile) .library-vars-panel__body {
        display: block;
        max-height: min(42vh, 17.5rem);
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0 1rem 0.875rem;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .library-vars-panel:not(.library-vars-panel--collapsed-mobile) .library-vars-panel__hint {
        display: block;
        margin: 0 0 0.65rem;
    }

    /* Modal tabs — horizontal scroll on mobile */
    #promptModal .prompt-tabs-bar-scroll {
        position: relative;
        margin-bottom: 0.75rem;
        min-width: 0;
    }

    #promptModal .prompt-tabs-bar-scroll::before,
    #promptModal .prompt-tabs-bar-scroll::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 1.75rem;
        pointer-events: none;
        z-index: 2;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    #promptModal .prompt-tabs-bar-scroll::before {
        left: 0;
        background: linear-gradient(90deg, #111117 25%, transparent);
    }

    #promptModal .prompt-tabs-bar-scroll::after {
        right: 0;
        background: linear-gradient(270deg, #111117 20%, transparent);
    }

    #promptModal .prompt-tabs-bar-scroll.has-overflow:not(.is-scroll-end)::after {
        opacity: 1;
    }

    #promptModal .prompt-tabs-bar-scroll.has-overflow.is-scroll-end::after {
        opacity: 0;
    }

    #promptModal .prompt-tabs-bar-scroll.has-overflow:not(.is-scroll-start)::before {
        opacity: 1;
    }

    #promptModal .prompt-tabs-bar-scroll__hint {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 1.5rem;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    #promptModal .prompt-tabs-bar-scroll__hint--left {
        left: 0.2rem;
        padding-right: 0.85rem;
        background: linear-gradient(90deg, #111117 45%, transparent);
    }

    #promptModal .prompt-tabs-bar-scroll__hint--right {
        right: 0.2rem;
        padding-left: 0.85rem;
        background: linear-gradient(270deg, #111117 45%, transparent);
    }

    #promptModal .prompt-tabs-bar-scroll__hint-icon {
        color: #a78bfa;
        font-size: 0.7rem;
        line-height: 1;
        animation: library-modal-tab-hint-nudge 1.15s ease-in-out infinite;
    }

    @keyframes library-modal-tab-hint-nudge {
        0%, 100% {
            transform: translateX(0);
            opacity: 0.75;
        }
        50% {
            transform: translateX(5px);
            opacity: 1;
        }
    }

    #promptModal .prompt-tabs-bar-scroll.has-overflow:not(.is-scroll-start) .prompt-tabs-bar-scroll__hint--left {
        opacity: 1;
    }

    #promptModal .prompt-tabs-bar-scroll.has-overflow:not(.is-scroll-end) .prompt-tabs-bar-scroll__hint--right {
        opacity: 1;
    }

    @media (prefers-reduced-motion: reduce) {
        #promptModal .prompt-tabs-bar-scroll__hint-icon {
            animation: none;
            opacity: 1;
        }
    }

    #promptModal #modalPromptTabsBar.prompt-tabs-bar--modal-mobile:not(.hidden) {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.45rem;
        margin-bottom: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 0.25rem;
        padding: 0.15rem 2rem 0.15rem 0.15rem;
        scrollbar-width: none;
    }

    #promptModal #modalPromptTabsBar.prompt-tabs-bar--modal-mobile::-webkit-scrollbar {
        display: none;
    }

    #promptModal #modalPromptTabsBar.prompt-tabs-bar--modal-mobile .prompt-tab-btn {
        flex: 0 0 auto;
        max-width: 12.5rem;
        scroll-snap-align: start;
        white-space: nowrap;
        padding: 0.5rem 0.85rem;
    }

    #promptModal #modalPromptTabsBar.prompt-tabs-bar--modal-mobile .prompt-tab-btn.is-active {
        box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25);
    }

    /* Library modal header — mobile: fixed height, ellipsis, close top-right */
    .library-modal-header {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        position: relative;
        min-height: 3.35rem;
        padding-right: 2.75rem !important;
    }

    .library-modal-header__main {
        min-width: 0;
        flex: 1 1 auto;
        margin-bottom: 0;
        padding-right: 0.25rem;
    }

    .library-modal-header__text {
        min-width: 0;
        overflow: hidden;
    }

    .library-modal-header__title-row {
        min-height: 1.25rem;
        max-height: 1.25rem;
    }

    .library-modal-header__title,
    #modalTitle {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .library-modal-header__platform,
    #modalPlatform {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        min-height: 1rem;
    }

    .library-modal-header__close,
    #modalCloseBtnMobile {
        position: absolute !important;
        top: 0.55rem;
        right: 0.55rem;
        margin: 0 !important;
        flex-shrink: 0;
    }

    #modalEditorLink,
    #modalSaveBtn,
    #copyBtn {
        width: auto;
        min-width: auto;
        max-width: none;
        justify-content: center;
        min-height: 1.45rem;
        padding: 0.28rem 0.42rem !important;
        font-size: 0.64rem !important;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #modalEditorLink i,
    #modalSaveBtn i,
    #copyBtn i {
        font-size: 0.64rem !important;
    }

    #modalActionDock {
        position: static;
        margin: 0;
        width: 100%;
        max-width: 100%;
        justify-content: center;
        gap: 0.28rem;
        padding: 0.52rem 0.875rem calc(0.52rem + env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 0;
        box-shadow: none;
        backdrop-filter: none;
    }

    #modalPanel .library-modal-content {
        padding: 0.875rem !important;
        padding-bottom: calc(0.875rem + 1.55em) !important;
    }

    #modalPanel .library-modal-content #modalContent {
        font-size: 0.8125rem !important;
        line-height: 1.55;
    }

    #modalPanel > .px-5.py-2\.5.border-t {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
        padding-top: 0.6rem !important;
        padding-bottom: 0.6rem !important;
        flex-wrap: nowrap !important;
    }

    /* Mobile footer: long hint should ellipsize, not push "View product" down */
    #modalFooterHint {
        flex: 1 1 auto;
        min-width: 0;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
        /* Small screens: fit fully by shrinking font (no '..' ellipsis) */
        font-size: clamp(8.2px, 2.4vw, 10.4px) !important;
        line-height: 1.25;
        padding-right: 0.45rem;
    }

    #modalDetailLink {
        flex: 0 0 auto;
        white-space: nowrap;
        margin-left: auto;
    }

    #modalDetailLink {
        margin-left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .library-modal-backdrop,
    #modalPanel.library-modal-panel {
        transition: none !important;
    }
}

/* Support */
.msg-bubble {
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.65;
}

/* Editor */
#editorArea {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.75;
    resize: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, .4) transparent;
}

#editorArea::-webkit-scrollbar {
    width: 5px;
}

#editorArea::-webkit-scrollbar-track {
    background: transparent;
}

#editorArea::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, .4);
    border-radius: 99px;
}

#editorArea::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, .7);
}

#previewPanel {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, .4) transparent;
}

#previewPanel::-webkit-scrollbar {
    width: 5px;
}

#previewPanel::-webkit-scrollbar-track {
    background: transparent;
}

#previewPanel::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, .4);
    border-radius: 99px;
}

#previewPanel::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, .7);
}

.var-fill-highlight {
    color: #fbbf24;
    background: rgba(251, 191, 36, .12);
    border-radius: 3px;
    padding: 0 2px;
}

.token-empty-highlight {
    color: #a78bfa;
    background: rgba(139, 92, 246, .15);
    border-radius: 3px;
    padding: 0 2px;
}

.token-highlight {
    color: #fbbf24;
    background: rgba(251, 191, 36, .12);
    border-radius: 3px;
    padding: 0 2px;
}

.cc-ok {
    color: #4ade80;
}

.cc-warn {
    color: #fbbf24;
}

.cc-over {
    color: #f87171;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, .08);
    color: #94a3b8;
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
    transition: all .15s;
}

.tool-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .15);
}

.tool-btn.active {
    color: #a78bfa;
    background: rgba(139, 92, 246, .15);
    border-color: rgba(139, 92, 246, .3);
}

.tool-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.tool-btn-save {
    color: #422006;
    background: linear-gradient(135deg, #facc15 0%, #fbbf24 55%, #f59e0b 100%);
    border-color: rgba(251, 191, 36, .65);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 4px 14px rgba(251, 191, 36, .22);
}

.tool-btn-save:hover {
    color: #1c1917;
    background: linear-gradient(135deg, #fde047 0%, #facc15 55%, #fbbf24 100%);
    border-color: rgba(253, 224, 71, .85);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .18) inset, 0 6px 18px rgba(251, 191, 36, .32);
}

.tool-btn-save:disabled {
    opacity: 0.7;
    pointer-events: none;
}

/* Editor preview BBCode */
.editor-preview-body strong {
    font-weight: 700;
    color: #f8fafc;
}

.editor-preview-body em {
    font-style: italic;
    color: #cbd5e1;
}

.editor-preview-code {
    display: block;
    margin: 0.65em 0;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 0.625rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    color: #e2e8f0;
}

/* Editor — library sidebar */
.editor-lib-sidebar {
    min-width: 0;
}

.editor-lib-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.55rem 0.625rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    color: #94a3b8;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
    text-decoration: none;
}

.editor-lib-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .06);
}

.editor-lib-item.is-active {
    color: #fff;
    background: rgba(139, 92, 246, .14);
    border-color: rgba(139, 92, 246, .28);
}

.editor-lib-item__icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(139, 92, 246, .12);
    color: #a78bfa;
}

.editor-lib-item.is-active .editor-lib-item__icon {
    background: rgba(139, 92, 246, .22);
    color: #c4b5fd;
}

.editor-lib-item__text {
    min-width: 0;
    flex: 1;
}

.editor-lib-item__title-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.editor-lib-item__title {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.editor-lib-item__meta {
    display: block;
    font-size: 0.625rem;
    color: #64748b;
    margin-top: 0.125rem;
}

.editor-lib-item__saved {
    color: #fbbf24;
    font-size: 0.625rem;
    flex-shrink: 0;
}

.multi-prompt-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.4rem;
    border-radius: 0.375rem;
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.2;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.28);
    flex-shrink: 0;
    white-space: nowrap;
}

.multi-prompt-badge--sm {
    font-size: 0.5625rem;
    padding: 0.0625rem 0.3rem;
    border-radius: 0.3rem;
}

.multi-prompt-badge i {
    font-size: 0.55rem;
    opacity: 0.95;
}

/* Profile editor — page shell */
:root {
    --editor-nav-h: 3.5rem;
}

@media (min-width: 640px) {
    :root {
        --editor-nav-h: 4rem;
    }
}

html.page-profile-editor-root,
body.page-profile-editor {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
}

body.page-profile-editor > footer {
    display: none !important;
}

body.page-profile-editor #spa-main[data-page="profile-editor"] {
    position: fixed;
    top: var(--editor-nav-h);
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    width: 100%;
    overflow: hidden;
    z-index: 40;
}

body.page-profile-editor #spa-main[data-page="profile-editor"] .editor-workspace > .flex-1.flex.overflow-hidden {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

body.page-profile-editor #spa-main[data-page="profile-editor"] #editorPane,
body.page-profile-editor #spa-main[data-page="profile-editor"] #previewPane {
    min-height: 0;
    flex: 1 1 0;
}

body.page-profile-editor #spa-main[data-page="profile-editor"] #previewPanel {
    flex: 1 1 auto;
    min-height: 0;
}

body.is-prompt-editor-page #ideasToggleBtn {
    z-index: 62;
}

body.is-prompt-editor-page #ideasDrawer {
    z-index: 60;
}

body.page-profile-editor #spa-main[data-page="profile-editor"] > main {
    height: 100%;
    min-height: 0;
}

/* Editor — always desktop layout (no mobile reflow; user pinch-zooms on phone) */
body.page-profile-editor {
    --editor-nav-h: 4rem;
}

@media (max-width: 1023px) {
    body.page-profile-editor #spa-main[data-page="profile-editor"] .editor-lib-sidebar {
        max-height: none !important;
    }

    body.page-profile-editor #spa-main[data-page="profile-editor"] #previewPane {
        border-left: 1px solid rgba(255, 255, 255, 0.06) !important;
        border-top: none !important;
    }

    body.page-profile-editor .editor-ideas-drawer__inner {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    body.page-profile-editor .hidden.sm\:inline {
        display: inline !important;
    }

    body.page-profile-editor .hidden.sm\:block {
        display: block !important;
    }
}

.navbar--editor {
    height: var(--editor-nav-h);
    min-height: var(--editor-nav-h);
    z-index: 50;
    background: rgba(11, 11, 15, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(12px);
}

.navbar--editor.navbar-scrolled {
    background: rgba(11, 11, 15, 0.98);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.editor-navbar__library {
    white-space: nowrap;
}

#spa-main[data-page="profile-editor"] main {
    min-height: 0;
    height: 100%;
}

/* Editor — idle state (no product selected) */
.editor-workspace.is-idle .editor-toolbar,
.editor-workspace.is-idle #editorPane,
.editor-workspace.is-idle #previewPane {
    opacity: 0.5;
}

.editor-workspace.is-idle textarea#editorArea {
    cursor: not-allowed;
    color: #64748b;
}

.editor-idle-overlay {
    background: rgba(11, 11, 15, 0.35);
}

.editor-cloud-save-badge {
    color: #7dd3fc;
    background: rgba(56, 189, 248, .12);
    border: 1px solid rgba(56, 189, 248, .28);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.editor-cloud-save-badge i {
    color: #38bdf8;
}

.editor-top-actions.is-disabled .tool-btn-save {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Editor — Ideas FAB + drawer (prompt editor only; portaled to body for SPA) */
body:not(.is-prompt-editor-page) #ideasToggleBtn,
body:not(.is-prompt-editor-page) #ideasDrawer {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.editor-ideas-fab {
    position: fixed;
    right: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    z-index: 62;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-radius: 9999px;
    border: 1px solid rgba(139, 92, 246, .35);
    background: linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(244, 114, 182, .14));
    color: #ede9fe;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, .45),
        0 0 0 1px rgba(255, 255, 255, .05) inset;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.editor-save-fab-modal {
    color: #422006 !important;
    background: linear-gradient(135deg, #facc15 0%, #fbbf24 55%, #f59e0b 100%) !important;
    border-color: rgba(251, 191, 36, .55) !important;
}

.editor-save-fab-modal.is-saved {
    color: #166534 !important;
    background: rgba(34, 197, 94, .15) !important;
    border-color: rgba(34, 197, 94, .35) !important;
}

.editor-ideas-fab:hover {
    transform: translateY(-2px);
    border-color: rgba(167, 139, 250, .55);
    box-shadow:
        0 14px 36px rgba(139, 92, 246, .25),
        0 0 0 1px rgba(255, 255, 255, .08) inset;
}

.editor-ideas-fab.is-open {
    background: linear-gradient(135deg, rgba(139, 92, 246, .35), rgba(244, 114, 182, .22));
    border-color: rgba(167, 139, 250, .65);
}

.editor-ideas-fab__icon {
    color: #fbbf24;
    font-size: 0.875rem;
}

.editor-ideas-fab__chevron {
    font-size: 0.625rem;
    opacity: 0.75;
    transition: transform .25s ease;
}

body.mob-has-bottom-nav .editor-ideas-fab {
    bottom: calc(var(--mob-nav-h, 4rem) + var(--mob-nav-float, 0.625rem) + env(safe-area-inset-bottom, 0px) + 0.85rem);
}

body.editor-ideas-open .editor-ideas-fab:hover {
    transform: none;
}

.editor-ideas-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    max-height: min(50vh, 28rem);
    background: #111118;
    border-top: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 -20px 50px rgba(0, 0, 0, .55);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.editor-ideas-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}

.editor-ideas-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .05);
    color: #cbd5e1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    flex-shrink: 0;
}

.editor-ideas-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .18);
}

.editor-ideas-drawer.is-open {
    transform: translateY(0);
    pointer-events: auto;
}

.editor-ideas-drawer__inner {
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, .4) transparent;
    padding-bottom: 1rem;
    padding-right: 0.5rem;
}

body.mob-has-bottom-nav .editor-ideas-drawer {
    padding-bottom: calc(var(--mob-nav-h, 4rem) + var(--mob-nav-float, 0.625rem) + env(safe-area-inset-bottom, 0px));
}

body.mob-has-bottom-nav .editor-ideas-drawer__inner {
    max-height: min(46vh, 24rem);
}

/* Support — ticket list (My Tickets) */
.support-ticket-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: inherit;
    text-decoration: none;
}

.support-ticket-row__lead {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.support-ticket-row__content {
    flex: 1;
    min-width: 0;
}

.support-ticket-row__subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.support-ticket-row__actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.support-ticket-row__status {
    white-space: nowrap;
}

.support-ticket-pagination__nav {
    flex-shrink: 0;
}

@media (max-width: 1023px) {
    .support-ticket-list__header {
        padding-left: 1.125rem;
        padding-right: 1.125rem;
    }

    .support-ticket-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.875rem;
        padding: 1.125rem 1.125rem;
    }

    .support-ticket-row__lead {
        width: 100%;
        gap: 0.875rem;
    }

    .support-ticket-row__actions {
        width: 100%;
        padding-left: 3.25rem;
        justify-content: space-between;
        align-items: center;
    }

    .support-ticket-row__subject {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .support-ticket-row__tags {
        row-gap: 0.375rem;
    }

    .support-ticket-row__status {
        font-size: 0.6875rem;
        padding: 0.375rem 0.625rem;
    }

    .support-ticket-pagination {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 1.125rem;
        gap: 0.875rem;
    }

    .support-ticket-pagination__info {
        text-align: center;
        line-height: 1.55;
    }

    .support-ticket-pagination__info .text-slate-600 {
        display: block;
        margin-top: 0.125rem;
    }

    .support-ticket-pagination__nav {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 380px) {
    .support-ticket-row__actions {
        padding-left: 0;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .support-ticket-row__status {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    .support-ticket-pagination__nav a span:not(.sr-only) {
        display: none;
    }

    .support-ticket-pagination__nav a {
        min-width: 2.5rem;
        justify-content: center;
    }
}

/* Support — alerts */
.support-alert {
    display: flex;
    align-items: flex-start;
    gap: .875rem;
    padding: 1rem 1.125rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    animation: supportAlertIn .35s ease;
}

@keyframes supportAlertIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

.support-alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, .12), rgba(16, 185, 129, .04));
    border-color: rgba(16, 185, 129, .25);
}

.support-alert-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, .12), rgba(239, 68, 68, .04));
    border-color: rgba(239, 68, 68, .25);
}

.support-alert-muted {
    display: block;
    background: rgba(255, 255, 255, .02);
    border-color: rgba(255, 255, 255, .06);
    padding: 1.25rem;
}

.support-alert-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .95rem;
}

.support-alert-success .support-alert-icon {
    background: rgba(16, 185, 129, .15);
    color: #34d399;
}

.support-alert-error .support-alert-icon {
    background: rgba(239, 68, 68, .15);
    color: #f87171;
}

.support-alert-muted .support-alert-icon {
    background: rgba(148, 163, 184, .12);
    color: #94a3b8;
}

.support-alert-title {
    font-size: .8125rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: .125rem;
}

.support-alert-text {
    font-size: .8125rem;
    line-height: 1.5;
    color: #94a3b8;
}

.support-alert-success .support-alert-text { color: #6ee7b7; }
.support-alert-error .support-alert-text { color: #fca5a5; }

/* Support — toast (bottom-right) */
#profileSupportToastContainer {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

body.mob-has-bottom-nav #profileSupportToastContainer {
    bottom: calc(var(--mob-nav-h, 4rem) + var(--mob-nav-float, 0.625rem) + env(safe-area-inset-bottom, 0px) + 0.5rem);
}

.profile-support-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 16rem;
    max-width: 22rem;
    padding: 0.875rem 1rem;
    border-radius: 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: rgba(16, 185, 129, 0.95);
    border: 1px solid rgba(52, 211, 153, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transform: translateY(1rem);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.profile-support-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.profile-support-toast.is-hiding {
    transform: translateY(0.75rem);
    opacity: 0;
}

/* Support — custom select */
.support-select {
    position: relative;
}

.support-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .875rem;
    background: #0c0c12;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: .875rem;
    color: #e2e8f0;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.support-select-trigger:hover {
    border-color: rgba(139, 92, 246, .35);
    background: #0e0e15;
}

.support-select.is-open .support-select-trigger,
.support-select-trigger:focus-visible {
    outline: none;
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .15);
}

.support-select-leading {
    width: 2rem;
    height: 2rem;
    border-radius: .625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .8rem;
}

.support-select-label {
    flex: 1;
    text-align: left;
}

.support-select-chevron {
    font-size: .7rem;
    color: #64748b;
    transition: transform .2s ease, color .15s;
}

.support-select.is-open .support-select-chevron {
    transform: rotate(180deg);
    color: #a78bfa;
}

.support-select-menu {
    position: absolute;
    top: calc(100% + .5rem);
    left: 0;
    right: 0;
    z-index: 40;
    padding: .375rem;
    background: #13131a;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .55), 0 0 0 1px rgba(139, 92, 246, .08);
    max-height: 16rem;
    overflow-y: auto;
    animation: supportMenuIn .18s ease;
}

.support-select-menu[hidden] {
    display: none !important;
}

@keyframes supportMenuIn {
    from { opacity: 0; transform: translateY(-4px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.support-select-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem .75rem;
    border: none;
    border-radius: .75rem;
    background: transparent;
    color: #cbd5e1;
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, color .12s;
    text-align: left;
}

.support-select-option:hover {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

.support-select-option.is-active {
    background: rgba(139, 92, 246, .12);
    color: #fff;
}

.support-select-option-text {
    flex: 1;
}

.support-select-check {
    font-size: .7rem;
    color: #a78bfa;
    opacity: 0;
    transform: scale(.8);
    transition: opacity .12s, transform .12s;
}

.support-select-option.is-active .support-select-check {
    opacity: 1;
    transform: scale(1);
}

.support-select-option.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.support-select-option.is-disabled:hover {
    background: rgba(245, 158, 11, 0.08);
    color: #fcd34d;
}

.support-select-option-note {
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.125rem 0.45rem;
    border-radius: 9999px;
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.22);
}

.support-select-menu::-webkit-scrollbar {
    width: 5px;
}

.support-select-menu::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, .35);
    border-radius: 99px;
}

/* Multi-tab prompt content */
.prompt-tabs-bar {
    display: flex;
    align-items: center;
    gap: .375rem;
    flex-wrap: wrap;
}

.prompt-tabs-bar.hidden {
    display: none;
}

.prompt-tab-item {
    display: inline-flex;
    align-items: center;
    gap: .125rem;
}

.prompt-tab-btn {
    padding: .375rem .75rem;
    border-radius: .625rem;
    font-size: .75rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .06);
    transition: all .15s ease;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-tab-btn.is-active {
    color: #e9d5ff;
    background: rgba(139, 92, 246, .15);
    border-color: rgba(139, 92, 246, .35);
}

.prompt-tab-remove {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: .45rem;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
}

.prompt-tab-remove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, .12);
}

.prompt-tab-add {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .375rem .7rem;
    border-radius: .625rem;
    font-size: .72rem;
    font-weight: 700;
    color: #a78bfa;
    border: 1px dashed rgba(139, 92, 246, .35);
    background: rgba(139, 92, 246, .06);
}

.prompt-tab-add:hover {
    background: rgba(139, 92, 246, .12);
    color: #c4b5fd;
}
