.ia-topbar-trigger {
    padding-inline: 0.9rem;
    white-space: nowrap;
}

html.ia-chat-scroll-lock,
html.ia-chat-scroll-lock body {
    overflow: hidden !important;
}

html.ia-chat-scroll-lock .page-wrapper,
html.ia-chat-scroll-lock .page-content {
    overflow: hidden !important;
}

.ia-chat-offcanvas {
    left: var(--ia-chat-offset-left, var(--bs-startbar-width, 240px));
    width: calc(100vw - var(--ia-chat-offset-left, var(--bs-startbar-width, 240px)));
    --bs-offcanvas-width: calc(100vw - var(--ia-chat-offset-left, var(--bs-startbar-width, 240px)));
    --bs-primary: #7c3aed;
    --bs-primary-rgb: 124, 58, 237;
}

/* offcanvas sem header proprio - topbar integrado no chat-main */
.ia-chat-offcanvas > .offcanvas-header {
    display: none;
}

.ia-chat-agent-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: min(420px, 52vw);
}

.ia-chat-agent-picker {
    position: relative;
    min-width: 0;
    flex: 1 1 auto;
}

.ia-chat-agent-picker.is-disabled {
    opacity: 0.7;
}

.ia-chat-agent-trigger {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    font-size: 0.78rem;
    padding: 0.5rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: left;
}

.ia-chat-agent-trigger:disabled {
    cursor: not-allowed;
}

.ia-chat-agent-trigger-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ia-chat-agent-menu {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    width: min(100%, 600px);
    min-width: 320px;
    background: var(--bs-secondary-bg);
    border: 1px solid rgba(122, 130, 177, 0.28);
    border-radius: 24px;
    padding: 1rem 0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    z-index: 1065;
    display: none;
}

.ia-chat-agent-picker.is-open .ia-chat-agent-menu {
    display: block;
}

.ia-chat-agent-menu-title {
    padding: 0 1.25rem 0.85rem;
    color: var(--bs-secondary-color);
    font-size: 0.84rem;
}

.ia-chat-agent-option {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-align: left;
}

.ia-chat-agent-option:hover {
    background: rgba(124, 58, 237, 0.04);
}

.ia-chat-agent-option-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ia-chat-agent-option-title {
    font-size: 0.92rem;
    color: var(--bs-body-color);
}

.ia-chat-agent-option-check {
    opacity: 0;
    font-size: 1rem;
    flex-shrink: 0;
}

.ia-chat-agent-option.is-selected .ia-chat-agent-option-check {
    opacity: 1;
}

.ia-chat-agent-divider {
    height: 1px;
    background: rgba(122, 130, 177, 0.22);
    margin: 0.25rem 1.25rem 0.45rem;
}

.ia-chat-agent-empty {
    padding: 0 1.25rem 0.85rem;
    color: var(--bs-secondary-color);
    font-size: 0.84rem;
}

.ia-chat-agent-add {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.ia-chat-body {
    background: var(--bs-body-bg);
    display: flex;
    flex-direction: row;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ---- Sidebar lateral ---- */
.ia-chat-sidebar {
    width: 280px;
    min-width: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bs-secondary-bg, #f8f9fa);
    border-right: 1px solid var(--bs-border-color);
    margin-left: -280px;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.ia-chat-sidebar.is-visible {
    margin-left: 0;
}

.ia-chat-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    flex-shrink: 0;
}

.ia-chat-sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--bs-heading-color);
}

.ia-chat-sidebar-close {
    border: 0;
    background: transparent;
    color: var(--bs-text-muted);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    transition: background 0.12s ease, color 0.12s ease;
}

.ia-chat-sidebar-close:hover {
    background: var(--bs-border-color);
    color: var(--bs-body-color);
}

/* ---- Nav items (Novo Chat, Agentes) ---- */
.ia-chat-sidebar-nav {
    padding: 0 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.ia-chat-sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: background 0.12s ease;
    text-decoration: none;
}

.ia-chat-sidebar-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--bs-body-color);
}

.ia-chat-sidebar-nav-item i {
    font-size: 17px;
    color: var(--bs-primary);
}

/* ---- Pesquisa no histórico ---- */
.ia-chat-sidebar-search-wrap {
    padding: 0.6rem 0.75rem 0;
    flex-shrink: 0;
}

.ia-chat-sidebar-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.15rem 0;
}

.ia-chat-sidebar-search-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ia-chat-sidebar-search-btn {
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.ia-chat-sidebar-search-btn:hover {
    background: var(--bs-border-color);
    color: var(--bs-body-color);
}

.ia-chat-sidebar-search-input-wrap {
    padding-top: 0.45rem;
}

.ia-chat-sidebar-search-input-wrap.is-hidden {
    display: none;
}

.ia-chat-sidebar-search-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 0.4rem 0.6rem;
    background: var(--bs-secondary-bg);
    transition: border-color 0.15s ease;
}

