/* ==============================
   RagTeck SaaS UI Styles
   ============================== */

/* ==============================
   Divi 5 Theme Wrapper Suppression for Fullscreen App Pages
   ============================== */

body.ragteck-fullscreen-page #et-main-area {
    padding: 0 !important;
    margin: 0 !important;
}

body.ragteck-fullscreen-page .et_pb_section {
    padding: 0 !important;
}

body.ragteck-fullscreen-page #main-content {
    padding: 0 !important;
}

body.ragteck-fullscreen-page .entry-content {
    padding: 0 !important;
    max-width: none !important;
}

body.ragteck-fullscreen-page .et_post_meta_wrapper {
    padding: 0 !important;
    display: none !important;
}

body.ragteck-fullscreen-page #page-container {
    overflow: visible !important;
}

/* ============================== */

/* Universal box-sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Break out of Divi container for SAAS pages */
.ragteck-saas-page {
    position: relative;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
}

/* Override Divi's container constraints */
.entry-content:has(.ragteck-saas-page) {
    max-width: none !important;
    width: 100% !important;
}

#left-area:has(.ragteck-saas-page) {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
}

.container:has(.ragteck-saas-page) {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
}

/* Hide Divi page title for SAAS pages - more aggressive */
.ragteck-saas-page ~ h1.main_title,
article:has(.ragteck-saas-page) h1.main_title,
body.page .ragteck-saas-page ~ h1,
body.page article:has(.ragteck-saas-page) .main_title,
.et_pb_section:has(.ragteck-saas-page) ~ h1,
.entry-content .ragteck-saas-page ~ h1 {
    display: none !important;
}

/* Force full width on body when SAAS page exists */
body:has(.ragteck-saas-page) #page-container,
body:has(.ragteck-saas-page) #main-content {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
}

/* Ensure app container also breaks out */
.ragteck-app-container {
    display: flex !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Override Divi theme default 58px top padding and match background to working area */
body:not(.et-tb) #main-content .container,
body:not(.et-tb-has-header) #main-content .container {
    padding-top: 0px !important;
    background: #f9f9f9 !important;
}

/* Force Divi main-content background to match working area */
#main-content {
    background: #f9f9f9 !important;
}

/* Hide WordPress page title on SaaS pages */
.ragteck-saas-page .main_title,
.main_title {
    display: none !important;
}

/* Hide page title when app container is present - more comprehensive */
body:has(.ragteck-app-container) h1.main_title,
body:has(.ragteck-app-container) .entry-title,
body:has(.ragteck-app-container) .page-title,
body:has(.ragteck-app-container) .post-title,
article:has(.ragteck-app-container) h1,
.entry-content:has(.ragteck-app-container) > h1:first-child,
.ragteck-app-container ~ h1,
.ragteck-container ~ h1 {
    display: none !important;
}

/* Restore plugin page titles suppressed by Divi h1 hiding rules */
article:has(.ragteck-app-container) h1.ragteck-page-title,
.ragteck-app-container h1.ragteck-page-title,
.ragteck-main-content h1.ragteck-page-title {
    display: block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #1a1a1a !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
}

/* Target Divi-specific title elements when app container exists */
body:has(.ragteck-app-container) .et_pb_title_container,
body:has(.ragteck-app-container) .et_pb_post_title {
    display: none !important;
}

/* Override Divi theme container padding for SaaS pages */
.ragteck-saas-page #main-content .container {
    padding-top: 0 !important;
    margin-top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Mobile Top Bar - Hidden on desktop */
#ragteck-mobile-topbar {
    display: none;
}

/* SaaS App Container */
.ragteck-app-container {
    display: flex;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

/* Sidebar */
.ragteck-sidebar {
    width: 250px;
    background: #1a1a1a;
    color: #fff;
    height: 100vh;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    /* Allow tooltips to overflow the right edge without being clipped */
    overflow-x: visible;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

/* Push sidebar down if WP Admin Bar is present */
body.admin-bar .ragteck-sidebar {
    top: 32px;
    height: calc(100vh - 32px);
}

/* Mobile Admin Bar is taller */
@media screen and (max-width: 782px) {
    body.admin-bar .ragteck-sidebar {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

.ragteck-sidebar h2 {
    color: #00d1b2;
    font-size: 20px;
    margin-bottom: 30px;
}

.ragteck-sidebar .menu-section {
    margin-bottom: 0;
}

.ragteck-sidebar .menu-section p {
    text-transform: uppercase;
    font-size: 12px;
    color: #aaa;
    margin-bottom: 6px;
}

.ragteck-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ragteck-sidebar ul li {
    margin-bottom: 2px;
    line-height: 1em;
}

.ragteck-sidebar ul li a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 400;
    padding: 4px 8px;
    display: block;
}

.ragteck-sidebar ul li a:hover {
    color: #00d1b2;
}

.ragteck-sidebar ul li a.active {
    color: #00d1b2;
    font-weight: 600;
}

.ragteck-main-content {
    flex: 1;
    margin-left: 250px;
    padding: 40px 40px 40px 20px;
    background: #f9f9f9;
    min-height: 100vh;
    overflow-y: auto;
}

.ragteck-main-content h1 {
    margin-top: 0;
    color: #333;
}

/* ==============================
   Hub Projects & Chats Styles
   ============================== */

/* Projects List Container */
.ragteck-col2-projects-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Project Item */
.ragteck-col2-project-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 8px;
    margin-bottom: 2px;
    background: #fff;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #333;
}

.ragteck-col2-project-item:hover {
    background: #f8f9fa;
    border-left-color: #00d1b2;
}

.ragteck-col2-project-item.ragteck-col2-project-active {
    background: #e8f5f3;
    border-left-color: #00d1b2;
    font-weight: 500;
}

/* Project Name */
.ragteck-col2-project-item > span:not(.project-chevron) {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hamburger Menu Button */
.ragteck-col2-project-item > button,
.ragteck-col2-chat-item > button {
    background: none;
    border: none;
    color: #1a1a1a;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
    transition: color 0.2s;
    line-height: 1;
}

.ragteck-col2-project-item > button:hover,
.ragteck-col2-chat-item > button:hover {
    color: #333;
}

/* Chats List Container */
.ragteck-col2-chats-list {
    background: #f8f9fa;
    padding: 8px 0;
    margin-bottom: 2px;
    border-left: 3px solid #00d1b2;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* New Chat Button */
.ragteck-col2-new-chat-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 8px 16px;
    padding: 8px 12px;
    background: #fff;
    border: 1px dashed #ccc;
    color: #1a1a1a;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.ragteck-col2-new-chat-btn:hover {
    background: #00d1b2;
    border-color: #00d1b2;
    color: #fff;
}

/* Chat Item */
.ragteck-col2-chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 10px 32px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
    color: #1a1a1a;
}

.ragteck-col2-chat-item:hover {
    background: #fff;
}

.ragteck-col2-chat-item.ragteck-col2-chat-active {
    background-color: #00d1b2;
    color: #ffffff;
    font-weight: 500;
    border-radius: 4px;
}

.ragteck-col2-chat-item.ragteck-col2-chat-empty {
    color: #1a1a1a;
    font-style: italic;
    cursor: default;
}

.ragteck-col2-chat-item > span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Context Menu */
.ragteck-col2-menu {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 120px;
}

/* Ensure context menu appears above mobile sidebar */
@media (max-width: 768px) {
    .ragteck-col2-menu {
        z-index: 10001 !important;
    }
}

.ragteck-col2-menu > div {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.ragteck-col2-menu > div:hover {
    background: #f8f9fa;
}

.ragteck-col2-menu > div[data-action="delete"] {
    color: #dc3545;
}

.ragteck-col2-menu > div[data-action="delete"]:hover {
    background: #fff5f5;
}

/* Buttons */
.ragteck-btn {
    background: #00d1b2;
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.ragteck-btn:hover {
    background: #00b89c;
}

.ragteck-btn-secondary {
    background: #eee;
    border: 1px solid #ccc;
    color: #333;
}

.ragteck-btn-secondary:hover {
    background: #ddd;
}

/* Rest of the existing styles... */
.ragteck-container {
    max-width: 1000px;
    margin: 20px 0;
}

.ragteck-upload-form {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ragteck-ingest-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.ragteck-ingest-tab {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    border-radius: 4px;
}

.ragteck-ingest-tab-active {
    background: #00d1b2;
    color: white;
    border-color: #00d1b2;
}

/* Mobile ingest type dropdown — hidden on desktop */
.ragteck-ingest-mobile-select {
    display: none;
}

.ragteck-field {
    margin-bottom: 20px;
}

.ragteck-field label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.ragteck-field input[type="text"],
.ragteck-field input[type="url"],
.ragteck-field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ragteck-submit-btn {
    background: #00d1b2;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.ragteck-confirmation {
    background: #e6fffa;
    border-left: 5px solid #38b2ac;
    color: #234e52;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.ragteck-documents-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
}

.ragteck-documents-table th, 
.ragteck-documents-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.ragteck-status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.ragteck-status-completed {
    background: #c6f6d5;
    color: #22543d;
}

.ragteck-status-other {
    background: #edf2f7;
    color: #4a5568;
}

body.admin-bar .ragteck-main-content {
    padding-top: 32px; 
}

.ragteck-file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.ragteck-file-input {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.ragteck-file-label {
    display: inline-block;
    padding: 8px 16px;
    background: #666;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.ragteck-file-label:hover {
    background: #444;
}

.ragteck-file-name {
    font-size: 0.9em;
    color: #1a1a1a;
}

.ragteck-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.ragteck-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Create Bot Modal */
#create-bot-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    overflow: hidden !important;
}

#create-bot-modal .modal-inner {
    background: #fff;
    padding: 30px;
    padding-bottom: 40px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    position: relative;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    margin: auto;
}

#create-bot-modal .modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #1a1a1a;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

#create-bot-modal .modal-close:hover {
    color: #333;
}

#create-bot-modal h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
}

#create-bot-modal p {
    color: #1a1a1a;
    margin-bottom: 30px;
}

#create-bot-modal .form-group {
    margin-bottom: 20px;
}

