﻿.numeric_input {
    text-align: right;
}

.folderview, .reportview, .navbar-right {
    display: none;
}

.folderview, .reportview, .navbar-right, #output-panel, #message_button {
    transition: opacity 1s linear;
}

/* Bootstrap 5 migration: the Seal Web Interface reveals navbar groups with jQuery
   .show(), which sets inline "display: block" on the <ul class="navbar-nav navbar-right">
   and overrides Bootstrap 5's flex, stacking the icons vertically (some <li> also carry
   .d-flex / .d-sm-block !important utilities, so forcing the <li> display is not enough).
   Force the shown <ul> back to a horizontal flex row so every <li> is a flex item in one row. */
#bar_top .navbar-nav.navbar-right[style*="display: block"] {
    display: flex !important;
    flex-direction: row;
    align-items: center;
}

/* light buttons */
.lighticon-menu .lightbutton {
    display: inline-block;
    text-align: center;
    background: #f2f2f2;
    padding: .4rem 0 .5rem .1rem;
}

.lightbutton {
    line-height: 1.25; /* default: 1.5 */
    cursor: pointer;
    padding: 0 1px;
    margin: 0;
    min-width: 40px;
    /*color: see theme*/
}

a {
    cursor: pointer;
}

.nopointer {
    cursor: default !important;
}

.lightbutton:hover {
    /*color: see theme*/
}

.lightbutton.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.lightbutton-icon {
    font-size: 1.2em;
}

/* Reduce lightbutton text size */
.lightbutton-text {
    font-size: 0.82em;
}

/* bootstrap override */

.report-name, .output-name {
    color: #000 !important;
    padding: 0px;
    cursor: pointer;
    text-decoration: none;
}

    .report-name:hover, .output-name:hover {
        text-decoration: none;
    }

#file-table-view > div > .row {
    margin-right: 0px !important; /* avoid overflow on datatable */
}

#schedule-row > div > .form-group, #schedule-exec > .form-group {
    margin-bottom: 2px;
}

#file-table-body td {
    vertical-align: middle;
    /* Comfortable, constant row height whether or not the selection checkbox column is shown
       (read-only users have no checkbox column, so the height must not depend on it). */
    padding: 8px 4px;
    font-size: 0.85em;
}

/* Shaded, compact header to match the report data tables (BS5 .table thead has
   no background of its own). */
#file-table > thead > tr > th {
    background-color: transparent;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.85em;
    padding: 3px 4px;
}

/* Output panel — popover style */
#output-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 260px;
    max-width: 380px;
    padding: 6px 0;
    overflow: hidden;
}

#output-panel-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    font-size: 16px;
    color: #aaa;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
#output-panel-close:hover {
    color: #333;
}

.output-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    transition: background 0.15s;
}
.output-item:hover {
    background: #f5f5f5;
}
.output-item.output-loading {
    color: #888;
    font-size: 13px;
    padding-right: 32px;
}
.output-item .output-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}
.output-type-badge {
    font-size: 11px;
    color: #fff;
    background: #5b9bd5;
    border-radius: 3px;
    padding: 1px 5px;
    flex-shrink: 0;
}
.output-type-badge.output-type-output {
    background: #70ad47;
}

.btn-table {
    font-size: 15px;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #888;
    padding: 4px 10px;
    margin: 0 2px;
}
.btn-table:hover, .btn-table:focus {
    background: rgba(0,0,0,0.07);
    border: none;
    box-shadow: none;
    color: #333;
}

/* Report name cell: name on left, action buttons overlay on right (Gmail-style) */
.report-name-cell {
    display: flex;
    align-items: center;
    position: relative;
}
.report-name-cell .report-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Status icons shown to the right of the report name (Task / scheduled) */
.report-name-cell .report-kind-icon,
.report-name-cell .report-schedule-icon {
    flex: 0 0 auto;
    margin-left: 6px;
    color: #6c757d;
    font-size: 0.85em;
}
/* Shortcut (.srln) indicator and broken-target state (shown to the right of the report name) */
.report-shortcut-icon {
    flex: 0 0 auto;
    margin-left: 6px;
    font-size: 0.85em;
    color: #888;
}
.report-shortcut-icon.report-broken {
    color: #c0392b;
}
.report-name.report-broken {
    color: #999;
    cursor: default;
    font-style: italic;
}
.report-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding-left: 20px;
}
.report-actions:not(:empty) {
    background: linear-gradient(to right, transparent, #fff 25%);
}

/* Hide action panel, show on row hover (mouse devices only) */
@media (hover: hover) {
    #file-table-body tr .report-actions {
        opacity: 0;
        pointer-events: none;
    }
    #file-table-body tr:hover .report-actions:not(:empty) {
        opacity: 1;
        pointer-events: auto;
        background: linear-gradient(to right, transparent, #f5f5f5 25%);
    }
}