.ia-chat-sidebar-search-field:focus-within {
    border-color: rgba(var(--bs-primary-rgb), 0.4);
}

.ia-chat-sidebar-search-field i {
    color: var(--bs-secondary-color);
    flex-shrink: 0;
}

.ia-chat-sidebar-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: var(--bs-body-color);
    flex: 1;
    min-width: 0;
    padding: 0;
}

.ia-chat-sidebar-search-input::placeholder {
    color: var(--bs-secondary-color);
}

.ia-chat-sidebar-search-clear {
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.ia-chat-sidebar-search-clear:hover {
    color: var(--bs-body-color);
}

/* ---- Grupos de data no histórico ---- */
.ia-chat-history-group-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.65rem 0.65rem 0.3rem;
}

/* ---- Area principal do chat ---- */
.ia-chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* ---- Topbar fixo da conversa (estilo Inner) ---- */
.ia-chat-conv-topbar {
    display: flex;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    flex-shrink: 0;
    z-index: 5;
}

.ia-chat-conv-topbar-inner {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ia-chat-topbar-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--bs-secondary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    text-decoration: none;
}

.ia-chat-topbar-btn:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.ia-chat-topbar-btn--primary {
    background: var(--bs-primary);
    color: #fff;
    border-radius: 8px;
}

.ia-chat-topbar-btn--primary:hover {
    background: #2856d4;
    color: #fff;
}

.ia-chat-conv-topbar-center {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.ia-chat-conv-topbar-center:empty,
.ia-chat-conv-topbar-center.is-hidden {
    visibility: hidden;
}

.ia-chat-conv-topbar-avatars {
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
}

.ia-chat-conv-topbar-avatars:empty {
    display: none;
}

.ia-chat-conv-topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--bs-body-bg);
    object-fit: contain;
    background: var(--bs-secondary-bg);
    flex-shrink: 0;
}

.ia-chat-conv-topbar-avatar:not(:first-child) {
    margin-left: -10px;
}

.ia-chat-conv-topbar-avatar-plus {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--bs-body-bg);
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: -10px;
    flex-shrink: 0;
}

.ia-chat-conv-topbar-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.05rem;
}

.ia-chat-conv-topbar-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bs-heading-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-radius: 4px;
    padding: 0.05rem 0.2rem;
    transition: background 0.15s ease;
}

.ia-chat-conv-topbar-title:hover {
    background: var(--bs-secondary-bg);
}

.ia-chat-conv-topbar-models {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0.2rem;
}

.ia-chat-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* ---- Lista de conversas na sidebar ---- */
.ia-chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.ia-chat-history-sentinel {
    height: 1px;
    width: 100%;
}

.ia-chat-history-item {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    border-radius: 8px;
    transition: background 0.12s ease;
    margin-bottom: 2px;
}

.ia-chat-history-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.ia-chat-history-open {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.65rem;
}

.ia-chat-history-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    margin-right: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.ia-chat-history-item:hover .ia-chat-history-actions {
    opacity: 1;
}

.ia-chat-history-rename,
.ia-chat-history-delete {
    border: 0;
    background: transparent;
    color: var(--bs-text-muted);
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    padding: 0;
}

.ia-chat-history-rename:hover {
    color: var(--bs-primary);
    background: rgba(124, 58, 237, 0.1);
}

.ia-chat-history-delete:hover {
    color: var(--bs-danger);
    background: rgba(220, 53, 69, 0.1);
}

.ia-chat-history-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--bs-body-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ia-chat-history-item-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
    line-height: 1.4;
}

.ia-chat-history-item-badge--livre {
    background-color: rgba(var(--bs-secondary-rgb, 108, 117, 125), 0.1);
    color: var(--bs-secondary);
    border-color: rgba(var(--bs-secondary-rgb, 108, 117, 125), 0.2);
}

.ia-chat-history-empty {
    padding: 2rem 1rem;
    font-size: 13px;
    color: var(--bs-text-muted);
    text-align: center;
}

.ia-chat-history-item.is-active {
    background: rgba(124, 58, 237, 0.08);
}

.ia-chat-history-item.is-active .ia-chat-history-item-title {
    color: var(--bs-primary);
    font-weight: 600;
}


.ia-chat-new-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bs-body-bg);
}

.ia-chat-new-panel.is-hidden {
    display: none;
}

.ia-chat-new-panel-inner {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.ia-chat-new-panel-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.1);
    color: var(--bs-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
}