#create-bot-modal .form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

#create-bot-modal .form-group input[type="text"],
#create-bot-modal .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

#create-bot-modal .form-group textarea {
    resize: vertical;
    font-family: inherit;
}

#create-bot-modal .form-hint {
    font-size: 12px;
    color: #1a1a1a;
    margin: 5px 0 0 0;
}

#create-bot-modal .plan-options {
    margin-bottom: 20px;
}

#create-bot-modal .plan-option {
    display: block;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

#create-bot-modal .plan-option:hover {
    border-color: #00d1b2;
    background: #f8f9fa;
}

#create-bot-modal .plan-option input[type="radio"] {
    margin-right: 10px;
}

#create-bot-modal .plan-option strong {
    color: #333;
}

#create-bot-modal .plan-option p {
    margin: 5px 0 0 28px;
    font-size: 13px;
    color: #1a1a1a;
}

#create-bot-modal .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

#create-bot-modal .modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s;
}

#create-bot-modal .btn-cancel {
    background: #ccc;
    color: #333;
}

#create-bot-modal .btn-cancel:hover {
    background: #bbb;
}

#create-bot-modal .btn-submit {
    background: #00d1b2;
    color: #fff;
}

#create-bot-modal .btn-submit:hover {
    background: #00b89c;
}

#create-bot-modal .btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile Responsive Styles for Create Bot Modal */
@media (max-width: 768px) {
    #create-bot-modal {
        padding: 10px 0;
        align-items: flex-start;
    }
    
    #create-bot-modal .modal-inner {
        padding: 30px 20px;
        max-height: 80vh;
        width: 95%;
        margin: 10px auto;
    }
    
    #create-bot-modal h2 {
        font-size: 20px;
        padding-right: 30px;
    }
    
    #create-bot-modal .modal-actions {
        flex-direction: column;
    }
    
    #create-bot-modal .modal-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #create-bot-modal .modal-inner {
        padding: 25px 15px;
    }
    
    #create-bot-modal h2 {
        font-size: 18px;
    }
    
    #create-bot-modal .form-group input[type="text"],
    #create-bot-modal .form-group textarea {
        padding: 10px;
        font-size: 13px;
    }
    
    #create-bot-modal .plan-option {
        padding: 12px;
    }
}

.ragteck-modal-close {
    color: #1a1a1a;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
}

.ragteck-modal-close:hover,
.ragteck-modal-close:focus {
    color: #000;
}

.ragteck-formats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.ragteck-formats-table th,
.ragteck-formats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.ragteck-formats-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.ragteck-formats-table tr:hover {
    background-color: #f9f9f9;
}

.ragteck-view-all-formats {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.ragteck-view-all-formats:hover {
    text-decoration: underline;
}

.ragteck-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.ragteck-radio-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
}

.ragteck-radio-label input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

/* Admin Desktop Tabs - Default display */
#ragteck-admin-desktop-tabs {
    display: flex;
}

/* Admin Mobile Dropdown Styles */
.ragteck-admin-mobile-dropdown {
    display: none;
    position: fixed;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10001;
    min-width: 250px;
    max-width: 90vw;
}

.ragteck-admin-dropdown-item {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.ragteck-admin-dropdown-item:last-child {
    border-bottom: none;
}

.ragteck-admin-dropdown-item:hover {
    background: #f8f9fa;
}

.ragteck-admin-dropdown-item.active {
    background: #e3f2fd;
    color: #00d1b2;
    font-weight: 600;
}

.ragteck-admin-dropdown-item.delete-item {
    color: #ff4d4d;
}

.ragteck-admin-dropdown-item.delete-item:hover {
    background: #fff5f5;
}

@media (max-width: 768px) {
    /* Hide desktop Admin tabs on mobile */
    #ragteck-admin-desktop-tabs {
        display: none !important;
    }
    
    /* Hide any inline-styled tab containers in Admin view on mobile */
    .ragteck-main-content > div[style*="border-bottom"][style*="display: flex"] {
        display: none !important;
    }
    
    /* Mobile Top Bar */
    #ragteck-mobile-topbar {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 48px;
        background: #f0f0f0;
        z-index: 9999;
        padding: 0 12px;
        box-sizing: border-box;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    #ragteck-mobile-menu-btn {
        background: none;
        border: none;
        font-size: 22px;
        color: #00D1B2;
        cursor: pointer;
        padding: 0;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #ragteck-mobile-secondary-slot {
        flex: 1;
        display: flex;
        justify-content: center;
    }
    
    #ragteck-mobile-topbar-right {
        font-family: 'Rubik', sans-serif;
        font-weight: 300;
        text-transform: uppercase;
        color: #000000;
        letter-spacing: 1px;
        font-size: 13px;
    }
    
    /* Topbar secondary button (Hub) */
    .ragteck-topbar-dropdown-btn {
        background: none;
        border: none;
        color: #0066cc;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        padding: 4px 8px;
        white-space: nowrap;
    }
    
    /* Push all page content down by topbar height */
    .ragteck-main-content {
        padding-top: 68px !important; /* 48px topbar + 20px spacing */
    }
    
    .ragteck-app-container {
        padding-top: 48px !important;
    }
    
    .ragteck-hub-container {
        padding-top: 48px !important;
    }
    
    /* Ensure all page-specific containers have proper offset */
    body > .ragteck-saas-page,
    body > .entry-content > .ragteck-saas-page {
        padding-top: 48px !important;
    }
    
    /* Hide old floating black hamburger on mobile */
    #ragteck-hamburger {
        display: none !important;
    }
    
    #main-content,
    #main-content .container,
    #main-content #content-area,
    #main-content #left-area,
    #main-content #left-area article,
    #main-content #left-area .entry-content,
    #main-content .ragteck-saas-page {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
        float: none !important;
    }
	
    #ragteck-hamburger-old {
        display: block !important;
        position: fixed !important;
        top: 10px !important;
        right: 10px !important;
        left: auto !important;
        z-index: 10001 !important;
    }
    #ragteck-sidebar-panel { display: none !important; position: fixed !important; top: 0; left: 0; z-index: 10000; height: 100vh; overflow-y: auto; }
    #ragteck-sidebar-panel.ragteck-sidebar-open { display: flex !important; }
    #ragteck-sidebar-panel.ragteck-sidebar-open ~ #ragteck-sidebar-overlay,
    .ragteck-sidebar-open + #ragteck-sidebar-overlay { display: block !important; }
    .ragteck-main-content { margin-left: 0 !important; padding: 20px !important; padding-top: 50px !important; width: 100% !important; max-width: 100% !important; }
    .ragteck-app-container { display: block !important; width: 100% !important; margin: 0 !important; padding-top: 48px !important; padding-left: 0 !important; padding-right: 0 !important; padding-bottom: 0 !important; }
    .ragteck-app-wrapper { height: 100vh !important; }
    .ragteck-app-wrapper iframe,
    .ragteck-main-content iframe { width: 100% !important; height: 100vh !important; }
    
    /* Chat page - full screen iframe */
    .ragteck-main-content > div[style*="flex: 1"] {
        height: 100vh !important;
    }
    .ragteck-main-content > div[style*="flex: 1"] iframe {
        height: 100vh !important;
    }
    /* Train Bot buttons - wrap to 2 columns on mobile */
    .ragteck-main-content > div:first-child {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        overflow-x: visible !important;
        justify-content: flex-start !important;
    }
    .ragteck-main-content > div:first-child a,
    .ragteck-main-content > div:first-child button {
        flex: 0 1 calc(50% - 4px) !important; /* 2 columns with gap */
        white-space: normal !important;
        font-size: 13px !important;
        padding: 10px 8px !important;
        text-align: center !important;
        min-height: 44px !important; /* Touch target */
        box-sizing: border-box !important;
    }
    
    /* Admin tabs - better visual separation on mobile */
    .nav-tab-wrapper {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-bottom: 20px !important;
        border-bottom: none !important;
    }
    
    .nav-tab {
        flex: 1 1 auto !important;
        min-width: calc(50% - 4px) !important; /* 2 columns */
        margin: 0 !important;
        padding: 12px 16px !important;
        border: 2px solid #ddd !important;
        border-radius: 6px !important;
        background: #f9f9f9 !important;
        color: #333 !important;
        text-align: center !important;
        text-decoration: none !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        min-height: 44px !important; /* Touch target */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        transition: all 0.2s ease !important;
    }
    
    .nav-tab:hover {
        background: #f0f0f0 !important;
        border-color: #999 !important;
    }
    
    .nav-tab-active,
    .nav-tab-active:hover {
        background: #0073aa !important;
        color: #fff !important;
        border-color: #0073aa !important;
        font-weight: 600 !important;
    }

    /* Ingest tab row → hide on mobile, show dropdown instead */
    .ragteck-ingest-tabs {
        display: none !important;
    }

    .ragteck-ingest-mobile-select {
        display: block;
        width: 100%;
        font-size: 16px; /* prevents iOS auto-zoom on focus */
        font-weight: 500;
        padding: 10px 12px;
        border: 1px solid #00d1b2;
        border-radius: 4px;
        background: #f5f5f5;
        color: #333;
        margin-bottom: 20px;
        box-sizing: border-box;
        cursor: pointer;
        appearance: auto;
    }
}

