/* ==========================================================================
   MYOPSAGENT DIGITAL AGENT WORKSPACE
   Visual layer only — no PHP / JS / IDs / references changed
   ========================================================================== */

:root{
    --moa-bg:#07111b;
    --moa-bg-2:#0a1622;
    --moa-panel:#0f1c29;
    --moa-panel-2:#132231;
    --moa-panel-soft:#172838;

    --moa-border:rgba(255,255,255,.085);
    --moa-border-strong:rgba(255,255,255,.15);

    --moa-text:#f7fafc;
    --moa-copy:#c9d4dd;
    --moa-muted:#8798a8;

    --moa-blue:#139ee6;
    --moa-blue-soft:#70cef5;
    --moa-green:#20b98a;
    --moa-purple:#786be8;
    --moa-amber:#e0ab34;
    --moa-red:#ef7070;

    --moa-shadow:0 14px 40px rgba(0,0,0,.18);
    --moa-shadow-lg:0 26px 70px rgba(0,0,0,.28);
}

/* ==========================================================================
   WORKSPACE FOUNDATION
   ========================================================================== */

.support-workspace{
    min-height:100vh;
    padding:18px !important;
    border-radius:22px !important;
    color:var(--moa-text);
    background:
        radial-gradient(circle at 100% 0,rgba(19,158,230,.10),transparent 34rem),
        radial-gradient(circle at 0 70%,rgba(120,107,232,.055),transparent 30rem),
        linear-gradient(180deg,#091521 0%,#07111b 100%) !important;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif;
    font-size:15px;
    line-height:1.55;
    -webkit-font-smoothing:antialiased;
}

.support-workspace *,
.support-workspace *::before,
.support-workspace *::after{
    box-sizing:border-box;
}

.support-workspace h1,
.support-workspace h2,
.support-workspace h3,
.support-workspace h4,
.support-workspace h5,
.support-workspace h6{
    color:var(--moa-text);
}

.support-workspace p{
    color:var(--moa-copy);
}

.support-workspace .small,
.support-workspace small{
    font-size:14px !important;
}

.support-workspace .text-secondary,
.support-workspace .text-muted{
    color:var(--moa-muted) !important;
}

/* ==========================================================================
   TOP AGENT HEADER
   ========================================================================== */

.support-workspace > .border-bottom:first-of-type{
    position:relative;
    overflow:hidden;
    margin-bottom:18px !important;
    padding:24px !important;
    border:1px solid rgba(19,158,230,.16) !important;
    border-radius:18px;
    background:
        radial-gradient(circle at 95% 0,rgba(19,158,230,.16),transparent 27rem),
        linear-gradient(135deg,#122536,#0c1925);
    box-shadow:var(--moa-shadow);
}

.support-workspace > .border-bottom:first-of-type::after{
    content:"";
    position:absolute;
    width:180px;
    height:180px;
    right:-90px;
    bottom:-105px;
    border:1px solid rgba(255,255,255,.06);
    border-radius:36px;
    transform:rotate(19deg);
    pointer-events:none;
}

.support-workspace > .border-bottom:first-of-type h4{
    position:relative;
    z-index:1;
    margin-bottom:8px !important;
    font-size:clamp(1.55rem,3vw,2rem);
    line-height:1.2;
    font-weight:650 !important;
    letter-spacing:-.035em;
}

.support-workspace > .border-bottom:first-of-type p{
    position:relative;
    z-index:1;
    max-width:900px;
    margin-bottom:6px !important;
    color:#c9d7e0 !important;
    font-size:15px !important;
    line-height:1.65;
}

/* ==========================================================================
   MAIN WORKSPACE NAVIGATION
   ========================================================================== */

#workspaceTabs{
    display:flex;
    gap:7px;
    margin-bottom:22px !important;
    padding:6px;
    overflow-x:auto;
    border:1px solid var(--moa-border) !important;
    border-radius:13px;
    background:rgba(255,255,255,.035);
}

#workspaceTabs .nav-item{
    flex:0 0 auto;
}

#workspaceTabs .nav-link{
    min-height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:8px 16px !important;
    border:0 !important;
    border-radius:9px !important;
    color:#9cadba !important;
    background:transparent !important;
    font-size:14px;
    font-weight:650;
    white-space:nowrap;
    transition:.18s ease;
}

#workspaceTabs .nav-link i{
    color:#879dac !important;
}

#workspaceTabs .nav-link:hover{
    color:#fff !important;
    background:rgba(255,255,255,.055) !important;
}

#workspaceTabs .nav-link.active{
    color:#fff !important;
    background:linear-gradient(135deg,rgba(19,158,230,.20),rgba(19,158,230,.10)) !important;
    box-shadow:inset 0 0 0 1px rgba(19,158,230,.18);
}

#workspaceTabs .nav-link.active i{
    color:#77d2f7 !important;
}

/* ==========================================================================
   SHARED CARDS
   ========================================================================== */

.apple-theme{
    color:var(--moa-text);
    font-family:inherit;
}

.apple-card,
.sys-module-card{
    border:1px solid var(--moa-border) !important;
    border-radius:16px !important;
    background:linear-gradient(145deg,#11202e,#0e1a26) !important;
    box-shadow:var(--moa-shadow);
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
}

.apple-card{
    transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}

/* ==========================================================================
   KNOWLEDGE LIBRARY HEADER
   ========================================================================== */

#tab_data > .d-flex:first-child{
    margin-bottom:18px !important;
}

#tab_data > .d-flex:first-child h4{
    color:#fff !important;
    font-size:22px;
    font-weight:700 !important;
    letter-spacing:-.025em !important;
}

#tab_data > .d-flex:first-child p{
    color:var(--moa-muted) !important;
    font-size:14px !important;
}

/* ==========================================================================
   KNOWLEDGE HELP / ACTION PANEL
   ========================================================================== */

#supportAgentHelp{
    position:relative;
    overflow:hidden;
    padding:22px !important;
    border-color:rgba(19,158,230,.13) !important;
    background:
        radial-gradient(circle at 100% 0,rgba(19,158,230,.10),transparent 24rem),
        linear-gradient(145deg,#122231,#0f1c29) !important;
}

#supportAgentHelp::before{
    content:"";
    position:absolute;
    top:0;
    bottom:0;
    left:0;
    width:3px;
    background:linear-gradient(180deg,var(--moa-blue),var(--moa-green));
}

#supportAgentHelp p{
    max-width:1050px;
    color:#b9c7d1 !important;
    font-size:15px !important;
    line-height:1.65 !important;
}

#supportAgentHelp strong{
    color:#fff !important;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn-apple-primary,
.btn-apple-secondary,
.btn-apple-destructive{
    min-height:42px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    padding:8px 14px !important;
    border-radius:9px !important;
    font-size:14px !important;
    line-height:1;
    font-weight:650 !important;
    transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease,background .16s ease;
}