.ia-chat-new-panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--bs-heading-color);
    margin-bottom: 0.5rem;
}

.ia-chat-new-panel-desc {
    font-size: 0.85rem;
    color: var(--bs-text-muted);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

.ia-chat-new-panel-field {
    text-align: left;
    margin-bottom: 1.5rem;
}

.ia-chat-new-panel-field .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
}

.ia-chat-new-panel-field .form-select {
    font-size: 0.9rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-secondary-bg);
}

.ia-chat-new-panel-actions {
    display: flex;
    gap: 0.75rem;
}

.ia-chat-new-panel-actions .btn-primary {
    flex: 1;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
}

.ia-chat-new-panel-actions .btn-light {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 10px;
}

/* ---- Painel de Agentes (cards) ---- */
.ia-chat-agentes-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    background: var(--bs-body-bg);
}

.ia-chat-agentes-panel.is-hidden {
    display: none;
}

.ia-chat-agentes-panel-inner {
    width: 100%;
    max-width: 720px;
}

.ia-chat-agentes-panel-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.25rem;
    color: var(--bs-heading-color);
}

.ia-chat-agentes-panel-search {
    position: relative;
    margin-bottom: 1.25rem;
}

.ia-chat-agentes-panel-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--bs-text-muted);
    pointer-events: none;
}

.ia-chat-agentes-panel-search input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.5rem;
    border-radius: 10px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    font-size: 0.9rem;
    color: var(--bs-body-color);
    outline: none;
    transition: border-color 0.15s;
}

.ia-chat-agentes-panel-search input:focus {
    border-color: var(--bs-primary);
}

.ia-chat-agentes-panel-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    justify-content: center;
}

.ia-chat-agentes-tab {
    border: none;
    background: transparent;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bs-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.ia-chat-agentes-tab:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--bs-body-color);
}

.ia-chat-agentes-tab.is-active {
    background: var(--bs-primary);
    color: #fff;
}

.ia-chat-agentes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.ia-chat-agente-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 1.15rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
    background: var(--bs-secondary-bg);
    position: relative;
}

.ia-chat-agente-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.12);
    transform: translateY(-1px);
}

.ia-chat-agente-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.ia-chat-agente-card-nome {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--bs-heading-color);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.ia-chat-agente-card-desc {
    font-size: 0.78rem;
    color: var(--bs-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ia-chat-agente-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--bs-primary);
}

.ia-chat-agente-card-star {
    position: absolute;
    top: 8px;
    left: 8px;
    border: none;
    background: transparent;
    padding: 4px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--bs-text-muted);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, transform 0.12s;
    z-index: 2;
    line-height: 1;
}

.ia-chat-agente-card:hover .ia-chat-agente-card-star,
.ia-chat-agente-card-star.is-favorito {
    opacity: 1;
}

.ia-chat-agente-card-star.is-favorito {
    color: #f59e0b;
}

.ia-chat-agente-card-star:hover {
    color: #f59e0b;
    transform: scale(1.15);
}

.ia-chat-agentes-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--bs-text-muted);
    font-size: 0.88rem;
    grid-column: 1 / -1;
}

.ia-chat-agentes-panel-footer {
    text-align: center;
    padding-top: 0.5rem;
}

/* Modo livre card especial */
.ia-chat-agente-card--livre {
    border-style: dashed;
}

.ia-chat-agente-card--livre .ia-chat-agente-card-avatar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.ia-chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

.ia-chat-empty.is-hidden {
    display: none;
}

.ia-chat-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    z-index: 5;
}
.ia-chat-loader.is-hidden {
    display: none;
}
.ia-chat-loader-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--bs-border-color, #dee2e6);
    border-top-color: var(--bs-primary, #0d6efd);
    border-radius: 50%;
    animation: ia-chat-spin 0.8s linear infinite;
}
.ia-chat-loader-text {
    font-size: 0.875rem;
    color: var(--bs-secondary, #6c757d);
}
@keyframes ia-chat-spin {
    to { transform: rotate(360deg); }
}

.ia-chat-messages {
    flex: 1;
    display: none;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    gap: 0.75rem;
}

.ia-chat-messages.is-visible {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ia-chat-row {
    display: flex;
    width: 100%;
    max-width: 860px;
}

.ia-chat-row-user {
    justify-content: flex-end;
}

.ia-chat-row-ai {
    justify-content: flex-start;
    flex-direction: column;
    gap: 0.25rem;
}

.ia-chat-bubble {
    max-width: 75%;
    border-radius: 18px;
    padding: 0.6rem 1rem;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}

.ia-chat-row-user .ia-chat-bubble {
    background: var(--bs-primary);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

.ia-chat-row-ai .ia-chat-bubble {
    background: transparent;
    color: var(--bs-body-color);
    border: none;
    border-radius: 0;
    max-width: 100%;
    padding: 0.25rem 0;
}

/* ---- Model header nas mensagens da IA ---- */
.ia-chat-msg-model-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.2rem;
}

.ia-chat-msg-model-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: contain;
}

.ia-chat-msg-model-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bs-heading-color);
}