.ragteck-main-content > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* ==============================
   Dashboard Styles
   ============================== */

/* Page Header */
.ragteck-dashboard-page-header {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 auto 40px auto;
}

.ragteck-saas-page .ragteck-dashboard-page-header,
.ragteck-saas-page .ragteck-dashboard-page-header h1,
.ragteck-saas-page .ragteck-dashboard-page-header p {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Shared page title class — used across all SaaS pages */
.ragteck-page-title {
    display: block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #1a1a1a !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
}

.ragteck-dashboard-page-header h1 {
    text-align: center !important;
    margin: 0 auto 20px auto;
    font-size: 36px;
    color: #1a1a1a;
    font-weight: 700;
}

.ragteck-dashboard-page-header p {
    text-align: center !important;
    margin: 0 auto;
    font-size: 16px;
    color: #1a1a1a;
    line-height: 1.6;
    max-width: 600px;
}

/* View Controls */
.ragteck-dashboard-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.ragteck-dashboard-view-toggle {
    display: flex;
    gap: 8px;
    background: #f5f5f5;
    padding: 4px;
    border-radius: 8px;
}

.ragteck-view-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ragteck-view-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.ragteck-view-btn-active {
    background: #fff;
    color: #00d1b2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ragteck-view-icon {
    font-size: 16px;
}

/* Dashboard Grid - auto-fill wrapping tiles, ~4 per row */
.ragteck-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* ~4 columns, wraps automatically */
    gap: 15px;
    margin: 0;
    padding: 20px 0;
    width: 100%;
    overflow-x: hidden;
}

/* Bot Card - Slightly larger to accommodate outcome button labels */
.ragteck-dashboard-bot-card {
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 18px 16px 14px 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    min-height: 170px; /* Increased from 140px to fit longer button labels */
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.ragteck-dashboard-bot-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: #00d1b2;
}

/* Bot Name */
.ragteck-dashboard-bot-name {
    margin: 0;
    font-size: 14px;
    line-height: 1.5; /* Increases vertical space */
    min-height: 21px; /* Ensures enough space (14px * 1.5) */
    color: #1a1a1a;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bot Meta (Type + Date) */
.ragteck-dashboard-bot-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    line-height: 1.6;
    color: #1a1a1a;
    margin: 0;
}

/* Bot type pill styling */
.ragteck-dashboard-bot-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Account tier pills — grid view (type-{tier}) */
.ragteck-dashboard-bot-type.type-trial_user {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.ragteck-dashboard-bot-type.type-startup_user {
    background: #ccfbf1;
    color: #0f766e;
    border: 1px solid #5eead4;
}
.ragteck-dashboard-bot-type.type-standard_user {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}
.ragteck-dashboard-bot-type.type-pro_user {
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
}
.ragteck-dashboard-bot-type.type-advanced_user {
    background: #e0e7ff;
    color: #4338ca;
    border: 1px solid #a5b4fc;
}
.ragteck-dashboard-bot-type.type-enterprise_user {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}
/* Legacy aliases */
.ragteck-dashboard-bot-type.type-personal {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}
.ragteck-dashboard-bot-type.type-business {
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
}

/* Remove bullet after type pill */
.ragteck-dashboard-bot-type::after {
    content: none;
}

/* Bot type pills — grid + table */
.ragteck-badge-personal {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}
.ragteck-badge-business {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

/* Bot status pills */
.ragteck-status-active {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}
.ragteck-status-trial {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde047;
}
.ragteck-status-paused {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fdba74;
}
.ragteck-status-inactive {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.ragteck-status-deleted {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.ragteck-dashboard-bot-date {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ragteck-dashboard-bot-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
    white-space: nowrap;
}

/* Account tier badge pills — grid/table (ragteck-dashboard-bot-badge-{tier}) */
.ragteck-dashboard-bot-badge-trial_user {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}
.ragteck-dashboard-bot-badge-startup_user {
    background: #ccfbf1;
    color: #0f766e;
    border-color: #5eead4;
}
.ragteck-dashboard-bot-badge-standard_user {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}
.ragteck-dashboard-bot-badge-pro_user {
    background: #ede9fe;
    color: #6d28d9;
    border-color: #c4b5fd;
}
.ragteck-dashboard-bot-badge-advanced_user {
    background: #e0e7ff;
    color: #4338ca;
    border-color: #a5b4fc;
}
.ragteck-dashboard-bot-badge-enterprise_user {
    background: #fef3c7;
    color: #b45309;
    border-color: #fcd34d;
}
/* Legacy aliases */
.ragteck-dashboard-bot-badge-personal {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}
.ragteck-dashboard-bot-badge-business {
    background: #ede9fe;
    color: #6d28d9;
    border-color: #c4b5fd;
}

/* Bot Description - Compact */
.ragteck-dashboard-bot-description {
    font-size: 11px; /* Smaller font for better fit */
    color: #1a1a1a;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Max 2 lines */
    -webkit-box-orient: vertical;
    flex: 1; /* Take remaining space */
}

/* Bot Meta - Compact */
.ragteck-dashboard-bot-meta {
    font-size: 11px; /* Reduced from 13px */
    color: #1a1a1a;
    margin: 0 0 10px 0; /* Reduced from 20px */
}

/* Bot Actions - Icon-only buttons */
.ragteck-dashboard-bot-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    margin-bottom: 4px; /* Space from bottom border */
}

.ragteck-dashboard-btn {
    flex: 1;
    padding: 9px 3px;
    text-align: center;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
}

.ragteck-dashboard-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

/* Icon and text styling */
.ragteck-btn-icon {
    font-size: 16px;
    line-height: 1;
}

.ragteck-btn-text {
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
    color: #1a1a1a;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.ragteck-dashboard-btn-chat:hover {
    background: #e3f2fd;
    border-color: #2196f3;
}

.ragteck-dashboard-btn-hub:hover {
    background: #f3e5f5;
    border-color: #9c27b0;
}

.ragteck-dashboard-btn-studio:hover {
    background: #fff9e6;
    border-color: #ffc107;
}

.ragteck-dashboard-btn-admin:hover {
    background: #fff3e0;
    border-color: #ff9800;
}

/* Table View - Full Width */
.ragteck-dashboard-table-wrapper {
    width: 100% !important;
    max-width: none !important;
    overflow-x: auto;
    margin: 0;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 2px solid #e8e8e8;
}

.ragteck-dashboard-table {
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    border-collapse: collapse;
    background: #fff;
    table-layout: fixed; /* Forces columns to respect width percentages */
}

.ragteck-dashboard-table thead {
    background: #f5f5f5;
}

.ragteck-dashboard-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

/* Column width distribution — 7 cols: Icon | Bot Name | Description | User Plan | Bot Type | Created | Actions */
.ragteck-dashboard-table thead th:nth-child(1) { width: 50px; }   /* Icon */
.ragteck-dashboard-table thead th:nth-child(2) { width: 20%; }   /* Bot Name — shrinks to content */
.ragteck-dashboard-table thead th:nth-child(3) { width: 30%; }    /* Description — widest column */
.ragteck-dashboard-table thead th:nth-child(4) { width: 10%; }    /* User Plan */
.ragteck-dashboard-table thead th:nth-child(5) { width: 10%; }    /* Bot Type */
.ragteck-dashboard-table thead th:nth-child(6) { width: 10%; }    /* Created */
.ragteck-dashboard-table thead th:nth-child(7) { width: 20%; }    /* Actions */

.ragteck-dashboard-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s;
}

.ragteck-dashboard-table tbody tr:hover {
    background-color: #f9f9f9;
}

.ragteck-dashboard-table tbody tr:last-child {
    border-bottom: none;
}

.ragteck-dashboard-table td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 13px;
    color: #333;
}

.ragteck-table-bot-name {
    font-weight: 600;
    color: #333;
}

.ragteck-table-description {
    color: #1a1a1a;
    line-height: 1.5;
}

.ragteck-table-date {
    color: #1a1a1a;
    white-space: nowrap;
}

.ragteck-table-actions {
    white-space: nowrap;
}

.ragteck-table-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    margin-right: 4px;
    gap: 2px;
}

.ragteck-table-btn:hover {
    transform: scale(1.05);
}

.ragteck-table-btn .ragteck-btn-icon {
    font-size: 16px;
    line-height: 1;
}

.ragteck-table-btn .ragteck-btn-text {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    color: #1a1a1a;
}

.ragteck-table-btn-chat:hover {
    background: #e3f2fd;
}

.ragteck-table-btn-hub:hover {
    background: #f3e5f5;
}

.ragteck-table-btn-studio:hover {
    background: #fff9e6;
}

.ragteck-table-btn-admin:hover {
    background: #fff3e0;
}