.btn-apple-primary{
    color:#fff !important;
    border:1px solid #128fd0 !important;
    background:linear-gradient(135deg,#087cba,var(--moa-blue)) !important;
    box-shadow:0 8px 20px rgba(19,158,230,.18);
}

.btn-apple-primary:hover{
    transform:translateY(-1px);
    background:linear-gradient(135deg,#0875af,#12a5ed) !important;
    box-shadow:0 11px 26px rgba(19,158,230,.24);
}

.btn-apple-secondary{
    color:#dce6ec !important;
    border:1px solid var(--moa-border) !important;
    background:rgba(255,255,255,.045) !important;
}

.btn-apple-secondary:hover{
    color:#fff !important;
    border-color:var(--moa-border-strong) !important;
    background:rgba(255,255,255,.075) !important;
}

.btn-apple-destructive{
    color:#e8b0b0 !important;
    border:1px solid rgba(239,112,112,.17) !important;
    background:rgba(239,112,112,.055) !important;
}

.btn-apple-destructive:hover{
    color:#ffc3c3 !important;
    border-color:rgba(239,112,112,.28) !important;
    background:rgba(239,112,112,.10) !important;
}

/* ==========================================================================
   FILTER / SEARCH TOOLBAR
   ========================================================================== */

.apple-segmented-control{
    display:flex;
    gap:4px;
    padding:5px;
    overflow-x:auto;
    border:1px solid var(--moa-border);
    border-radius:10px;
    background:rgba(255,255,255,.035);
    backdrop-filter:none;
}

.apple-segmented-btn{
    min-height:38px;
    padding:6px 13px;
    border:0;
    border-radius:7px;
    color:#8fa1af;
    background:transparent;
    font-size:14px;
    font-weight:600;
    white-space:nowrap;
    transition:.18s ease;
}

.apple-segmented-btn:hover{
    color:#e9f0f4;
    background:rgba(255,255,255,.045);
}

.apple-segmented-btn.active{
    color:#fff;
    background:rgba(19,158,230,.14);
    box-shadow:inset 0 0 0 1px rgba(19,158,230,.15);
}

.support-workspace .position-relative:has(#productSearchInput){
    width:min(100%,420px);
    min-width:0 !important;
}

.apple-search-input{
    width:100%;
    min-height:44px;
    padding-left:42px !important;
    border:1px solid var(--moa-border) !important;
    border-radius:10px !important;
    color:#fff !important;
    background:#0d1925 !important;
    font-size:14px !important;
    backdrop-filter:none;
}

.apple-search-input::placeholder{
    color:#6f8291 !important;
}

.apple-search-input:focus{
    border-color:rgba(19,158,230,.55) !important;
    background:#0f1d2a !important;
    box-shadow:0 0 0 3px rgba(19,158,230,.10) !important;
}

/* ==========================================================================
   KNOWLEDGE LIST
   ========================================================================== */

#catalogContainer{
    gap:9px !important;
}

.apple-list-item{
    position:relative;
    padding:15px 16px !important;
    overflow:hidden;
    border:1px solid var(--moa-border) !important;
    border-radius:13px !important;
    background:#0f1d29 !important;
    box-shadow:0 4px 14px rgba(0,0,0,.08);
    transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease;
}

.apple-list-item::before{
    content:"";
    position:absolute;
    top:12px;
    bottom:12px;
    left:0;
    width:3px;
    border-radius:0 3px 3px 0;
    background:rgba(19,158,230,.60);
    opacity:.4;
    transition:.18s ease;
}

.apple-list-item:hover{
    transform:translateY(-1px) !important;
    border-color:rgba(19,158,230,.24) !important;
    background:#122331 !important;
    box-shadow:0 9px 24px rgba(0,0,0,.13);
}

.apple-list-item:hover::before{
    opacity:1;
}

.catalog-item h6{
    color:#f7fafc !important;
    font-size:15px !important;
    line-height:1.4;
}

.catalog-item p{
    color:#8fa1ae !important;
    font-size:14px !important;
    line-height:1.45;
}

.catalog-item > div:last-child{
    border-color:var(--moa-border) !important;
}

.catalog-item .btn-link{
    width:34px;
    height:34px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:8px;
    color:#8ea2b1 !important;
    text-decoration:none;
    transition:.16s ease;
}

.catalog-item .btn-link:hover{
    color:#fff !important;
    background:rgba(255,255,255,.065);
}

.catalog-item form .btn-link:hover{
    color:#f1a0a0 !important;
    background:rgba(239,112,112,.08);
}

/* ==========================================================================
   BADGES
   ========================================================================== */

.apple-badge{
    min-height:25px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    padding:4px 8px;
    border:1px solid transparent;
    border-radius:7px;
    font-size:12px !important;
    line-height:1;
    font-weight:650;
    letter-spacing:0;
}

.apple-badge-blue{
    color:#86d8fb;
    border-color:rgba(19,158,230,.15);
    background:rgba(19,158,230,.10);
}

.apple-badge-green{
    color:#78dbbc;
    border-color:rgba(32,185,138,.15);
    background:rgba(32,185,138,.09);
}

.apple-badge-gray{
    color:#abb9c3;
    border-color:rgba(255,255,255,.07);
    background:rgba(255,255,255,.045);
}

.apple-badge-red{
    color:#f0a4a4;
    border-color:rgba(239,112,112,.18);
    background:rgba(239,112,112,.08);
}

/* ==========================================================================
   DOCUMENT LIBRARY
   ========================================================================== */

#documentLibraryCollapse{
    background:#0d1a26;
}

.sys-module-card .border-bottom{
    border-color:var(--moa-border) !important;
}

.sys-module-card h5{
    color:#fff !important;
    font-size:17px;
}

.table-dark-custom{
    margin:0;
    color:var(--moa-copy);
    border-color:var(--moa-border);
}

.table-dark-custom thead th{
    padding:12px 15px;
    border-bottom:1px solid var(--moa-border);
    color:#91a4b3;
    background:#13222f !important;
    font-size:12px;
    font-weight:700;
    letter-spacing:.04em;
    text-transform:uppercase;
}

.table-dark-custom tbody td{
    padding:14px 15px;
    border-bottom:1px solid rgba(255,255,255,.05);
    color:#b7c5cf;
    background:#0f1d29 !important;
    font-size:14px;
}

.table-dark-custom tbody tr:hover td{
    background:#122431 !important;
}

.table-dark-custom tbody tr:last-child td{
    border-bottom:0;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */

.support-workspace .form-control,
.support-workspace .form-select,
.support-workspace .rich-builder-input,
:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .form-control,
:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .form-select{
    min-height:44px;
    border:1px solid var(--moa-border) !important;
    border-radius:9px !important;
    color:#f7fafc !important;
    background:#0b1722 !important;
    font-size:14px !important;
    box-shadow:none !important;
}

.support-workspace .form-control:focus,
.support-workspace .form-select:focus,
:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .form-control:focus,
:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .form-select:focus{
    border-color:rgba(19,158,230,.52) !important;
    box-shadow:0 0 0 3px rgba(19,158,230,.10) !important;
}

.support-workspace .form-control::placeholder{
    color:#718493 !important;
}

.support-workspace label,
:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) label{
    color:#b7c4ce !important;
    font-size:14px;
    font-weight:650;
}

.support-workspace .form-select option,
:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .form-select option{
    color:#fff;
    background:#0c1824;
}

/* ==========================================================================
   CONVERSATIONS WORKSPACE
   ========================================================================== */

#tab_chat > .row{
    --bs-gutter-x:1rem;
}

#tab_chat .apple-card{
    height:100%;
    padding:18px !important;
}

#tab_chat h5{
    color:#fff !important;
    font-size:17px;
    line-height:1.35;
}

#tab_chat .apple-select-glass{
    min-height:38px;
    padding:6px 33px 6px 11px;
    border:1px solid var(--moa-border) !important;
    border-radius:8px !important;
    color:#dce5eb !important;
    background:#0c1924 !important;
    font-size:13px !important;
}

#tab_chat .apple-select-glass:focus{
    border-color:rgba(19,158,230,.5) !important;
    box-shadow:0 0 0 3px rgba(19,158,230,.09) !important;
}

/* ==========================================================================
   CONVERSATION INBOX
   ========================================================================== */

#threadListContainer{
    max-height:640px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    padding-right:3px;
}

