:root {
    /* FluxPro SaaS Palette - Balanced High Fidelity */
    --accent: #818cf8; /* Lighter Indigo for softer focus */
    --accent-light: #a5b4fc;
    --accent-dark: #6366f1;
    --accent-glow: rgba(129, 140, 248, 0.15);
    
    /* Dark Theme Default (Premium Slate) */
    --bg-main: #0f172a; /* Slate 900 */
    --bg-side: #1e293b; /* Slate 800 */
    --bg-2: #0b1220;
    --bg-card: rgba(30, 41, 59, 0.5);
    --bg-card-hover: rgba(51, 65, 85, 0.7);
    --shadow-main: 0 20px 60px rgba(0, 0, 0, 0.35);
    
    --border: rgba(148, 163, 184, 0.08);
    --border-bright: rgba(148, 163, 184, 0.15);
    
    --text-primary: #f8fafc;  /* Slate 50 */
    --text-secondary: #cbd5e1; /* Slate 300 */
    --text-muted: #94a3b8;    /* Slate 400 */
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #f43f5e;
    --info: #3b82f6;
    
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-main: #f8fafc; /* Slate 50 */
    --bg-side: #ffffff;
    --bg-2: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: #f1f5f9;
    --border: rgba(15, 23, 42, 0.06);
    --text-primary: #0f172a;   /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    --text-muted: #64748b;     /* Slate 500 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Layout Framework */
.app-shell {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar - SaaS Enterprise Style */
.sidebar {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    z-index: 1000;
    flex-shrink: 0;
    height: 100vh;
}

.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 1rem -0.5rem;
    padding: 0 0.5rem;
}

/* Custom Scrollbar for Sidebar */
.sidebar-scrollable::-webkit-scrollbar {
    width: 5px;
}
.sidebar-scrollable::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0.75rem 2.5rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 16px var(--accent-glow);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-name span { color: var(--accent); }

.nav-group { margin-bottom: 2rem; }

.nav-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 0.75rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s var(--transition);
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 20px var(--accent-glow);
}

.nav-item i { width: 20px; flex-shrink: 0; }
.nav-item span { 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    flex: 1; 
}

.project-category {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem 0.25rem;
    margin-top: 0.5rem;
}

/* Content Main Wrapper */
.main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.header-pro {
    height: 72px;
    padding: 0 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    width: 400px;
    transition: 0.2s;
}

input.search-field,
select.search-field,
textarea.search-field {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.search-field:focus-within {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.search-field input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 0.9rem;
    font-weight: 500;
}

.scroll-container {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Typography SaaS */
h1 { font-size: 2.25rem; font-weight: 800; letter-spacing: -1px; }
h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.5px; }

/* Component: Stat Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: 0.3s var(--transition);
}

.stat-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    margin-top: 0.5rem;
    display: block;
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1rem;
}

/* Charts & Widgets */
.widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 100%;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

/* Agent Grid Card */
.node-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: 0.2s var(--transition);
}

