.llm-modern-messaging-text {
    color: var(--color);
    border-radius: 20px 20px 4px 20px;
    font-size: 1rem;
    padding: 6px 12px;
    margin-top: 2px;
    margin-bottom: 8px;
    text-align: left;
    transition: background-color 0.3s ease, transform 0.2s ease;
    max-width: 90%;

    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.llm-modern-messaging-text .x-panel-body {
    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.25px;
    text-align: left;
    padding: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.llm-modern-messaging-text-received-modifier {
    margin-right: 15%;
    margin-left: 20px;
    max-width: calc(100% - 15% - 20px);
    min-width: 0;
}

/* Let ExtJS shrink-wrap/flex children size down below their content's natural width
   so wide content (e.g. markdown tables) scrolls inside the bubble instead of clipping. */
.llm-modern-messaging-text-received-modifier .x-panel-body,
.llm-modern-messaging-text-received-modifier .x-autocontainer-innerCt,
.llm-modern-messaging-text-received-modifier .x-container {
    min-width: 0;
    max-width: 100%;
}
.llm-lazy-wrapper {
    min-width: 0;
    max-width: 100%;
}

.llm-typing-indicator {
    margin-left: 20px;
    margin-right: 15%;
    width: 100px;
}

.llm-modern-messaging-text-sent-modifier {
    background: var(--alt-background-color);
    margin-left: 10%;
    margin-right: 16px;
}

/* Ensure user-message text wraps naturally inside the shrink-wrapped bubble
   instead of collapsing into narrow column-like fragments. */
.llm-modern-messaging-text-sent-modifier .x-panel-body {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    padding: 0 !important;
}

/* Strip default <p> margins inside user bubbles so the bubble padding
   is the only vertical spacing around the text. */
.llm-modern-messaging-text-sent-modifier p {
    margin: 0;
}

.llm-modern-messaging-text-sent-modifier-no-background {
    margin-left: 10%;
    margin-right: 16px;
}

.modern-message-bar-container {
    background-color: #ffffff;
    display: flex;
}

.modern-message-bar-text-input {
    border-radius: 15px !important;
}

.modern-selection-button {
    background-image: linear-gradient(135deg, var(--border-color-1) 0%, var(--border-color-2) 100%);
    color: var(--color);
    border-radius: 15px;
    line-height: 2rem; 
    transition: background-color 0.3s ease, transform 0.3s ease;
    text-align: center;
    box-shadow: var(--shadow-extra-light);
    cursor: pointer;
    margin-left: 30px;
    margin-right: 30px;
    user-select: none;
}

.modern-selection-button:hover,
.modern-selection-button:focus {
    background-image: linear-gradient(135deg, var(--border-color-2) 0%, var(--border-color-3) 100%);
    transform: translateY(-2px);
    outline: none;
}

.modern-selection-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-light);
}

.modern-selection-button .x-btn-inner {
    color: var(--color);
    font-size: 1.1rem;
    line-height: 1.1rem;
    padding: 5px;
}

.modern-selection-button .x-btn-inner:focus {
    outline: none;
}


.modern-messaging-send-bar {
    border-radius: 25px;
    padding: 5px 10px;
    box-shadow: var(--shadow-light);
    display: flex;
    align-items: center;
    margin: 0 10px 10px 10px;
}

.modern-messaging-send-bar .x-form-textarea, 
.modern-messaging-send-bar .x-form-text {
    border: none !important;
    border-radius: 15px !important;
    padding: 10px 15px !important;
    font-size: 1rem;
    outline: none !important;
    resize: none !important;
    box-shadow: inset 0 2px 5px var(--border-color-2);
    max-height: 300px;
    overflow-y: auto !important;
    width: 100% !important;
    box-sizing: border-box;
}

.modern-messaging-send-bar .x-form-textarea::-webkit-scrollbar,
.modern-messaging-send-bar .x-form-text::-webkit-scrollbar {
    width: 5px;
}

/* Send button styling */
.modern-send-btn {
    background-color: transparent;
    color: var(--base-color);
    border: none;
    font-size: 1rem; 
    cursor: pointer; 
    transition: color 0.3s ease; 
    border-radius: 25px;
    user-select: none;
}

.modern-send-btn:hover {
    color: var(--status-green-vibrant); 
}

.fa-paper-plane-blue-modifier {
    color: var(--base-color); 
}