.ia-chat-msg-model-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.ia-chat-msg-model-badge img {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.ia-chat-bubble .ia-chat-table,
.ia-chat-bubble table.ia-chat-table {
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 13px;
}

.ia-chat-bubble--has-table .ia-chat-export-wrap {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Markdown: headings, blockquote, hr, listas, links */
.ia-chat-bubble h1,
.ia-chat-bubble h2,
.ia-chat-bubble h3,
.ia-chat-bubble h4,
.ia-chat-bubble h5,
.ia-chat-bubble h6 {
    margin: 0.75rem 0 0.4rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--bs-heading-color);
}
.ia-chat-bubble h1 { font-size: 1.3rem; }
.ia-chat-bubble h2 { font-size: 1.15rem; }
.ia-chat-bubble h3 { font-size: 1.05rem; }
.ia-chat-bubble h4 { font-size: 0.95rem; }
.ia-chat-bubble h1:first-child,
.ia-chat-bubble h2:first-child,
.ia-chat-bubble h3:first-child { margin-top: 0; }

.ia-chat-bubble p {
    margin: 0.35rem 0;
    line-height: 1.6;
}
.ia-chat-bubble p:first-child { margin-top: 0; }
.ia-chat-bubble p:last-child { margin-bottom: 0; }

.ia-chat-bubble ul,
.ia-chat-bubble ol {
    margin: 0.4rem 0;
    padding-left: 1.4rem;
}

.ia-chat-bubble li {
    margin-bottom: 0.2rem;
    line-height: 1.5;
}

.ia-chat-bubble blockquote {
    border-left: 3px solid var(--bs-primary);
    margin: 0.5rem 0;
    padding: 0.4rem 0.8rem;
    color: var(--bs-text-muted);
    background: rgba(0,0,0,0.02);
    border-radius: 0 6px 6px 0;
}

.ia-chat-bubble hr {
    border: none;
    border-top: 1px solid var(--bs-border-color);
    margin: 0.75rem 0;
}

.ia-chat-bubble a {
    color: var(--bs-primary);
    text-decoration: underline;
}

.ia-chat-bubble code:not([class]) {
    background: rgba(0,0,0,0.06);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Wrapper de tabela com scroll horizontal */
.ia-chat-table-wrap {
    overflow-x: auto;
    margin: 0.5rem 0;
    border-radius: 8px;
}

.ia-chat-table-wrap table {
    margin-bottom: 0;
    font-size: 0.82rem;
}

/* Botão copiar código em blocos pre */
.ia-chat-bubble pre {
    position: relative;
    background: #1e1e2e;
    color: #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    font-size: 0.82rem;
}

.ia-chat-code-copy-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 6px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
    transition: all 0.15s ease;
}

.ia-chat-code-copy-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.ia-chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 18px;
}

.ia-chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #7a82b1;
    animation: iaTyping 0.9s infinite ease-in-out;
}

.ia-chat-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ia-chat-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes iaTyping {
    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.ia-chat-typing-label {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    font-style: italic;
    margin-left: 0.3rem;
}

.ia-chat-input-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1rem 1rem;
    background: transparent;
    width: 100%;
}

.ia-chat-input-wrap .ia-chat-compose {
    width: 100%;
    max-width: 860px;
}

.ia-chat-compose {
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bs-border-color);
    border-radius: 20px;
    background: var(--bs-body-bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ia-chat-compose:focus-within {
    border-color: rgba(var(--bs-primary-rgb), 0.4);
    box-shadow: 0 2px 16px rgba(var(--bs-primary-rgb), 0.1);
}

.ia-chat-compose-inner {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem 0.5rem 1rem;
}

.ia-chat-compose-textarea {
    flex: 1;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
    resize: none;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    border-radius: 0;
}

.ia-chat-compose-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    padding-bottom: 0.1rem;
}

.ia-chat-action-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--bs-secondary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    padding: 0;
}

.ia-chat-action-btn:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.ia-chat-action-btn--send {
    background: var(--bs-primary);
    color: #fff;
    border-radius: 10px;
}

.ia-chat-action-btn--send:hover {
    background: #2856d4;
    color: #fff;
}

.ia-chat-action-btn--send.ia-chat-send--loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

.ia-chat-action-btn--send.ia-chat-send--loading .iconoir-send {
    display: none;
}