.chat-thread-card{
    margin-bottom:1px;
    cursor:pointer;
}

.chat-thread-card strong{
    color:#eef5f8 !important;
    font-size:14px !important;
}

.chat-thread-card.border-primary{
    border-color:rgba(19,158,230,.55) !important;
    background:linear-gradient(135deg,rgba(19,158,230,.13),rgba(19,158,230,.05)) !important;
    box-shadow:inset 3px 0 var(--moa-blue);
}

.chat-thread-card .text-end{
    color:#788c9a !important;
    font-size:12px !important;
}

/* ==========================================================================
   TRANSCRIPT
   ========================================================================== */

#terminalStreamViewport{
    min-height:480px !important;
    max-height:650px !important;
    padding:18px !important;
    border:1px solid var(--moa-border) !important;
    border-radius:14px !important;
    background:
        radial-gradient(circle at 100% 0,rgba(19,158,230,.035),transparent 20rem),
        #08131d !important;
    box-shadow:inset 0 1px 14px rgba(0,0,0,.24);
}

.apple-code-block{
    border:1px solid var(--moa-border) !important;
    border-radius:12px !important;
    color:#d8e2e8 !important;
    background:#07121c !important;
    font-family:inherit !important;
    font-size:14px !important;
}

/* Chat bubbles */

.chat-bubble-user{
    border:1px solid rgba(19,158,230,.18);
    border-radius:15px 15px 4px 15px;
    color:#fff;
    background:linear-gradient(135deg,#087fbe,#139ee6);
    box-shadow:0 5px 16px rgba(19,158,230,.18);
}

.chat-bubble-assistant{
    border:1px solid rgba(255,255,255,.085);
    border-radius:15px 15px 15px 4px;
    color:#e9f0f4;
    background:#122331;
    box-shadow:0 5px 16px rgba(0,0,0,.18);
}

.chat-bubble-text{
    color:inherit;
    font-size:14px;
    line-height:1.6;
    white-space:pre-wrap;
    word-break:break-word;
}

.super-small{
    font-size:11px !important;
}

/* ==========================================================================
   TRANSCRIPT TOOLBAR
   ========================================================================== */

#btnCopyTranscript,
#btnFlagThread,
#btnArchiveThread,
#btnDeleteThread{
    min-height:38px;
    padding:6px 11px !important;
}

#btnCopyTranscript:disabled,
#btnFlagThread:disabled,
#btnArchiveThread:disabled,
#btnDeleteThread:disabled{
    opacity:.4;
}

/* ==========================================================================
   PRODUCT DETAIL / OTHER MODALS
   ========================================================================== */

:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .modal-content{
    overflow:hidden;
    border:1px solid rgba(255,255,255,.10) !important;
    border-radius:18px !important;
    color:#f7fafc !important;
    background:#0e1b27 !important;
    box-shadow:var(--moa-shadow-lg);
    backdrop-filter:none !important;
}

:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .modal-header{
    padding:17px 20px;
    border-bottom:1px solid var(--moa-border) !important;
}

:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .modal-body{
    padding:20px;
}

:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .modal-footer{
    padding:14px 20px;
    border-top:1px solid var(--moa-border) !important;
}

:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .modal-title{
    color:#fff !important;
    font-size:18px;
    font-weight:700;
}

:is(#manualAddModal,#editKnowledgeModal,#bulkPasteModal,#uploadDocModal,#productDetailModal) .btn-close{
    filter:invert(1) brightness(2);
    opacity:.65;
}

/* Detail payload */

#detailModalBody{
    padding:16px !important;
    color:#cbd8e1 !important;
    background:#07131d !important;
    font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace !important;
    font-size:13px !important;
    line-height:1.6;
}

/* ==========================================================================
   SMART FORM COMPONENTS
   ========================================================================== */

.smart-form-row{
    margin-bottom:12px;
    padding:16px;
    border:1px solid var(--moa-border);
    border-radius:12px;
    background:#101f2c;
    opacity:1;
    animation:smartSlideUp .28s ease both;
    backdrop-filter:none;
    transition:.18s ease;
}

.smart-form-row:hover{
    transform:translateY(-1px);
    border-color:rgba(19,158,230,.20);
    box-shadow:0 8px 22px rgba(0,0,0,.12);
}

.smart-context-card{
    padding-right:18px;
    border-right:1px solid var(--moa-border);
}

.smart-context-icon{
    width:36px;
    height:36px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    border-radius:9px;
    color:#75d2f8;
    background:rgba(19,158,230,.10);
    font-size:14px;
}

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */

#catalogContainer .text-center h6,
#threadListContainer .text-center h6{
    color:#e9f0f4 !important;
    font-size:16px;
}

#catalogContainer .text-center p,
#threadListContainer .text-center p{
    color:#8698a7 !important;
    font-size:14px !important;
}

/* ==========================================================================
   SCROLLBARS
   ========================================================================== */

#threadListContainer,
#terminalStreamViewport,
#workspaceTabs{
    scrollbar-width:thin;
    scrollbar-color:#314656 transparent;
}

#threadListContainer::-webkit-scrollbar,
#terminalStreamViewport::-webkit-scrollbar,
#workspaceTabs::-webkit-scrollbar{
    width:7px;
    height:7px;
}

#threadListContainer::-webkit-scrollbar-thumb,
#terminalStreamViewport::-webkit-scrollbar-thumb,
#workspaceTabs::-webkit-scrollbar-thumb{
    border-radius:999px;
    background:#314656;
}

/* ==========================================================================
   ANIMATION
   ========================================================================== */

@keyframes smartSlideUp{
    from{
        opacity:0;
        transform:translateY(8px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}

@keyframes chatBubbleSlideIn{
    from{
        opacity:0;
        transform:translateY(7px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}

.chat-bubble-animated{
    animation:chatBubbleSlideIn .22s ease forwards;
    opacity:0;
}

/* ==========================================================================
   MOBILE
   ========================================================================== */

@media(max-width:767.98px){

    .support-workspace{
        padding:10px !important;
        border-radius:15px !important;
    }

    .support-workspace > .border-bottom:first-of-type{
        padding:18px !important;
        border-radius:15px;
    }

    .support-workspace > .border-bottom:first-of-type h4{
        font-size:1.55rem;
    }

    .support-workspace > .border-bottom:first-of-type p{
        font-size:14px !important;
    }

    #workspaceTabs{
        position:sticky;
        top:0;
        z-index:20;
        margin-bottom:15px !important;
        border-radius:11px;
        background:rgba(9,21,33,.95);
        backdrop-filter:blur(14px);
    }

    #workspaceTabs .nav-link{
        min-height:42px;
        padding:7px 12px !important;
    }

    #supportAgentHelp{
        padding:17px !important;
    }

    #supportAgentHelp p{
        font-size:14px !important;
    }

    #supportAgentHelp .d-flex{
        width:100%;
    }

    #supportAgentHelp .btn{
        width:100%;
    }

    #tab_data > .d-flex:nth-of-type(2){
        align-items:stretch !important;
    }

    .apple-segmented-control{
        width:100%;
    }

    .apple-segmented-btn{
        flex:1 0 auto;
    }

    .support-workspace .position-relative:has(#productSearchInput){
        width:100%;
        min-width:0 !important;
    }

    .apple-list-item{
        padding:14px !important;
    }

    .catalog-item > div:first-child{
        width:100%;
    }

    .catalog-item > div:last-child{
        width:100%;
        margin-top:3px;
        padding-top:11px !important;
        border-top:1px solid var(--moa-border) !important;
    }

    #tab_chat .apple-card{
        padding:14px !important;
    }

    #threadListContainer{
        max-height:380px !important;
    }

    #terminalStreamViewport{
        min-height:400px !important;
        max-height:540px !important;
        padding:12px !important;
    }

    .chat-bubble-user,
    .chat-bubble-assistant{
        max-width:92% !important;
    }

    .smart-context-card{
        margin-bottom:14px;
        padding-right:0;
        padding-bottom:14px;
        border-right:0;
        border-bottom:1px solid var(--moa-border);
    }

    .table-dark-custom th,
    .table-dark-custom td{
        padding:11px;
    }
}