/* Empty State */
.ragteck-dashboard-empty {
    text-align: center;
    padding: 100px 40px;
    background: #fff;
    border: 2px dashed #ddd;
    border-radius: 12px;
    margin-top: 60px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.ragteck-dashboard-empty-icon {
    font-size: 72px;
    margin-bottom: 24px;
    opacity: 0.6;
}

.ragteck-dashboard-empty h2 {
    margin: 0 0 30px 0;
    font-size: 26px;
    color: #333;
    font-weight: 600;
}

.ragteck-dashboard-empty-btn {
    display: inline-block;
    background: #00d1b2;
    color: #fff;
    padding: 16px 40px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 209, 178, 0.25);
}

.ragteck-dashboard-empty-btn:hover {
    background: #00b89c;
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 209, 178, 0.35);
}

/* Responsive Design - grid wraps automatically via auto-fill minmax */

@media (max-width: 768px) {
    .ragteck-dashboard-page-header h1 {
        font-size: 28px;
    }
    
    .ragteck-dashboard-page-header p {
        font-size: 14px;
    }
    
    .ragteck-dashboard-controls {
        justify-content: center;
    }
    
    .ragteck-dashboard-view-toggle {
        width: 100%;
    }
    
    .ragteck-view-btn {
        flex: 1;
        justify-content: center;
    }
    
    .ragteck-dashboard-grid {
        gap: 15px;
    }
    
    /* Keep buttons horizontal on mobile - just reduce size to fit */
    .ragteck-dashboard-bot-actions {
        gap: 4px; /* Tighter spacing on tablets */
    }
    
    .ragteck-dashboard-btn {
        padding: 6px 4px; /* Reduce horizontal padding */
        font-size: 15px; /* Slightly smaller emoji */
    }
    
    .ragteck-dashboard-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ragteck-dashboard-table {
        min-width: 600px; /* Prevent table from being too narrow */
    }
    
    /* Slightly smaller padding on mobile */
    .ragteck-dashboard-table thead th,
    .ragteck-dashboard-table tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .ragteck-dashboard-empty {
        padding: 60px 20px;
        margin-top: 40px;
    }
    
    .ragteck-dashboard-empty h2 {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    .ragteck-dashboard-grid {
        gap: 12px; /* Slightly tighter on tablets */
    }
    
    /* Slightly larger text on mobile for readability */
    .ragteck-dashboard-bot-name {
        font-size: 15px;
        min-height: 23px;
    }
    
    .ragteck-dashboard-bot-description {
        font-size: 13px;
    }
    
    /* Keep buttons horizontal with adequate touch targets */
    .ragteck-dashboard-bot-actions {
        gap: 6px; /* Comfortable spacing */
    }
    
    .ragteck-dashboard-btn {
        padding: 10px 6px; /* Good vertical touch target, compact horizontal */
        font-size: 18px; /* Larger emoji for better visibility */
        min-width: 44px; /* Minimum touch target */
    }
}

@media (max-width: 480px) {
    .ragteck-dashboard-page-header h1 {
        font-size: 24px;
    }
    
    .ragteck-dashboard-grid {
        gap: 10px;
    }
    
    .ragteck-dashboard-bot-card {
        padding: 15px;
    }
    
    .ragteck-dashboard-bot-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .ragteck-view-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .ragteck-view-icon {
        font-size: 14px;
    }
}

/* ==============================
   AJAX Content Fixes
   ============================== */

/* Make #ragteck-main-content a flex container for proper child sizing */
#ragteck-main-content {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Force padding on main content area with high specificity */
.ragteck-saas-shell #ragteck-main-content,
#ragteck-main-content.ragteck-main-content {
    padding-left: 15px !important;
}

/* Exception: Chat page with iframe needs no padding */
#ragteck-main-content:has(> div > iframe[allow*="clipboard-read"]) {
    padding: 0 !important;
}

/* Exception: Hub page needs reduced padding (has its own internal spacing) */
#ragteck-main-content:has(.ragteck-hub-col-projects) {
    padding: 20px !important;
}

/* Dashboard should use full available width */
.ragteck-bots-grid,
.ragteck-bots-table {
    width: 100%;
    max-width: none;
}

/* Table view - full width with table layout */
.ragteck-bots-table {
    display: table !important;
    width: 100% !important;
    max-width: none !important;
    border-collapse: collapse;
    background: #fff;
    margin: 0;
}

/* Table rows */
.ragteck-bots-table .ragteck-dashboard-bot-card {
    display: table-row;
    border: none;
    border-radius: 0;
    padding: 0;
    min-height: auto;
    max-height: none;
    background: transparent;
}

.ragteck-bots-table .ragteck-dashboard-bot-card:hover {
    background: #f9f9f9;
    transform: none;
    box-shadow: none;
}

/* Table cells */
.ragteck-bots-table .ragteck-dashboard-bot-card > * {
    display: table-cell;
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #e0e0e0;
}

/* Bot name column */
.ragteck-bots-table .ragteck-dashboard-bot-name {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    width: 20%;
    font-size: 14px;
}

/* Bot meta column */
.ragteck-bots-table .ragteck-dashboard-bot-meta {
    width: 25%;
    font-size: 12px;
    color: #1a1a1a;
    display: table-cell;
}

/* Keep pill styling in table view */
.ragteck-bots-table .ragteck-dashboard-bot-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

/* Bot description column */
.ragteck-bots-table .ragteck-dashboard-bot-description {
    width: 40%;
    font-size: 13px;
    color: #1a1a1a;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: table-cell;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    line-height: 1.5;
}

/* Bot actions column */
.ragteck-bots-table .ragteck-dashboard-bot-actions {
    width: 15%;
    display: table-cell;
    gap: 8px;
    margin: 0;
}

.ragteck-bots-table .ragteck-dashboard-btn {
    display: inline-flex;
    padding: 6px 10px;
    font-size: 16px;
    margin-right: 4px;
}

/* Ensure dashboard content doesn't get constrained */
#ragteck-main-content > h1,
#ragteck-main-content > .ragteck-dashboard-header,
#ragteck-main-content > .ragteck-dashboard-page-header,
#ragteck-main-content > .ragteck-bots-grid,
#ragteck-main-content > .ragteck-bots-table {
    width: 100%;
    max-width: none;
}

/* Ensure iframe containers expand to fill available space */
#ragteck-main-content > div[style*="flex: 1"] {
    min-height: 0; /* Critical for nested flex */
}

/* Chat iframe should fill its container */
#ragteck-main-content iframe[allow*="clipboard-read"] {
    display: block;
}

/* ==============================
   Loading Spinner Styles
   ============================== */

/* Loading spinner overlay */
#ragteck-loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Spinner container - centers content vertically */
#ragteck-loading-spinner > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Spinner image */
#ragteck-loading-spinner img {
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

/* Loading text below spinner */
#ragteck-loading-spinner span {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==============================
   Hub Mobile Hamburger Menu
   ============================== */

/* Hamburger button - hidden on desktop, visible on mobile */
.ragteck-hub-hamburger {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1002;
    background: #00d1b2;
    border: none;
    border-radius: 6px;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.ragteck-hub-hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.ragteck-hub-hamburger:hover {
    background: #00b89c;
    transform: scale(1.05);
}

/* Hamburger animation when open */
.ragteck-hub-hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.ragteck-hub-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.ragteck-hub-hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Overlay - hidden by default */
.ragteck-hub-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ragteck-hub-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile styles (≤768px) */
@media (max-width: 768px) {
    /* Hide original floating hamburger - it will be moved to topbar */
    .ragteck-hub-hamburger {
        display: none !important;
    }
    
    /* Hub container adjustments */
    .ragteck-hub-container {
        position: relative;
        height: calc(100vh - 48px) !important; /* Full height minus topbar */
        margin-top: 48px !important; /* Sits below topbar */
        padding-top: 0 !important; /* No padding to avoid height overflow */
    }
    
    /* Sidebar - slide-out drawer */
    .ragteck-hub-sidebar {
        position: fixed !important;
        top: 48px; /* Below topbar */
        left: 0;
        width: 300px !important;
        height: calc(100vh - 48px) !important; /* Full height minus topbar */
        z-index: 10000 !important;
        flex: none !important;
        transform: translateX(-100%); /* Off-screen using transform instead */
        transition: transform 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
        overflow-x: visible !important; /* Allow menu to overflow horizontally */
        overflow-y: auto !important; /* Keep vertical scrolling */
    }
    
    /* Sidebar open state */
    .ragteck-hub-sidebar.mobile-open {
        transform: translateX(0); /* Slide in */
    }
    
    /* Chat area takes full width on mobile */
    .ragteck-hub-col-main {
        width: 100% !important;
        margin-left: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
    }
    
    /* Chat iframe fills container */
    .ragteck-hub-col-main iframe {
        height: 100% !important;
    }
    
    /* Disable body scroll when sidebar is open */
    body.hub-sidebar-open {
        overflow: hidden;
    }
}

/* Tablet adjustments (769px - 1024px) - optional narrower sidebar */
@media (min-width: 769px) and (max-width: 1024px) {
    .ragteck-hub-sidebar {
        flex: 0 0 250px !important;
    }
}

/* ==============================
   Studio Col 3 Ingest Tile - Compact Styles
   ============================== */

.ragteck-col3-ingest-tile {
    font-size: 12px;
    overflow-x: hidden;
}

/* Hide the intro paragraph */
.ragteck-col3-ingest-tile > p:first-of-type {
    display: none;
}

/* Compact tab buttons */
.ragteck-col3-ingest-tile .ragteck-ingest-tabs {
    gap: 4px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.ragteck-col3-ingest-tile .ragteck-ingest-tab {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
}

/* Compact form fields */
.ragteck-col3-ingest-tile .ragteck-field {
    margin-bottom: 12px;
}

.ragteck-col3-ingest-tile .ragteck-field label {
    font-size: 11px;
    margin-bottom: 3px;
    font-weight: 600;
}

.ragteck-col3-ingest-tile .ragteck-field input[type="text"],
.ragteck-col3-ingest-tile .ragteck-field input[type="url"],
.ragteck-col3-ingest-tile .ragteck-field textarea {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 3px;
}

.ragteck-col3-ingest-tile .ragteck-field textarea {
    min-height: 80px;
    resize: vertical;
}

/* Compact file input */
.ragteck-col3-ingest-tile .ragteck-file-label {
    padding: 6px 10px;
    font-size: 11px;
}

.ragteck-col3-ingest-tile .ragteck-file-name {
    font-size: 11px;
    margin-left: 8px;
}

/* Compact field notes */
.ragteck-col3-ingest-tile .ragteck-field-note {
    font-size: 10px;
    margin-top: 4px;
    line-height: 1.3;
}

/* Compact radio group */
.ragteck-col3-ingest-tile .ragteck-radio-group {
    font-size: 11px;
}

.ragteck-col3-ingest-tile .ragteck-radio-label {
    margin-bottom: 4px;
}

/* Compact submit button */
.ragteck-col3-ingest-tile .ragteck-submit-btn {
    padding: 8px 16px;
    font-size: 12px;
    width: 100%;
    margin-top: 8px;
}

/* Compact warning text */
.ragteck-col3-ingest-tile .ragteck-warning {
    font-size: 10px;
    margin-top: 8px;
    line-height: 1.3;
}

/* Compact result messages */
.ragteck-col3-ingest-tile #ragteck-ingest-result {
    margin-top: 10px;
    font-size: 11px;
}

.ragteck-col3-ingest-tile #ragteck-ingest-result > div {
    padding: 8px;
    font-size: 11px;
}