.ia-chat-action-btn--send.ia-chat-send--loading::after {
    content: "";
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: iaSpin 0.6s linear infinite;
}

@keyframes iaSpin {
    to { transform: rotate(360deg); }
}

.ia-chat-compose-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem 0.5rem;
    border-top: 1px solid var(--bs-border-color-translucent);
}

/* ---- Botão Prompts ---- */
.ia-chat-prompts-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
}

.ia-chat-prompts-btn:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.3);
    background: rgba(var(--bs-primary-rgb), 0.04);
}

/* ---- Modal Criar Prompt ---- */
.ia-chat-prompt-modal {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
}

.ia-chat-prompt-modal.is-hidden {
    display: none;
}

.ia-chat-prompt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.25);
}

.ia-chat-prompt-modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--bs-body-bg);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    margin-bottom: 80px;
    overflow: hidden;
}

.ia-chat-prompt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.ia-chat-prompt-modal-title {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0;
    color: var(--bs-heading-color);
}

.ia-chat-prompt-modal-close-btn {
    border: none;
    background: none;
    color: var(--bs-text-muted);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 6px;
    transition: background 0.12s;
}

.ia-chat-prompt-modal-close-btn:hover {
    background: rgba(0,0,0,0.06);
}

.ia-chat-prompt-modal-body {
    padding: 1rem;
}

.ia-chat-prompt-modal-body textarea {
    font-size: 0.88rem;
    border-radius: 10px;
    resize: vertical;
}

.ia-chat-prompt-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--bs-border-color);
}

/* ---- Seletor de modelo ---- */
.ia-chat-model-selector {
    position: relative;
}

.ia-chat-model-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    border-radius: 999px;
    padding: 0.25rem 0.65rem 0.25rem 0.35rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ia-chat-model-trigger:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.3);
    background: rgba(var(--bs-primary-rgb), 0.04);
}

.ia-chat-model-trigger-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: contain;
}

.ia-chat-model-trigger-label {
    white-space: nowrap;
}

.ia-chat-model-menu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    min-width: 240px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
    padding: 0.4rem;
    display: none;
    z-index: 1065;
}

.ia-chat-model-selector.is-open .ia-chat-model-menu {
    display: block;
}

.ia-chat-model-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: background 0.12s ease;
    text-align: left;
}

.ia-chat-model-option:hover {
    background: var(--bs-secondary-bg);
}

.ia-chat-model-option.is-selected {
    background: rgba(var(--bs-primary-rgb), 0.06);
}

.ia-chat-model-option-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
}

.ia-chat-model-option-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ia-chat-model-option-name {
    font-weight: 600;
    font-size: 0.84rem;
}

.ia-chat-model-option-desc {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

.ia-chat-model-option-check {
    opacity: 0;
    color: var(--bs-primary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ia-chat-model-option.is-selected .ia-chat-model-option-check {
    opacity: 1;
}

/* Menu de modelos: scroll e largura */
.ia-chat-model-menu {
    max-height: 420px;
    overflow-y: auto;
    min-width: 280px;
}

/* Separador entre AUTO e provedores */
.ia-chat-model-separator {
    height: 1px;
    background: var(--bs-border-color);
    margin: 0.3rem 0.5rem;
}

/* Header de grupo de provedor */
.ia-chat-model-group-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem 0.25rem;
    margin-top: 0.15rem;
}

.ia-chat-model-group-icon {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    object-fit: contain;
}

.ia-chat-model-group-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ia-chat-model-group-count {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--bs-white);
    background: var(--bs-primary);
    border-radius: 6px;
    padding: 0.08rem 0.38rem;
    line-height: 1.3;
}

/* Destaque do PH IA AUTO */
.ia-chat-model-option.is-auto {
    border: 1px solid rgba(var(--bs-primary-rgb), 0.15);
    background: rgba(var(--bs-primary-rgb), 0.03);
}

.ia-chat-model-option.is-auto:hover {
    background: rgba(var(--bs-primary-rgb), 0.08);
}

/* Badge AUTO na mensagem */
.ia-chat-msg-model-badge--auto {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1)) !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
}

.ia-chat-empty h4,
.ia-chat-empty p {
    font-weight: 400;
}

.ia-agentes-page .ia-agentes-list-card,
.ia-agentes-page .ia-agentes-form-card {
    border: 1px solid rgba(124, 58, 237, 0.08);
    box-shadow: 0 12px 28px rgba(20, 32, 68, 0.05);
}

.ia-agentes-page .ia-agentes-training-card {
    border: 1px solid rgba(124, 58, 237, 0.08);
    box-shadow: 0 10px 22px rgba(20, 32, 68, 0.04);
    border-radius: 18px;
}