/* ==========================================================================
   DESKTOP
   ========================================================================== */

@media(min-width:992px){

    .support-workspace{
        padding:24px !important;
    }

    #tab_chat .col-lg-5 .apple-card{
        position:sticky;
        top:20px;
    }
}

@media(min-width:1400px){

    .support-workspace{
        padding:28px !important;
    }

    #tab_chat .col-lg-5{
        width:38%;
    }

    #tab_chat .col-lg-7{
        width:62%;
    }
}

/* ==========================================================================
   DIGITAL AGENT — COMPLETE VISUAL WORKSPACE
   Knowledge + Library + Conversations
   Mobile-first / isolated / production
   ========================================================================== */


/* ==========================================================================
   1. AGENT OVERVIEW
   ========================================================================== */

.moa-agent-overview{
    display:flex;
    align-items:center;
    gap:15px;
    min-width:0;
}

.moa-agent-overview-avatar{
    position:relative;
    width:58px;
    height:58px;
    flex:0 0 58px;
    border:1px solid rgba(19,158,230,.20);
    border-radius:16px;
    background:#0d1c29;
    overflow:hidden;
    box-shadow:0 8px 22px rgba(0,0,0,.14);
}

.moa-agent-overview-avatar img{
    width:100%;
    height:100%;
    display:block;
    object-fit:cover;
}

.moa-agent-overview-avatar::after{
    content:"";
    position:absolute;
    right:4px;
    bottom:4px;
    width:11px;
    height:11px;
    border:2px solid #10202d;
    border-radius:50%;
    background:var(--moa-green);
    box-shadow:0 0 0 3px rgba(32,185,138,.08);
}

.moa-agent-overview-copy{
    min-width:0;
    flex:1;
}

.moa-agent-kicker{
    margin-bottom:3px;
    color:#80cfee;
    font-size:12px;
    font-weight:700;
    letter-spacing:.07em;
    text-transform:uppercase;
}

.moa-agent-overview-copy h4{
    margin:0 0 4px!important;
}

.moa-agent-overview-copy p{
    max-width:760px;
    margin:0!important;
}