.modern-bubble-animation-message {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modern-bubble-animation-dot-container {
    display: flex;
    justify-content: space-between;
    width: 40px;
}

.modern-animated-dot {
    width: 8px;
    height: 8px;
    background-color: var(--base-dark-color);
    border-radius: 50%;
    position: relative;
    animation: modern-bounce-upwards-animation 1.2s infinite ease-in-out;
}

.modern-animated-dot:nth-child(1) {
    animation-delay: -0.32s;
}
.modern-animated-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes modern-bounce-upwards-animation {
    0%, 80%, 100% {
        transform: translateY(4px) scale(0);
    }
    40% {
        transform: translateY(-1px) scale(1);
    }
}


.chatBotMessage {
    font-weight: bold;
    display: block;
}

.llm-rounded-border {
    border-radius: 5px;
    border: 1px solid var(--border-color-3);
}

.llm-chart-rounded-border {
    border-radius: 6px;
    border: 1px solid var(--border-color-1);
    background: white;
}
.llm-chart-rounded-border:hover {
    border-radius: 24px;
    border: 1px solid var(--border-color-1);
    background: #FFF;
}

/* Markdown rendering styles for AI messages */
.llm-modern-messaging-text-received-modifier .x-panel-body {
    white-space: normal;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}
.llm-modern-messaging-text-received-modifier p {
    margin: 0 0 0.5em 0;
}
.llm-modern-messaging-text-received-modifier p:last-child {
    margin-bottom: 0;
}
.llm-modern-messaging-text-received-modifier code {
    background-color: var(--alt-background-color);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}
.llm-modern-messaging-text-received-modifier pre {
    background-color: var(--alt-background-color);
    padding: 8px 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5em 0;
}
.llm-modern-messaging-text-received-modifier pre code {
    background: none;
    padding: 0;
}
.llm-modern-messaging-text-received-modifier ul,
.llm-modern-messaging-text-received-modifier ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}
.llm-markdown-table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    margin: 0.5em 0;
    display: block;
}
.llm-modern-messaging-text-received-modifier table {
    border-collapse: collapse;
    margin: 0;
}
.llm-modern-messaging-text-received-modifier th,
.llm-modern-messaging-text-received-modifier td {
    border: 1px solid var(--border-color-3);
    padding: 4px 8px;
    white-space: nowrap;
}
.llm-modern-messaging-text-received-modifier blockquote {
    border-left: 3px solid var(--border-color-3);
    margin: 0.5em 0;
    padding-left: 10px;
    color: var(--light-color);
}


/* ── Confirmation Dialog ── */
.llm-confirmation-panel {
    border-radius: 12px;
    border: 1px solid var(--border-color-1);
    background: #FFF;
    padding: 16px;
    margin-left: 20px;
    margin-right: 15%;
}

.llm-confirmation-header {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.llm-confirmation-header .fa-shield-alt {
    color: var(--base-color);
    font-size: 16px;
}

.llm-confirmation-tool-card {
    border-radius: 8px;
    border: 1px solid var(--border-color-1);
    background: var(--alt-background-color);
    padding: 12px;
    margin: 0 2px 8px 2px;
    position: relative;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    border-left: 3px solid transparent;
}

.llm-confirmation-tool-header {
    display: flex;
    align-items: center;
}

.llm-confirmation-tool-name {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--color);
}

.llm-confirmation-tool-details {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--light-color);
    background: var(--alt-background-color);
    border-radius: 6px;
    padding: 8px 10px;
    max-height: 160px;
    overflow-y: auto;
}

/* ── Per-tool confirmation message ── */
.llm-confirmation-tool-message {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #3c4043;
    background: rgba(5, 113, 134, 0.05);
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.llm-confirmation-tool-message .fa-info-circle {
    color: #057186;
    margin-right: 4px;
}

/* ── Per-tool Accept / Reject action links ── */
.llm-confirmation-tool-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding-top: 0;
}

.llm-tool-action-link {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
    color: #5f6368;
    white-space: nowrap;
}

.llm-tool-action-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

.llm-tool-action-link.llm-tool-action-accept.llm-tool-action-active {
    color: #057186;
    font-weight: 600;
}

.llm-tool-action-link.llm-tool-action-reject.llm-tool-action-active {
    color: #d93025;
    font-weight: 600;
}

.llm-tool-action-sep {
    color: #dadce0;
    font-size: 11px;
    user-select: none;
    padding: 0 2px;
}