/* Compact bulk upload warning */
.ragteck-col3-ingest-tile #ragteck-bulk-upload-warning {
    font-size: 11px;
    margin-top: 6px;
}

/* Compact coming soon messages */
.ragteck-col3-ingest-tile .ragteck-coming-soon p {
    padding: 12px;
    font-size: 11px;
    margin: 0 0 12px 0;
}

/* Ensure no horizontal overflow */
.ragteck-col3-ingest-tile * {
    max-width: 100%;
    box-sizing: border-box;
}

/* ==============================
   Studio Mobile Layout - Stack Col 3 below Col 2
   ============================== */

@media (max-width: 768px) {
    /* Change container to column layout with scrolling */
    .ragteck-hub-container {
        flex-direction: column !important;
        overflow-x: hidden !important;
    }
    
    /* Col 2 (chat area) - full width, responsive height */
    .ragteck-col2 {
        width: 100% !important;
        flex: none !important;
        height: 100% !important;
    }
    
    /* Col 3 (ingest/documents panel) - full width, stack vertically, allow overflow */
    .ragteck-col3 {
        width: 100% !important;
        flex: none !important;
        overflow: visible !important;
    }
    
    /* Col 3 tiles - stack vertically with min height */
    .ragteck-col3 > div {
        min-height: 300px !important;
    }
    
    /* Studio-specific mobile layout - scrollable with all 3 columns stacked */
    .ragteck-studio-layout {
        height: auto !important;
        min-height: calc(100vh - 48px) !important;
        overflow-y: auto !important;
    }
    
    .ragteck-studio-layout .ragteck-col2 {
        height: 60vh !important;
        min-height: 300px !important;
    }
    
    .ragteck-studio-layout .ragteck-col3 {
        height: auto !important;
        padding-bottom: 20px !important;
    }
}

/* ==============================
   Onboarding Modal — v9.7.2
   Three-stage funnel: Create Bot → Train Bot → Share Bot
   ============================== */

/* Backdrop */
.ragteck-onboarding-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: ragteck-ob-backdrop-in 0.25s ease both;
}

.ragteck-onboarding-backdrop.ragteck-onboarding-fade-out {
    animation: ragteck-ob-backdrop-out 0.3s ease forwards;
}

@keyframes ragteck-ob-backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ragteck-ob-backdrop-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Card */
.ragteck-onboarding-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.10);
    max-width: 420px;
    width: 100%;
    padding: 40px 32px 32px;
    text-align: center;
    animation: ragteck-ob-card-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ragteck-onboarding-backdrop.ragteck-onboarding-fade-out .ragteck-onboarding-card {
    animation: ragteck-ob-card-out 0.25s ease forwards;
}

@keyframes ragteck-ob-card-in {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes ragteck-ob-card-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.92) translateY(8px);
    }
}

/* Icon */
.ragteck-onboarding-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 20px;
    display: block;
}

/* Headline */
.ragteck-onboarding-headline {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 0 0 12px !important;
    line-height: 1.3 !important;
}

/* Body */
.ragteck-onboarding-body {
    font-size: 14px !important;
    color: #6b7280 !important;
    line-height: 1.6 !important;
    margin: 0 0 28px !important;
}

/* CTA Button — works for both <button> and <a> */
.ragteck-onboarding-cta {
    display: block;
    width: 100%;
    height: 48px;
    line-height: 48px;
    padding: 0 20px;
    background: #00d1b2;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
    transition: background 0.18s ease, transform 0.12s ease;
    box-sizing: border-box;
}

.ragteck-onboarding-cta:hover {
    background: #00b89c;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.ragteck-onboarding-cta:active {
    transform: translateY(0);
}

/* Dismiss hint */
.ragteck-onboarding-dismiss-hint {
    font-size: 12px !important;
    color: #9ca3af !important;
    margin: 14px 0 0 !important;
}

/* Mobile */
@media (max-width: 480px) {
    .ragteck-onboarding-card {
        padding: 32px 20px 24px;
        border-radius: 14px;
    }

    .ragteck-onboarding-headline {
        font-size: 19px !important;
    }

    .ragteck-onboarding-icon {
        font-size: 40px;
    }
}

/* ==============================
   Collections Page
   ============================== */

/* Collection card — inherits .ragteck-dashboard-bot-card; no overrides needed */
.ragteck-collection-card {
    cursor: default; /* cards are not clickable yet — actions use buttons */
}

/* Edit / Delete action buttons on collection cards */
.ragteck-collection-btn-edit,
.ragteck-collection-btn-delete {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 8px;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #333;
}

.ragteck-collection-btn-edit:hover {
    background: #e3f2fd;
    border-color: #90caf9;
}

.ragteck-collection-btn-delete:hover {
    background: #fff5f5;
    border-color: #f5c6cb;
    color: #dc3545;
}

/* Responsive — match dashboard grid breakpoints */
@media (max-width: 1400px) {
    #ragteck-collections-grid-view.ragteck-dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1100px) {
    #ragteck-collections-grid-view.ragteck-dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    #ragteck-collections-grid-view.ragteck-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    #ragteck-collections-grid-view.ragteck-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ==============================
   Collections — Dismissible Notice Banners (Task 1.6)
   ============================== */

.ragteck-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.ragteck-notice-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ragteck-notice-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ragteck-notice-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: inherit;
    opacity: 0.7;
    padding: 0 0 0 12px;
    flex-shrink: 0;
}

.ragteck-notice-dismiss:hover {
    opacity: 1;
}

/* Edit-mode highlight on the collection form */
#ragteck-create-collection-form[data-editing="1"] {
    border-color: #00d1b2;
    box-shadow: 0 0 0 3px rgba(0, 209, 178, 0.15);
}

/* -------------------------------------------------------
   Searchable Multi-Select Tag Input (.ragteck-ms)
   ------------------------------------------------------- */

/* Outer container — position:relative so dropdown can be absolute */
.ragteck-ms {
    position: relative;
    font-size: 14px;
}

/* Input wrap: tag chips + search input side by side */
.ragteck-ms-input-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-height: 40px;
    padding: 5px 8px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    cursor: text;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.ragteck-ms-input-wrap:focus-within {
    border-color: #00d1b2;
    box-shadow: 0 0 0 2px rgba(0,209,178,0.12);
}

/* Tag chips */
.ragteck-ms-tags {
    display: contents; /* lets tags flow inline with the search input */
}

.ragteck-ms-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e6faf7;
    border: 1px solid #00d1b2;
    border-radius: 20px;
    padding: 2px 6px 2px 4px;
    font-size: 12px;
    color: #007a6a;
    white-space: nowrap;
    max-width: 180px;
}

.ragteck-ms-tag-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.ragteck-ms-tag-icon-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #00d1b2;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.ragteck-ms-tag-label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.ragteck-ms-tag-remove {
    background: none;
    border: none;
    padding: 0;
    margin-left: 2px;
    font-size: 14px;
    line-height: 1;
    color: #00a08a;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.12s;
}

.ragteck-ms-tag-remove:hover {
    color: #e53e3e;
}

/* Search input inside the wrap */
.ragteck-ms-search {
    flex: 1;
    min-width: 80px;
    border: none;
    outline: none;
    font-size: 13px;
    padding: 2px 0;
    background: transparent;
    color: #222;
}

.ragteck-ms-search::placeholder {
    color: #bbb;
}

/* Dropdown */
.ragteck-ms-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
}

/* Dropdown option row */
.ragteck-ms-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.12s;
}