/* Resizable split between the folder tree and the report list.
   Default width of the tree pane; overridden at runtime via localStorage. */
:root {
    --folder-view-width: 33.333%;
}

/* Mobile-first: panels stack full-width and the splitter is hidden
   (matches the previous col-sm-* stacking behavior on xs). */
#folder-view,
#file-view {
    flex: 0 0 100%;
    max-width: 100%;
}

.folder-splitter {
    display: none;
}

@media (min-width: 576px) {
    .swi-folder-row {
        position: relative; /* anchor for the absolutely-positioned splitter */
        align-items: stretch;
    }

    #folder-view {
        flex: 0 0 var(--folder-view-width);
        max-width: var(--folder-view-width);
        /* Keep the tree clear of the fixed AI-agent toggle tab (26px wide,
           pinned to the far-left edge at vertical center). */
        padding-left: 20px;
    }

    #file-view {
        flex: 1 1 0;
        max-width: none;
        min-width: 0; /* allow the report table to shrink instead of overflowing */
    }

    /* Overlay handle at the seam — no layout footprint. A wide (transparent)
       grab area for easy dragging, but only a thin 2px line shows on hover. */
    .folder-splitter {
        display: block;
        position: absolute;
        top: 0;
        bottom: 0;
        left: var(--folder-view-width);
        width: 7px;
        margin-left: -3px; /* center the grab area over the seam */
        cursor: ew-resize;
        background: transparent;
        z-index: 5;
    }

    .folder-splitter::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 2px;
        transform: translateX(-50%);
        background: transparent;
    }

    .folder-splitter:hover::after,
    body.folder-resizing .folder-splitter::after {
        background: #62a6ff;
    }

    /* Avoid text selection / iframe mouse-capture while dragging the splitter. */
    body.folder-resizing {
        user-select: none;
        cursor: ew-resize;
    }
}

/* Folder treeview (Bootstrap 5 hand-built, replaces jstree) */
.swi-tree {
    font-size: 14px;
}

.swi-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.swi-tree ul ul {
    padding-left: 18px;
}

.swi-tree-children.collapsed {
    display: none;
}

.swi-tree-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.swi-tree-node:hover {
    background: #f0f0f0;
}

.swi-tree-node.selected {
    background: #d9d9d9;
}

.swi-tree-toggle {
    flex: 0 0 auto;
    width: 14px;
    text-align: center;
    color: #777;
}

.swi-tree-toggle.empty {
    visibility: hidden;
}

.swi-tree-icon {
    flex: 0 0 auto;
}

.swi-tree-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Larger touch targets on small screens (was jstree themes.responsive) */
@media (max-width: 768px) {
    .swi-tree-node {
        padding: 7px 6px;
    }
}

#elements-tree {
    background: none !important;
}

/* Drag panels */
.drag-panel {
    padding: 1px !important;
    margin: 2px 0px !important;
    background: linear-gradient(#FFF, #d9d9d9);
    overflow: auto;
}

.drop-span {
    margin: 10px;
    position: absolute;
    font-style: italic;
}


.over {
    border: 1px dashed #000;
    opacity: 0.5;
    background: #cccccc;
}

.over2 {
    opacity: 0.5;
    background: orange !important;
}

#wait-dialog {
    top: 80px;
    z-index: 100000 !important;
}

@media (min-width: 768px) {
    #wait-dialog > .modal-dialog {
        width: 300px;
    }
}

.properties-label {
    display: inline;
    padding-top: 8px;
    width: 35%;
    float: left;
}

.properties-value {
    display: inline;
    width: 65%;
    float: left;
}

#action-tableheader {
    width: 200px;
    min-width: 200px;
    text-align: center;
}

@media (max-width: 768px) {
    #action-tableheader {
        width: 120px;
        min-width: 120px;
    }
}

/* Element buttons */
.element-btn-group {
    display: none;
    width: 100%;
}