/* ── Per-tool redirect textarea ── */
.llm-tool-redirect-area {
    margin-top: 8px;
}

.llm-tool-redirect-field .x-form-text {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #dadce0;
    padding: 6px 10px;
    resize: vertical;
}

.llm-tool-redirect-field .x-form-text:focus {
    border-color: #d93025;
    box-shadow: 0 0 0 2px rgba(217, 48, 37, 0.15);
}

/* ── Card state styling ── */
.llm-confirmation-tool-card.llm-card-accepted {
    border-left: 3px solid #34a853;
}

.llm-confirmation-tool-card.llm-card-rejected {
    border-left: 3px solid #d93025;
}

.llm-confirmation-param-row {
    padding: 4px 0;
    line-height: 1.4;
}

.llm-confirmation-param-row + .llm-confirmation-param-row {
    border-top: 1px solid var(--border-color-2);
}

/* ── Object-level grouping ── */
.llm-confirmation-param-group {
    padding: 6px 0;
}

.llm-confirmation-param-group + .llm-confirmation-param-group,
.llm-confirmation-param-group + .llm-confirmation-param-row,
.llm-confirmation-param-row + .llm-confirmation-param-group {
    border-top: 1px solid var(--border-color-2);
}

.llm-param-group-key {
    font-size: 12px;
    margin-bottom: 4px;
}

.llm-confirmation-param-group-body {
    margin-left: 12px;
    padding-left: 10px;
    border-left: 2px solid var(--border-color-2);
}

.llm-confirmation-param-group-body .llm-confirmation-param-row:first-child {
    padding-top: 0;
}

.llm-param-object-pre {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: var(--light-color);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    line-height: 1.5;
}

/* ── SQL formatting ── */
.llm-param-sql-pre {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: var(--color);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    line-height: 1.6;
    background: var(--alt-background-color);
    padding: 6px 8px;
    border-radius: 4px;
}

.llm-sql-keyword {
    color: var(--base-color);
    font-weight: 600;
}

.llm-param-viewer-sql {
    padding: 4px;
}

.llm-param-viewer-sql .llm-param-sql-pre {
    font-size: 12px;
    line-height: 1.7;
    padding: 10px 12px;
}

.llm-confirmation-param-key {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--color);
}

.llm-confirmation-param-key::after {
    content: ':';
}

.llm-confirmation-param-val {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: var(--light-color);
    white-space: pre-wrap;
    word-break: break-word;
    display: block;
    margin-top: 2px;
}

.llm-confirmation-param-val.llm-param-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.llm-confirmation-param-expand {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: var(--base-color);
    cursor: pointer;
    user-select: none;
    margin-top: 2px;
    display: inline-block;
}

.llm-confirmation-param-expand:hover {
    text-decoration: underline;
}

.llm-confirmation-param-val.llm-param-markdown {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    white-space: normal;
}

.llm-confirmation-param-val.llm-param-markdown p {
    margin: 0 0 4px 0;
}

.llm-confirmation-param-val.llm-param-markdown p:last-child {
    margin-bottom: 0;
}

.llm-confirmation-param-val.llm-param-markdown code {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    background: var(--alt-background-color);
    padding: 1px 4px;
    border-radius: 3px;
}

.llm-confirmation-param-val.llm-param-markdown pre {
    background: var(--alt-background-color);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 4px 0;
}

.llm-confirmation-param-val.llm-param-markdown pre code {
    background: none;
    padding: 0;
}

.llm-confirmation-param-val.llm-param-markdown ul,
.llm-confirmation-param-val.llm-param-markdown ol {
    margin: 4px 0;
    padding-left: 20px;
}

.llm-confirmation-param-val.llm-param-markdown table {
    border-collapse: collapse;
    margin: 4px 0;
    font-size: 11px;
}

.llm-confirmation-param-val.llm-param-markdown th,
.llm-confirmation-param-val.llm-param-markdown td {
    border: 1px solid var(--border-color-2);
    padding: 4px 8px;
}

.llm-param-viewer-body {
    padding: 12px;
    background: var(--alt-background-color);
    height: 100%;
    overflow: auto;
}

.llm-param-viewer-pre {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: var(--color);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    line-height: 1.5;
}

.llm-param-viewer-markdown {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    color: var(--color);
    line-height: 1.6;
    word-break: break-word;
}

