/* Document-level scrollbar styling. No `scrollbar-gutter: stable`
   because .app-layout uses overflow:hidden — reserving a gutter
   would create an empty stripe on the right with no thumb. */
html, body {
    scrollbar-width: thin !important;
    scrollbar-color: #1A9AB5 transparent !important;
}
/* Global WebKit scrollbar — catches every scroll container */
::-webkit-scrollbar { width: 10px !important; height: 10px !important; background: transparent !important; }
::-webkit-scrollbar-track { background: transparent !important; background-color: transparent !important; border: none !important; box-shadow: none !important; }
::-webkit-scrollbar-track-piece { background: transparent !important; background-color: transparent !important; }
::-webkit-scrollbar-thumb { background: #1A9AB5 !important; border-radius: 10px !important; border: none !important; transition: background 0.2s ease !important; }
::-webkit-scrollbar-thumb:hover { background: #2BAFD4 !important; }
::-webkit-scrollbar-corner { background: transparent !important; }

/* Base typography & color */
.briefing-fox-app-wrapper {
    font-family: 'Inter', sans-serif;
    color: #F1F5F9;
}

/* -------------------------------------------
    MODE SPECIFIC LAYOUT LOGIC
    ------------------------------------------- */

/* APP MODE: Full Screen, Fixed, Unscrollable Background */
.briefing-fox-app-wrapper.mode-app {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100dvh !important;
    margin: 0 !important; padding: 0 !important;
    background-color: #0D1B2A !important;
    overflow: hidden; display: flex; flex-direction: column; z-index: 99999 !important;
}

/* HEADER/LIBRARY MODE: Standard scrolling relative element */
.briefing-fox-app-wrapper.mode-header,
.briefing-fox-app-wrapper.mode-library {
    position: relative;
    z-index: 1000;
			width: 100%;
			background: transparent;
}

.briefing-fox-app-wrapper.mode-header .ai-site-header,
.briefing-fox-app-wrapper.mode-library .ai-site-header {
    position: sticky;
    top: 0;
    background: transparent;
    border-bottom: none;
}

/* Ambient Glow - Hidden on legal pages so it doesn't mess up text readability */
.ambient-glow { position: absolute; top: -10%; left: 50%; transform: translateX(-50%); width: 800px; max-width: 100vw; height: 600px; background: radial-gradient(circle, rgba(26, 154, 181,0.15) 0%, rgba(13, 27, 42,0) 70%); border-radius: 50%; pointer-events: none; z-index: 0; animation: ambientPulse 8s ease-in-out infinite; }
@keyframes ambientPulse { 0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); } 50% { opacity: 1; transform: translateX(-50%) scale(1.12); } }
.briefing-fox-app-wrapper.mode-header .ambient-glow { display: none; }
.briefing-fox-app-wrapper.mode-library .ambient-glow { display: none; }