.ia-agente-upload-box {
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.ia-agente-upload-preview {
    margin-top: 0.9rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ia-agente-upload-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    text-align: left;
}

.ia-agente-upload-file-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ia-agente-upload-file-icon i {
    font-size: 18px;
}

.ia-agente-upload-file-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.ia-agente-upload-file-text strong,
.ia-agente-upload-file-text small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ia-agente-upload-file-remove {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: rgba(220, 53, 69, 0.1);
    color: #b02a37;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
}

.ia-agente-upload-file-remove:hover {
    background: rgba(220, 53, 69, 0.16);
}

.ia-agente-upload-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--bs-secondary-color);
}

.ia-agentes-page h1,
.ia-agentes-page h2,
.ia-agentes-page h3,
.ia-agentes-page h4,
.ia-agentes-page h5,
.ia-agentes-page h6,
.ia-agentes-page p,
.ia-agentes-page strong,
.ia-agentes-page label,
.ia-agentes-page .form-label,
.ia-agentes-page .page-title,
.ia-agentes-page .app-head-subtitle,
.ia-agentes-page .btn,
.ia-agentes-page .badge,
.ia-agentes-page .ia-agente-item-title,
.ia-agentes-page .ia-agente-item-desc,
.ia-agentes-page .ia-agente-item-meta,
.ia-agentes-page .ia-agentes-panel-subtitle,
.ia-agentes-page .ia-agentes-empty,
.ia-agentes-page .ia-agentes-training-empty,
.ia-agentes-page .ia-agentes-training-item,
.ia-agentes-page .form-control,
.ia-agentes-page .form-select {
    font-weight: 300 !important;
}

.ia-agentes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ia-agente-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 16px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ia-agente-item-link {
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.ia-agente-item-link:hover {
    color: inherit;
}

.ia-agente-item-delete {
    flex-shrink: 0;
}

.ia-agente-item:hover {
    border-color: rgba(124, 58, 237, 0.24);
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.08);
    transform: translateY(-1px);
}

.ia-agente-item.is-active {
    border-color: rgba(124, 58, 237, 0.35);
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.05) 0%, rgba(124, 58, 237, 0.02) 100%);
}

.ia-agente-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.ia-agente-item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--bs-heading-color);
}

.ia-agente-item-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--bs-secondary-color);
    margin-bottom: 0.8rem;
}

.ia-agente-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 12px;
    color: var(--bs-secondary-color);
}

.ia-agente-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 11px;
    font-weight: 600;
}

.ia-agente-badge--active {
    background: rgba(25, 135, 84, 0.12);
    color: #157347;
}

.ia-agente-badge--inactive {
    background: rgba(220, 53, 69, 0.12);
    color: #b02a37;
}

.ia-agente-badge--erro {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.25);
}

.ia-agentes-empty {
    padding: 1.25rem;
    border-radius: 16px;
    background: #fbfbfc;
    border: 1px dashed var(--bs-border-color);
    color: var(--bs-secondary-color);
}

.ia-agentes-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.ia-agentes-panel-subtitle {
    font-size: 13px;
    color: var(--bs-secondary-color);
}

.ia-agentes-training-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ia-agentes-training-item {
    border: 1px solid var(--bs-border-color);
    border-radius: 16px;
    padding: 1rem;
    background: #fff;
}

.ia-agentes-training-item--nested {
    background: #fbfbfc;
}

.ia-agentes-training-index {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ia-agentes-training-empty {
    border: 1px dashed var(--bs-border-color);
    border-radius: 16px;
    padding: 1rem;
    background: #fbfbfc;
    color: var(--bs-secondary-color);
}

.ia-agentes-doc-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.ia-agentes-doc-item {
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    padding: 1rem;
    background: #fbfbfc;
}

.ia-agentes-doc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

/* Chamado IA - Sugestão de análise */
.chamado-ia-suggestion-wrapper {
    margin-top: 1.25rem;
    margin-left: 0.75rem;
    margin-right: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease;
}

.chamado-ia-suggestion-wrapper.is-visible {
    max-height: 1000px;
    opacity: 1;
}

.chamado-ia-suggestion-wrapper.is-hidden {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
}

.chamado-ia-suggestion-box {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    padding: 1.35rem;
    position: relative;
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.chamado-ia-suggestion-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
}

.chamado-ia-suggestion-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(109, 40, 217, 0.04));
    border: 1px solid rgba(124, 58, 237, 0.18);
}

.chamado-ia-suggestion-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.24);
}

.chamado-ia-suggestion-icon.is-pulsing::before {
    content: '';
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(124, 58, 237, 0.3);
    animation: chamado-ia-pulse 1.5s ease-out infinite;
}