.moa-agent-summary{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

.moa-agent-summary-item{
    min-height:38px;
    display:flex;
    align-items:center;
    gap:8px;
    padding:7px 11px;
    border:1px solid var(--moa-border);
    border-radius:9px;
    color:#becbd4;
    background:rgba(255,255,255,.035);
    font-size:13px;
}

.moa-agent-summary-item strong{
    color:#fff;
    font-size:14px;
}

.moa-agent-summary-item i{
    color:var(--moa-blue-soft);
}


/* ==========================================================================
   2. KNOWLEDGE VISUAL STAGE
   ========================================================================== */

.moa-knowledge-stage{
    position:relative;
    margin:0 0 28px;
    padding:18px;
    border:1px solid var(--moa-border);
    border-radius:20px;
    background:
        radial-gradient(circle at 50% 18%,rgba(19,158,230,.10),transparent 340px),
        linear-gradient(155deg,#10212f 0%,#0b1823 55%,#09151f 100%);
    box-shadow:0 18px 45px rgba(0,0,0,.16);
    overflow:hidden;
}

.moa-knowledge-stage::before{
    content:"";
    position:absolute;
    width:320px;
    height:320px;
    top:-190px;
    right:-150px;
    border:1px solid rgba(19,158,230,.08);
    border-radius:50%;
    pointer-events:none;
}

.moa-knowledge-stage::after{
    content:"";
    position:absolute;
    width:190px;
    height:190px;
    bottom:-120px;
    left:-80px;
    border:1px solid rgba(120,107,232,.08);
    border-radius:50%;
    pointer-events:none;
}

.moa-knowledge-stage-head{
    position:relative;
    z-index:2;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    margin-bottom:22px;
}

.moa-knowledge-stage-head h4{
    margin:0!important;
    color:#fff;
    font-size:19px;
    line-height:1.25;
}

.moa-knowledge-stage-head p{
    max-width:680px;
    margin:0!important;
    color:var(--moa-muted)!important;
    font-size:14px;
    line-height:1.55;
}


/* ==========================================================================
   3. KNOWLEDGE MAP — MOBILE FIRST
   ========================================================================== */

.moa-knowledge-map{
    position:relative;
    z-index:2;
    display:grid;
    grid-template-columns:1fr;
    grid-template-areas:
        "core"
        "manual"
        "sync"
        "document"
        "all";
    gap:16px;
}

.moa-knowledge-map::before{
    content:"";
    position:absolute;
    z-index:0;
    top:196px;
    bottom:42px;
    left:15px;
    width:1px;
    background:linear-gradient(
        180deg,
        rgba(19,158,230,.45),
        rgba(19,158,230,.18) 55%,
        rgba(120,107,232,.18),
        transparent
    );
    pointer-events:none;
}

.moa-knowledge-map::after{
    display:none;
}

.moa-knowledge-source.manual{grid-area:manual}
.moa-knowledge-source.sync{grid-area:sync}
.moa-knowledge-source.document{grid-area:document}
.moa-knowledge-source.all{grid-area:all}


/* ==========================================================================
   4. CENTRAL DIGITAL AGENT
   ========================================================================== */

.moa-agent-core{
    grid-area:core;
    position:relative;
    z-index:3;
    min-height:168px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:22px 20px 24px;
    border:1px solid rgba(19,158,230,.23);
    border-radius:18px;
    text-align:center;
    background:
        radial-gradient(circle at 50% 25%,rgba(19,158,230,.18),transparent 58%),
        linear-gradient(150deg,#142c3d,#0d1d29);
    box-shadow:
        0 16px 36px rgba(0,0,0,.18),
        inset 0 1px 0 rgba(255,255,255,.025);
}

.moa-agent-core::after{
    content:"";
    position:absolute;
    left:15px;
    bottom:-17px;
    width:1px;
    height:17px;
    background:rgba(19,158,230,.42);
}

.moa-agent-core-avatar{
    position:relative;
    width:72px;
    height:72px;
    margin-bottom:13px;
    border:1px solid rgba(19,158,230,.24);
    border-radius:21px;
    background:#091722;
    overflow:hidden;
    box-shadow:
        0 12px 28px rgba(0,0,0,.24),
        0 0 0 5px rgba(19,158,230,.035);
}

.moa-agent-core-avatar img{
    width:100%;
    height:100%;
    display:block;
    object-fit:cover;
}

.moa-agent-core-status{
    position:absolute;
    right:6px;
    bottom:6px;
    width:12px;
    height:12px;
    border:2px solid #10202e;
    border-radius:50%;
    background:var(--moa-green);
    box-shadow:0 0 0 3px rgba(32,185,138,.08);
}

.moa-agent-core small{
    display:block;
    margin-bottom:4px;
    color:#79c8e9;
    font-size:11px;
    font-weight:700;
    letter-spacing:.09em;
    text-transform:uppercase;
}

.moa-agent-core strong{
    display:block;
    color:#fff;
    font-size:20px;
    font-weight:700;
    letter-spacing:-.02em;
}

.moa-agent-core span{
    display:block;
    max-width:250px;
    margin-top:7px;
    color:#91a5b3;
    font-size:13px;
    line-height:1.5;
}

.moa-agent-core-total{
    margin-top:14px!important;
    padding:7px 11px;
    border:1px solid rgba(255,255,255,.075);
    border-radius:999px;
    color:#d2dce3!important;
    background:rgba(255,255,255,.035);
    font-size:12px!important;
}


/* ==========================================================================
   5. KNOWLEDGE SOURCES
   ========================================================================== */

.moa-knowledge-source{
    position:relative;
    z-index:2;
    width:auto;
    min-height:94px;
    margin-left:30px;
    display:flex;
    align-items:center;
    gap:13px;
    padding:15px;
    border:1px solid var(--moa-border);
    border-radius:15px;
    color:inherit;
    text-align:left;
    background:rgba(16,32,45,.94);
    box-shadow:0 8px 22px rgba(0,0,0,.10);
    transition:
        transform .18s ease,
        border-color .18s ease,
        background .18s ease,
        box-shadow .18s ease;
}

.moa-knowledge-source::before{
    content:"";
    position:absolute;
    top:50%;
    left:-15px;
    width:15px;
    height:1px;
    background:rgba(19,158,230,.32);
}

.moa-knowledge-source::after{
    content:"";
    position:absolute;
    top:50%;
    left:-20px;
    width:9px;
    height:9px;
    transform:translateY(-50%);
    border:2px solid #0c1924;
    border-radius:50%;
    background:#399fd0;
    box-shadow:0 0 0 3px rgba(19,158,230,.08);
}

.moa-knowledge-source:hover{
    transform:translateY(-2px);
    border-color:rgba(19,158,230,.32);
    background:#132838;
    box-shadow:0 13px 30px rgba(0,0,0,.16);
}

.moa-knowledge-source-icon{
    width:44px;
    height:44px;
    flex:0 0 44px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(19,158,230,.14);
    border-radius:12px;
    color:#77cff4;
    background:rgba(19,158,230,.08);
    font-size:17px;
}

.moa-knowledge-source.manual .moa-knowledge-source-icon{
    color:#94d9f5;
}

.moa-knowledge-source.sync .moa-knowledge-source-icon{
    color:#76d5b6;
    background:rgba(32,185,138,.08);
    border-color:rgba(32,185,138,.14);
}

.moa-knowledge-source.document .moa-knowledge-source-icon{
    color:#b1a8ff;
    background:rgba(120,107,232,.10);
    border-color:rgba(120,107,232,.16);
}

.moa-knowledge-source.all .moa-knowledge-source-icon{
    color:#f0c86d;
    background:rgba(224,171,52,.08);
    border-color:rgba(224,171,52,.14);
}

.moa-knowledge-source-copy{
    min-width:0;
    flex:1;
}

.moa-knowledge-source-label{
    margin-bottom:3px;
    color:#fff;
    font-size:14px;
    font-weight:700;
    line-height:1.3;
}

.moa-knowledge-source-description{
    color:#899eac;
    font-size:12.5px;
    line-height:1.45;
}

.moa-knowledge-source-count{
    min-width:34px;
    flex:0 0 auto;
    color:#fff;
    font-size:22px;
    font-weight:700;
    letter-spacing:-.04em;
    text-align:right;
}


/* ==========================================================================
   6. KNOWLEDGE LIBRARY
   ========================================================================== */

.moa-library-panel{
    margin-top:24px;
}

.moa-library-heading{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:18px;
    margin-bottom:14px;
}

.moa-library-heading h4{
    margin:0 0 3px!important;
    font-size:18px;
}

.moa-library-heading p{
    margin:0!important;
    color:var(--moa-muted)!important;
    font-size:14px;
    line-height:1.5;
}

.moa-library-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:14px;
    padding:9px;
    border:1px solid var(--moa-border);
    border-radius:13px;
    background:rgba(255,255,255,.025);
}

.moa-library-toolbar .apple-segmented-control{
    border:0;
    background:transparent;
    padding:0;
}

.moa-library-search{
    position:relative;
    width:100%;
    max-width:360px;
}

.moa-library-search i{
    position:absolute;
    z-index:2;
    left:13px;
    top:50%;
    transform:translateY(-50%);
    color:var(--moa-muted);
    font-size:13px;
}

.moa-library-search .apple-search-input{
    padding-left:38px!important;
}


/* ==========================================================================
   7. KNOWLEDGE RECORDS
   ========================================================================== */

.moa-knowledge-record{
    min-height:78px;
}

.moa-record-main{
    display:flex;
    align-items:center;
    gap:13px;
    min-width:0;
    flex:1;
}

.moa-record-icon{
    width:42px;
    height:42px;
    flex:0 0 42px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(19,158,230,.12);
    border-radius:11px;
    color:#73cdf2;
    background:rgba(19,158,230,.07);
}

.moa-record-icon.document{
    color:#aaa0f7;
    border-color:rgba(120,107,232,.13);
    background:rgba(120,107,232,.08);
}

.moa-record-body{
    min-width:0;
    flex:1;
}

.moa-record-title-row{
    display:flex;
    align-items:center;
    gap:7px;
    flex-wrap:wrap;
    margin-bottom:3px;
}

.moa-record-title-row h6{
    margin:0!important;
}

.moa-record-preview{
    max-width:760px!important;
}

.moa-record-actions{
    display:flex;
    align-items:center;
    gap:8px;
    flex-shrink:0;
}

.moa-record-date{
    color:var(--moa-muted);
    font-size:13px;
    white-space:nowrap;
}


/* ==========================================================================
   8. SOURCE DOCUMENT MANAGER
   ========================================================================== */

.moa-source-manager{
    margin-top:18px!important;
}

.moa-source-manager-toggle{
    cursor:pointer;
    transition:background .16s ease;
}

.moa-source-manager-toggle:hover{
    background:rgba(255,255,255,.025);
}

.moa-source-manager-icon{
    width:38px;
    height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--moa-border);
    border-radius:10px;
    color:#8ca0ae;
    background:rgba(255,255,255,.035);
}


/* ==========================================================================
   9. LEGACY / EXISTING CONVERSATION LAYOUT SUPPORT
   Keep these because existing markup may still reference them.
   ========================================================================== */

.moa-conversation-layout{
    display:grid;
    grid-template-columns:minmax(290px,36%) minmax(0,1fr);
    gap:15px;
}

.moa-conversation-panel{
    min-width:0;
    height:100%;
    padding:18px;
    border:1px solid var(--moa-border);
    border-radius:17px;
    background:linear-gradient(155deg,#10202d,#0d1b27);
    box-shadow:0 12px 30px rgba(0,0,0,.12);
}

.moa-conversation-panel-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:14px;
}

.moa-conversation-panel-head h5{
    margin:0!important;
}

.moa-conversation-filterbar{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-bottom:12px;
}

.moa-conversation-toolbar{
    display:flex;
    align-items:center;
    gap:7px;
    flex-wrap:wrap;
}

.moa-conversation-toolbar .btn-warning,
.moa-conversation-toolbar .btn-outline-warning{
    min-height:38px;
    padding:6px 11px;
    border-radius:9px;
    font-size:13px;
    font-weight:650;
}

.moa-thread-top{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
}

.moa-thread-title{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
}

.moa-thread-title strong{
    min-width:0;
}

.moa-thread-time{
    margin-top:5px;
    color:var(--moa-muted);
    font-size:12px;
}

.moa-thread-badges{
    display:flex;
    align-items:flex-end;
    flex-direction:column;
    gap:4px;
    flex-shrink:0;
}


/* ==========================================================================
   10. CONVERSATIONS WORKSPACE
   Scoped so it cannot alter Knowledge.
   ========================================================================== */

#tab_chat{
    --chat-bg:#0b1721;
    --chat-panel:#10202d;
    --chat-panel-soft:#122532;
    --chat-border:rgba(255,255,255,.075);
    --chat-border-active:rgba(19,158,230,.42);
    --chat-text:#f4f7f9;
    --chat-muted:#8296a5;
    --chat-blue:#55bce9;
    --chat-green:#52c69d;
    --chat-yellow:#e6b94f;
    --chat-red:#ee7479;
}