.ragteck-ms-option:hover {
    background: #f0faf9;
}

.ragteck-ms-option-icon {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}

.ragteck-ms-option-icon-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #00d1b2;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.ragteck-ms-option-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ragteck-ms-option-name {
    font-size: 13px;
    font-weight: 500;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ragteck-ms-option-sub {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ragteck-ms-option-empty {
    color: #aaa;
    font-size: 13px;
    cursor: default;
    justify-content: center;
}

.ragteck-ms-option-empty:hover {
    background: none;
}

/* -------------------------------------------------------
   Shared Collection Public View (?c=short_token)
   ------------------------------------------------------- */

/* Full-page body */
.ragteck-shared-col-body {
    margin: 0;
    padding: 0;
    background: #f4f6f9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #222;
    min-height: 100vh;
}

/* Outer page wrapper */
.ragteck-shared-col-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ── Header ── */
.ragteck-shared-col-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid #e0e0e0;
}

.ragteck-shared-col-header-logo {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.ragteck-shared-col-header-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: #00d1b2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    flex-shrink: 0;
}

.ragteck-shared-col-header-text {
    flex: 1;
    min-width: 0;
}

.ragteck-shared-col-title {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}

.ragteck-shared-col-desc {
    margin: 0;
    font-size: 15px;
    color: #555;
    line-height: 1.6;
}

/* ── App Grid ── */
.ragteck-shared-col-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-top: 48px !important;
}

@media (max-width: 1024px) {
    .ragteck-shared-col-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .ragteck-shared-col-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ragteck-shared-col-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .ragteck-shared-col-title {
        font-size: 22px;
    }
    .ragteck-shared-col-page {
        padding: 24px 16px 48px;
    }
}

@media (max-width: 600px) {
    .ragteck-shared-col-grid {
        grid-template-columns: 1fr;
    }
}

/* ── App Card ── */
.ragteck-shared-col-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 18px 16px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.18s, border-color 0.18s, transform 0.12s;
    cursor: pointer;
}

.ragteck-shared-col-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.10);
    border-color: #00d1b2;
    transform: translateY(-2px);
}

.ragteck-shared-col-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0faf9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ragteck-shared-col-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ragteck-shared-col-card-icon-letter {
    font-size: 20px;
    font-weight: 700;
    color: #00d1b2;
}

.ragteck-shared-col-card-body {
    flex: 1;
    min-width: 0;
}

.ragteck-shared-col-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ragteck-shared-col-card-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ragteck-shared-col-card-bot {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ragteck-shared-col-card-arrow {
    font-size: 18px;
    color: #ccc;
    flex-shrink: 0;
    align-self: center;
    transition: color 0.15s, transform 0.15s;
}

.ragteck-shared-col-card:hover .ragteck-shared-col-card-arrow {
    color: #00d1b2;
    transform: translateX(3px);
}

/* ── Empty state ── */
.ragteck-shared-col-empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.ragteck-shared-col-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ── Password gate ── */
.ragteck-shared-col-gate {
    max-width: 400px;
    margin: 80px auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 40px 36px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.ragteck-shared-col-gate-logo {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: cover;
    margin-bottom: 16px;
}

.ragteck-shared-col-gate-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: #00d1b2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    margin: 0 auto 16px;
}

.ragteck-shared-col-gate-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #111;
}

.ragteck-shared-col-gate-sub {
    font-size: 14px;
    color: #777;
    margin: 0 0 20px;
}

.ragteck-shared-col-gate-error {
    font-size: 13px;
    color: #e53e3e;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 14px;
}

.ragteck-shared-col-gate-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ragteck-shared-col-gate-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 7px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.ragteck-shared-col-gate-input:focus {
    border-color: #00d1b2;
}

/* ── Shared button ── */
.ragteck-shared-col-btn {
    display: inline-block;
    background: #00d1b2;
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.ragteck-shared-col-btn:hover {
    background: #00b89c;
    color: #fff;
}

/* ── 404 error page ── */
.ragteck-shared-col-error {
    max-width: 420px;
    margin: 100px auto;
    text-align: center;
    padding: 0 20px;
}

.ragteck-shared-col-error-icon {
    font-size: 56px;
    margin-bottom: 20px;
}

.ragteck-shared-col-error h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px;
    color: #111;
}

.ragteck-shared-col-error p {
    font-size: 15px;
    color: #666;
    margin: 0 0 28px;
    line-height: 1.6;
}

/* ── Footer ── */
.ragteck-shared-col-footer {
    margin-top: 48px;
    text-align: center;
    font-size: 12px;
    color: #bbb;
}

.ragteck-shared-col-footer a {
    color: #00d1b2;
    text-decoration: none;
}

/* ==============================
   Public View — Sticky Header + Feedback Modal
   Tasks 5.1 / 5.2 / 5.3
   ============================== */

/* Centred container wrapping header + chat/grid */
.ragteck-public-wrap {
    width: 60%;
    margin: 0 auto;
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Sticky header bar */
.ragteck-public-header {
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-height: 70px;
    min-height: 60px;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 16px 24px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Left block: bot/collection name + description */
.ragteck-public-header-left {
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
    overflow: hidden;
}

.ragteck-public-header-left .rph-name {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    margin: 0;
    font-family: inherit;
}

.ragteck-public-header-left .rph-desc {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 4px 0 0;
    line-height: 1.4;
    font-family: inherit;
}

/* Right block: CTA button + sub-text */
.ragteck-public-header-right {
    flex: 0 0 auto;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    max-width: 50%;
}

.ragteck-public-header-right .rph-cta-btn {
    display: inline-block;
    background: #f3f4f6;
    color: #333;
    border: 1px solid #ddd;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
    font-family: inherit;
}

.ragteck-public-header-right .rph-cta-btn:hover {
    background: #e8e9eb;
    border-color: #bbb;
    color: #111;
}

.ragteck-public-header-right .rph-sub {
    font-size: 10px;
    color: #999;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 220px;
    text-align: right;
    font-family: inherit;
}

/* Chat iframe fills remaining height */
.ragteck-public-chat-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ragteck-public-chat-area iframe {
    flex: 1 1 auto;
    width: 100%;
    border: none;
    display: block;
    min-height: calc(100vh - 70px);
}

/* Collection grid area inside public wrap */
.ragteck-public-col-area {
    flex: 1 1 auto;
    padding-top: 48px;
}

/* ── Feedback Modal ── */
.ragteck-feedback-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.ragteck-feedback-modal-overlay.is-open {
    display: flex;
}

.ragteck-feedback-modal {
    background: #fff;
    border-radius: 10px;
    padding: 28px 28px 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    position: relative;
    box-sizing: border-box;
}

.ragteck-feedback-modal h2 {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.ragteck-feedback-modal .rfm-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0;
}

.ragteck-feedback-modal .rfm-close:hover {
    color: #333;
}

.ragteck-feedback-modal label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    margin-top: 12px;
}

.ragteck-feedback-modal input,
.ragteck-feedback-modal textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    background: #fafafa;
}

.ragteck-feedback-modal input:focus,
.ragteck-feedback-modal textarea:focus {
    border-color: #00d1b2;
    background: #fff;
}

.ragteck-feedback-modal input[readonly] {
    background: #f0f0f0;
    color: #888;
    cursor: default;
}

.ragteck-feedback-modal textarea {
    resize: vertical;
    min-height: 90px;
}

.ragteck-feedback-modal .rfm-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    justify-content: flex-end;
}