.numeric {
    text-align: right;
}

/* dataTables */
table.dataTable {
    margin: 0px !important;
}

#refresh-nav-item {
    font-size: 20px;
}
    /* spin speed */
    #refresh-nav-item.fa-spin {
        animation-duration: 1s;
    }

#agent-nav-item {
    font-size: 20px;
}

#nav_button .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: .15em;
    margin-left: 5px;
}

/* sub-menus */
.dropdown-submenu {
    position: relative;
}

    .dropdown-submenu > .dropdown-menu {
        top: 0;
        left: 100%;
        margin-top: -6px;
        margin-left: -1px;
        -webkit-border-radius: 0 6px 6px 6px;
        -moz-border-radius: 0 6px 6px 6px;
        border-radius: 0 6px 6px 6px;
    }

    .dropdown-submenu > a:after {
        display: block;
        content: " ";
        float: right;
        width: 0;
        height: 0;
        border-color: transparent;
        border-style: solid;
        border-width: 5px 0 5px 5px;
        border-left-color: #cccccc;
        margin-top: 5px;
        margin-right: -10px;
    }

    .dropdown-submenu:hover > a:after {
        border-left-color: #555;
    }

    .dropdown-submenu.pull-left {
        float: none;
    }

        .dropdown-submenu.pull-left > .dropdown-menu {
            left: -100%;
            margin-left: 10px;
            -webkit-border-radius: 6px 0 6px 6px;
            -moz-border-radius: 6px 0 6px 6px;
            border-radius: 6px 0 6px 6px;
        }

.not-dotnet-core {
    display: none !important;
}


/*ALERT*/
.sr-alert {
    position: fixed !important;
    top: 5px !important;
    left: 50% !important;
    transform: translateX(-50%);
    width: auto !important;
    min-width: 300px;
    max-width: 600px;
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    z-index: 10000;
    opacity: 1;
    animation: none;
}

    .sr-alert .sr-alert-icon {
        flex: 0 0 auto;
        font-size: 18px;
        line-height: 1;
        opacity: 0.9;
    }

    .sr-alert .sr-alert-text {
        flex: 1 1 auto;
        margin: 0;
        font-weight: 500;
        font-size: 14px;
        line-height: 1.35;
    }

    .sr-alert .sr-alert-close {
        flex: 0 0 auto;
        margin-left: 4px;
        padding: 4px;
        opacity: 0.6;
        font-size: 11px;
    }

        .sr-alert .sr-alert-close:hover {
            opacity: 1;
        }

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    90% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* menu divider */
#menu-main.dropdown-menu {
    padding-top: 0;
    border-radius: 8px !important;
    overflow: hidden;
}

/* Style the divider */
.menu-divider {
    font-weight: bold;
    padding: 5px 10px;
    background: #f1f1f1;
    color: #333;
    cursor: default;
    text-transform: uppercase;
}

/* Favorites / Recents section label in the reports menu (mirrors the AI chat dropdown) */
#menu-main li.menu-fav-label {
    font-size: 11px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 8px 14px 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: #e6e6e6;
    cursor: default;
}

#menu-main li.menu-fav-label .fa-star {
    color: #f5a623;
}

#menu-main li.menu-fav-label .fa-clock {
    color: #62a6ff;
}

/* Favorites / Recents row with hover-revealed action buttons */
#menu-main li.menu-fav-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 6px 0 0;
    transition: background-color 0.12s;
}

#menu-main li.menu-fav-item:hover {
    background: #f0f5ff;
}

#menu-main a.menu-fav-link {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 5px 14px;
    color: #333;
    text-decoration: none;
}

#menu-main li.menu-fav-item:hover a.menu-fav-link {
    color: #62a6ff;
}

.menu-fav-actions {
    display: none;
    flex-shrink: 0;
    gap: 2px;
    align-items: center;
}

#menu-main li.menu-fav-item:hover .menu-fav-actions {
    display: flex;
}

.menu-fav-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.12s, background 0.12s;
}

.menu-fav-star:hover {
    color: #f5a623;
    background: rgba(245, 166, 35, 0.12);
}

.menu-fav-remove:hover {
    color: #e05252;
    background: rgba(224, 82, 82, 0.1);
}

.menu-fav-rename:hover {
    color: #337ab7;
    background: rgba(51, 122, 183, 0.12);
}