@keyframes chamado-ia-pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.chamado-ia-suggestion-title-wrap {
    flex: 1;
    min-width: 0;
}

.chamado-ia-suggestion-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.2rem;
    letter-spacing: -0.01em;
}

.chamado-ia-suggestion-subtitle {
    font-size: 12px;
    color: #475569;
}

.chamado-ia-suggestion-content {
    font-size: 14px;
    line-height: 1.7;
    color: #1f2937;
    padding: 0 0.15rem;
}

.chamado-ia-suggestion-content h1,
.chamado-ia-suggestion-content h2,
.chamado-ia-suggestion-content h3,
.chamado-ia-suggestion-content h4,
.chamado-ia-suggestion-content h5,
.chamado-ia-suggestion-content h6 {
    font-size: 15px;
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.chamado-ia-suggestion-content h1:first-child,
.chamado-ia-suggestion-content h2:first-child,
.chamado-ia-suggestion-content h3:first-child,
.chamado-ia-suggestion-content h4:first-child,
.chamado-ia-suggestion-content h5:first-child,
.chamado-ia-suggestion-content h6:first-child {
    margin-top: 0;
}

.chamado-ia-suggestion-content p {
    margin-bottom: 0.6rem;
}

.chamado-ia-suggestion-content ul,
.chamado-ia-suggestion-content ol {
    margin-bottom: 0.85rem;
    padding-left: 1.4rem;
}

.chamado-ia-suggestion-content li {
    margin-bottom: 0.4rem;
}

.chamado-ia-suggestion-content ul {
    list-style: disc;
}

.chamado-ia-suggestion-content ul li::marker {
    color: #7c3aed;
    font-weight: 700;
}

.chamado-ia-suggestion-content strong {
    font-weight: 700;
    color: #0f172a;
}

.chamado-ia-suggestion-content code {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 13px;
}

.chamado-ia-suggestion-content pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.chamado-ia-suggestion-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* Loading state no botão */
.btn-submit-chamado.is-loading {
    opacity: 0.85;
    pointer-events: none;
    cursor: not-allowed;
    position: relative;
}

.btn-submit-chamado.is-loading .btn-text {
    opacity: 0;
}

.btn-submit-chamado.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btnChamadoSpin 0.6s linear infinite;
}

@keyframes btnChamadoSpin {
    to { transform: rotate(360deg); }
}

.btn-submit-chamado .iconoir-sparkles {
    animation: btn-sparkle 1.5s ease-in-out infinite;
}

@keyframes btn-sparkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@media (max-width: 1199.98px) {
    .ia-chat-offcanvas {
        left: 0;
        width: 100vw;
        --bs-offcanvas-width: 100vw;
    }

    .ia-chat-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 20;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.12);
    }

    .ia-chat-row {
        max-width: 100%;
    }

    .ia-chat-compose {
        max-width: 100%;
    }
}

/* SweetAlert dentro do offcanvas */
.ia-chat-offcanvas .swal2-container {
    z-index: 1100 !important;
    position: fixed !important;
    inset: 0 !important;
}

/* ==== Chat IA: imagens inline nas mensagens ==== */
.ia-chat-msg-img-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 0.4rem;
    gap: 0.4rem;
}

.ia-chat-img-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--bs-primary);
    text-decoration: none;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    transition: all 0.15s;
    cursor: pointer;
}

.ia-chat-img-download-btn:hover {
    background: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
}

.ia-chat-img-download-btn i {
    font-size: 14px;
}

.ia-chat-msg-img {
    display: block;
    max-width: 240px;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
    object-fit: cover;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.ia-chat-row-user .ia-chat-msg-img {
    border-color: rgba(255, 255, 255, 0.2);
}

.ia-chat-msg-img:hover {
    opacity: 0.88;
    transform: scale(1.02);
}

/* ==== Modal de zoom de imagem do chat IA ==== */
.ia-chat-img-zoom-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.ia-chat-img-zoom-modal.is-visible {
    opacity: 1;
    pointer-events: all;
}

.ia-chat-img-zoom-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 92vw;
    max-height: 92vh;
}

.ia-chat-img-zoom-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
    z-index: 1;
}

.ia-chat-img-zoom-close:hover {
    background: rgba(255, 255, 255, 0.26);
}

.ia-chat-img-zoom-img {
    display: block;
    max-width: 92vw;
    max-height: 86vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

/* ==== Lista clicavel de arquivos no chat ==== */
.ia-chat-msg-file-list {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

.ia-chat-msg-file-btn {
    border: 1px solid var(--bs-border-color-translucent);
    background: var(--bs-tertiary-bg);
    color: inherit;
    border-radius: 10px;
    padding: 0.32rem 0.45rem;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    max-width: min(100%, 320px);
    transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.ia-chat-msg-file-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--bs-primary-rgb), 0.45);
    background: rgba(var(--bs-primary-rgb), 0.08);
}