.ragteck-feedback-modal .rfm-submit {
    background: #00d1b2;
    color: #fff;
    border: none;
    padding: 9px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.ragteck-feedback-modal .rfm-submit:hover {
    background: #00b89c;
}

.ragteck-feedback-modal .rfm-submit:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.ragteck-feedback-modal .rfm-cancel {
    background: none;
    border: 1px solid #d0d0d0;
    color: #555;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ragteck-feedback-modal .rfm-cancel:hover {
    border-color: #aaa;
}

.ragteck-feedback-modal .rfm-msg {
    margin-top: 12px;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 5px;
    display: none;
}

.ragteck-feedback-modal .rfm-msg.success {
    background: #e6faf7;
    color: #00856e;
    display: block;
}

.ragteck-feedback-modal .rfm-msg.error {
    background: #fff0f0;
    color: #c0392b;
    display: block;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .ragteck-public-wrap {
        width: 95%;
    }

    .ragteck-public-header {
        flex-direction: column;
        align-items: flex-start;
        max-height: none;
        min-height: auto;
        padding: 10px 14px;
        gap: 8px;
    }

    .ragteck-public-header-left .rph-name {
        font-size: 16px;
        letter-spacing: 0;
    }

    .ragteck-public-header-right {
        width: 100%;
        max-width: 100%;
        align-items: stretch;
    }

    .ragteck-public-header-right .rph-cta-btn {
        width: 100%;
        text-align: center;
        padding: 10px 16px;
        font-size: 14px;
    }

    .ragteck-public-header-right .rph-sub {
        max-width: 100%;
        text-align: left;
        font-size: 10px;
    }

    .ragteck-feedback-modal {
        margin: 16px;
        padding: 20px 16px 18px;
    }
}

/* ==============================
   Phase 8 — Credit Split Bars
   ============================== */
.ragteck-split-bar {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    width: 100%;
}
.ragteck-split-bar--recommended {
    height: 20px;
}
.ragteck-split-bar--usage {
    height: 24px;
}
.ragteck-split-bar-seg {
    height: 100%;
    flex-shrink: 0;
}

/* ==============================
   WPPB Edit Profile Page
   Scoped under #wppb-edit-user and .wppb-user-forms
   to prevent bleed to other pages.
   ============================== */

/* ── Form container ── */
#wppb-edit-user,
.wppb-user-forms {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 32px 36px;
    max-width: 720px;
    margin: 0 0 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #333;
}

/* ── Remove default list styles from form field list ── */
#wppb-edit-user ul,
.wppb-user-forms ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#wppb-edit-user ul li,
.wppb-user-forms ul li {
    margin-bottom: 20px;
    padding: 0;
}

/* ── Section headings (h4 inside .wppb-form-field) ── */
#wppb-edit-user .wppb-form-field h4,
.wppb-user-forms .wppb-form-field h4 {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    color: #aaa !important;
    margin: 28px 0 16px 0 !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #e8e8e8 !important;
}

/* ── Labels ── */
#wppb-edit-user label,
.wppb-user-forms label {
    display: block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 6px !important;
    text-align: left !important;
}

/* ── Text, email, and generic inputs ── */
#wppb-edit-user input.text-input,
#wppb-edit-user input[type="text"],
#wppb-edit-user input[type="email"],
#wppb-edit-user input[type="url"],
#wppb-edit-user input[type="tel"],
.wppb-user-forms input.text-input,
.wppb-user-forms input[type="text"],
.wppb-user-forms input[type="email"],
.wppb-user-forms input[type="url"],
.wppb-user-forms input[type="tel"] {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: #333 !important;
    background: #fff !important;
    box-sizing: border-box !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    outline: none !important;
}

#wppb-edit-user input.text-input:focus,
#wppb-edit-user input[type="text"]:focus,
#wppb-edit-user input[type="email"]:focus,
#wppb-edit-user input[type="url"]:focus,
#wppb-edit-user input[type="tel"]:focus,
.wppb-user-forms input.text-input:focus,
.wppb-user-forms input[type="text"]:focus,
.wppb-user-forms input[type="email"]:focus,
.wppb-user-forms input[type="url"]:focus,
.wppb-user-forms input[type="tel"]:focus {
    border-color: #00d1b2 !important;
    box-shadow: 0 0 0 2px rgba(0, 209, 178, 0.12) !important;
}

/* ── Select dropdowns ── */
#wppb-edit-user select,
.wppb-user-forms select {
    width: 100% !important;
    padding: 10px 36px 10px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: #333 !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    transition: border-color 0.15s ease !important;
    outline: none !important;
}

#wppb-edit-user select:focus,
.wppb-user-forms select:focus {
    border-color: #00d1b2 !important;
    box-shadow: 0 0 0 2px rgba(0, 209, 178, 0.12) !important;
}

/* ── Textarea (#description) ── */
#wppb-edit-user textarea#description,
#wppb-edit-user textarea,
.wppb-user-forms textarea {
    width: 100% !important;
    min-height: 120px !important;
    padding: 10px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: #333 !important;
    background: #fff !important;
    box-sizing: border-box !important;
    resize: vertical !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    outline: none !important;
}

#wppb-edit-user textarea:focus,
.wppb-user-forms textarea:focus {
    border-color: #00d1b2 !important;
    box-shadow: 0 0 0 2px rgba(0, 209, 178, 0.12) !important;
}

/* ── Password fields ── */
#wppb-edit-user .wppb-password-field-container input[type="password"],
.wppb-user-forms .wppb-password-field-container input[type="password"] {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: #333 !important;
    background: #fff !important;
    box-sizing: border-box !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    outline: none !important;
}

#wppb-edit-user .wppb-password-field-container input[type="password"]:focus,
.wppb-user-forms .wppb-password-field-container input[type="password"]:focus {
    border-color: #00d1b2 !important;
    box-shadow: 0 0 0 2px rgba(0, 209, 178, 0.12) !important;
}

/* ── Submit button ── */
#wppb-edit-user input#edit_profile.submit.button,
#wppb-edit-user input[type="submit"],
.wppb-user-forms input[type="submit"] {
    background: #00d1b2 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 28px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: background 0.2s ease, transform 0.1s ease !important;
    display: inline-block !important;
    margin-top: 8px !important;
}

#wppb-edit-user input#edit_profile.submit.button:hover,
#wppb-edit-user input[type="submit"]:hover,
.wppb-user-forms input[type="submit"]:hover {
    background: #00b89c !important;
    transform: translateY(-1px) !important;
}

#wppb-edit-user input#edit_profile.submit.button:active,
#wppb-edit-user input[type="submit"]:active,
.wppb-user-forms input[type="submit"]:active {
    transform: translateY(0) !important;
}

/* ── User-to-edit select form (admin only) ── */
#select_user_to_edit_form {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px 24px;
    max-width: 720px;
    margin: 0 auto 24px auto;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
}

#select_user_to_edit_form label {
    font-weight: 600 !important;
    color: #333 !important;
    white-space: nowrap;
    margin-bottom: 0 !important;
}

#select_user_to_edit_form select {
    flex: 1;
    min-width: 200px;
    padding: 10px 36px 10px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: #333 !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    outline: none !important;
    transition: border-color 0.15s ease !important;
}

#select_user_to_edit_form select:focus {
    border-color: #00d1b2 !important;
    box-shadow: 0 0 0 2px rgba(0, 209, 178, 0.12) !important;
}

#select_user_to_edit_form input[type="submit"] {
    background: #00d1b2 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    white-space: nowrap;
}

#select_user_to_edit_form input[type="submit"]:hover {
    background: #00b89c !important;
}

/* ── Username field — greyed out (read-only/disabled) ── */
#wppb-edit-user .wppb-default-username label,
.wppb-user-forms .wppb-default-username label {
    color: #aaa !important;
}

#wppb-edit-user .wppb-default-username input,
.wppb-user-forms .wppb-default-username input {
    background: #f5f5f5 !important;
    color: #aaa !important;
    border-color: #e0e0e0 !important;
    cursor: not-allowed !important;
}

/* ── Required field indicator ── */
#wppb-edit-user .wppb-required,
.wppb-user-forms .wppb-required {
    color: #e53e3e !important;
    font-weight: 700 !important;
    margin-left: 2px;
}

/* ── Page header — confirm alignment with other pages ── */
.ragteck-dashboard-page-header:has(+ #wppb-edit-user),
.ragteck-dashboard-page-header:has(+ .wppb-user-forms) {
    margin-bottom: 24px;
}

/* ── Notification / error messages from WPPB ── */
#wppb-edit-user .wppb-message,
.wppb-user-forms .wppb-message,
#wppb-edit-user .wppb-error,
.wppb-user-forms .wppb-error {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
}

#wppb-edit-user .wppb-message,
.wppb-user-forms .wppb-message {
    background: #e6faf7;
    border-left: 4px solid #00d1b2;
    color: #00856e;
}

#wppb-edit-user .wppb-error,
.wppb-user-forms .wppb-error {
    background: #fff5f5;
    border-left: 4px solid #e53e3e;
    color: #c0392b;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
    #wppb-edit-user,
    .wppb-user-forms {
        padding: 20px 16px;
        margin: 0 0 24px 0;
    }

    #select_user_to_edit_form {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        margin: 0 0 16px 0;
    }

    #select_user_to_edit_form label {
        margin-bottom: 6px !important;
    }

    #select_user_to_edit_form select,
    #select_user_to_edit_form input[type="submit"] {
        width: 100% !important;
    }
}

/* ==============================
   Loose-Chat Sidebar  (#ragteck-loose-chat-app)
   Scoped to #ragteck-loose-chat-app — no bleed to other pages.
   Mirrors .ragteck-col2-* visual language (colours, spacing, transitions).
   23j.4 Part B
   ============================== */

/* ── Layout wrapper ─────────────────────────────────────────────────────── */
#ragteck-loose-chat-app {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;   /* allow flex children to shrink below content height */
}

/* ── Left sidebar panel ─────────────────────────────────────────────────── */
#ragteck-loose-chat-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    background: #fafafa;
    overflow: hidden;
    transition: width 0.25s ease, opacity 0.25s ease;
}

/* Sidebar header row */
#ragteck-loose-chat-sidebar > div:first-child {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: #f5f5f5;
}

/* "Chats" label */
#ragteck-loose-chat-sidebar > div:first-child > span {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── New Chat button ────────────────────────────────────────────────────── */
#ragteck-loose-new-chat {
    background: #fff;
    border: 1px dashed #ccc;
    color: #1a1a1a;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    line-height: 1.6;
    white-space: nowrap;
}

#ragteck-loose-new-chat:hover {
    background: #00d1b2;
    border-color: #00d1b2;
    color: #fff;
}

/* ── Chat list <ul> ─────────────────────────────────────────────────────── */
#ragteck-loose-chat-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Scrollbar — match hub sidebar */
#ragteck-loose-chat-list::-webkit-scrollbar {
    width: 4px;
}
#ragteck-loose-chat-list::-webkit-scrollbar-track {
    background: #fafafa;
}
#ragteck-loose-chat-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}
#ragteck-loose-chat-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ── Loading / empty placeholder ────────────────────────────────────────── */
#ragteck-loose-chat-list .rlc-loading,
#ragteck-loose-chat-list .rlc-empty {
    padding: 12px 14px;
    font-size: 12px;
    color: #999;
    font-style: italic;
    cursor: default;
}