#menu-main input.menu-fav-rename-input {
    flex: 1;
    min-width: 0;
    margin: 2px 10px;
    padding: 2px 6px;
    font-size: 14px;
    border: 1px solid #62a6ff;
    border-radius: 3px;
    outline: none;
}

/* Input Layout Styling */
.config-input-row {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
    width: 100%;
}

    .config-input-row span {
        align-self: flex-start;
    }

.config-input-column {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.config-input-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    min-width: 250px;
    max-width: 250px;
    flex-shrink: 0;
}

.config-input-field {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 166px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .config-input-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .config-input-label {
        margin-bottom: 4px;
        min-width: auto;
        max-width: none;
    }

    .config-input-field {
        width: 100%;
        max-width: 100%;
    }

    #profile-dialog .modal-dialog,
    #folder-dialog .modal-dialog {
        width: auto;
        margin: 10px;
    }
}

/*  Profile Dialog  */
#profile-dialog .modal-dialog,
#folder-dialog .modal-dialog {
    margin: 20px auto;
}

#profile-dialog .modal-dialog {
    max-width: 800px;
}

#profile-dialog .modal-content,
#folder-dialog .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#profile-dialog .modal-header,
#folder-dialog .modal-header {
    background-color: #f5f5f7;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#profile-dialog .modal-title,
#folder-dialog .modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

#profile-dialog .modal-body,
#folder-dialog .modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

#profile-dialog .modal-footer,
#folder-dialog .modal-footer {
    padding: 16px 24px;
    background-color: #f5f5f7;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#profile-dialog .form-group,
#folder-dialog .form-group {
    margin-bottom: 16px;
}

#profile-dialog .form-control,
#folder-dialog .form-control {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    padding: 10px 12px;
    transition: border-color 0.2s ease;
    width: 100%;
    height: 42px;
    box-sizing: border-box;
}

    #profile-dialog .form-control:focus,
    #folder-dialog .form-control:focus {
        border-color: #62a6ff;
        box-shadow: none;
        outline: none;
    }

#profile-dialog textarea.form-control,
#folder-dialog textarea.form-control {
    min-height: 80px;
    resize: vertical;
    height: auto;
}

#profile-dialog select,
#folder-dialog select {
    /*    width: 100% !important;*/
    max-width: 100% !important;
    border-radius: 6px;
    min-height: 42px;
}

#profile-dialog .btn,
#folder-dialog .btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
}

#profile-dialog .btn-primary,
#folder-dialog .btn-primary {
    background-color: #337ab7;
    color: white;
}

    #profile-dialog .btn-primary:hover,
    #folder-dialog .btn-primary:hover {
        background-color: #286090;
    }

#profile-dialog .btn-default,
#folder-dialog .btn-default {
    background-color: #f5f5f7;
    color: #333;
    border: 1px solid #e0e0e0;
}

    #profile-dialog .btn-default:hover,
    #folder-dialog .btn-default:hover {
        background-color: #e5e5e7;
    }

#profile-dialog .close,
#folder-dialog .close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 4px;
}

    #profile-dialog .close:hover,
    #folder-dialog .close:hover {
        background-color: #e0e0e0;
    }

@media (max-width: 768px) {
    #profile-dialog .modal-dialog,
    #folder-dialog .modal-dialog {
        margin: 10px;
        max-width: none;
    }
}

/* ============================================================
   AI Chat Panel — collapsible left drawer
   ============================================================ */

/* Drawer */
:root {
    --ai-panel-width: 400px;
}

#ai-chat-panel {
    position: fixed;
    top: 51px;                        /* sits just below the fixed navbar */
    left: 0;
    width: var(--ai-panel-width);
    height: calc(100vh - 51px);
    background: #fff;
    border-right: 1px solid #e0e0e0;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.10);
    z-index: 500;                     /* below Bootstrap navbar (1030) and dropdowns (1000) */
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    font-family: 'Inter', sans-serif;
}

#ai-chat-panel.ai-panel-open {
    transform: translateX(0);
}

/* Toggle tab — sticks to the right edge of the drawer */
#ai-panel-toggle {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    background: #62a6ff;
    color: #fff;
    border: none;
    border-radius: 0 8px 8px 0;
    width: 26px;
    height: 60px;
    padding: 0;
    cursor: pointer;
    z-index: 501;                     /* just above the panel, still below navbar */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.14);
    transition: left 0.28s ease, background-color 0.2s;
}