.node-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-online { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-offline { background: rgba(239, 68, 68, 0.1); color: var(--error); }

/* Progress Mini */
.progress-mini {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    transition: 0.5s var(--transition);
}

/* Detail Master Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* Tab Pro */
.tab-row {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.tab-link {
    padding: 1rem 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    position: relative;
    transition: 0.2s;
}

.tab-link:hover { color: var(--text-primary); }
.tab-link.active { color: var(--accent); }
.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
}

/* Dashboard Utilities */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.4s var(--transition); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Buttons SaaS */
.btn-pro {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn-secondary { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

/* Multi-step/Auth Overlay */
.auth-container {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.auth-card {
    background: var(--bg-side);
    padding: 3rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0,0,0,0.6);
}

/* Service Badges */
.srv-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-right: 4px;
}
.srv-ok { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.srv-err { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }
/* MOCKUP TENANT (TERMINAL STYLE) */
.mockup-tenant {
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #e2e8f0;
    font-family: var(--font-mono);
    position: relative;
    border: 1px solid #334155;
    overflow: hidden;
}
.mockup-header { 
    display: flex; 
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    padding: 10px 15px;
    border-bottom: 1px solid #334155;
}
.window-controls { display: flex; gap: 10px; }
.win-btn { width: 12px; height: 12px; border-radius: 50%; background: #475569; }
.win-btn.close { background: #ef4444; }
.win-btn.min { background: #fbbf24; }
.win-btn.max { background: #22c55e; }

.mockup-body { padding: 1.5rem; font-size: 0.85rem; line-height: 1.6; }

/* ENTERPRISE TABLE */
.enterprise-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.enterprise-table th {
    text-align: left;
    padding: 1rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.enterprise-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 500;
}
.enterprise-table tr:last-child td { border-bottom: none; }
.enterprise-table tr:hover td { background: rgba(255,255,255,0.01); }

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
    z-index: 900;
}

@media (max-width: 1024px) {
    body {
        overflow: auto;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        z-index: 1001;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .header-pro {
        height: auto;
        min-height: 64px;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .header-pro > div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .scroll-container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.55rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.9rem;
        margin-bottom: 1rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tab-row {
        overflow-x: auto;
        white-space: nowrap;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .widget,
    .stat-card,
    .node-card,
    .auth-card {
        padding: 1rem;
    }

    .btn-pro {
        width: 100%;
        justify-content: center;
    }

    .header-pro .btn-pro {
        width: auto;
    }

    .enterprise-table {
        min-width: 680px;
    }

    .widget {
        overflow-x: auto;
    }

    [style*="display:grid"][style*="1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 0.9rem !important;
    }

    [style*="display:grid"][style*="1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 0.9rem !important;
    }

    [style*="display:flex"][style*="justify-content:space-between"] {
        flex-wrap: wrap;
    }

    [style*="width:300px"],
    [style*="width:400px"],
    [style*="width:480px"],
    [style*="width:600px"],
    [style*="width:760px"] {
        max-width: 100% !important;
    }

    #tenantNameDisplay,
    #userNameDisplay {
        max-width: 70vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* UI Safety Layer: contrast + overflow + modal responsiveness */
body [style*="color:#000"],
body [style*="color: #000"],
body [style*="color:#111"],
body [style*="color: #111"],
body [style*="color:#222"],
body [style*="color: #222"],
body [style*="color:black"],
body [style*="color: black"] {
    color: var(--text-primary) !important;
}

[data-theme="light"] body [style*="background:#fff"][style*="color"],
[data-theme="light"] body [style*="background: #fff"][style*="color"] {
    color: #0f172a !important;
}

.widget,
.stat-card,
.node-card,
.auth-card {
    color: var(--text-primary);
}

.search-field:is(input, textarea, select) {
    display: block;
    width: 100%;
}

.widget *,
.stat-card *,
.node-card *,
.auth-card * {
    max-width: 100%;
}

.widget :where(p, span, div, code, b, strong, small),
.stat-card :where(p, span, div, code, b, strong, small),
.node-card :where(p, span, div, code, b, strong, small) {
    word-break: break-word;
}

@media (max-width: 1024px) {
    body [id$="Modal"] {
        padding: 8px !important;
    }

    body [id$="Modal"] > div,
    #projectOnboardingModal > div {
        width: min(96vw, 760px) !important;
        max-height: calc(100vh - 16px) !important;
        overflow: auto !important;
    }

    #sessionWarningBanner {
        align-items: flex-start !important;
    }

    #sessionWarningBanner .search-field {
        width: 100% !important;
    }

    [style*="display:grid"][style*="repeat(4"] {
        grid-template-columns: 1fr !important;
        gap: 0.9rem !important;
    }
}

/* Company admin details block (dedicated styles to avoid extracted-class collisions) */
.company-admin-grid {
    margin-top: 0.5rem;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem 2rem;
}

.company-admin-value {
    margin-top: 0.35rem;
    color: var(--text-primary);
    font-weight: 600;
    min-height: 1.25rem;
    overflow-wrap: anywhere;
}

.company-admin-grid .nav-label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.company-admin-cid {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.01em;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.company-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.company-subtitle {
    color: var(--text-secondary);
}

.company-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.company-edit-btn {
    justify-content: center;
}

.company-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.company-stat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
    gap: 0.8rem;
}

.company-label {
    padding: 0;
}

.company-stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

.company-progress {
    height: 10px;
}

.company-progress-emp {
    width: 0%;
    background: var(--accent);
}

.company-progress-proj {
    width: 0%;
    background: var(--success);
}

.company-progress-ticket {
    width: 0%;
    background: var(--warning);
}

.company-stat-help {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 1024px) {
    .company-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Tenant theme harmonization after CSS extraction */
[data-theme="light"] .nav-item:hover {
    background: rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .sidebar-scrollable::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.35);
}

/* Extracted classes that had fixed dark backgrounds: map to theme variables in light mode */
[data-theme="light"] .fx-js-inline-18,
[data-theme="light"] .fx-js-inline-130,
[data-theme="light"] .fx-js-inline-140,
[data-theme="light"] .fx-js-inline-146,
[data-theme="light"] .fx-js-inline-155 {
    background: var(--bg-side) !important;
    border-color: var(--border-bright) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .fx-js-inline-140,
[data-theme="light"] .fx-js-inline-146 {
    border-color: var(--border) !important;
}

[data-theme="light"] .fx-js-inline-66 {
    background: var(--bg-main) !important;
    color: var(--text-primary) !important;
}

.fx-alert-badge {
    color: var(--text-primary) !important;
}

/* Support center: keep background context visible behind thread modal */
.fx-overlay-thread {
    background: rgba(2, 6, 23, 0.48) !important;
    backdrop-filter: blur(3px) !important;
}

.fx-thread-modal {
    width: min(980px, 96vw);
    max-height: min(86vh, 900px);
    display: flex;
    flex-direction: column;
    background: var(--bg-side);
    border: 1px solid var(--border-bright);
    border-radius: 16px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.fx-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.fx-thread-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.fx-thread-close {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
}

.fx-thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
}

.fx-thread-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fx-thread-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.fx-thread-textarea {
    width: 100%;
    min-height: 78px;
    resize: vertical;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-family: var(--font-main);
}

.fx-thread-send {
    display: flex;
    align-items: flex-end;
}

.fx-signed-quote-modal {
    width: min(560px, 94vw);
    background: var(--bg-side);
    border: 1px solid var(--border-bright);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fx-signed-quote-title {
    font-size: 1rem;
    font-weight: 800;
}

.fx-signed-quote-sub {
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.fx-signed-quote-input {
    width: 100%;
}

.fx-signed-quote-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.fx-wf-cgv-consent {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--bg-2);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fx-wf-cgv-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: .85rem;
    color: var(--text-secondary);
}

.fx-wf-cgv-line input {
    margin-top: 2px;
}

.fx-wf-cgv-version {
    font-size: .76rem;
    color: var(--text-muted);
}

.fx-wf-legal-pre {
    margin: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 50vh;
    overflow: auto;
    white-space: pre-wrap;
    font-size: .84rem;
    line-height: 1.45;
    color: var(--text-secondary);
    background: var(--bg-2);
}

@media (max-width: 900px) {
    .fx-thread-modal {
        width: 98vw;
        max-height: 92vh;
    }

    .fx-thread-footer {
        grid-template-columns: 1fr;
    }

    .fx-signed-quote-actions {
        justify-content: stretch;
    }

    .fx-signed-quote-actions .btn-pro {
        width: 100%;
    }
}

/* Dedicated questionnaire controls (avoid fx-js-inline class collisions) */
#wfQuestionnaireFields .fx-js-inline-210 {
    margin-bottom: 0.85rem;
}

#wfQuestionnaireFields .fx-js-inline-214 {
    margin-bottom: 0.8rem;
}

#wfQuestionnaireFields .fx-js-inline-213,
#wfQuestionnaireFields .fx-js-inline-217 {
    margin-top: 0.3rem;
}

#wfQuestionnaireFields .fx-js-inline-219 {
    margin-top: 0.65rem;
}

#wfQuestionnaireFields .fx-js-inline-218,
#wfQuestionnaireFields .fx-js-inline-220 {
    gap: 0.75rem;
}

#wfQuestionnaireFields .fx-js-inline-223 {
    margin-top: 0.4rem;
    gap: 0.75rem;
}

.wf-q-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
}

.wf-q-checkbox-input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.wf-q-webshowcase {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
}

.wf-q-section-title {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
    color: var(--text-muted);
}

.wf-q-webshowcase .wf-q-block,
.wf-q-webshowcase .wf-q-checkbox-row {
    grid-column: 1 / -1;
}

.wf-q-options-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.wf-q-options-grid .fx-js-inline-210 {
    margin-bottom: 0;
}

.wf-q-options-grid .wf-q-checkbox-row {
    min-height: 42px;
}

.wf-q-radio-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.wf-q-radio-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.wf-q-radio-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.wf-q-radio-input {
    accent-color: var(--accent);
}

/* Step 2 workflow layout: project context left, discussion right */
#wfStep2Layout.wf-step2-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.95fr);
    gap: 14px;
    align-items: start;
}

#wfStep2Layout #wfDiscussionPanel {
    margin-top: 0;
    position: sticky;
    top: 84px;
}