#tab_chat .moa-conversations-workspace{
    width:100%;
}


/* Conversation hero */

#tab_chat .moa-conversations-hero{
    display:flex;
    align-items:flex-start;
    gap:14px;
    margin-bottom:20px;
    padding:18px;
    border:1px solid var(--chat-border);
    border-radius:18px;
    background:
        radial-gradient(circle at 12% 0%,rgba(19,158,230,.09),transparent 230px),
        linear-gradient(145deg,#10212e,#0c1924);
    box-shadow:0 12px 30px rgba(0,0,0,.10);
}

#tab_chat .moa-conversations-hero-icon{
    width:46px;
    height:46px;
    flex:0 0 46px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(19,158,230,.17);
    border-radius:13px;
    color:#76cef2;
    background:rgba(19,158,230,.08);
    font-size:18px;
}

#tab_chat .moa-conversations-hero-copy{
    min-width:0;
    flex:1;
}

#tab_chat .moa-conversations-kicker,
#tab_chat .moa-panel-eyebrow{
    display:block;
    margin-bottom:3px;
    color:#70bddf;
    font-size:10.5px;
    font-weight:750;
    letter-spacing:.09em;
    text-transform:uppercase;
}

#tab_chat .moa-conversations-hero h4{
    margin:0 0 4px!important;
    color:var(--chat-text);
    font-size:19px;
    letter-spacing:-.02em;
}

#tab_chat .moa-conversations-hero p{
    max-width:720px;
    margin:0!important;
    color:var(--chat-muted)!important;
    font-size:13.5px;
    line-height:1.5;
}

#tab_chat .moa-conversations-live{
    flex:0 0 auto;
    display:flex;
    align-items:center;
    gap:7px;
    padding:7px 10px;
    border:1px solid rgba(82,198,157,.14);
    border-radius:999px;
    color:#9bdfc8;
    background:rgba(82,198,157,.06);
    font-size:11px;
    font-weight:700;
}

#tab_chat .moa-conversations-live span{
    width:7px;
    height:7px;
    border-radius:50%;
    background:var(--chat-green);
    box-shadow:0 0 0 4px rgba(82,198,157,.09);
}


/* Workspace columns */

#tab_chat .moa-conversations-grid{
    display:grid;
    grid-template-columns:minmax(300px,34%) minmax(0,1fr);
    gap:15px;
    align-items:stretch;
}

#tab_chat .moa-conversations-sidebar,
#tab_chat .moa-conversation-detail{
    min-width:0;
    border:1px solid var(--chat-border);
    border-radius:18px;
    background:linear-gradient(155deg,#10202d,#0d1b27);
    box-shadow:0 12px 30px rgba(0,0,0,.12);
    overflow:hidden;
}


/* Conversation inbox */

#tab_chat .moa-conversations-sidebar{
    display:flex;
    flex-direction:column;
}

#tab_chat .moa-conversations-sidebar-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:17px 17px 13px;
}

#tab_chat .moa-conversations-sidebar-head h5,
#tab_chat .moa-conversation-detail-head h5{
    margin:0!important;
    color:var(--chat-text);
    font-size:16px;
    font-weight:700;
}

#tab_chat .moa-conversation-count{
    min-width:31px;
    height:31px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0 8px;
    border:1px solid rgba(19,158,230,.14);
    border-radius:9px;
    color:#a8dff5;
    background:rgba(19,158,230,.07);
    font-size:12px;
    font-weight:700;
}


/* Conversation filters */

#tab_chat .moa-conversation-filters{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    padding:0 12px 13px;
    border-bottom:1px solid var(--chat-border);
}

#tab_chat .moa-filter-field label{
    display:block;
    margin:0 0 5px 2px;
    color:#758b9a;
    font-size:10px;
    font-weight:700;
    letter-spacing:.06em;
    text-transform:uppercase;
}

#tab_chat .moa-filter-field .form-select{
    width:100%;
    min-height:39px;
    padding-top:7px;
    padding-bottom:7px;
    border:1px solid rgba(255,255,255,.08)!important;
    border-radius:10px!important;
    color:#dce6ec!important;
    background-color:rgba(255,255,255,.035)!important;
    font-size:12.5px;
    box-shadow:none!important;
}

#tab_chat .moa-filter-field .form-select:focus{
    border-color:rgba(19,158,230,.35)!important;
}


/* Thread list */

#tab_chat .moa-thread-list{
    display:flex;
    flex-direction:column;
    gap:7px;
    max-height:590px;
    padding:10px;
    overflow-y:auto;
    scrollbar-width:thin;
}

#tab_chat .moa-chat-thread,
#tab_chat .chat-thread-card{
    position:relative;
    min-width:0;
    border-color:transparent;
    transition:
        border-color .16s ease,
        background .16s ease,
        transform .16s ease,
        box-shadow .16s ease;
}

#tab_chat .moa-chat-thread{
    display:flex;
    align-items:flex-start;
    gap:11px;
    padding:13px;
    border:1px solid transparent;
    border-radius:13px;
    color:inherit;
    background:rgba(255,255,255,.022);
    cursor:pointer;
}

#tab_chat .moa-chat-thread:hover,
#tab_chat .chat-thread-card:hover{
    transform:translateY(-1px);
    border-color:rgba(255,255,255,.08)!important;
    background:rgba(255,255,255,.045);
}

#tab_chat .moa-chat-thread.border-primary,
#tab_chat .chat-thread-card.border-primary{
    border-color:var(--chat-border-active)!important;
    background:
        linear-gradient(
            90deg,
            rgba(19,158,230,.10),
            rgba(19,158,230,.025)
        )!important;
    box-shadow:
        inset 3px 0 0 rgba(19,158,230,.75),
        0 7px 18px rgba(0,0,0,.12);
}

#tab_chat .moa-chat-thread-marker{
    width:36px;
    height:36px;
    flex:0 0 36px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(19,158,230,.12);
    border-radius:10px;
    color:#6ec7ed;
    background:rgba(19,158,230,.07);
    font-size:13px;
}

#tab_chat .moa-chat-thread.border-primary .moa-chat-thread-marker{
    border-color:rgba(19,158,230,.25);
    background:rgba(19,158,230,.13);
}

#tab_chat .moa-chat-thread-content{
    min-width:0;
    flex:1;
}

#tab_chat .moa-chat-thread-top{
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:8px;
}

#tab_chat .moa-chat-thread-title{
    min-width:0;
    flex:1;
    overflow:hidden;
    color:#eef3f6;
    font-size:13.5px;
    font-weight:650;
    line-height:1.35;
    text-overflow:ellipsis;
    white-space:nowrap;
}

#tab_chat .moa-chat-thread-chevron{
    flex:0 0 auto;
    color:#536976;
    font-size:9px;
    transition:transform .16s ease,color .16s ease;
}