#ai-panel-toggle:hover {
    background: #4a90e2;
}

#ai-panel-toggle.ai-panel-open {
    left: var(--ai-panel-width);
}

/* Drag handle to resize the panel — pinned to the right edge */
.ai-panel-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: ew-resize;
    z-index: 502;
    background: transparent;
}

.ai-panel-resizer:hover,
body.ai-resizing .ai-panel-resizer {
    background: #62a6ff;
}

/* Suppress width/offset transitions while actively dragging */
body.ai-resizing #ai-chat-panel,
body.ai-resizing #ai-panel-toggle,
body.ai-resizing #main-container,
body.ai-resizing #report-body,
body.ai-resizing #footer-div {
    transition: none !important;
}


#ai-panel-toggle .fa {
    font-size: 13px;
}

/* Panel header */
.ai-panel-header {
    background: #f5f5f7;
    padding: 13px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    flex: 1 1 auto;
    min-width: 0;          /* allow the title to shrink so the action buttons stay inside the panel */
}

.ai-panel-title .fa {
    color: #62a6ff;
    font-size: 16px;
}

/* Agent selectpicker in the panel header */
.ai-panel-title .bootstrap-select {
    margin: 0;
}
.ai-panel-title .bootstrap-select > .btn {
    background: transparent;
    border: none;
    box-shadow: none !important;
    padding: 2px 4px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    height: auto;
    line-height: 1.4;
    overflow: hidden;      /* truncate the agent name here (the menu is a sibling, so it isn't clipped) */
}
.ai-panel-title .bootstrap-select > .btn:hover,
.ai-panel-title .bootstrap-select > .btn:focus,
.ai-panel-title .bootstrap-select > .btn:active,
.ai-panel-title .bootstrap-select > .btn.active,
.ai-panel-title .bootstrap-select.open > .btn,
.ai-panel-title .bootstrap-select.open > .btn:focus {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    outline: none !important;
    box-shadow: none !important;
}
.ai-panel-title .bootstrap-select > .btn.disabled,
.ai-panel-title .bootstrap-select > .btn[disabled] {
    opacity: 1;
    cursor: default;
    color: #333;
}
.ai-panel-title .bootstrap-select > .btn .caret {
    margin-left: 5px;
}
/* Truncate a long agent name instead of pushing the header action buttons out */
.ai-panel-title .bootstrap-select > .btn .filter-option,
.ai-panel-title .bootstrap-select > .btn .filter-option-inner,
.ai-panel-title .bootstrap-select > .btn .filter-option-inner-inner {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Open menu: remove the focus outline on options and widen the dropdown */
.ai-panel-title .bootstrap-select .dropdown-menu a {
    outline: none !important;
}
.ai-panel-title .bootstrap-select.ai-panel-agent-select {
    width: auto !important;
    max-width: 220px;
    min-width: 0;          /* permit the selectpicker to shrink within the title */
}

#ai-panel-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.15s;
}

#ai-panel-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* Messages area */
.ai-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-panel-messages::-webkit-scrollbar {
    width: 5px;
}

.ai-panel-messages::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

/* Chat bubbles */
.ai-panel-bubble {
    position: relative;
    max-width: 90%;
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
}

/* Hover action toolbar on bubbles (copy / paste / send) */
.ai-bubble-actions {
    position: absolute;
    top: 100%;
    margin-top: -6px;
    display: none;
    gap: 1px;
    padding: 1px 2px;
    background: #fff;
    border: 1px solid #e3e3e6;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    z-index: 5;
}
.ai-panel-bubble.user .ai-bubble-actions { right: 4px; }
.ai-panel-bubble.ai   .ai-bubble-actions { right: 4px; }
.ai-panel-bubble:hover .ai-bubble-actions { display: flex; }

.ai-bubble-action-btn {
    background: none;
    border: none;
    padding: 5px 9px;
    cursor: pointer;
    color: #888;
    font-size: 15px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.12s, background 0.12s;
}
.ai-bubble-action-btn:hover {
    color: #62a6ff;
    background: rgba(98, 166, 255, 0.12);
}