#wfContractDiscussionHost.wf-step2-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.95fr);
    gap: 14px;
    margin-top: 12px;
    align-items: start;
}

#wfContractMainCol {
    min-width: 0;
}

#wfContractDiscussionHost #wfDiscussionPanel {
    margin-top: 0;
    position: sticky;
    top: 84px;
    grid-column: 2;
}

#wfStep2Layout #wfDiscussionMessages {
    max-height: 320px;
}

#wfContractDiscussionHost #wfDiscussionMessages {
    max-height: 320px;
}

#wfStep2Layout .fx-inline-209 {
    flex-direction: column;
}

#wfStep2Layout .fx-inline-209 .btn-pro {
    align-self: flex-end;
}

@media (max-width: 900px) {
    .wf-q-webshowcase {
        grid-template-columns: 1fr;
    }
    .wf-q-options-grid {
        grid-template-columns: 1fr;
    }
    .wf-q-radio-grid {
        grid-template-columns: 1fr;
    }

    #wfStep2Layout.wf-step2-layout {
        grid-template-columns: 1fr;
    }

    #wfContractDiscussionHost.wf-step2-layout {
        grid-template-columns: 1fr;
    }

    #wfContractDiscussionHost #wfDiscussionPanel {
        grid-column: auto;
        position: static;
        top: auto;
    }

    #wfStep2Layout #wfDiscussionPanel {
        position: static;
        top: auto;
    }

    #wfStep2Layout .fx-inline-209 .btn-pro {
        width: 100%;
        align-self: stretch;
    }
}

/* Live notifications (top-right) */
.fx-live-notice-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 12000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, calc(100vw - 32px));
}

.fx-live-notice {
    border: 1px solid var(--border-bright);
    background: var(--bg-side);
    color: var(--text-primary);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .32);
    padding: 12px 14px;
    cursor: pointer;
}

.fx-live-notice-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
}

.fx-live-notice-msg {
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}

.fx-legal-pre {
    margin-top: 12px;
    max-height: 62vh;
    overflow: auto;
    white-space: pre-wrap;
    font-size: .86rem;
    line-height: 1.45;
    color: var(--text-primary);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-2);
}

.auth-card .search-field {
    color: var(--text-primary);
    background: var(--bg-card);
}

.fx-legal-header p,
.fx-legal-muted {
    color: var(--text-muted);
}

.fx-legal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.fx-legal-card {
    min-width: 0;
}

.fx-legal-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 0;
}

@media (max-width: 1100px) {
    .fx-legal-grid {
        grid-template-columns: 1fr;
    }
}

/* Ticket links: only internal FluxFacile messages are linkified in JS */
.fx-msg-bubble-internal a,
.fx-wf-discussion-item.is-internal a {
    color: var(--accent-light);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}