.llm-param-viewer-markdown p {
    margin: 0 0 8px 0;
}

.llm-param-viewer-markdown p:last-child {
    margin-bottom: 0;
}

.llm-param-viewer-markdown code {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    background: var(--alt-background-color);
    padding: 1px 4px;
    border-radius: 3px;
}

.llm-param-viewer-markdown pre {
    background: var(--alt-background-color);
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.llm-param-viewer-markdown pre code {
    background: none;
    padding: 0;
}

.llm-confirmation-footer {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color-1);
}

.llm-confirm-execute-btn {
    border-radius: 20px !important;
    background: var(--base-color) !important;
    color: #fff !important;
    border: none !important;
    padding: 6px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
}
.llm-confirm-execute-btn .x-btn-inner {
    color: #fff !important;
}
.llm-confirm-execute-btn:hover {
    background: var(--base-dark-color) !important;
    box-shadow: var(--shadow-light);
}

.llm-confirm-cancel-btn {
    border-radius: 20px !important;
    background: transparent !important;
    color: #d93025 !important;
    border: none !important;
    padding: 6px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
}
.llm-confirm-cancel-btn .x-btn-inner {
    color: #d93025 !important;
}
.llm-confirm-cancel-btn:hover {
    background: rgba(217, 48, 37, 0.06) !important;
}

/* ── Tool Execution Status ── */

/* ── Chat Box Disabled State ── */
.llm-chat-box-disabled .x-panel-body,
.splash-screen-chat-box-panel-no-outline.llm-chat-box-disabled .x-panel-body,
.splash-screen-chat-box-panel.llm-chat-box-disabled .x-panel-body {
    background-color: #ebebeb !important;
    box-shadow: none !important;
}

.llm-chat-box-disabled .x-form-field {
    background-color: #ebebeb !important;
    cursor: not-allowed !important;
    color: #aaa !important;
}

.llm-chat-box-disabled .conversation-stop-btn {
    opacity: 1 !important;
}

/* ── Tool Execution Status ── */
.llm-tool-status-panel {
    border-radius: 12px;
    border: 1px solid var(--border-color-1);
    padding: 12px 16px;
    margin: 8px 0;
    background: #FCFCFF;
}

.llm-tool-status-header {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--base-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.llm-tool-status-item {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--color);
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.llm-tool-status-icon {
    font-size: 14px;
    width: 14px;
    text-align: center;
}

.llm-tool-status-running {
    color: var(--base-color);
}

.llm-tool-status-done {
    color: var(--status-green-vibrant);
}

.llm-tool-status-error {
    color: var(--status-red-vibrant);
}

.llm-tool-status-skipped {
    color: var(--light-color);
}

.llm-tool-status-name {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
}


/* ── Conversation Cost Bar ── */
.llm-conversation-cost-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 4px 16px;
    margin: 0 10px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: var(--light-color);
}

.llm-cost-icon {
    color: var(--base-color);
    font-size: 12px;
}

.llm-cost-value {
    font-weight: 600;
    color: var(--color);
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
}

/* ── Usage Container ── */
.llm-usage-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    justify-content: flex-end;
}

.llm-usage-container.llm-usage-power {
    gap: 8px;
}

.llm-usage-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.llm-cost-label {
    color: var(--light-color);
    font-size: 11px;
}

/* ── Usage Progress Bar ── */
.llm-usage-bar-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 1 auto;
}

.llm-usage-bar-label {
    font-size: 10px;
    color: var(--light-color);
    white-space: nowrap;
}

.llm-usage-bar-track {
    flex: 1;
    display: block;
    height: 8px;
    background: var(--faded-color);
    border-radius: 4px;
    overflow: hidden;
    width: 36px;
    min-width: 24px;
}

.llm-usage-bar-fill {
    display: block;
    height: 100%;
    background: var(--status-green-vibrant);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.llm-usage-bar-fill.warning {
    background: var(--status-yellow-vibrant);
}

.llm-usage-bar-fill.danger {
    background: var(--status-red-vibrant);
}

.llm-usage-bar-pct {
    font-size: 10px;
    font-weight: 600;
    color: var(--color);
    font-family: 'Roboto Mono', monospace;
    text-align: right;
    white-space: nowrap;
}

/* ── Info Button ── */
.llm-usage-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    color: var(--base-color);
    font-size: 13px;
    margin-left: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.llm-usage-info-btn:hover {
    opacity: 1;
}