.ai-panel-bubble.user {
    background-color: #62a6ff;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.ai-panel-bubble.ai {
    background-color: #f5f5f7;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

/* Typing indicator — animated bouncing dots */
.ai-panel-bubble.ai.typing .dot,
.ai-thinking-header .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 2px;
    background-color: #aaa;
    border-radius: 50%;
    animation: ai-dot-blink 1.4s infinite;
    vertical-align: middle;
}
.ai-panel-bubble.ai.typing .dot:nth-child(2),
.ai-thinking-header .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-panel-bubble.ai.typing .dot:nth-child(3),
.ai-thinking-header .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-dot-blink {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.85); }
    40%            { opacity: 1;   transform: scale(1.1);  }
}

/* Live "thinking" panel (while a request runs) and its persisted collapsed summary */
.ai-panel-thinking {
    align-self: flex-start;
    max-width: 90%;
    margin: 2px 0;
    font-size: 12px;
    color: #888;
}
.ai-thinking-header {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ai-thinking-label { margin-left: 4px; font-style: italic; }
.ai-thinking-steps { margin-top: 4px; }
.ai-thinking-step {
    padding: 2px 0 2px 16px;
    color: #999;
    line-height: 1.5;
    white-space: pre-wrap;
}
.ai-thinking-step::before {
    content: '\2713';   /* check mark */
    margin-left: -16px;
    margin-right: 6px;
    color: #9bbf6a;
}

/* Collapsed "Thought for N steps" summary above the answer */
.ai-panel-steps {
    align-self: flex-start;
    max-width: 90%;
    margin: 2px 0 0;
    font-size: 12px;
}
.ai-steps-toggle {
    cursor: pointer;
    color: #888;
    user-select: none;
}
.ai-steps-toggle:hover { color: #555; }
.ai-steps-toggle i { width: 10px; }
.ai-steps-list {
    margin-top: 3px;
    padding-left: 4px;
    border-left: 2px solid #eee;
}

/* Muted token/cost usage line under the answer */
.ai-panel-usage {
    align-self: flex-start;
    margin: 2px 0 0;
    font-size: 11px;
    color: #aaa;
}

/* Cancelled message */
.ai-panel-bubble.ai.cancelled {
    color: #bbb;
    font-style: italic;
    font-size: 12px;
}

/* AI response markdown formatting */
.ai-panel-bubble.ai .ai-h {
    font-weight: 600;
    margin: 8px 0 3px;
    line-height: 1.3;
}
.ai-panel-bubble.ai .ai-h:first-child {
    margin-top: 0;
}
.ai-panel-bubble.ai .ai-h1 { font-size: 16px; }
.ai-panel-bubble.ai .ai-h2 { font-size: 15px; }
.ai-panel-bubble.ai .ai-h3 { font-size: 14px; }
.ai-panel-bubble.ai .ai-h4,
.ai-panel-bubble.ai .ai-h5,
.ai-panel-bubble.ai .ai-h6 { font-size: 13px; }
.ai-panel-bubble.ai .ai-list {
    margin: 4px 0;
    padding-left: 20px;
}
.ai-panel-bubble.ai .ai-list li {
    margin: 2px 0;
}
.ai-panel-bubble.ai code {
    background-color: #e6e6ea;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    font-family: Consolas, "Courier New", monospace;
    color: #c0341d;
    word-break: break-all;
}

/* Execute report actions — row of buttons below an AI bubble */
.ai-panel-report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0 4px 8px;
}

.ai-panel-execute-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #4a9c4a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.ai-panel-execute-btn:hover {
    background-color: #3a7c3a;
}

.ai-panel-execute-btn .fa {
    font-size: 11px;
}

/* Input area */
.ai-panel-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 12px 14px;
    background: #fff;
    flex-shrink: 0;
}

.ai-panel-input {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 9px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    resize: none;
    box-sizing: border-box;
    line-height: 1.5;
    color: #333;
    transition: border-color 0.2s;
}

.ai-panel-input:focus {
    outline: none;
    border-color: #62a6ff;
    box-shadow: 0 0 0 3px rgba(98, 166, 255, 0.15);
}

.ai-panel-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 8px;
}

.ai-panel-send-btn {
    background-color: #62a6ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.2s, opacity 0.2s;
}

.ai-panel-send-btn:hover:not(:disabled) {
    background-color: #4a90e2;
}

.ai-panel-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ai-panel-send-btn.ai-panel-cancel-btn {
    background-color: #e05252;
}

.ai-panel-send-btn.ai-panel-cancel-btn:hover {
    background-color: #c0392b;
}