/* ── Individual chat item ───────────────────────────────────────────────── */
.rlc-chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 8px 12px;
    margin: 1px 4px;
    border-radius: 4px;
    background: transparent;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-left-color 0.15s ease;
    font-size: 13px;
    color: #333;
    gap: 6px;
}

.rlc-chat-item:hover {
    background: #f0f0f0;
    border-left-color: #00d1b2;
}

/* Active state — matches .ragteck-col2-chat-active */
.rlc-chat-item.rlc-active {
    background: #00d1b2;
    border-left-color: #00b89c;
    color: #fff;
    font-weight: 500;
}

.rlc-chat-item.rlc-active:hover {
    background: #00c4a7;
}

/* ── Inline rename input ────────────────────────────────────────────────── */
.rlc-rename-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    border-bottom: 1px solid #00d1b2;
    border-radius: 0;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    line-height: 1.3;
    outline: none;
    box-shadow: none;
    box-sizing: border-box;
}

.rlc-chat-item.rlc-active .rlc-rename-input {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.7);
}

/* ── Chat title (truncated) ─────────────────────────────────────────────── */
.rlc-chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.3;
}

/* ── Date subtitle ──────────────────────────────────────────────────────── */
.rlc-chat-date {
    font-size: 10px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 2px;
    transition: color 0.15s;
}

.rlc-chat-item.rlc-active .rlc-chat-date {
    color: rgba(255, 255, 255, 0.75);
}

/* ── "..." menu trigger button ──────────────────────────────────────────── */
.rlc-menu-btn {
    background: none;
    border: none;
    padding: 0 4px;
    margin-left: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: transparent; /* hidden until row hover */
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

/* Reveal on row hover */
.rlc-chat-item:hover .rlc-menu-btn {
    color: #888;
}

.rlc-chat-item:hover .rlc-menu-btn:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.08);
}

/* On active (teal) row */
.rlc-chat-item.rlc-active .rlc-menu-btn {
    color: rgba(255, 255, 255, 0.5);
}

.rlc-chat-item.rlc-active .rlc-menu-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Context menu dropdown ──────────────────────────────────────────────── */
.rlc-context-menu {
    display: none;
    position: absolute;
    right: 6px;
    top: calc(100% + 2px);
    z-index: 200;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    min-width: 120px;
    white-space: nowrap;
}

.rlc-context-menu.rlc-menu-open {
    display: block;
}

/* Ensure the parent li is the positioning context */
.rlc-chat-item {
    position: relative;
}

.rlc-context-menu li {
    margin: 0;
    padding: 0;
}

.rlc-context-menu button {
    display: block;
    width: 100%;
    padding: 7px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.12s ease;
}

.rlc-context-menu button:hover {
    background: #f5f5f5;
}

/* Delete option — red on hover */
.rlc-context-menu .rlc-menu-delete:hover {
    color: #dc3545;
    background: #fff5f5;
}

/* ── Delete button (legacy — kept for safety, hidden by default) ─────────── */
.rlc-delete-btn {
    background: none;
    border: none;
    color: transparent;          /* hidden by default */
    font-size: 13px;
    line-height: 1;
    padding: 2px 4px;
    margin-left: 2px;
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

/* Reveal on row hover */
.rlc-chat-item:hover .rlc-delete-btn {
    color: #aaa;
}

.rlc-chat-item:hover .rlc-delete-btn:hover {
    color: #dc3545;
    background: #fff5f5;
}

/* On active (teal) row — white × that turns red on hover */
.rlc-chat-item.rlc-active .rlc-delete-btn {
    color: rgba(255, 255, 255, 0.5);
}

.rlc-chat-item.rlc-active .rlc-delete-btn:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.15);
}

/* ── Iframe wrapper (right column) ─────────────────────────────────────── */
#ragteck-loose-chat-app > div:last-child {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

/* ── Mobile: sidebar collapses to a top strip, iframe goes full-width ───── */
@media (max-width: 768px) {
    /* Hide the desktop left sidebar — replaced by the topbar dropdown */
    #ragteck-loose-chat-sidebar {
        display: none !important;
    }

    /* Iframe fills the full available height */
    #ragteck-loose-chat-app > div:last-child {
        flex: 1;
        min-height: 0;
    }
}

/* ── Mobile chat dropdown panel ─────────────────────────────────────────── */
/* Shown only on mobile (≤768px) via the topbar secondary slot.             */
/* The panel itself is toggled by JS (.toggle()), so no media query needed  */
/* on the panel — it simply must not appear on desktop.                     */
#rlc-mobile-dropdown {
    position: absolute;
    top: 48px; /* below the topbar */
    left: 0;
    right: 0;
    z-index: 1200;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 60vh;
    overflow-y: auto;
}

#rlc-mobile-chat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rlc-mobile-chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.15s;
}

.rlc-mobile-chat-item:hover {
    background: #f5f5f5;
}

.rlc-mobile-chat-item.rlc-mobile-active {
    background: #e8f4ff;
    font-weight: 600;
    color: #0066cc;
}

.rlc-mobile-chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.rlc-mobile-delete-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
    line-height: 1;
}

.rlc-mobile-delete-btn:hover {
    background: #ffe0e0;
    color: #cc0000;
}

.rlc-mobile-empty {
    padding: 12px 16px;
    color: #999;
    font-size: 13px;
    font-style: italic;
}

.rlc-mobile-new-chat-row {
    padding: 10px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

#rlc-mobile-new-chat {
    width: 100%;
    padding: 8px 12px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

#rlc-mobile-new-chat:hover {
    background: #0052a3;
}

/* Hide the mobile dropdown on desktop — it should only appear on mobile */
@media (min-width: 769px) {
    #rlc-mobile-dropdown {
        display: none !important;
    }
}

/* ── Tablet: slightly narrower sidebar ─────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
    #ragteck-loose-chat-sidebar {
        width: 180px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Col2 Hub/Studio sidebar — inline chat context menu + rename input
   Mirrors the .rlc-* pattern used in ragteck-loose-chats.js
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Project item row ───────────────────────────────────────────────────── */
.ragteck-col2-project-item {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 4px;
}

/* ── Project title span ─────────────────────────────────────────────────── */
.col2-project-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.3;
}

/* ── Project ⋯ menu button ──────────────────────────────────────────────── */
.col2-project-menu-btn {
    background: none;
    border: none;
    padding: 0 4px;
    margin-left: 2px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: transparent;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.ragteck-col2-project-item:hover .col2-project-menu-btn {
    color: #888;
}

.ragteck-col2-project-item:hover .col2-project-menu-btn:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.08);
}

.ragteck-col2-project-item.ragteck-col2-project-active .col2-project-menu-btn {
    color: rgba(255, 255, 255, 0.5);
}

.ragteck-col2-project-item.ragteck-col2-project-active .col2-project-menu-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Project context menu ───────────────────────────────────────────────── */
.col2-project-context-menu {
    display: none;
    position: absolute;
    right: 6px;
    top: calc(100% + 2px);
    z-index: 200;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    min-width: 120px;
    white-space: nowrap;
}

.col2-project-context-menu.col2-menu-open {
    display: block;
}

.col2-project-context-menu li {
    margin: 0;
    padding: 0;
}

.col2-project-context-menu button {
    display: block;
    width: 100%;
    padding: 7px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.12s ease;
}

.col2-project-context-menu button:hover {
    background: #f5f5f5;
}

.col2-project-context-menu .col2-proj-delete:hover {
    color: #dc3545;
    background: #fff5f5;
}

/* ── Chat item row ──────────────────────────────────────────────────────── */
.ragteck-col2-chat-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Chat title span ────────────────────────────────────────────────────── */
.col2-chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.3;
}

/* ── "..." menu trigger button ──────────────────────────────────────────── */
.col2-menu-btn {
    background: none;
    border: none;
    padding: 0 4px;
    margin-left: 2px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: transparent; /* hidden until row hover */
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.ragteck-col2-chat-item:hover .col2-menu-btn {
    color: #888;
}

.ragteck-col2-chat-item:hover .col2-menu-btn:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.08);
}

.ragteck-col2-chat-item.ragteck-col2-chat-active .col2-menu-btn {
    color: rgba(255, 255, 255, 0.5);
}

.ragteck-col2-chat-item.ragteck-col2-chat-active .col2-menu-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Context menu dropdown ──────────────────────────────────────────────── */
.col2-context-menu {
    display: none;
    position: absolute;
    right: 6px;
    top: calc(100% + 2px);
    z-index: 200;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    min-width: 120px;
    white-space: nowrap;
}

.col2-context-menu.col2-menu-open {
    display: block;
}

.col2-context-menu li {
    margin: 0;
    padding: 0;
}

.col2-context-menu button {
    display: block;
    width: 100%;
    padding: 7px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.12s ease;
}

.col2-context-menu button:hover {
    background: #f5f5f5;
}

.col2-context-menu .col2-menu-delete:hover {
    color: #dc3545;
    background: #fff5f5;
}

/* ── Inline rename input ────────────────────────────────────────────────── */
.col2-rename-input {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    line-height: 1.3;
    padding: 1px 4px;
    border: none;
    border-bottom: 1px solid #0d9488;
    border-radius: 0;
    background: transparent;
    color: inherit;
    outline: none;
    box-shadow: none;
    box-sizing: border-box;
}

.ragteck-col2-chat-item.ragteck-col2-chat-active .col2-rename-input {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.7);
}