.ia-chat-msg-file-btn.is-file-viewer .ia-chat-msg-file-icon,
.ia-chat-msg-file-btn.is-file-download .ia-chat-msg-file-icon {
    background: rgba(15, 23, 42, 0.3);
    color: #fff;
}

.ia-chat-row-user .ia-chat-msg-file-btn.is-file-viewer .ia-chat-msg-file-icon,
.ia-chat-row-user .ia-chat-msg-file-btn.is-file-download .ia-chat-msg-file-icon {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.ia-chat-row-user .ia-chat-msg-file-btn {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.32);
    color: #fff;
}

.ia-chat-row-user .ia-chat-msg-file-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}

.ia-chat-msg-file-btn.is-disabled,
.ia-chat-msg-file-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ia-chat-msg-file-icon {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(var(--bs-primary-rgb), 0.12);
    color: var(--bs-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.ia-chat-row-user .ia-chat-msg-file-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.ia-chat-msg-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 190px;
    text-align: left;
}

.ia-chat-msg-file-ext {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--bs-secondary-color);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: 999px;
    padding: 0.08rem 0.35rem;
    flex-shrink: 0;
}

.ia-chat-row-user .ia-chat-msg-file-ext {
    color: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.34);
}

/* ==== Offcanvas de visualizacao de arquivo ==== */
.ia-chat-file-viewer-offcanvas {
    width: min(860px, 76vw);
    max-width: 100vw;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    transform: translateX(104%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.22, 1), visibility 0s linear 0.28s;
    z-index: 1085 !important;
    border-left: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: -24px 0 40px rgba(2, 6, 23, 0.26);
}

.ia-chat-file-viewer-offcanvas.show {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.22, 1);
}

.ia-chat-file-viewer-offcanvas .offcanvas-body {
    flex: 1 1 auto;
    position: relative;
    background: #f7f9fc;
    overflow: hidden;
}

.ia-chat-file-viewer-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.9) 100%);
}

.ia-chat-file-viewer-head-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.ia-chat-file-viewer-head-label {
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
}

.ia-chat-file-viewer-head .offcanvas-title {
    font-size: 0.98rem;
    line-height: 1.25;
    color: #0f172a;
}

.ia-chat-file-viewer-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ia-chat-file-viewer-head-actions .btn {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.ia-chat-file-viewer-open-btn,
.ia-chat-file-viewer-close-btn {
    width: 34px;
    padding: 0;
}

.ia-chat-file-viewer-download-btn {
    min-width: 95px;
    font-weight: 600;
}

.ia-chat-file-viewer-open-btn.disabled,
.ia-chat-file-viewer-download-btn.disabled {
    pointer-events: none;
    opacity: 0.55;
}

.ia-chat-file-viewer-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.ia-chat-file-viewer-loading,
.ia-chat-file-viewer-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    padding: 1.2rem;
    background: #f7f9fc;
    z-index: 2;
}

.ia-chat-file-viewer-empty p {
    max-width: 460px;
    color: #334155;
}

.ia-chat-file-viewer-loading.is-hidden,
.ia-chat-file-viewer-empty.is-hidden,
.ia-chat-file-viewer-frame.is-hidden {
    display: none;
}

.ia-chat-file-viewer-offcanvas .offcanvas-header,
.ia-chat-file-viewer-offcanvas .offcanvas-body {
    opacity: 0;
    transform: translateY(10px);
}

.ia-chat-file-viewer-offcanvas.show .offcanvas-header,
.ia-chat-file-viewer-offcanvas.show .offcanvas-body {
    animation: ia-file-viewer-content-in 0.28s cubic-bezier(0.2, 0.85, 0.2, 1) forwards;
}

.ia-chat-file-viewer-offcanvas.show .offcanvas-body {
    animation-delay: 0.04s;
}

html.ia-chat-file-viewer-open #iaChatOffcanvas::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 24, 0.42);
    backdrop-filter: blur(1.5px);
    pointer-events: none;
    z-index: 12;
}

.ia-chat-file-viewer-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #d8e0eb;
    border-right-color: transparent;
    border-radius: 50%;
    animation: ia-file-viewer-spin 0.7s linear infinite;
}

@keyframes ia-file-viewer-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ia-file-viewer-content-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 767.98px) {
    .ia-chat-file-viewer-offcanvas {
        width: 100vw;
    }

    .ia-chat-file-viewer-head {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .ia-chat-file-viewer-head-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .ia-chat-file-viewer-download-btn {
        min-width: 88px;
    }
}