/* Running indicator */
#ai-panel-running {
    display: none;
    align-self: center;
    margin-right: auto;
    font-size: 12px;
    color: #888;
    font-style: italic;
}

/* Sample prompts button (in the input-area actions row) */
.ai-panel-samples-wrap {
    position: relative;
    margin-right: 6px;
}

.ai-panel-samples-btn {
    color: #f0a500;
}

.ai-panel-samples-btn:hover {
    color: #c07d00;
}

/* Sample prompts dropdown — positioned via JS (position:fixed escapes the panel's
   transform stacking context so it is never clipped by the drawer) */
.ai-panel-samples-dropdown {
    position: fixed !important; /* must escape the panel's transform stacking context */
    min-width: 600px;
    max-width: 600px;
    max-height: 600px;
    overflow-y: auto !important;
    z-index: 1100;
}

.ai-panel-samples-dropdown .ai-panel-dropdown-list li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* Header action group (fav + dropdown + close) */
.ai-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;        /* never collapse the action buttons out past the panel edge */
}

/* Shared icon button (fav, history) */
.ai-panel-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 4px 6px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1;
    transition: background-color 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 3px;
}

.ai-panel-icon-btn:hover {
    background: #e8e8e8;
    color: #333;
}

/* Favourite active state */
.ai-panel-icon-btn.fav-active {
    color: #f5a623;
}

.ai-panel-icon-btn.fav-active .fa {
    font-weight: 900;  /* solid star via fa-star */
}

.ai-caret {
    font-size: 10px;
    margin-left: 1px;
}

/* Dropdown wrapper — anchor for absolute dropdown */
.ai-panel-dropdown-wrap {
    position: relative;
}

/* Dropdown panel */
.ai-panel-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: -70px;
    width: 380px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    z-index: 502;                     /* above panel and toggle, still below navbar */
    overflow: hidden;
}

.ai-panel-dropdown-section {
    padding: 8px 0 4px;
}

/* First section's grey label sits flush with the rounded top of the dropdown
   (no white gap above FAVORITES) */
.ai-panel-dropdown-section:first-child {
    padding-top: 0;
}

.ai-panel-dropdown-label {
    font-size: 11px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: #e6e6e6;
}

.ai-panel-dropdown-label .fa {
    color: #62a6ff;
}

.ai-panel-dropdown-label .fa-star {
    color: #f5a623;
}

.ai-panel-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ai-panel-dropdown-list li {
    padding: 5px 14px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background-color 0.12s;
}

.ai-panel-dropdown-list li:hover {
    background: #f0f5ff;
    color: #62a6ff;
}

/* Chat item label (clickable name) */
.ai-chat-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    padding: 2px 0;
}

/* Action buttons (rename / delete) — hidden by default, shown on row hover */
.ai-chat-item-actions {
    display: none;
    flex-shrink: 0;
    gap: 2px;
    align-items: center;
}

.ai-panel-dropdown-list li:hover .ai-chat-item-actions {
    display: flex;
}

.ai-chat-item-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.12s, background 0.12s;
}

.ai-chat-item-btn:hover {
    color: #62a6ff;
    background: rgba(98, 166, 255, 0.12);
}

.ai-chat-item-btn-delete:hover {
    color: #e05252;
    background: rgba(224, 82, 82, 0.1);
}

/* Inline rename input */
.ai-chat-item-rename-input {
    flex: 1;
    font-size: 13px;
    padding: 1px 4px;
    border: 1px solid #62a6ff;
    border-radius: 3px;
    outline: none;
    min-width: 0;
}

.ai-panel-dropdown-empty {
    color: #aaa !important;
    font-style: italic;
    cursor: default !important;
}

.ai-panel-dropdown-empty:hover {
    background: none !important;
    color: #aaa !important;
}

/* Push main content right when the panel is open */
#main-container,
#report-body {
    transition: margin-left 0.28s ease, width 0.28s ease;
}

#footer-div {
    transition: left 0.28s ease, width 0.28s ease;
}

body.ai-panel-visible #main-container,
body.ai-panel-visible #report-body {
    margin-left: var(--ai-panel-width);
    width: calc(100% - var(--ai-panel-width));
}

body.ai-panel-visible #footer-div {
    left: var(--ai-panel-width);
    width: calc(100% - var(--ai-panel-width));
}