/* Noise/grain texture overlay */
.noise-overlay { position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E"); opacity: 0.028; pointer-events: none; z-index: 0; }
.briefing-fox-app-wrapper.mode-header .noise-overlay { display: none; }
.briefing-fox-app-wrapper.mode-library .noise-overlay { display: none; }

/* Stage 1 staggered entrance animations */
.stage-enter { animation: stageEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stage-enter-d1 { animation: stageEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both; }
.stage-enter-d2 { animation: stageEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both; }
@keyframes stageEnter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

/* Hero brand gradient text */
.hero-brand { background: linear-gradient(135deg, #1A9AB5 0%, #82DEFF 50%, #B8F0FF 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Prevent Elementor paragraph margins from messing up layout */
.briefing-fox-app-wrapper p { margin: 0; }
.briefing-fox-app-wrapper h1 { margin: 0 0 24px 0 !important; padding: 0 !important; }
.briefing-fox-app-wrapper h2, .briefing-fox-app-wrapper h3, .briefing-fox-app-wrapper h4 { margin: 0 !important; padding: 0 !important; }

/* --- HEADER STYLES --- */
.briefing-fox-app-wrapper .ai-site-header {
    width: 100%; height: 70px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; background: transparent; border-bottom: none;
    flex-shrink: 0; z-index: 50; position: relative;
}
@media (max-width: 768px) {
    .briefing-fox-app-wrapper .ai-site-header { padding: 0 16px; background: transparent !important; height: 60px; border-bottom: 1px solid rgba(255,255,255,0.06); } 
    .ai-header-logo-img { height: 38px !important; }
    .ai-login-btn { width: 38px !important; min-width: 38px !important; height: 38px !important; padding: 0 !important; border-radius: 50% !important; justify-content: center !important; }
    .ai-login-btn span { display: none !important; }
}

.ai-header-logo-link { display: flex; align-items: center; transition: opacity 0.2s; }
.ai-header-logo-link:hover { opacity: 0.9; }
.ai-header-logo-img { height: 56px !important; width: auto !important; object-fit: contain; display: block; }
.ai-auth-container { display: flex; align-items: center; position: relative; gap: 12px; }

/* --- Navigation Pill (desktop only, stage-input only) --- */
.bf-nav-pill {
    position: absolute;
    top: 60%;
    left: calc(50% + 34px);
    transform: translate(-50%, -50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 99px;
    padding: 4px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease, opacity 0.3s ease;
}
.bf-nav-pill:hover {
    border-color: rgba(255,255,255,0.12);
}
.bf-nav-pill a {
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    width: 100px;
    text-align: center;
    padding: 7px 0;
    border-radius: 99px;
    letter-spacing: 0.01em;
}
.bf-nav-pill a:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.06);
}
.bf-nav-pill a:focus,
.bf-nav-pill a:active,
.bf-nav-pill a:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}
/* Nav item wrapper for popover positioning */
.bf-nav-item {
    position: relative;
}
.bf-nav-item > a {
    display: block;
}

/* --- Hover Popovers --- */
.bf-popover {
    position: absolute;
    top: calc(100% + 18px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 100;
}
.bf-popover-pricing { width: 300px; }

.bf-nav-item:hover .bf-popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.12s;
}

/* Invisible bridge between pill link and popover */
.bf-popover-bridge {
    position: absolute;
    top: -18px;
    left: 0;
    right: 0;
    height: 18px;
}

.bf-popover-arrow {
    width: 10px;
    height: 10px;
    background: #124559;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-left: 1px solid rgba(255,255,255,0.08);
    transform: rotate(45deg);
    position: absolute;
    top: -5px;
    left: 50%;
    margin-left: -5px;
    z-index: 1;
}
.bf-popover-body {
    background: #124559;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    z-index: 2;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(26, 154, 181, 0.3) transparent;
}
.bf-popover-body::-webkit-scrollbar { width: 4px; }
.bf-popover-body::-webkit-scrollbar-track { background: transparent; }
.bf-popover-body::-webkit-scrollbar-thumb { background: rgba(26, 154, 181, 0.3); border-radius: 4px; }

/* Guide popover */
.bf-pop-heading {
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin: 0 0 16px 0;
    text-align: center;
    letter-spacing: -0.01em;
}
.bf-pop-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
}
.bf-pop-step + .bf-pop-step {
    border-top: 1px solid rgba(255,255,255,0.05);
}
.bf-pop-num {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #82DEFF;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(130, 222, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.bf-pop-title {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin: 0 0 8px 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.3;
}
.bf-pop-desc {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    margin: 4px 0 0 0 !important;
    line-height: 1.55;
}

/* Pricing popover: two plan cards, Premium highlighted */
.bf-popover-pricing { width: 320px; }
.bf-popover-pricing .bf-popover-body { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.bf-pop-plan {
    padding: 14px 14px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
}
.bf-pop-plan-pro {
    background: linear-gradient(160deg, rgba(26,154,181,0.22) 0%, rgba(26,154,181,0.05) 100%);
    border-color: rgba(130,222,255,0.30);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.bf-pop-plan-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.bf-pop-plan-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #C9D4E2;
}
.bf-pop-plan-name.bf-pop-pro { color: #F5C26B; }
.bf-pop-plan-name i { font-size: 10px; }
.bf-pop-plan-price {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #F1F5F9;
}
.bf-pop-plan-period {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    color: rgba(255,255,255,0.45);
}
.bf-pop-yearly {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin: -4px 0 10px;
    font-family: 'Inter', sans-serif;
    font-size: 11.5px;
    color: rgba(255,255,255,0.6);
}
.bf-pop-save {
    padding: 1px 7px;
    border-radius: 99px;
    background: #F5C26B;
    color: #0D1B2A;
    font-size: 10px;
    font-weight: 700;
}
.bf-pop-features {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid;
    gap: 6px;
}
.bf-pop-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    line-height: 1.4;
    color: rgba(255,255,255,0.78);
}
.bf-pop-features li::before { content: none !important; }
.bf-pop-features li i { width: 12px; font-size: 10px; color: #1A9AB5; }
.bf-pop-plan-pro .bf-pop-features li i { color: #82DEFF; }
.bf-pop-upgrade-btn {
    display: block !important;
    width: 100% !important;
    margin-top: 14px !important;
    padding: 10px 0 !important;
    background: #1A9AB5 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    text-align: center !important;
    letter-spacing: 0.01em !important;
    outline: none !important;
    box-shadow: none !important;
}
.bf-pop-upgrade-btn:hover,
.bf-pop-upgrade-btn:active,
.bf-pop-upgrade-btn:focus {
    background: #157E96 !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
}
.bf-pop-free-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    margin-top: 8px !important;
    padding: 9px 0 !important;
    background: transparent !important;
    color: #B8F0FF !important;
    border: 1px solid rgba(165,180,252,0.35) !important;
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    letter-spacing: 0.01em !important;
    cursor: pointer !important;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
    box-sizing: border-box !important;
}
.bf-pop-free-link:hover,
.bf-pop-free-link:focus {
    background: rgba(26, 154, 181,0.10) !important;
    border-color: rgba(165,180,252,0.6) !important;
    color: #e0e7ff !important;
    text-decoration: none !important;
    outline: none !important;
}

/* Compact Guide popover for shorter screens */
@media (max-height: 750px) {
}

@media (max-height: 600px) {
}

@media (max-width: 768px) {
    .bf-nav-pill { display: none !important; }
}

.ai-login-btn {
    background: #1A9AB5 !important; color: #ffffff !important; border: none !important; padding: 0 20px !important;
    border-radius: 99px !important; font-size: 0.85rem !important; font-weight: 700 !important; cursor: pointer; transition: all 0.2s;
    display: flex !important; align-items: center; gap: 8px; justify-content: center; text-decoration: none !important; height: 38px !important;
}
.ai-login-btn:hover { background: #157E96 !important; transform: translateY(-1px); }

/* Login nudge popover (anchored under the login button, no overlay) */
.ai-auth-container { position: relative; }
.ai-login-nudge {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: #124559;
    border: 1px solid #1A9AB5;
    color: #F1F5F9;
    border-radius: 12px;
    padding: 12px 36px 12px 16px;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-width: 280px;
    z-index: 60;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.ai-login-nudge.ai-login-nudge-show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.ai-login-nudge-arrow {
    position: absolute;
    top: -7px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: #124559;
    border-left: 1px solid #1A9AB5;
    border-top: 1px solid #1A9AB5;
    transform: rotate(45deg);
}
.ai-login-nudge-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: none;
    color: #8D99AE;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}
.ai-login-nudge-close:hover { color: #F1F5F9; background: rgba(255,255,255,0.06); }
.ai-login-nudge-text strong { color: #82DEFF; font-weight: 700; }
@media (max-width: 767px) {
    .ai-login-nudge {
        position: fixed;
        top: 60px;
        right: 12px;
        left: auto;
        max-width: 260px;
    }
    .ai-login-nudge-arrow { right: 12px; }
}

/* In-app browser modal (Reddit/Twitter/Instagram/etc.) */
.bf-iab-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 14, 0.82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.bf-iab-backdrop.bf-iab-show {
    display: flex;
    opacity: 1;
}
.bf-iab-card {
    background: linear-gradient(180deg, #0f2a36 0%, #0a1a23 100%);
    border: 1px solid rgba(26,154,181,0.35);
    border-radius: 20px;
    max-width: 400px;
    width: 100%;
    padding: 28px 24px 22px;
    box-shadow: 0 28px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    color: #f1f5f9;
    text-align: center;
    transform: translateY(12px);
    transition: transform 0.25s ease;
}
.bf-iab-backdrop.bf-iab-show .bf-iab-card { transform: translateY(0); }
.bf-iab-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1A9AB5 0%, #82DEFF 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 10px 26px rgba(26,154,181,0.45);
}
.bf-iab-icon i { color: #ffffff; font-size: 22px; }
.bf-iab-card h3 {
    margin: 0 0 8px;
    font-size: 1.18rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.bf-iab-card p {
    margin: 0 0 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #cbd5e1;
}
.bf-iab-steps {
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 16px;
    text-align: left;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #d4d4d8;
}
.bf-iab-steps strong { color: #82DEFF; font-weight: 700; }
.bf-iab-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bf-iab-btn {
    height: 44px;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.bf-iab-btn-primary {
    background: #1A9AB5 !important;
    color: #ffffff !important;
}
.bf-iab-btn-primary:hover,
.bf-iab-btn-primary:focus { background: #157E96 !important; color: #ffffff !important; }
.bf-iab-btn-secondary {
    background: rgba(255,255,255,0.05) !important;
    color: #d4d4d8 !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}
.bf-iab-btn-secondary:hover,
.bf-iab-btn-secondary:focus {
    background: rgba(255,255,255,0.1) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.18) !important;
}
.bf-iab-dismiss {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 0.78rem;
    margin-top: 12px;
    cursor: pointer;
    padding: 6px 8px;
    font-family: inherit;
    transition: color 0.2s ease;
}
.bf-iab-dismiss:hover { color: #d4d4d8; }

.ai-user-trigger { position: relative; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 38px; height: 38px; border-radius: 50% !important; border: 2px solid #163344 !important; object-fit: cover; }

.ai-user-dropdown { display: none; position: absolute; top: 130%; right: 0; width: 260px; background: #124559 !important; border: 1px solid #163344 !important; border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); z-index: 60; animation: slideUpFade 0.2s ease-out; }
.ai-user-dropdown.is-open { display: block; }
.dropdown-upgrade-btn { background: linear-gradient(135deg, #157E96 0%, #82DEFF 50%, #157E96 100%) !important; color: #ffffff !important; border: 1px solid rgba(130, 222, 255, 0.5) !important; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: all 0.2s; width: 100%; text-shadow: 0 1px 2px rgba(0,0,0,0.2); outline: none !important; }
.dropdown-upgrade-btn:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26, 154, 181, 0.35); }

.user-header { padding: 16px; border-bottom: 1px solid #163344 !important; background: #0D1B2A !important; border-radius: 16px 16px 0 0; }
.user-name { font-size: 14px; font-weight: 700; color: #F1F5F9 !important; }
.user-email { margin-top: 2px !important; font-size: 11px; color: #8D99AE !important; overflow: hidden; text-overflow: ellipsis; }
.stats-box { padding: 12px 16px; border-bottom: 1px solid #163344 !important; }
.stats-header { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: #8D99AE !important; margin-bottom: 6px; }
.progress-track { width: 100%; height: 6px; background: #163344 !important; border-radius: 3px; }
.progress-fill { height: 100%; transition: width 0.3s; border-radius: 3px; }
.info-row { display: flex; justify-content: space-between; padding: 10px 16px; font-size: 12px; color: #d4d4d8 !important; border-bottom: 1px solid #163344 !important; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: #d4d4d8 !important; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s ease !important; }
.menu-item:hover { background-color: #163344 !important; color: #ffffff !important; }
.menu-item.logout { color: #ef4444 !important; }
.menu-item.logout:hover { background-color: rgba(239, 68, 68, 0.1) !important; }

/* Share-rewards section in the avatar dropdown */
.bf-rewards-box { padding: 12px 16px; border-bottom: 1px solid #163344 !important; }
.bf-rewards-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 600; color: #8D99AE; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.bf-rewards-head .bf-rewards-monthly-label { color: #d4d4d8; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 11px; }
.bf-rewards-tier-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.bf-rewards-tier-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); font-size: 11px; }
.bf-rewards-tier-row.is-claimable { background: rgba(26, 154, 181,0.12); border-color: rgba(26, 154, 181,0.35); }
.bf-rewards-tier-row.is-claimed { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.2); }
.bf-rewards-tier-label { color: #d4d4d8; font-weight: 500; line-height: 1.3; }
.bf-rewards-tier-label .bf-rewards-tier-num { color: #F1F5F9; font-weight: 700; }
.bf-rewards-tier-claim-btn { background: #1A9AB5; color: #fff !important; border: none; padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer; transition: background 0.15s ease; white-space: nowrap; }
.bf-rewards-tier-claim-btn:hover { background: #157E96; }
.bf-rewards-tier-claim-btn:disabled { opacity: 0.6; cursor: wait; }
.bf-rewards-tier-status { font-size: 10.5px; color: #8D99AE; font-weight: 500; white-space: nowrap; }
.bf-rewards-tier-status.is-claimed { color: #22c55e; }
.bf-rewards-foot { font-size: 10px; color: #8D99AE; margin-top: 8px; text-align: center; }

/* --- WP THEME OVERRIDE PROTECTIONS --- */
.briefing-fox-app-wrapper button, 
.briefing-fox-app-wrapper a[role="button"],
.briefing-fox-app-wrapper a.ai-login-btn,
.briefing-fox-app-wrapper a.share-social-btn { outline: none !important; text-decoration: none !important; }

.sidebar-toggle-btn { background: transparent !important; color: #8D99AE !important; border: none !important; }
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.05) !important; color: #ffffff !important; }

.new-brief-btn { background: rgba(255,255,255,0.05) !important; color: #ffffff !important; border: 1px solid rgba(255,255,255,0.05) !important; }
.new-brief-btn:hover { background: rgba(255,255,255,0.1) !important; border-color: rgba(255,255,255,0.1) !important; color: #ffffff !important; }

.history-search-input { width: 100%; background: rgba(0,0,0,0.2) !important; border: 1px solid rgba(255,255,255,0.06) !important; color: #e4e4e7 !important; border-radius: 10px; padding: 8px 12px 8px 34px !important; font-size: 0.8rem !important; outline: none !important; transition: all 0.2s; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1) !important; }
.history-search-input:focus { border-color: rgba(26, 154, 181,0.4) !important; background: rgba(0,0,0,0.4) !important; }

.sidebar-guide-btn { background: transparent !important; border: none !important; color: #8D99AE !important; outline: none !important; box-shadow: none !important; cursor: pointer !important; transition: color 0.2s ease !important; }
.sidebar-guide-btn:hover, .sidebar-guide-btn:active { color: #ffffff !important; background: transparent !important; }

.sidebar-clear-btn { background: transparent !important; border: none !important; color: #ef4444 !important; outline: none !important; box-shadow: none !important; cursor: pointer !important; transition: color 0.2s ease !important; opacity: 0.8; }
.sidebar-clear-btn:hover, .sidebar-clear-btn:active { color: #f87171 !important; opacity: 1; background: transparent !important; }

.sidebar-legal-link, .sidebar-legal-link:visited { color: #8D99AE !important; text-decoration: none !important; transition: color 0.2s ease !important; outline: none !important; }
.sidebar-legal-link:hover, .sidebar-legal-link:active, .sidebar-legal-link:focus { color: #d4d4d8 !important; }

.mobile-nav-btn { background: transparent !important; border: none !important; color: #d4d4d8 !important; }
.mobile-nav-btn:hover { color: #ffffff !important; }
.mobile-nav-btn.text-cyan-300 { color: #82DEFF !important; }
.mobile-nav-btn.text-cyan-300:hover { color: #a5b4fc !important; }

.btn-primary { background: linear-gradient(135deg, #1A9AB5 0%, #157E96 100%) !important; color: white !important; padding: 16px 28px !important; border-radius: 16px !important; text-align: center !important; border: none !important; font-weight: 600 !important; cursor: pointer !important; }
.btn-primary:hover { filter: brightness(1.1) !important; transform: translateY(-1px) !important; }

.btn-secondary { background: rgba(18, 69, 89, 0.8) !important; color: #d4d4d8 !important; border: 1px solid rgba(255,255,255,0.1) !important; padding: 16px 28px !important; border-radius: 16px !important; text-align: center !important; font-weight: 600 !important; cursor: pointer !important; }
.btn-secondary:hover { background: rgba(18, 69, 89, 1) !important; border-color: rgba(255,255,255,0.2) !important; color: #ffffff !important; }

.btn-regenerate { background: rgba(26, 154, 181, 0.08) !important; color: #B8F0FF !important; border: 1px solid rgba(26, 154, 181, 0.28) !important; padding: 16px 28px !important; border-radius: 16px !important; text-align: center !important; font-weight: 600 !important; cursor: pointer !important; transition: all 0.2s ease !important; outline: none !important; text-decoration: none !important; box-shadow: none !important; }
.btn-regenerate:hover { background: rgba(26, 154, 181, 0.16) !important; border-color: rgba(26, 154, 181, 0.55) !important; color: #ffffff !important; transform: translateY(-1px) !important; text-decoration: none !important; box-shadow: 0 4px 14px rgba(26, 154, 181, 0.18) !important; }
.btn-regenerate:active { background: rgba(26, 154, 181, 0.22) !important; border-color: rgba(26, 154, 181, 0.65) !important; color: #ffffff !important; transform: translateY(0) !important; box-shadow: none !important; text-decoration: none !important; }
.btn-regenerate:focus-visible { outline: 2px solid rgba(26, 154, 181, 0.6) !important; outline-offset: 2px !important; }
.btn-regenerate:disabled { opacity: 0.5 !important; cursor: not-allowed !important; transform: none !important; }

.btn-danger { background: #ef4444 !important; color: white !important; padding: 16px 28px !important; border-radius: 16px !important; text-align: center !important; border: none !important; font-weight: 600 !important; cursor: pointer !important; }
.btn-danger:hover { background: #dc2626 !important; filter: brightness(1.1) !important; transform: translateY(-1px) !important; }

.action-btn-secondary { background: rgba(18, 69, 89, 0.8) !important; border: 1px solid rgba(255,255,255,0.1) !important; color: #d4d4d8 !important; }
.action-btn-secondary:hover { background: #163344 !important; color: #ffffff !important; border-color: rgba(255,255,255,0.2) !important; }

.action-btn-share { background: rgba(252, 211, 77, 0.12) !important; border: 1px solid rgba(252, 211, 77, 0.4) !important; color: #FCD34D !important; position: relative !important; overflow: hidden !important; }
.action-btn-share:hover { background: rgba(252, 211, 77, 0.22) !important; border-color: #FCD34D !important; color: #FEF3C7 !important; }
.action-btn-share::after { content: ''; position: absolute; top: 0; left: -75%; width: 50%; height: 100%; background: linear-gradient(120deg, transparent 0%, rgba(252, 211, 77, 0.22) 50%, transparent 100%); animation: share-shimmer 2.8s ease-in-out infinite; }
@keyframes share-shimmer { 0% { left: -75%; } 60%, 100% { left: 125%; } }

.share-reward-bar { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; margin-bottom: 20px; padding: 8px 16px; background: rgba(252, 211, 77, 0.08); border: 1px solid rgba(252, 211, 77, 0.25); border-radius: 12px; font-size: 12px; color: #d4d4d8; }
.bf-save-brief-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; padding: 12px 16px; background: rgba(130, 222, 255, 0.08); border: 1px solid rgba(130, 222, 255, 0.3); border-radius: 12px; font-size: 13px; color: #d4d4d8; }
.bf-save-brief-text { display: flex; align-items: center; gap: 10px; }
.bf-save-brief-btn, .bf-save-brief-btn:focus { display: inline-flex !important; align-items: center !important; padding: 8px 16px !important; border: none !important; border-radius: 10px !important; background: #2563eb !important; color: #ffffff !important; font-size: 13px !important; font-weight: 600 !important; line-height: 1.4 !important; white-space: nowrap !important; text-decoration: none !important; box-shadow: none !important; cursor: pointer; transition: background 0.2s; }
.bf-save-brief-btn:hover { background: #1d4ed8 !important; color: #ffffff !important; border: none !important; }
.bf-save-brief-btn:active { background: #1e40af !important; color: #ffffff !important; border: none !important; transform: translateY(1px); }
.bf-free-week-btn, .bf-free-week-btn:focus { background: rgba(34, 211, 238, 0.1) !important; color: #a5f3fc !important; border: 1px solid rgba(34, 211, 238, 0.25) !important; text-decoration: none !important; box-shadow: none !important; }
.bf-free-week-btn:hover { background: rgba(34, 211, 238, 0.15) !important; color: #a5f3fc !important; border: 1px solid rgba(34, 211, 238, 0.4) !important; }
.bf-free-week-btn:active { background: rgba(34, 211, 238, 0.22) !important; color: #cffafe !important; border: 1px solid rgba(34, 211, 238, 0.5) !important; }

.action-btn-primary { background: rgba(26, 154, 181,0.1) !important; border: 1px solid rgba(26, 154, 181,0.3) !important; color: #82DEFF !important; }
.action-btn-primary:hover { background: #1A9AB5 !important; color: #ffffff !important; border-color: #1A9AB5 !important; }

.copy-prompt-btn { background: rgba(39, 39, 42, 0.8) !important; border: 1px solid rgba(255,255,255,0.1) !important; color: #ffffff !important; }
.copy-prompt-btn:hover { background: #163344 !important; border-color: rgba(255,255,255,0.2) !important; }

.modal-btn-red { border: 1px solid rgba(239,68,68,0.5) !important; background: transparent !important; color: #ef4444 !important; outline: none !important; transition: all 0.2s ease !important; cursor: pointer !important; }
.modal-btn-red:hover, .modal-btn-red:active { background: rgba(127,29,29,0.2) !important; color: #f87171 !important; border-color: rgba(239,68,68,0.8) !important; }

.modal-btn-red-fill { border: 1px solid #ef4444 !important; background: #ef4444 !important; color: #ffffff !important; outline: none !important; transition: all 0.2s ease !important; cursor: pointer !important; }
.modal-btn-red-fill:hover, .modal-btn-red-fill:active { background: #dc2626 !important; border-color: #dc2626 !important; transform: translateY(-1px) !important; box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important; }

.modal-btn-orange { background: #ea580c !important; border: none !important; color: #ffffff !important; outline: none !important; transition: all 0.2s ease !important; cursor: pointer !important; }
.modal-btn-orange:hover, .modal-btn-orange:active { background: #c2410c !important; transform: translateY(-1px) !important; box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3) !important; }

.modal-btn-dark { background: #163344 !important; border: 1px solid rgba(255,255,255,0.05) !important; color: #e4e4e7 !important; outline: none !important; transition: all 0.2s ease !important; cursor: pointer !important; }
.modal-btn-dark:hover, .modal-btn-dark:active { background: #163344 !important; color: #ffffff !important; border-color: rgba(255,255,255,0.1) !important; }

.share-modal-close { background: transparent !important; color: #8D99AE !important; border: none !important; }
.share-modal-close:hover { color: #ffffff !important; }

.share-modal-copy { background: rgba(255,255,255,0.05) !important; color: #ffffff !important; border: 1px solid rgba(255,255,255,0.1) !important; }
.share-modal-copy:hover { background: rgba(255,255,255,0.1) !important; border-color: rgba(255,255,255,0.2) !important; }

.shared-open-btn { background: #1A9AB5 !important; color: #ffffff !important; border: none !important; box-shadow: 0 4px 15px rgba(26, 154, 181,0.3) !important; outline: none !important; transition: all 0.2s ease !important; cursor: pointer !important; }
.shared-open-btn:hover, .shared-open-btn:active { background: #157E96 !important; transform: translateY(-1px) !important; color: #ffffff !important; }

.share-social-btn { background: rgba(255,255,255,0.05) !important; border: 1px solid rgba(255,255,255,0.05) !important; color: #ffffff !important; }
.share-social-btn:hover { background: rgba(255,255,255,0.1) !important; border-color: rgba(255,255,255,0.15) !important; color: #ffffff !important; }

.launch-engine-btn { background: rgba(18, 69, 89, 0.6) !important; border: 1px solid rgba(255,255,255,0.05) !important; }
.launch-engine-btn:hover { background: rgba(39, 39, 42, 1) !important; border-color: rgba(26, 154, 181,0.5) !important; box-shadow: 0 4px 20px rgba(26, 154, 181,0.15) !important; }

/* Custom launch button states */
.launch-action-content { opacity: 0; transform: translateY(8px); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.launch-default-content { transition: opacity 0.3s ease; }

@media (hover: hover) {
    .launch-engine-btn:hover .launch-default-content { opacity: 0 !important; }
    .launch-engine-btn:hover .launch-action-content { opacity: 1 !important; transform: translateY(0) !important; }
}

.launch-engine-btn.mobile-primed { background: rgba(39, 39, 42, 1) !important; border-color: rgba(26, 154, 181,0.5) !important; box-shadow: 0 4px 20px rgba(26, 154, 181,0.15) !important; }
.launch-engine-btn.mobile-primed .launch-default-content { opacity: 0 !important; }
.launch-engine-btn.mobile-primed .launch-action-content { opacity: 1 !important; transform: translateY(0) !important; }

.attach-trigger { background: transparent !important; color: #8D99AE !important; border: none !important; }
.attach-trigger:not(:disabled):hover { color: #ffffff !important; background: rgba(255,255,255,0.02) !important; }
.attach-trigger:disabled { opacity: 0.5; cursor: not-allowed !important; }

.attach-remove { background: transparent !important; color: #8D99AE !important; border: none !important; }
.attach-remove:hover { color: #ef4444 !important; background: rgba(239, 68, 68, 0.1) !important; }

.tip-nav-btn { background: transparent !important; border: none !important; color: #8D99AE !important; outline: none !important; cursor: pointer !important; }
.tip-nav-btn:hover { background: rgba(255,255,255,0.1) !important; color: #ffffff !important; }
.tip-nav-btn:active { background: rgba(255,255,255,0.15) !important; color: #ffffff !important; }

.attach-wrapper.active { border-color: rgba(26, 154, 181,0.5) !important; }

.meta-chip { display: flex; flex-direction: column; width: 100%; padding: 12px 16px; cursor: pointer; transition: all 0.2s ease; background: rgba(18, 69, 89, 0.4) !important; border: 1px solid rgba(255, 255, 255, 0.06) !important; border-radius: 16px; }
.meta-chip:hover { border-color: rgba(255, 255, 255, 0.15) !important; background: rgba(18, 69, 89, 0.8) !important; }
.meta-chip.active { border-color: rgba(26, 154, 181,0.5) !important; background: rgba(26, 154, 181,0.05) !important; }
.meta-chip.error { border-color: #ef4444 !important; }

.custom-option { padding: 6px 12px; display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #d4d4d8; cursor: pointer; border-radius: 6px; margin: 2px; transition: background 0.15s ease; outline: none; }
.custom-option:hover, .custom-option:focus, .custom-option.submenu-open { background: rgba(26, 154, 181,0.1) !important; color: #ffffff !important; }
.custom-option.selected { background: rgba(26, 154, 181,0.2) !important; color: #82DEFF !important; font-weight: 500; }

/* Mobile Modal Dropdowns */
@media (max-width: 768px) {
    .custom-options {
        position: fixed !important;
        top: 50% !important;
        bottom: auto !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0.95) !important;
        width: 90vw !important;
        max-width: 420px !important;
        height: auto !important;
        max-height: 70vh !important;
        z-index: 100000 !important;
        border-radius: 20px !important;
        padding: 0 !important; /* Flush items to edges */
        background: rgba(18, 69, 89, 0.95) !important;
        backdrop-filter: blur(16px) !important;
        box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8), 0 0 0 100vmax rgba(0,0,0,0.6) !important;
        display: block !important; 
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        border: 1px solid rgba(255,255,255,0.1) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
    .custom-options.open {
        transform: translate(-50%, -50%) scale(1) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    .custom-option {
        padding: 16px 20px !important;
        font-size: 1rem !important; /* Slightly more readable */
        border-radius: 0 !important;
        margin: 0 !important;
        border-bottom: 1px solid rgba(255,255,255,0.06) !important;
        gap: 12px !important; /* Extra space between icon and text */
    }
    .custom-option:last-child {
        border-bottom: none !important;
    }
    .custom-option .gap-2 {
        gap: 12px !important; /* Ensure nested flex items match the gap */
    }
    .custom-option i.min-icon {
        font-size: 1.25rem !important; /* Bigger icons */
        width: 24px; /* Consistent width for vertical alignment */
        text-align: center;
    }
    .custom-option.group {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        align-items: center !important;
        transition: background 0.3s ease !important;
    }
    .custom-option.group.submenu-open-mobile {
        background: rgba(255,255,255,0.05) !important; /* Highlights the entire expanded block */
    }
    .submenu-container {
        position: relative !important; /* Forces it into the document flow to push everything down */
        bottom: auto !important; /* Stops it from teleporting upwards */
        top: auto !important;
        grid-column: 1 / -1 !important;
        width: calc(100% + 40px) !important; /* Counteract parent padding */
        background: transparent !important; /* Removes the nested dark tray look */
        border: none !important;
        box-shadow: none !important; /* Removes the inset shadow */
        padding: 0 !important;
        margin: 16px -20px -16px -20px !important; /* Grid flawlessly accepts negative margins */
        display: none !important;
        border-radius: 0 !important;
    }
    .submenu-container .custom-option {
        padding-left: 54px !important; /* Indent nested items */
        background: transparent !important;
        border-bottom: none !important; /* Cleaner look */
        border-top: 1px solid rgba(255,255,255,0.03) !important; /* Subtle separator from the header */
    }
    .group.submenu-open-mobile .submenu-container {
        display: block !important;
    }
    .group.submenu-open-mobile > i.fa-chevron-right {
        transform: rotate(90deg);
    }
}

/* --- APP WORKSPACE STYLES (Only applied to full app) --- */
.app-layout { flex: 1; display: flex; position: relative; overflow: hidden; width: 100%; min-height: 0; background: transparent; }

.app-sidebar { width: 280px; background: rgba(13, 27, 42, 0.4); backdrop-filter: blur(12px); border-right: 1px solid rgba(255,255,255,0.06); display: flex; flex-direction: column; z-index: 40; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease; flex-shrink: 0; }
@media (max-width: 768px) { .app-sidebar { position: absolute; top: 0; bottom: 0; left: 0; transform: translateX(-100%); z-index: 90; background: #0D1B2A; } .app-sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.8); } }

@media (min-width: 769px) {
    .app-sidebar.collapsed { width: 68px; }
    .app-sidebar.collapsed .sidebar-text,
    .app-sidebar.collapsed .history-section-title,
    .app-sidebar.collapsed .history-search-container,
    .app-sidebar.collapsed .sidebar-clear-btn { display: none !important; }
    .app-sidebar.collapsed .sidebar-header-container { flex-direction: column; padding: 12px 10px; gap: 12px; }
    .app-sidebar.collapsed .sidebar-toggle-btn { width: 100%; margin-bottom: 0; }
    .app-sidebar.collapsed .new-brief-btn { width: 100%; padding: 0; justify-content: center; border: none; background: transparent; box-shadow: none; }
    .app-sidebar.collapsed .new-brief-btn:hover { background: rgba(255,255,255,0.1); }
    .app-sidebar.collapsed .history-item { display: none; } 
    .app-sidebar.collapsed .history-delete { display: none !important; }
    
    .app-sidebar.collapsed .sidebar-footer { padding: 16px 0; align-items: center; }
    .app-sidebar.collapsed .sidebar-guide-btn { justify-content: center; padding: 0; width: 100%; }
    .app-sidebar.collapsed .sidebar-legal-links { display: none; }
}

.app-main { flex: 1; display: flex; flex-direction: column; position: relative; background: transparent; overflow: hidden; z-index: 10; }

/* Loader: constrained to canvas area on desktop so sidebar stays interactive */
@media (min-width: 769px) {
    #loader {
        top: 70px; /* Below the header, so the logo keeps its normal background while loading */
        left: 68px; /* Default: sidebar starts collapsed (68px) */
        z-index: 35;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    body:has(.app-sidebar:not(.collapsed)) #loader { left: 280px; }
}

.workspace-canvas { flex: 1; overflow-y: auto; padding: 24px 16px calc(var(--bottom-bar-h, 120px) + 16px) 16px; scroll-behavior: smooth; z-index: 10; position: relative; display: flex; flex-direction: column; }
@media (min-width: 768px) { .workspace-canvas { padding: 32px 24px calc(var(--bottom-bar-h, 180px) + 24px) 24px; } }
.workspace-canvas.input-stage-active { overflow-y: auto; overflow-x: hidden; }

.bottom-input-bar { position: absolute; bottom: 0; left: 0; right: 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)) 16px; background: linear-gradient(to top, #0D1B2A 70%, transparent); transition: transform 0.6s, opacity 0.4s; z-index: 30; pointer-events: none; }
@media (min-width: 768px) { .bottom-input-bar { padding: 32px 24px; } }
.bottom-input-bar > div { pointer-events: auto; }
.bottom-input-bar.hidden-down { transform: translateY(150%); opacity: 0; pointer-events: none; }

.command-bar-glow { display: block; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 70%; height: 120px; background: radial-gradient(ellipse at bottom, rgba(26, 154, 181,0.18) 0%, transparent 70%); pointer-events: none; z-index: 0; filter: blur(8px); }
.chat-input-wrapper { position: relative; background: rgba(18, 69, 89, 0.8) !important; backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1) !important; border-radius: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important; display: flex; align-items: flex-end; padding: 12px 16px; outline: none !important; }
.chat-input-wrapper:focus-within { background: rgba(18, 69, 89, 0.95) !important; border-color: rgba(26, 154, 181,0.4) !important; outline: none !important; box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 0 3px rgba(26, 154, 181,0.08) !important; }
.chat-input { flex: 1; background-color: transparent !important; border: none !important; color: #e4e4e7 !important; font-size: 1.05rem; padding: 10px 12px; resize: none; outline: none !important; box-shadow: none !important; max-height: 200px; overflow-y: auto; }
@media (max-width: 767px) { .chat-input { max-height: 80px !important; } }
@media (max-width: 768px) { input, textarea, select { font-size: 16px !important; } }
.chat-input:focus { outline: none !important; box-shadow: none !important; border: none !important; }
.chat-input-wrapper.limit-reached { border-color: rgba(239, 68, 68, 0.55) !important; box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 0 3px rgba(239,68,68,0.10) !important; transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.form-input.limit-reached, .form-textarea.limit-reached { border-color: rgba(239,68,68,0.55) !important; box-shadow: 0 0 0 3px rgba(239,68,68,0.08) !important; transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.upload-hint-bubble { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(8px); background: linear-gradient(135deg, rgba(26, 154, 181,0.95), rgba(21, 126, 150,0.95)); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 0.78rem; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.08); white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s; z-index: 50; display: flex; align-items: center; gap: 8px; }
.upload-hint-bubble.visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.upload-hint-bubble::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: rgba(21, 126, 150,0.95); }
.upload-hint-bubble .upload-hint-close { background: rgba(255,255,255,0.18); border: none; color: #fff; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; line-height: 1; flex-shrink: 0; }
.upload-hint-bubble .upload-hint-close:hover { background: rgba(255,255,255,0.32); }
.attach-trigger.hint-pulse { animation: attachHintPulse 1.6s ease-in-out 2; }
@keyframes attachHintPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(26, 154, 181,0); } 50% { box-shadow: 0 0 0 6px rgba(26, 154, 181,0.18); } }
@media (max-width: 480px) { .upload-hint-bubble { white-space: normal; max-width: 240px; text-align: center; } }

.chat-submit-btn { background: #1A9AB5 !important; color: white !important; width: 44px; height: 44px; border-radius: 16px; display: flex; align-items: center; justify-content: center; border: none !important; cursor: pointer !important; flex-shrink: 0; }
.chat-submit-btn:hover:not(.opacity-50) { background: #157E96 !important; }
.chat-submit-btn.opacity-50 { opacity: 0.5 !important; cursor: not-allowed !important; background: #163344 !important; }

.config-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; width: 100%; margin-top: 40px; }
@media (max-width: 1024px) { .config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (max-width: 480px) { .config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.custom-select-container { position: relative; width: 100%; }

.chip-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; color: #8D99AE; margin-bottom: 4px; pointer-events: none; }
.meta-chip.active .chip-label { color: #82DEFF; }
.chip-content { display: flex; justify-content: space-between; align-items: center; width: 100%; pointer-events: none; }
.chip-value { font-size: 0.85rem; font-weight: 500; color: #F1F5F9; display: flex; align-items: center; gap: 8px; }

.dynamic-multiselect { display: grid; grid-template-columns: 1fr; gap: 12px 24px; margin-top: 8px; padding: 0 4px; }
@media (min-width: 640px) { .dynamic-multiselect { grid-template-columns: repeat(2, 1fr); } }
.dynamic-cb-label { display: flex; align-items: flex-start; gap: 12px; font-size: 0.95rem; color: #e4e4e7; cursor: pointer; transition: color 0.2s; }
.dynamic-cb-label:hover { color: #ffffff; }
.dynamic-cb { width: 20px; height: 20px; border-radius: 6px; background: rgba(18, 69, 89, 0.8) !important; border: 1px solid rgba(255,255,255,0.2) !important; flex-shrink: 0; margin-top: 2px; cursor: pointer; appearance: none; -webkit-appearance: none; position: relative; transition: all 0.2s ease; }
.dynamic-cb:checked { background: #1A9AB5 !important; border-color: #1A9AB5 !important; box-shadow: 0 0 10px rgba(26, 154, 181,0.4); }
.dynamic-cb:checked::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: white; font-size: 11px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: block; }

.custom-options { bottom: calc(100% + 6px); top: auto; left: 0; width: 100%; min-width: 220px; background: rgba(18, 69, 89, 0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; position: absolute; display: none; z-index: 1000; max-height: 280px; overflow-y: auto; box-shadow: 0 -10px 40px rgba(0,0,0,0.5); }
.custom-options.open { display: block; }
#category-options { overflow: visible !important; max-height: none !important; }

.attach-wrapper { display: flex; align-items: stretch; width: 100%; min-height: 48px; background: rgba(18, 69, 89, 0.4); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 16px; transition: all 0.2s ease; position: relative; }
.attach-wrapper.active { border-color: rgba(26, 154, 181,0.5); }
.attach-trigger { flex: 1; min-width: 0; padding: 12px 16px; color: #8D99AE; background: transparent; border: none; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-size: 0.85rem; border-radius: 16px; overflow: hidden; }
.attach-remove { display: none; align-items: center; padding: 0 16px; border-left: 1px solid rgba(255,255,255,0.1); background: transparent; color: #8D99AE; cursor: pointer; border: none; flex-shrink: 0; border-radius: 0 16px 16px 0; }
.attach-remove:hover { color: #ef4444; }

.attach-wrapper.active { border-color: rgba(26, 154, 181,0.5) !important; }

/* Lock button shape — prevent long filenames from wrapping or resizing the button */
#attach-icon, #attach-ext { flex-shrink: 0; }
#attach-text { min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Custom hover tooltip listing supported file formats */
.attach-tooltip { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(4px); background: rgba(18, 69, 89, 0.98); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 8px 14px; font-size: 0.75rem; color: #d4d4d8; white-space: nowrap; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease; z-index: 1000; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.attach-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: rgba(18, 69, 89, 0.98); }
.attach-tooltip strong { color: #82DEFF; font-weight: 600; }
.attach-trigger:hover ~ .attach-tooltip, .attach-trigger:focus-visible ~ .attach-tooltip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.history-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; margin-bottom: 2px; transition: background 0.2s; border-left: 2px solid transparent; }
.history-item:hover { background: rgba(255,255,255,0.03); border-left-color: rgba(26, 154, 181,0.3); }
.history-goal { font-size: 0.85rem; font-weight: 500; color: #e4e4e7; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.history-meta { display: flex; gap: 8px; margin-top: 3px; }
.history-meta span { font-size: 10px; font-weight: 500; color: #8D99AE; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.05); padding: 1px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.history-delete { display: none; align-items: center; justify-content: center; color: #8D99AE !important; background: transparent !important; border: none !important; cursor: pointer; padding: 6px; flex-shrink: 0; }
.history-delete:hover { color: #ef4444 !important; background: rgba(239, 68, 68, 0.1) !important; }
.history-item:hover .history-delete { display: inline-flex; }
@media (max-width: 768px) { .history-delete { display: inline-flex; } }

/* Per-use-case feedback (thumbs up / down on history items).
   The buttons are display: none, not opacity: 0, until hover, so they don't take the title's width. */
.history-feedback { display: none; gap: 2px; margin-right: 2px; flex-shrink: 0; }
.history-item:hover .history-feedback, .history-feedback.has-active { display: flex; }
.hf-btn { background: transparent !important; border: none !important; color: #8D99AE !important; cursor: pointer !important; padding: 5px !important; border-radius: 6px !important; font-size: 11px !important; line-height: 1 !important; transition: background-color 0.15s ease, color 0.15s ease !important; outline: none !important; box-shadow: none !important; }
.hf-btn i { pointer-events: none; }
.hf-btn:hover, .hf-btn:focus { background: rgba(255,255,255,0.06) !important; color: #d4d4d8 !important; outline: none !important; }
.hf-btn:active { background: rgba(255,255,255,0.1) !important; color: #e4e4e7 !important; }
.hf-btn.hf-up.active, .hf-btn.hf-up.active:hover, .hf-btn.hf-up.active:focus, .hf-btn.hf-up.active:active { color: #22c55e !important; background: rgba(34,197,94,0.12) !important; }
.hf-btn.hf-down.active, .hf-btn.hf-down.active:hover, .hf-btn.hf-down.active:focus, .hf-btn.hf-down.active:active { color: #ef4444 !important; background: rgba(239,68,68,0.12) !important; }

/* Feedback comment modal (thumbs-down follow-up) */
#bf-feedback-modal .ai-upgrade-modal { max-width: 440px !important; text-align: left !important; padding: 28px !important; }
.bf-feedback-title { font-size: 1.15rem; font-weight: 700; color: #F1F5F9 !important; margin: 0 0 6px 0; }
.bf-feedback-sub { font-size: 0.85rem; color: #8D99AE !important; margin: 0 0 16px 0; line-height: 1.5; }
.bf-feedback-textarea { width: 100% !important; background: rgba(0,0,0,0.4) !important; border: 1px solid rgba(255,255,255,0.1) !important; color: #e4e4e7 !important; padding: 12px 14px !important; border-radius: 12px !important; font-size: 0.9rem !important; font-family: inherit !important; resize: vertical !important; min-height: 90px !important; outline: none !important; transition: border-color 0.2s !important; box-shadow: none !important; }
.bf-feedback-textarea:focus, .bf-feedback-textarea:active { border-color: rgba(26, 154, 181,0.6) !important; outline: none !important; }
.bf-feedback-counter { font-size: 10px; color: #8D99AE; text-align: right; margin-top: 4px; }
.bf-feedback-actions { display: flex; gap: 10px; margin-top: 18px; }

/* =================================================================
   Registration survey — right-side drawer, full height
   ================================================================= */
#bf-survey-modal.ai-upgrade-backdrop { align-items: stretch !important; justify-content: flex-end !important; background: rgba(0, 0, 0, 0.72) !important; backdrop-filter: blur(6px) !important; -webkit-backdrop-filter: blur(6px) !important; cursor: default !important; }
#bf-survey-modal .ai-upgrade-modal { width: 480px !important; max-width: 100vw !important; height: 100vh !important; max-height: 100vh !important; margin: 0 !important; padding: 0 !important; border-radius: 0 !important; border: none !important; border-left: 1px solid rgba(130, 222, 255, 0.08) !important; display: flex !important; flex-direction: column !important; overflow: hidden !important; background: #0D1B2A !important; box-shadow: -24px 0 60px rgba(0, 0, 0, 0.6) !important; text-align: left !important; transform: translateX(100%) !important; transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1) !important; position: relative !important; }
#bf-survey-modal.show .ai-upgrade-modal { transform: translateX(0) !important; }

.bf-survey-head { padding: 26px 34px 22px; flex-shrink: 0; position: relative; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.bf-survey-logo-wrap { display: flex; align-items: center; justify-content: flex-start; margin-bottom: 22px; }
.bf-survey-logo { height: 24px !important; width: auto !important; display: block; opacity: 0.95; }
.bf-survey-close { position: absolute !important; top: 18px !important; right: 18px !important; background: transparent !important; border: none !important; color: #8D99AE !important; font-size: 16px !important; cursor: pointer !important; width: 32px !important; height: 32px !important; border-radius: 8px !important; display: flex !important; align-items: center !important; justify-content: center !important; transition: color 0.15s, background-color 0.15s !important; padding: 0 !important; line-height: 1 !important; font-family: inherit !important; outline: none !important; box-shadow: none !important; }
.bf-survey-close:hover, .bf-survey-close:focus { color: #e4e4e7 !important; background: rgba(255, 255, 255, 0.05) !important; outline: none !important; border: none !important; box-shadow: none !important; }
.bf-survey-close:active { background: rgba(255, 255, 255, 0.08) !important; }
.bf-survey-title { font-size: 1.35rem; font-weight: 700; color: #F1F5F9 !important; margin: 0 0 8px 0; letter-spacing: -0.015em; line-height: 1.25; text-align: left; }
.bf-survey-intro { font-size: 0.86rem; color: #8D99AE !important; margin: 0; line-height: 1.55; font-weight: 400; text-align: left; }

.bf-survey-body { padding: 4px 34px 4px; overflow-y: auto; flex: 1 1 auto; }
.bf-survey-body::-webkit-scrollbar { width: 4px; }
.bf-survey-body::-webkit-scrollbar-track { background: transparent; }
.bf-survey-body::-webkit-scrollbar-thumb { background: rgba(26, 154, 181, 0.2); border-radius: 2px; }
.bf-survey-body::-webkit-scrollbar-thumb:hover { background: rgba(26, 154, 181, 0.45); }
.bf-survey-q { padding: 22px 0; border-top: 1px solid rgba(255,255,255,0.05); }
.bf-survey-q:first-child { border-top: none; padding-top: 20px; }
.bf-survey-q:last-child { padding-bottom: 10px; }
.bf-survey-q-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.bf-survey-q-label { font-size: 0.9rem; font-weight: 500; color: #e4e4e7 !important; line-height: 1.4; margin: 0; }
.bf-survey-q-req { color: #8D99AE !important; font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; background: transparent; padding: 0; border: none; }
.bf-survey-q-req::before { content: "• "; opacity: 0.6; }
.bf-survey-q-opt { color: #8D99AE !important; font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.bf-survey-q-opt::before { content: "• "; opacity: 0.6; }

.bf-chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.bf-chip { background: transparent !important; border: 1px solid rgba(255,255,255,0.09) !important; color: #8D99AE !important; padding: 8px 14px !important; border-radius: 8px !important; font-size: 0.81rem !important; font-weight: 400 !important; cursor: pointer !important; transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease !important; outline: none !important; user-select: none !important; line-height: 1.2 !important; box-shadow: none !important; font-family: inherit !important; transform: none !important; }
.bf-chip:hover, .bf-chip:focus { background: rgba(255,255,255,0.03) !important; border-color: rgba(255,255,255,0.18) !important; color: #e4e4e7 !important; transform: none !important; box-shadow: none !important; outline: none !important; }
.bf-chip:active { background: rgba(255,255,255,0.05) !important; transform: none !important; }
.bf-chip.selected, .bf-chip.selected:hover, .bf-chip.selected:focus, .bf-chip.selected:active { background: rgba(26, 154, 181,0.08) !important; border-color: rgba(26, 154, 181,0.55) !important; color: #B8F0FF !important; box-shadow: none !important; transform: none !important; }

.bf-survey-input, .bf-survey-select, .bf-survey-ta { width: 100% !important; background: rgba(255,255,255,0.02) !important; border: 1px solid rgba(255,255,255,0.08) !important; color: #e4e4e7 !important; padding: 12px 14px !important; border-radius: 8px !important; font-size: 0.86rem !important; font-family: inherit !important; outline: none !important; transition: border-color 0.15s, background-color 0.15s !important; box-shadow: none !important; line-height: 1.5 !important; height: auto !important; box-sizing: border-box !important; }
.bf-survey-input:focus, .bf-survey-select:focus, .bf-survey-ta:focus, .bf-survey-input:active, .bf-survey-select:active, .bf-survey-ta:active { border-color: rgba(26, 154, 181,0.5) !important; background: rgba(255,255,255,0.035) !important; outline: none !important; box-shadow: none !important; }
.bf-survey-input::placeholder, .bf-survey-ta::placeholder { color: #8D99AE !important; }
.bf-survey-ta { resize: vertical !important; min-height: 84px !important; line-height: 1.55 !important; }
.bf-survey-select { appearance: none !important; -webkit-appearance: none !important; -moz-appearance: none !important; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path fill='%2371717a' d='M6 9L1 4h10z'/></svg>") !important; background-repeat: no-repeat !important; background-position: right 14px center !important; padding-right: 36px !important; padding-top: 13px !important; padding-bottom: 13px !important; cursor: pointer !important; line-height: 1.4 !important; }
.bf-survey-select option { background: #0D1B2A !important; color: #e4e4e7 !important; padding: 8px !important; }
.bf-survey-other { margin-top: 8px; display: none; }
.bf-survey-other.show { display: block; animation: bfSurveyFadeIn 0.18s ease; }
@keyframes bfSurveyFadeIn { from { opacity: 0; } to { opacity: 1; } }
.bf-survey-ta-counter { font-size: 10px; color: #163344; text-align: right; margin-top: 6px; font-variant-numeric: tabular-nums; font-weight: 400; }

.bf-survey-foot { padding: 18px 34px 22px; border-top: 1px solid rgba(255,255,255,0.05); flex-shrink: 0; background: rgba(0, 0, 0, 0.2); }
.bf-survey-foot-row { display: flex; gap: 10px; align-items: stretch; }
.bf-survey-skip { background: transparent !important; border: none !important; color: #8D99AE !important; padding: 12px 18px !important; border-radius: 8px !important; font-weight: 400 !important; font-size: 0.85rem !important; font-family: inherit !important; cursor: pointer !important; transition: color 0.15s !important; outline: none !important; box-shadow: none !important; transform: none !important; white-space: nowrap !important; min-height: 44px !important; flex-shrink: 0 !important; }
.bf-survey-skip:hover, .bf-survey-skip:focus { color: #e4e4e7 !important; background: transparent !important; border: none !important; outline: none !important; transform: none !important; box-shadow: none !important; }
.bf-survey-skip:active { color: #e4e4e7 !important; transform: none !important; background: transparent !important; }
.bf-survey-submit { flex: 1 1 auto !important; padding: 12px 22px !important; font-size: 0.88rem !important; border-radius: 8px !important; letter-spacing: 0 !important; font-weight: 600 !important; background: #1A9AB5 !important; color: #ffffff !important; border: 1px solid #1A9AB5 !important; cursor: pointer !important; font-family: inherit !important; transition: background-color 0.15s, border-color 0.15s !important; outline: none !important; box-shadow: none !important; transform: none !important; min-height: 44px !important; white-space: nowrap !important; }
.bf-survey-submit:hover, .bf-survey-submit:focus { background: #157E96 !important; border-color: #157E96 !important; color: #ffffff !important; transform: none !important; box-shadow: none !important; outline: none !important; }
.bf-survey-submit:active { background: #0F6B82 !important; border-color: #0F6B82 !important; transform: none !important; }
.bf-survey-privacy { font-size: 11px; color: #8D99AE; text-align: center; margin-top: 12px; line-height: 1.4; font-weight: 400; }
.bf-survey-privacy i { color: #8D99AE; margin-right: 5px; font-size: 9px; }
.bf-survey-err { color: #f87171; font-size: 0.8rem; margin-top: 10px; min-height: 18px; text-align: center; font-weight: 400; }

@media (max-width: 768px) {
    #bf-survey-modal.ai-upgrade-backdrop { align-items: flex-end !important; justify-content: center !important; }
    #bf-survey-modal .ai-upgrade-modal { width: 100% !important; max-width: 100% !important; height: auto !important; max-height: 92vh !important; border-radius: 20px 20px 0 0 !important; border-left: none !important; border-top: 1px solid rgba(255, 255, 255, 0.06) !important; transform: translateY(100%) !important; box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.6) !important; }
    #bf-survey-modal.show .ai-upgrade-modal { transform: translateY(0) !important; }
    .bf-survey-head { padding: 22px 22px 18px; }
    .bf-survey-body { padding: 2px 22px 2px; }
    .bf-survey-foot { padding: 14px 22px 18px; }
    .bf-survey-title { font-size: 1.18rem; }
    .bf-survey-intro { font-size: 0.82rem; }
    .bf-survey-logo { height: 22px !important; }
    .bf-survey-logo-wrap { margin-bottom: 18px; }
}

.app-stage { display: none; animation: fadeInUp 0.5s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile Dropdown Positioning Fix: Remove CSS transform/backdrop-filter that breaks position:fixed context */
@media (max-width: 768px) {
    .app-stage { animation: fadeInMobile 0.4s ease; transform: none !important; }
    #stage-input { padding-top: 8px !important; padding-bottom: 8px !important; }
    /* Strip backdrop-filter on the Stage 2 form card — it silently turns the card into the containing block
       for position:fixed descendants, which throws the dynamic dropdowns off-screen. */
    #stage-form div:has(> #dynamic-fields) {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    @keyframes fadeInMobile { from { opacity: 0; } to { opacity: 1; } }
}

.custom-scrollbar { scrollbar-width: thin !important; scrollbar-color: #1A9AB5 transparent !important; }
.custom-scrollbar::-webkit-scrollbar { width: 8px !important; height: 8px !important; background: transparent !important; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent !important; background-color: transparent !important; border: none !important; box-shadow: none !important; }
.custom-scrollbar::-webkit-scrollbar-track-piece { background: transparent !important; background-color: transparent !important; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #1A9AB5 !important; border-radius: 10px !important; border: none !important; transition: background 0.2s ease !important; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #2BAFD4 !important; }
.custom-scrollbar::-webkit-scrollbar-corner { background: transparent !important; }

.form-input, .form-textarea { width: 100%; padding: 14px 16px !important; background-color: rgba(0,0,0,0.2) !important; border: 1px solid rgba(255,255,255,0.08) !important; border-radius: 12px !important; color: #F1F5F9 !important; font-size: 0.95rem !important; box-sizing: border-box !important; height: auto !important; line-height: 1.5 !important; color-scheme: dark !important; }
.form-input:focus, .form-textarea:focus { outline: none !important; border-color: #1A9AB5 !important; background-color: rgba(0,0,0,0.4) !important; }

.form-custom-select { width: 100%; padding: 14px 16px !important; background-color: rgba(0,0,0,0.2) !important; border: 1px solid rgba(255,255,255,0.08) !important; border-radius: 12px !important; color: #F1F5F9 !important; font-size: 0.95rem !important; box-sizing: border-box !important; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: all 0.2s; outline: none !important; }
.form-custom-select:focus, .form-custom-select.active { border-color: #1A9AB5 !important; background-color: rgba(0,0,0,0.4) !important; box-shadow: 0 0 15px rgba(26, 154, 181,0.15) !important; }

.output-doc-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: rgba(18,18,20,0.8); border: 1px solid rgba(255,255,255,0.08); border-left: 3px solid #1A9AB5; border-bottom: 1px solid rgba(255,255,255,0.05); border-radius: 20px 20px 0 0; }
.output-doc-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #8D99AE; display: flex; align-items: center; gap: 6px; }
.output-doc-label i { color: #82DEFF; opacity: 0.7; }
.output-doc-copy { background: rgba(26, 154, 181,0.08) !important; border: 1px solid rgba(26, 154, 181,0.2) !important; color: #82DEFF !important; font-size: 11px; font-weight: 600; padding: 5px 14px; border-radius: 8px; cursor: pointer !important; transition: all 0.2s ease; outline: none !important; }
.output-doc-copy:hover { background: #1A9AB5 !important; color: #ffffff !important; border-color: #1A9AB5 !important; }
#final-output { background: #0D1B2A; border: 1px solid rgba(255,255,255,0.08); border-left: 3px solid #1A9AB5; border-top: none; padding: 2rem; border-radius: 0 0 20px 20px; font-family: 'Inter', sans-serif; white-space: pre-wrap; font-size: 0.95rem; line-height: 1.7; color: #e4e4e7; box-shadow: inset 4px 0 24px rgba(26, 154, 181,0.05); }

/* --- MODALS (ALL) --- */
.ai-guide-backdrop, .ai-upgrade-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); z-index: 100000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; pointer-events: none; transition: all 0.3s; }
.ai-guide-backdrop.show, .ai-upgrade-backdrop.show { opacity: 1; visibility: visible; pointer-events: auto; }

.ai-guide-modal { background: #124559 !important; width: 95%; max-width: 720px; border-radius: 24px; border: 1px solid #163344 !important; transform: scale(0.95) translateY(10px); transition: all 0.3s; display: flex; flex-direction: column; color: #F1F5F9 !important; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important; }
.ai-upgrade-modal { background: #124559 !important; border: 1px solid #163344 !important; width: 90%; max-width: 420px; border-radius: 20px; padding: 32px; transform: scale(0.95); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s; position: relative; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important; }
.ai-guide-backdrop.show .ai-guide-modal, .ai-upgrade-backdrop.show .ai-upgrade-modal { transform: scale(1) translateY(0); }

/* Referral intro ("Earn free Premium by sharing") — keep it from running past short-desktop viewports. */
#bf-referral-intro-modal .ai-upgrade-modal { max-height: 88vh !important; overflow-y: auto !important; padding-top: 24px !important; padding-bottom: 20px !important; scrollbar-width: thin; scrollbar-color: rgba(130,222,255,0.25) transparent; }
#bf-referral-intro-modal .ai-upgrade-modal::-webkit-scrollbar { width: 4px; }
#bf-referral-intro-modal .ai-upgrade-modal::-webkit-scrollbar-thumb { background: rgba(130,222,255,0.25); border-radius: 2px; }
#bf-referral-intro-modal .ai-upgrade-modal .relative.w-full.flex.justify-center { margin-top: 0.25rem !important; margin-bottom: 1rem !important; }
#bf-referral-intro-modal .ai-upgrade-modal .upgrade-title { font-size: 1.25rem !important; margin-bottom: 0.4rem !important; }
#bf-referral-intro-modal .ai-upgrade-modal .upgrade-desc { margin-bottom: 1rem !important; font-size: 0.85rem !important; }

/* Mobile Bottom Sheet for Modals */
@media (max-width: 768px) {
    .ai-upgrade-backdrop, .ai-guide-backdrop { align-items: flex-end; }
    .ai-upgrade-backdrop .ai-upgrade-modal, 
    .ai-guide-backdrop .ai-guide-modal { 
        width: 100% !important; 
        max-width: 100% !important; 
        border-radius: 28px 28px 0 0 !important; 
        border-bottom: none !important; 
        max-height: 85vh !important; 
        overflow-y: auto !important; 
        transform: translateY(100%) !important; 
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; 
        margin: 0 !important;
    }
    .ai-upgrade-backdrop.show .ai-upgrade-modal, 
    .ai-guide-backdrop.show .ai-guide-modal { 
        transform: translateY(0) !important; 
    }
}

/* --- Watch Demo Pill (stage-input) --- Protected against WP theme overrides */
.briefing-fox-app-wrapper button.bf-watch-demo,
button.bf-watch-demo {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-top: 26px !important;
    padding: 6px 18px 6px 6px !important;
    background: rgba(18, 69, 89, 0.6) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 999px !important;
    color: #e4e4e7 !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
    line-height: 1 !important;
    text-decoration: none !important;
    text-transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    cursor: pointer !important;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease !important;
    outline: none !important;
    box-shadow: none;
    filter: none !important;
    transform: translateY(0);
}
.briefing-fox-app-wrapper button.bf-watch-demo:hover,
button.bf-watch-demo:hover,
.briefing-fox-app-wrapper button.bf-watch-demo:focus,
button.bf-watch-demo:focus,
.briefing-fox-app-wrapper button.bf-watch-demo:focus-visible,
button.bf-watch-demo:focus-visible {
    transform: translateY(-1px) !important;
    background: rgba(18, 69, 89, 0.85) !important;
    border-color: rgba(26, 154, 181, 0.45) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 24px rgba(26, 154, 181, 0.18), 0 0 0 3px rgba(26, 154, 181, 0.07) !important;
    opacity: 1 !important;
    visibility: visible !important;
    filter: none !important;
    outline: none !important;
    text-decoration: none !important;
}
.briefing-fox-app-wrapper button.bf-watch-demo:active,
button.bf-watch-demo:active {
    transform: translateY(0) !important;
    background: rgba(18, 69, 89, 0.95) !important;
    border-color: rgba(26, 154, 181, 0.55) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(26, 154, 181, 0.25), 0 0 0 3px rgba(26, 154, 181, 0.1) !important;
    opacity: 1 !important;
    visibility: visible !important;
    filter: none !important;
    outline: none !important;
    text-decoration: none !important;
}
.bf-watch-demo .bf-watch-demo-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #1A9AB5, #82DEFF) !important;
    color: #ffffff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    padding-left: 2px !important;
    box-shadow: 0 4px 12px rgba(26, 154, 181, 0.4) !important;
    flex-shrink: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}
.bf-watch-demo .bf-watch-demo-icon i { color: #ffffff !important; opacity: 1 !important; }
.bf-watch-demo .bf-watch-demo-text {
    color: inherit !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: color 0.2s ease !important;
}
@media (max-width: 768px) {
    .briefing-fox-app-wrapper button.bf-watch-demo,
    button.bf-watch-demo { margin-top: 20px !important; font-size: 12.5px !important; }
}

/* --- Video Explainer Modal --- */
.bf-video-modal {
    background: #0D1B2A !important;
    width: 95%;
    max-width: 960px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08) !important;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    color: #F1F5F9 !important;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(26, 154, 181,0.06) !important;
    overflow: hidden;
    position: relative;
}
.ai-guide-backdrop.show .bf-video-modal { transform: scale(1) translateY(0); }
.bf-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}
.bf-video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.bf-video-hover-zone {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    max-width: 60%;
    height: 72px;
    z-index: 9;
    background: transparent;
    pointer-events: auto;
}
.bf-video-close {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    opacity: 0;
    pointer-events: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease, background 0.2s ease, border-color 0.2s ease;
    outline: none;
}
.bf-video-hover-zone:hover ~ .bf-video-close,
.bf-video-close:hover,
.bf-video-close:focus-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.bf-video-close:hover {
    background: rgba(0, 0, 0, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateX(-50%) translateY(0) scale(1.05);
}
/* Touch devices: no hover — keep button always visible */
@media (hover: none) {
    .bf-video-close {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    .bf-video-hover-zone { display: none; }
}
@media (max-width: 768px) {
    #ai-video-backdrop { align-items: center !important; }
    #ai-video-backdrop .bf-video-modal {
        width: 92% !important;
        max-width: 92% !important;
        border-radius: 16px !important;
        overflow: visible !important;
        transform: scale(0.95) translateY(10px) !important;
        margin: 0 !important;
    }
    #ai-video-backdrop.show .bf-video-modal { transform: scale(1) translateY(0) !important; }
    /* Round the iframe since the modal no longer clips */
    #ai-video-backdrop .bf-video-frame {
        border-radius: 16px;
        overflow: hidden;
    }
    /* Hide the top hover hot-zone — not needed on touch */
    #ai-video-backdrop .bf-video-hover-zone { display: none !important; }
    /* Float close chip above the video, centered */
    #ai-video-backdrop .bf-video-close {
        top: -52px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        width: 40px !important;
        height: 40px !important;
        background: rgba(0, 0, 0, 0.72) !important;
        border-color: rgba(255, 255, 255, 0.14) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
    }
    #ai-video-backdrop .bf-video-close:hover,
    #ai-video-backdrop .bf-video-close:active,
    #ai-video-backdrop .bf-video-close:focus {
        transform: translateX(-50%) !important;
        background: rgba(0, 0, 0, 0.9) !important;
    }
}

/* Universal Close Buttons for Modals */
.modal-close-btn { background: transparent !important; border: none !important; color: #8D99AE !important; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50% !important; cursor: pointer !important; transition: all 0.2s ease !important; outline: none !important; box-shadow: none !important; position: absolute; top: 16px; right: 16px; }
.modal-close-btn.static-close { position: relative; top: auto; right: auto; }
.modal-close-btn:hover, .modal-close-btn:active { background: rgba(255,255,255,0.05) !important; color: #ffffff !important; }

/* Terms Consent Pill Button (Protected against WP Theme) */
.terms-got-it-btn { background: rgba(255,255,255,0.1) !important; color: #ffffff !important; border: none !important; outline: none !important; box-shadow: none !important; transition: all 0.2s ease !important; cursor: pointer !important; text-decoration: none !important; display: inline-block !important; }
.terms-got-it-btn:hover, .terms-got-it-btn:active, .terms-got-it-btn:focus { background: rgba(255,255,255,0.2) !important; color: #ffffff !important; transform: translateY(0) !important; }

/* Primary Action Buttons */
.guide-cta-btn, .upgrade-btn-final, .modal-btn-primary { background: #1A9AB5 !important; color: #ffffff !important; border: none !important; font-weight: 700 !important; cursor: pointer !important; transition: all 0.2s ease !important; outline: none !important; text-align: center !important; }
.guide-cta-btn { padding: 12px 42px !important; border-radius: 99px !important; font-size: 0.88rem !important; letter-spacing: 0.01em !important; }
.upgrade-btn-final { width: 100% !important; padding: 14px !important; border-radius: 12px !important; }

/* Monthly / yearly choice in the upgrade modal */
.bf-plan-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 85%; margin: -16px auto 18px; }
.bf-plan-option, .bf-plan-option:focus { position: relative; display: flex !important; flex-direction: column !important; align-items: flex-start !important; gap: 4px; padding: 14px 14px 12px !important; border-radius: 14px !important; background: rgba(255,255,255,0.04) !important; border: 1px solid rgba(255,255,255,0.12) !important; color: #E4E9F0 !important; text-align: left !important; cursor: pointer !important; box-shadow: none !important; outline: none !important; transition: background 0.15s ease, border-color 0.15s ease !important; }
.bf-plan-option:hover, .bf-plan-option:focus-visible { background: rgba(26,154,181,0.10) !important; border-color: rgba(130,222,255,0.45) !important; color: #FFFFFF !important; }
.bf-plan-option:active { background: rgba(26,154,181,0.18) !important; }
.bf-plan-option.is-selected, .bf-plan-option.is-selected:hover, .bf-plan-option.is-selected:focus { background: rgba(26,154,181,0.16) !important; border-color: #1A9AB5 !important; box-shadow: 0 0 0 1px #1A9AB5 inset !important; }
.bf-plan-option-name { font-size: 0.8rem; font-weight: 600; color: #8D99AE; text-transform: uppercase; letter-spacing: 0.06em; }
.bf-plan-option-price { font-size: 1.3rem; font-weight: 800; color: #F1F5F9; letter-spacing: -0.02em; }
.bf-plan-option-price span { font-size: 0.8rem; font-weight: 500; color: #8D99AE; letter-spacing: 0; }
.bf-plan-option-badge { position: absolute; top: -9px; right: 10px; padding: 2px 8px; border-radius: 99px; background: #F5C26B; color: #0D1B2A; font-size: 10px; font-weight: 700; }

/* --- Redesigned Guide Modal --- */
.bf-guide-inner {
    padding: 44px 40px 36px;
    position: relative;
    z-index: 10;
}
.bf-guide-header {
    text-align: center;
    margin-bottom: 32px;
}
.bf-guide-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #82DEFF;
    margin: 0 0 14px 0;
}
.bf-guide-headline {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
}
.bf-guide-subline {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.3);
    margin: 0;
    line-height: 1.5;
}

/* Steps vertical layout */
.bf-guide-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 32px;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 6px 0;
}
.bf-guide-step {
    display: flex;
    gap: 16px;
    align-items: stretch;
}
.bf-guide-step-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 32px;
    flex-shrink: 0;
    padding-top: 22px;
}
.bf-guide-number {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #82DEFF;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(130, 222, 255, 0.2);
    background: rgba(130, 222, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.05em;
}
.bf-guide-line {
    width: 1px;
    flex: 1;
    background: rgba(130, 222, 255, 0.12);
    margin: 6px 0 0 0;
}
.bf-guide-step-content {
    flex: 1;
    padding: 18px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.bf-guide-step:last-child .bf-guide-step-content {
    border-bottom: none;
}
.bf-guide-step-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 5px 0;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.bf-guide-step-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.38);
    line-height: 1.55;
    margin: 0;
}
.bf-guide-footer {
    text-align: center;
}

@media (max-width: 768px) {
    .bf-guide-inner { padding: 36px 24px 28px; }
    .bf-guide-header { margin-bottom: 24px; }
    .bf-guide-headline { font-size: 1.25rem; }
}
.guide-cta-btn:hover, .guide-cta-btn:active, .upgrade-btn-final:hover, .upgrade-btn-final:active, .modal-btn-primary:hover, .modal-btn-primary:active { background: #157E96 !important; transform: translateY(-1px) !important; box-shadow: 0 4px 15px rgba(26, 154, 181, 0.3) !important; }

.upgrade-logo-img { width: auto !important; height: 160px !important; margin: 0 auto 20px !important; display: block; object-fit: contain; }
.upgrade-title { font-size: 1.5rem; font-weight: 800; color: #F1F5F9 !important; text-align: center; }
.upgrade-desc { font-size: 0.9rem; color: #8D99AE !important; text-align: center; margin-bottom: 24px; }

.mobile-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.8); z-index: 35; opacity: 0; visibility: hidden; transition: opacity 0.3s; }
.mobile-backdrop.show { opacity: 1; visibility: visible; }
/* Library mode backdrop needs fixed positioning (no app-layout parent) */
.bf-library-layout .mobile-backdrop { position: fixed; z-index: 85; }
@keyframes slideUpFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