#tab_chat .moa-chat-thread:hover .moa-chat-thread-chevron,
#tab_chat .moa-chat-thread.border-primary .moa-chat-thread-chevron{
    transform:translateX(2px);
    color:#7fcff0;
}

#tab_chat .moa-chat-thread-meta{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    color:#718693;
    font-size:10.5px;
}

#tab_chat .moa-chat-thread-meta > span{
    display:flex;
    align-items:center;
    gap:5px;
    white-space:nowrap;
}

#tab_chat .moa-chat-thread-statuses{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:4px;
    flex-wrap:wrap;
}

#tab_chat .moa-thread-status{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:3px 6px;
    border-radius:6px;
    font-size:9px;
    font-weight:750;
    letter-spacing:.035em;
    text-transform:uppercase;
}

#tab_chat .moa-thread-status.escalated{
    color:#ffc1c4;
    background:rgba(238,116,121,.10);
}

#tab_chat .moa-thread-status.flagged{
    color:#efd17c;
    background:rgba(230,185,79,.10);
}


/* Empty conversation list */

#tab_chat .moa-conversation-empty{
    min-height:310px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:30px 22px;
    text-align:center;
}

#tab_chat .moa-conversation-empty-icon{
    width:54px;
    height:54px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-bottom:13px;
    border:1px solid var(--chat-border);
    border-radius:16px;
    color:#718895;
    background:rgba(255,255,255,.025);
    font-size:19px;
}

#tab_chat .moa-conversation-empty strong{
    margin-bottom:5px;
    color:#dbe4e9;
    font-size:14px;
}

#tab_chat .moa-conversation-empty span{
    max-width:250px;
    color:var(--chat-muted);
    font-size:12px;
    line-height:1.5;
}


/* ==========================================================================
   11. CONVERSATION DETAIL + TOOLBAR
   ========================================================================== */

#tab_chat .moa-conversation-detail{
    display:flex;
    flex-direction:column;
}

#tab_chat .moa-conversation-detail-head{
    min-height:73px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:15px;
    padding:13px 15px;
    border-bottom:1px solid var(--chat-border);
    background:rgba(255,255,255,.012);
}

#tab_chat .moa-conversation-detail-title{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}

#tab_chat .moa-conversation-detail-icon{
    width:38px;
    height:38px;
    flex:0 0 38px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(82,198,157,.14);
    border-radius:10px;
    color:#7ad2b4;
    background:rgba(82,198,157,.07);
}

#tab_chat .moa-conversation-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:6px;
    flex-wrap:wrap;
}

#tab_chat .moa-conversation-action{
    min-height:35px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    padding:6px 9px;
    border:1px solid rgba(255,255,255,.075);
    border-radius:9px;
    color:#acbbc5;
    background:rgba(255,255,255,.025);
    font-size:11px;
    font-weight:650;
    transition:
        color .16s ease,
        border-color .16s ease,
        background .16s ease;
}

#tab_chat .moa-conversation-action:not(:disabled):hover{
    border-color:rgba(19,158,230,.25);
    color:#e8f2f7;
    background:rgba(19,158,230,.07);
}

#tab_chat .moa-conversation-action.destructive:not(:disabled):hover{
    border-color:rgba(238,116,121,.25);
    color:#ffc1c4;
    background:rgba(238,116,121,.07);
}

#tab_chat .moa-conversation-action:disabled{
    opacity:.35;
    cursor:not-allowed;
}


/* ==========================================================================
   12. TRANSCRIPT
   ========================================================================== */

#tab_chat .moa-transcript-viewport{
    min-height:520px;
    max-height:620px;
    flex:1;
    display:flex;
    flex-direction:column;
    gap:10px;
    margin:0!important;
    padding:18px!important;
    border:0!important;
    border-radius:0!important;
    background:
        radial-gradient(circle at 50% 0%,rgba(19,158,230,.035),transparent 280px),
        #09151f!important;
    overflow-y:auto;
}

#tab_chat .moa-transcript-empty{
    min-height:450px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    margin:auto;
    padding:25px;
    text-align:center;
}

#tab_chat .moa-transcript-empty-visual{
    position:relative;
    width:90px;
    height:70px;
    margin-bottom:15px;
}

#tab_chat .moa-transcript-bubble{
    position:absolute;
    height:16px;
    border:1px solid rgba(19,158,230,.13);
    border-radius:8px;
    background:rgba(19,158,230,.06);
}

#tab_chat .moa-transcript-bubble.one{
    top:4px;
    left:7px;
    width:61px;
}

#tab_chat .moa-transcript-bubble.two{
    top:27px;
    right:5px;
    width:54px;
    border-color:rgba(82,198,157,.13);
    background:rgba(82,198,157,.06);
}

#tab_chat .moa-transcript-bubble.three{
    top:50px;
    left:18px;
    width:47px;
}

#tab_chat .moa-transcript-empty strong{
    margin-bottom:5px;
    color:#dbe5eb;
    font-size:14px;
}

#tab_chat .moa-transcript-empty span{
    max-width:300px;
    color:#718794;
    font-size:12px;
    line-height:1.5;
}


/*
 * Existing JS-generated transcript compatibility.
 */

#tab_chat #terminalStreamViewport{
    border-color:transparent!important;
}

#tab_chat #terminalStreamViewport > div:not(.moa-transcript-empty){
    max-width:88%;
}

#tab_chat #terminalStreamViewport .font-monospace{
    font-family:inherit!important;
}


/* ==========================================================================
   13. TABLET — 768+
   ========================================================================== */

@media(min-width:768px){

    .moa-knowledge-stage{
        padding:22px;
        border-radius:22px;
    }

    .moa-knowledge-stage-head{
        margin-bottom:24px;
    }

    .moa-knowledge-map{
        grid-template-columns:repeat(2,minmax(0,1fr));
        grid-template-areas:
            "core core"
            "manual document"
            "sync all";
        gap:14px;
    }

    .moa-knowledge-map::before{
        top:216px;
        bottom:auto;
        left:50%;
        width:1px;
        height:25px;
        transform:translateX(-50%);
    }

    .moa-agent-core{
        min-height:190px;
    }

    .moa-agent-core::after{
        left:50%;
        bottom:-26px;
        height:26px;
    }

    .moa-knowledge-source{
        min-height:108px;
        margin-left:0;
        padding:16px;
    }

    .moa-knowledge-source::before,
    .moa-knowledge-source::after{
        display:none;
    }

}


/* ==========================================================================
   14. DESKTOP — 992+
   ========================================================================== */

@media(min-width:992px){

    .moa-knowledge-stage{
        padding:26px;
        margin-bottom:30px;
    }

    .moa-knowledge-stage-head{
        flex-direction:row;
        align-items:flex-end;
        justify-content:space-between;
        gap:24px;
        margin-bottom:24px;
    }

    .moa-knowledge-map{
        grid-template-columns:minmax(0,1fr) minmax(235px,285px) minmax(0,1fr);
        grid-template-rows:1fr 1fr;
        grid-template-areas:
            "manual core document"
            "sync core all";
        gap:16px 22px;
        align-items:stretch;
    }

    .moa-knowledge-map::before{
        display:block;
        top:50%;
        left:18%;
        right:18%;
        bottom:auto;
        width:auto;
        height:1px;
        transform:none;
        background:linear-gradient(
            90deg,
            transparent,
            rgba(19,158,230,.15) 8%,
            rgba(19,158,230,.35) 36%,
            rgba(19,158,230,.35) 64%,
            rgba(19,158,230,.15) 92%,
            transparent
        );
    }

    .moa-knowledge-map::after{
        content:"";
        display:block;
        position:absolute;
        z-index:0;
        top:12%;
        bottom:12%;
        left:50%;
        width:1px;
        background:linear-gradient(
            180deg,
            transparent,
            rgba(19,158,230,.26),
            rgba(120,107,232,.20),
            transparent
        );
        pointer-events:none;
    }

    .moa-agent-core{
        min-height:260px;
        padding:24px;
        border-radius:20px;
    }

    .moa-agent-core::before{
        content:"";
        position:absolute;
        width:155px;
        height:155px;
        top:50%;
        left:50%;
        transform:translate(-50%,-50%);
        border:1px solid rgba(19,158,230,.08);
        border-radius:50%;
        pointer-events:none;
    }

    .moa-agent-core::after{
        display:none;
    }

    .moa-agent-core-avatar{
        width:78px;
        height:78px;
    }

    .moa-knowledge-source{
        min-height:122px;
        margin-left:0;
        padding:17px;
        border-radius:16px;
    }

    .moa-knowledge-source::before{
        display:block;
        top:50%;
        width:22px;
        height:1px;
        background:rgba(19,158,230,.28);
    }

    .moa-knowledge-source::after{
        display:block;
        top:50%;
        width:7px;
        height:7px;
        border-width:1px;
        background:#318bb4;
        box-shadow:0 0 0 3px rgba(19,158,230,.05);
    }

    /* Left-hand sources connect towards core */
    .moa-knowledge-source.manual::before,
    .moa-knowledge-source.sync::before{
        left:auto;
        right:-22px;
    }

    .moa-knowledge-source.manual::after,
    .moa-knowledge-source.sync::after{
        left:auto;
        right:-26px;
    }

    /* Right-hand sources connect towards core */
    .moa-knowledge-source.document::before,
    .moa-knowledge-source.all::before{
        left:-22px;
        right:auto;
    }

    .moa-knowledge-source.document::after,
    .moa-knowledge-source.all::after{
        left:-26px;
        right:auto;
    }

}


/* ==========================================================================
   15. TABLET / COMPACT DESKTOP
   ========================================================================== */

@media(max-width:991.98px){

    .moa-agent-summary{
        width:100%;
    }

    .moa-conversation-layout{
        grid-template-columns:1fr;
    }

    #tab_chat .moa-conversations-grid{
        grid-template-columns:1fr;
    }

    #tab_chat .moa-thread-list{
        max-height:380px;
    }

    #tab_chat .moa-transcript-viewport{
        min-height:460px;
        max-height:600px;
    }

}


/* ==========================================================================
   16. MOBILE
   ========================================================================== */

@media(max-width:767.98px){

    /* Agent overview */

    .moa-agent-overview{
        align-items:flex-start;
    }

    .moa-agent-overview-avatar{
        width:50px;
        height:50px;
        flex-basis:50px;
        border-radius:14px;
    }

    .moa-agent-summary-item{
        flex:1 1 auto;
    }


    /* Knowledge library */

    .moa-library-heading{
        align-items:flex-start;
        flex-direction:column;
        gap:8px;
    }

    .moa-library-toolbar{
        align-items:stretch;
        flex-direction:column;
    }

    .moa-library-toolbar .apple-segmented-control{
        width:100%;
    }

    .moa-library-search{
        max-width:none;
    }

    .moa-record-main{
        align-items:flex-start;
    }

    .moa-record-actions{
        width:100%;
        justify-content:space-between;
        padding-top:10px;
        border-top:1px solid var(--moa-border);
    }


    /* Legacy conversation classes */

    .moa-conversation-panel-head{
        align-items:flex-start;
        flex-direction:column;
    }

    .moa-conversation-filterbar{
        grid-template-columns:1fr;
    }

    .moa-conversation-toolbar{
        width:100%;
    }


    /* New conversation workspace */

    #tab_chat .moa-conversations-hero{
        position:relative;
        padding:15px;
        border-radius:16px;
    }

    #tab_chat .moa-conversations-hero-icon{
        width:40px;
        height:40px;
        flex-basis:40px;
        border-radius:11px;
    }

    #tab_chat .moa-conversations-hero-copy{
        padding-right:48px;
    }

    #tab_chat .moa-conversations-hero h4{
        font-size:17px;
    }

    #tab_chat .moa-conversations-hero p{
        font-size:12.5px;
    }

    #tab_chat .moa-conversations-live{
        position:absolute;
        top:13px;
        right:13px;
        padding:5px 7px;
        font-size:9px;
    }

    #tab_chat .moa-conversations-sidebar,
    #tab_chat .moa-conversation-detail{
        border-radius:15px;
    }

    #tab_chat .moa-conversation-filters{
        grid-template-columns:1fr 1fr;
    }

    #tab_chat .moa-thread-list{
        max-height:330px;
        padding:8px;
    }

    #tab_chat .moa-chat-thread{
        padding:12px;
    }

    #tab_chat .moa-conversation-detail-head{
        align-items:flex-start;
        flex-direction:column;
        padding:13px;
    }

    #tab_chat .moa-conversation-actions{
        width:100%;
        display:grid;
        grid-template-columns:repeat(4,minmax(0,1fr));
        gap:5px;
    }

    #tab_chat .moa-conversation-action{
        min-width:0;
        padding:8px 5px;
    }

    #tab_chat .moa-conversation-action span{
        display:none;
    }

    #tab_chat .moa-conversation-action i{
        font-size:13px;
    }

    #tab_chat .moa-transcript-viewport{
        min-height:420px;
        max-height:540px;
        padding:13px!important;
    }

    #tab_chat .moa-transcript-empty{
        min-height:370px;
    }

}


/* ==========================================================================
   17. SMALL MOBILE
   ========================================================================== */

@media(max-width:480px){

    /* Knowledge */

    .moa-knowledge-stage{
        margin-left:-2px;
        margin-right:-2px;
        padding:15px;
        border-radius:18px;
    }

    .moa-knowledge-stage-head{
        margin-bottom:18px;
    }

    .moa-knowledge-stage-head h4{
        font-size:18px;
    }

    .moa-agent-core{
        min-height:158px;
        padding:19px 16px 21px;
    }

    .moa-agent-core-avatar{
        width:64px;
        height:64px;
        border-radius:18px;
    }

    .moa-knowledge-source{
        min-height:88px;
        margin-left:26px;
        gap:11px;
        padding:13px;
        border-radius:14px;
    }

    .moa-knowledge-map::before{
        left:13px;
    }

    .moa-agent-core::after{
        left:13px;
    }

    .moa-knowledge-source::before{
        left:-13px;
        width:13px;
    }

    .moa-knowledge-source::after{
        left:-17px;
        width:8px;
        height:8px;
    }

    .moa-knowledge-source-icon{
        width:40px;
        height:40px;
        flex-basis:40px;
        border-radius:11px;
    }

    .moa-knowledge-source-count{
        font-size:19px;
    }


    /* Conversations */

    #tab_chat .moa-conversations-hero{
        gap:10px;
    }

    #tab_chat .moa-conversations-hero-copy{
        padding-right:0;
    }

    #tab_chat .moa-conversations-live{
        display:none;
    }

    #tab_chat .moa-conversation-filters{
        grid-template-columns:1fr;
    }

    #tab_chat .moa-chat-thread-marker{
        width:33px;
        height:33px;
        flex-basis:33px;
    }

    #tab_chat .moa-chat-thread-meta{
        align-items:flex-start;
        flex-direction:column;
    }

    #tab_chat .moa-chat-thread-statuses{
        justify-content:flex-start;
    }

    #tab_chat .moa-conversation-actions{
        grid-template-columns:repeat(4,1fr);
    }

}