/* =========================================================
   CRM CUSTOM CSS - Tecnilor CRM
   ---------------------------------------------------------
   Ficheiro limpo para substituir o crm-custom.css.
   Mantém apenas as regras CRM próprias e junta duplicados.
   ---------------------------------------------------------
   Índice:
   01. Variáveis e fonte
   02. Layout geral e footer
   03. Cabeçalho, sidebar e utilizador
   04. Toolbars, filtros e ações de página
   05. Cards, listas e detalhes
   06. Dashboard
   07. Tabelas e DataTables
   08. Formulários
   09. Badges e botões de ação
   10. Modals
   11. Agente AI
   12. Importação Excel / mapeamento
   13. Light mode
   14. Responsivo
   15. Header e logos por tema
   16. Agente AI - construtor de perguntas
   17. Agente AI - selects nativos
   18. Botões e badges adicionais
   19. Select2 - Agente AI
========================================================= */


/* =========================================================
   01. Variáveis e fonte
========================================================= */

:root {
    --crm-font: "Space Grotesk", sans-serif;

    --crm-primary: #635bff;
    --crm-primary-hover: #756eff;
    --crm-primary-soft: rgba(99, 91, 255, 0.18);
    --crm-primary-border: rgba(99, 91, 255, 0.45);
    --crm-primary-text: #bdb8ff;

    --crm-danger: #ff5252;
    --crm-danger-soft: rgba(255, 82, 82, 0.16);
    --crm-danger-border: rgba(255, 82, 82, 0.45);
    --crm-danger-text: #ff9a9a;

    --crm-warning: #ffc107;
    --crm-warning-soft: rgba(255, 193, 7, 0.16);
    --crm-warning-border: rgba(255, 193, 7, 0.55);
    --crm-warning-text: #ffd666;

    --crm-success-soft: rgba(49, 196, 141, 0.16);
    --crm-success-border: rgba(49, 196, 141, 0.55);
    --crm-success-text: #75ddb8;

    --crm-bg-card: rgba(255, 255, 255, 0.055);
    --crm-bg-card-soft: rgba(255, 255, 255, 0.035);
    --crm-border: rgba(255, 255, 255, 0.11);
    --crm-border-soft: rgba(255, 255, 255, 0.08);

    --crm-text: rgba(255, 255, 255, 0.82);
    --crm-text-strong: #ffffff;
    --crm-text-muted: rgba(255, 255, 255, 0.58);
    --crm-text-faint: rgba(255, 255, 255, 0.45);

    --crm-radius: 18px;
    --crm-radius-sm: 12px;
}

.crm-list-page,
.crm-dashboard-page,
.crm-form,
.crm-form *,
.crm-table,
.crm-table *,
.crm-dashboard-card,
.crm-dashboard-card *,
.crm-form-card,
.crm-form-card *,
.crm-table-card,
.crm-index-title,
.crm-page-title,
.crm-action-btn,
.crm-badge,
.crm-modal,
.crm-modal *,
.crm-ai-agent-page,
.crm-ai-agent-page *,
div.dt-container,
div.dt-container * {
    font-family: var(--crm-font);
}


/* =========================================================
   02. Layout geral e footer
========================================================= */

.dash-board-main-wrapper {
    min-height: 100vh;
}

.main-center-content-m-left {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.crm-list-page,
.crm-dashboard-page {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 30px 30px 50px 30px;
    box-sizing: border-box;
}

.crm-list-page .container-bd,
.crm-dashboard-page .container-bd {
    width: 100%;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    margin-right: 0;
}

.crm-index-header {
    margin-bottom: 24px;
}

.crm-index-content {
    width: 100%;
    flex: 1 1 auto;
}

.copyright-area-bottom {
    margin-top: auto;
    flex: 0 0 auto;
}

.header-area-one .header-inner-one {
    padding-left: 20px !important;
    padding-right: 20px !important;
}


/* =========================================================
   03. Cabeçalho, sidebar e utilizador
========================================================= */

.crm-header-logout-form {
    margin: 0;
    padding: 0;
}

.crm-header-logout-btn {
    width: 100%;
    border: 0 !important;
    background: transparent !important;
    cursor: pointer;
    text-align: left;
    font-family: var(--crm-font);
}

.crm-header-logout-btn i {
    pointer-events: none;
}

/* Sidebar: ícones Font Awesome com largura uniforme */
.dash-board-main-wrapper .left-side-bar .single-menu .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
    flex: 0 0 24px;
}

.dash-board-main-wrapper .left-side-bar .single-menu .icon i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    color: currentColor !important;
    font-size: 18px;
    line-height: 1;
}

.dash-board-main-wrapper .left-side-bar .single-menu.active .icon i,
.dash-board-main-wrapper .left-side-bar .single-menu:hover .icon i {
    color: currentColor !important;
}

/* Role debaixo do email no sidebar */
.dash-board-main-wrapper .left-side-bar .bottom-user .user-wrapper .info .crm-user-role-inline {
    position: inherit;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--crm-primary-soft);
    color: var(--crm-primary-text);
    font-size: 11px;
    line-height: 1.2;
    font-weight: 500;
}

/* Avatar por inicial */
.crm-avatar-initial {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: rgba(99, 91, 255, 0.22);
    border: 1px solid var(--crm-primary-border);
    color: #ffffff;
    font-family: var(--crm-font);
    font-size: 20px;
    line-height: 1;
    font-weight: 800;
    text-transform: uppercase;
    position: relative !important;
    inset: auto !important;
    margin: 0;
    overflow: hidden;
}

.header-area-one .user_avatar__information .avatar.crm-avatar-initial {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    font-size: 20px;
}

.header-area-one .user_information_main_wrapper .user_header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-area-one .user_information_main_wrapper .main-avatar.crm-avatar-initial,
.header-area-one .user_information_main_wrapper .main-avatar.crm-avatar-initial.crm-avatar-initial-lg {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    border-radius: 50% !important;
    font-size: 26px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
}

.dash-board-main-wrapper .left-side-bar .bottom-user .user-wrapper .crm-avatar-initial-sidebar {
    flex: 0 0 44px;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    font-size: 21px;
}

/* Botão tema */
.crm-theme-toggle-btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.crm-theme-toggle-btn i {
    font-size: 18px;
}

.crm-theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

#collups-left.is-disabled {
    pointer-events: none;
    opacity: 0.65;
}


/* =========================================================
   04. Toolbars, filtros e ações de página
========================================================= */

.crm-index-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.crm-index-toolbar .crm-index-title {
    flex: 1 1 auto;
    min-width: 240px;
}

.crm-index-title h2,
.crm-page-title .title,
.crm-page-title h2,
.crm-page-title h4 {
    margin: 0 0 8px 0;
    color: var(--crm-text-strong);
    font-size: 32px;
    line-height: 1.2;
    font-weight: 600;
}

.crm-index-title p,
.crm-page-title p {
    margin: 0;
    color: rgba(255, 255, 255, 0.65);
}

.crm-index-actions,
.crm-page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.crm-filter-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
}

.crm-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.72);
    font-family: var(--crm-font);
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.crm-filter-btn:hover {
    border-color: var(--crm-primary-border);
    background: rgba(99, 91, 255, 0.14);
    color: #ffffff;
}

.crm-filter-btn.active {
    border-color: rgba(99, 91, 255, 0.65);
    background: rgba(99, 91, 255, 0.24);
    color: #ffffff;
}

.crm-new-btn,
.crm-inline-form .rts-btn {
    white-space: nowrap;
    flex: 0 0 auto;
}

.crm-inline-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}


/* =========================================================
   05. Cards, listas e detalhes
========================================================= */

.crm-table-card,
.crm-form-card,
.crm-dashboard-card {
    border-radius: var(--crm-radius);
    background: var(--crm-bg-card);
    border: 1px solid var(--crm-border);
}

.crm-table-card,
.crm-form-card {
    width: 100%;
    padding: 24px;
    margin-bottom: 20px;
}

.crm-form-card {
    height: 100%;
}

.crm-form-card-title {
    margin: 0 0 22px 0;
    color: var(--crm-text-strong);
    font-size: 20px;
    line-height: 1.25;
    font-weight: 600;
}

.crm-card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.crm-card-header-row .crm-form-card-title {
    margin-bottom: 0;
}

.crm-mini-link {
    color: rgba(255, 255, 255, 1);
    font-family: var(--crm-font);
    font-size: 13px;
    text-decoration: none;
    background: var(--color-primary);
    padding: 6px 12px;
    border-radius: 4px;
    transition: 0.3s;
    font-weight: 500 !important;
    border-color: #0d6efd;
}

    .crm-mini-link:hover {
        color: #ffffff;
        background: #151f39;
    }

/* Detalhes de documento */
.crm-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.crm-detail-item,
.crm-detail-label,
.crm-detail-value {
    display: block;
}

.crm-detail-label {
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    line-height: 1.3;
}

.crm-detail-value {
    color: var(--crm-text-strong);
    font-size: 15px;
    line-height: 1.35;
    font-weight: 600;
}

/* Listas de resumo */
.crm-summary-list,
.crm-entity-list,
.crm-dashboard-list,
.crm-chunk-list {
    display: flex;
    flex-direction: column;
}

.crm-summary-list,
.crm-entity-list {
    gap: 10px;
}

.crm-dashboard-list {
    gap: 10px;
}

.crm-chunk-list {
    gap: 14px;
}

.crm-summary-item,
.crm-entity-item,
.crm-dashboard-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-summary-item,
.crm-entity-item {
    padding: 12px 0;
}

.crm-dashboard-list-item {
    padding: 13px 0;
    text-decoration: none;
}

.crm-summary-item:last-child,
.crm-entity-item:last-child,
.crm-dashboard-list-item:last-child {
    border-bottom: 0;
}

.crm-summary-item span {
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
}

.crm-summary-item strong {
    color: var(--crm-text-strong);
    font-size: 18px;
    font-weight: 600;
}

.crm-entity-item strong,
.crm-dashboard-list-item strong {
    display: block;
    color: var(--crm-text-strong);
    font-size: 14px;
    line-height: 1.35;
    font-weight: 600;
}

.crm-entity-item small,
.crm-dashboard-list-item small {
    display: block;
    margin-top: 4px;
    color: var(--crm-text-faint);
    font-size: 12px;
}

.crm-entity-meta,
.crm-dashboard-list-meta {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    text-align: right;
}

.crm-empty-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.56);
}

.crm-chunk-item {
    padding: 16px;
    border-radius: var(--crm-radius-sm);
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--crm-border-soft);
}

.crm-chunk-meta {
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

.crm-chunk-item p {
    margin: 0;
    color: var(--crm-text);
    font-size: 14px;
    line-height: 1.55;
}


/* =========================================================
   06. Dashboard
========================================================= */

.crm-dashboard-page {
    padding-top: 30px;
}

.crm-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.crm-dashboard-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 120px;
    padding: 20px;
    text-decoration: none;
}

.crm-dashboard-card:hover,
.crm-dashboard-action:hover {
    border-color: rgba(99, 91, 255, 0.42);
    background: rgba(99, 91, 255, 0.08);
}

.crm-dashboard-card-icon,
.crm-dashboard-action-icon,
.crm-dashboard-product-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 91, 255, 0.16);
    color: #ffffff;
}

.crm-dashboard-card-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 16px;
}

.crm-dashboard-action-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 12px;
}

.crm-dashboard-product-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 11px;
}

.crm-dashboard-card-icon i {
    font-size: 22px;
    line-height: 1;
    font-family: "Font Awesome 6 Pro";
    font-weight: 600;
}

.crm-dashboard-action-icon i,
.crm-dashboard-product-icon i {
    display: block;
    width: 1.25em;
    min-width: 1.25em;
    text-align: center;
    font-size: 16px;
    line-height: 1;
    font-family: "Font Awesome 6 Pro";
    font-weight: 600;
}

.crm-dashboard-card span {
    display: block;
    margin-bottom: 6px;
    color: var(--crm-text-muted);
    font-size: 13px;
}

.crm-dashboard-card strong {
    display: block;
    color: var(--crm-text-strong);
    font-size: 28px;
    line-height: 1.15;
    font-weight: 700;
}

.crm-dashboard-card small {
    display: block;
    margin-top: 7px;
    color: var(--crm-text-faint);
    font-size: 12px;
}

.crm-dashboard-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.crm-dashboard-action {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--crm-bg-card-soft);
    border: 1px solid var(--crm-border-soft);
    color: rgba(255, 255, 255, 0.80);
    text-decoration: none;
    font-size: 14px;
}

.crm-dashboard-action:hover {
    color: #ffffff;
}

.crm-dashboard-action:hover .crm-dashboard-action-icon {
    background: rgba(99, 91, 255, 0.28);
}

.crm-dashboard-product-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.crm-dashboard-product-main > div {
    min-width: 0;
}

.crm-dashboard-product-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =========================================================
   07. Tabelas e DataTables
========================================================= */

.crm-table-responsive {
    width: 100%;
    overflow-x: auto;
}

.crm-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.crm-table thead th {
    padding: 14px 16px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--crm-border-soft);
    white-space: nowrap;
}

.crm-table tbody td {
    padding: 16px;
    vertical-align: middle;
    color: var(--crm-text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-table tbody tr:last-child td {
    border-bottom: 0;
}

.crm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

/* DataTables base */
div.dt-container {
    color: var(--crm-text);
}

div.dt-container .dt-layout-row {
    margin: 0 0 18px 0;
    gap: 14px;
}

div.dt-container .dt-layout-row:last-child {
    margin: 18px 0 0 0;
}

div.dt-container .dt-length,
div.dt-container .dt-search,
div.dt-container .dt-info,
div.dt-container .dt-paging {
    color: rgba(255, 255, 255, 0.72) !important;
}

div.dt-container .dt-search input,
div.dt-container .dt-length select,
div.dt-container .dt-input {
    min-height: 38px;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.24) !important;
    background: rgba(255, 255, 255, 0.075) !important;
    color: #ffffff !important;
    padding: 6px 10px !important;
    outline: none !important;
    box-shadow: none !important;
}

div.dt-container .dt-length select option {
    color: #ffffff;
    background-color: #1d1d24;
}

div.dt-container .dt-search input:focus,
div.dt-container .dt-length select:focus,
div.dt-container .dt-input:focus {
    border-color: rgba(99, 91, 255, 0.95) !important;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18) !important;
}

table.dataTable.crm-table > thead > tr > th,
table.dataTable.crm-table > thead > tr > td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--crm-border-soft);
}

table.dataTable.crm-table > tbody > tr > td {
    padding: 16px;
}

/* DataTables ordering */
table.dataTable thead th,
table.dataTable thead td {
    position: relative;
}

table.dataTable thead th.dt-orderable-asc,
table.dataTable thead th.dt-orderable-desc,
table.dataTable thead td.dt-orderable-asc,
table.dataTable thead td.dt-orderable-desc {
    cursor: pointer;
}

table.dataTable thead th .dt-column-header,
table.dataTable thead td .dt-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

table.dataTable thead th .dt-column-title,
table.dataTable thead td .dt-column-title {
    flex: 1 1 auto;
}

table.dataTable thead th .dt-column-order,
table.dataTable thead td .dt-column-order {
    display: inline-flex;
    width: 12px;
    height: 18px;
    position: relative;
    flex: 0 0 12px;
    opacity: 0.75;
}

table.dataTable thead th .dt-column-order::before,
table.dataTable thead td .dt-column-order::before {
    content: "▲";
    position: absolute;
    top: -2px;
    left: 0;
    font-size: 8px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.35);
}

table.dataTable thead th .dt-column-order::after,
table.dataTable thead td .dt-column-order::after {
    content: "▼";
    position: absolute;
    bottom: -2px;
    left: 0;
    font-size: 8px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.35);
}

table.dataTable thead th.dt-ordering-asc .dt-column-order::before,
table.dataTable thead td.dt-ordering-asc .dt-column-order::before,
table.dataTable thead th.dt-ordering-desc .dt-column-order::after,
table.dataTable thead td.dt-ordering-desc .dt-column-order::after {
    color: #ffffff;
}

/* DataTables pagination */
div.dt-container .dt-paging,
div.dt-container .dt-paging nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}

div.dt-container .dt-paging .dt-paging-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 30px !important;
    width: auto !important;
    height: 30px !important;
    padding: 0 8px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    background-image: none !important;
    filter: none !important;
    color: rgba(255, 255, 255, 0.78) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    margin: 0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, color .2s ease;
}

div.dt-container .dt-paging .dt-paging-button.first,
div.dt-container .dt-paging .dt-paging-button.previous,
div.dt-container .dt-paging .dt-paging-button.next,
div.dt-container .dt-paging .dt-paging-button.last {
    min-width: 30px !important;
    width: 30px !important;
    padding: 0 !important;
    font-size: 17px !important;
    font-weight: 500 !important;
}

div.dt-container .dt-paging .dt-paging-button:hover {
    border-color: rgba(99, 91, 255, 0.55) !important;
    background: rgba(99, 91, 255, 0.16) !important;
    color: #ffffff !important;
}

div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover {
    border-color: rgba(99, 91, 255, 0.70) !important;
    background: rgba(99, 91, 255, 0.28) !important;
    color: #ffffff !important;
}

div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover,
div.dt-container .dt-paging .dt-paging-button.disabled:active {
    opacity: 0.38 !important;
    cursor: not-allowed !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.025) !important;
    color: rgba(255, 255, 255, 0.45) !important;
}

div.dt-container .dt-paging .ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 30px;
    color: rgba(255, 255, 255, 0.55);
    padding: 0 2px;
    font-size: 12px;
}


/* =========================================================
   08. Formulários
========================================================= */

.crm-form {
    width: 100%;
    margin-bottom: 30px;
}

.crm-form-group {
    margin-bottom: 18px;
}

.crm-form-label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
    font-weight: 500;
}

.crm-form input[type="text"],
.crm-form input[type="email"],
.crm-form input[type="password"],
.crm-form input[type="tel"],
.crm-form input[type="number"],
.crm-form input[type="search"],
.crm-form input[type="file"],
.crm-form textarea,
.crm-form select,
.crm-form .form-control,
.crm-form .crm-form-control {
    width: 100%;
    min-height: 48px;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    background: rgba(255, 255, 255, 0.085) !important;
    color: #ffffff !important;
    padding: 10px 14px !important;
    outline: none !important;
    font-size: 15px !important;
    box-shadow: none !important;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.crm-form input[type="text"]:hover,
.crm-form input[type="email"]:hover,
.crm-form input[type="password"]:hover,
.crm-form input[type="tel"]:hover,
.crm-form input[type="number"]:hover,
.crm-form input[type="search"]:hover,
.crm-form input[type="file"]:hover,
.crm-form textarea:hover,
.crm-form select:hover,
.crm-form .form-control:hover,
.crm-form .crm-form-control:hover {
    border-color: rgba(255, 255, 255, 0.42) !important;
    background: rgba(255, 255, 255, 0.11) !important;
}

.crm-form input[type="text"]:focus,
.crm-form input[type="email"]:focus,
.crm-form input[type="password"]:focus,
.crm-form input[type="tel"]:focus,
.crm-form input[type="number"]:focus,
.crm-form input[type="search"]:focus,
.crm-form input[type="file"]:focus,
.crm-form textarea:focus,
.crm-form select:focus,
.crm-form .form-control:focus,
.crm-form .crm-form-control:focus {
    border-color: rgba(99, 91, 255, 0.95) !important;
    background: rgba(255, 255, 255, 0.13) !important;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18) !important;
}

.crm-form input::placeholder,
.crm-form textarea::placeholder,
.crm-form .form-control::placeholder,
.crm-form .crm-form-control::placeholder {
    color: rgba(255, 255, 255, 0.48) !important;
}

/* Selects e options */
.crm-form select,
.crm-form select option,
.crm-form select optgroup,
.crm-form select.crm-form-control,
.crm-form select.crm-form-control option,
.crm-form select.crm-form-control optgroup {
    font-size: 15px !important;
    font-weight: 400 !important;
}

.crm-form select.crm-form-control {
    appearance: auto;
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.085) !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
}

.crm-form select.crm-form-control option {
    color: #ffffff !important;
    background-color: #1d1d24 !important;
}

.crm-form select.crm-form-control option:checked {
    color: #ffffff !important;
    background-color: var(--crm-primary) !important;
}

.crm-help-text {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

.crm-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.78);
    cursor: pointer;
    line-height: 1.35;
}

.crm-check input[type="checkbox"] {
    margin-top: 2px;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    accent-color: var(--crm-primary);
}

.crm-check span {
    display: inline-block;
}

.crm-permission-group {
    margin-bottom: 28px;
}

.crm-permission-group h6 {
    margin: 0 0 16px 0;
    color: var(--crm-text-strong);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 600;
}

.crm-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

.crm-form .text-danger,
.crm-table-card .text-danger {
    display: block;
    margin-top: 5px;
    font-size: 13px;
}

.crm-form .alert,
.crm-table-card .alert {
    border-radius: var(--crm-radius-sm);
}


/* =========================================================
   09. Badges e botões de ação
========================================================= */

.crm-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    margin: 2px 4px 2px 0;
    white-space: nowrap;
}

.crm-badge-primary {
    background: var(--crm-primary-soft);
    color: var(--crm-primary-text);
}

.crm-badge-success {
    background: var(--crm-success-soft);
    color: var(--crm-success-text);
}

.crm-badge-secondary,
.crm-badge-light {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.78);
}

.crm-badge-danger {
    background: var(--crm-danger-soft);
    color: var(--crm-danger-text);
}

/* Ações em tabelas */
.crm-table-actions {
    white-space: nowrap;
    text-align: right;
}

.crm-table-actions form {
    display: inline-flex !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle;
}

.crm-action-btn,
.crm-table-actions button.crm-action-btn,
.crm-table-actions input.crm-action-btn[type="submit"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 32px !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    border-style: solid !important;
    border-width: 1px !important;
    background-color: transparent !important;
    background-image: none !important;
    font-family: var(--crm-font) !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    box-shadow: none !important;
    appearance: none !important;
    margin-left: 6px;
}

    .crm-action-btn-add,
    .crm-table-actions button.crm-action-btn-add,
    .crm-table-actions input.crm-action-btn-add[type="submit"] {
        border-color: var(--crm-success-border) !important;
        color: var(--crm-success-text) !important;
    }

        .crm-action-btn-add:hover,
        .crm-table-actions button.crm-action-btn-add:hover,
        .crm-table-actions input.crm-action-btn-add[type="submit"]:hover {
            background-color: var(--crm-success-soft) !important;
            border-color: var(--crm-success-border) !important;
            color: #ffffff !important;
        }

.crm-action-btn-view,
.crm-table-actions button.crm-action-btn-view,
.crm-table-actions input.crm-action-btn-view[type="submit"] {
    border-color: var(--crm-primary-border) !important;
    color: var(--crm-primary-text) !important;
}

.crm-action-btn-view:hover,
.crm-table-actions button.crm-action-btn-view:hover,
.crm-table-actions input.crm-action-btn-view[type="submit"]:hover {
    background-color: rgba(99, 91, 255, 0.16) !important;
    color: #ffffff !important;
}

.crm-action-btn-edit,
.crm-table-actions button.crm-action-btn-edit,
.crm-table-actions input.crm-action-btn-edit[type="submit"] {
    border-color: var(--crm-warning-border) !important;
    color: var(--crm-warning-text) !important;
}

.crm-action-btn-edit:hover,
.crm-table-actions button.crm-action-btn-edit:hover,
.crm-table-actions input.crm-action-btn-edit[type="submit"]:hover {
    background-color: var(--crm-warning-soft) !important;
    color: #ffffff !important;
}

.crm-action-btn-danger,
.crm-table-actions button.crm-action-btn-danger,
.crm-table-actions input.crm-action-btn-danger[type="submit"],
.crm-btn-danger-inline {
    border-color: var(--crm-danger-border) !important;
    color: var(--crm-danger-text) !important;
}

.crm-action-btn-danger:hover,
.crm-table-actions button.crm-action-btn-danger:hover,
.crm-table-actions input.crm-action-btn-danger[type="submit"]:hover,
.crm-btn-danger-inline:hover {
    background-color: rgba(255, 82, 82, 0.15) !important;
    color: #ffffff !important;
}

.crm-btn-danger-inline {
    margin-left: 8px;
}


/* =========================================================
   10. Modals
========================================================= */

.crm-modal .modal-content {
    border-radius: var(--crm-radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #17171f;
    color: var(--crm-text);
    font-family: var(--crm-font);
}

.crm-modal .modal-header,
.crm-modal .modal-footer {
    border-color: var(--crm-border-soft);
}

.crm-modal .modal-title {
    color: var(--crm-text-strong);
    font-weight: 600;
}

.crm-modal .modal-body p {
    color: rgba(255, 255, 255, 0.78);
}

.crm-modal .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

.crm-modal .btn-close:hover {
    opacity: 1;
}

/* Modal de ações sobre entidades */
.crm-modal-entity-box,
.crm-action-choice {
    border-radius: var(--crm-radius-sm);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.crm-modal-entity-box {
    padding: 12px 14px;
}

.crm-modal-entity-box strong,
.crm-action-choice strong {
    display: block;
    color: var(--crm-text-strong);
    font-size: 15px;
    font-weight: 600;
}

.crm-modal-entity-box small,
.crm-action-choice small {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.58);
}

.crm-action-choice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-action-choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    cursor: pointer;
}

.crm-action-choice input {
    margin-top: 4px;
    accent-color: var(--crm-primary);
}

.crm-action-choice small {
    line-height: 1.4;
}

.crm-action-choice-danger {
    border-color: rgba(255, 82, 82, 0.25);
}

.crm-action-choice-danger strong {
    color: var(--crm-danger-text);
}


/* =========================================================
   11. Agente AI
========================================================= */

.crm-ai-agent-page {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    padding: 30px 30px 0 30px;
    box-sizing: border-box;
}

.crm-ai-agent-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.crm-ai-chat-panel {
    flex: 0 0 auto;
    width: 100%;
}

.crm-ai-message {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
    margin-bottom: 22px;
}

.crm-ai-message-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: rgba(99, 91, 255, 0.22);
    border: 1px solid var(--crm-primary-border);
    color: #ffffff;
}

    .crm-ai-message-avatar i {
        font-size: 19px;
        line-height: 1;
        font-family: "Font Awesome 6 Pro";
        font-weight: 900;
    }

.crm-ai-message-content {
    width: 100%;
    max-width: 1320px;
}

.crm-ai-message-content h4 {
    margin: 0 0 10px 0;
    color: var(--crm-text-strong);
    font-size: 20px;
    font-weight: 600;
}

.crm-ai-message-content p {
    margin: 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 15px;
    line-height: 1.6;
}

.crm-ai-suggestions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
    width: 100%;
    max-width: 1320px;
}

.crm-ai-suggestion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
    cursor: pointer;
}

.crm-ai-suggestion:hover {
    border-color: var(--crm-primary-border);
    background: rgba(99, 91, 255, 0.14);
    color: #ffffff;
}

.crm-ai-form {
    position: relative;
    /*width: calc(100% - 60px);*/
    max-width: 1320px;
    margin: 30px 0 30px 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.crm-ai-form input {
    width: 100%;
    min-height: 62px;
    border-radius: var(--crm-radius);
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(23, 23, 31, 0.98);
    color: #ffffff;
    padding: 0 64px 0 20px;
    font-size: 15px;
    outline: none;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22);
}

.crm-ai-form input::placeholder {
    color: rgba(255, 255, 255, 0.48);
}

.crm-ai-form input:focus {
    border-color: rgba(99, 91, 255, 0.80);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18), 0 12px 35px rgba(0, 0, 0, 0.22);
}

    .crm-ai-form button {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: 42px;
        height: 42px;
        min-width: 42px;
        border-radius: 50%;
        border: 0;
        background: var(--crm-primary);
        color: #ffffff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .crm-ai-form button i {
        font-family: "Font Awesome 6 Pro";
        font-weight: 900;
    }

.crm-ai-form button:hover {
    background: var(--crm-primary-hover);
}

.crm-ai-agent-page .copyright-area-bottom {
    margin-top: auto;
    padding: 20px 0 30px 0;
}

/* Mensagens do utilizador */
.crm-ai-message-user {
    justify-content: flex-end;
}

.crm-ai-message-user .crm-ai-message-content {
    max-width: 860px;
    width: auto;
}

.crm-ai-message-user .crm-ai-message-content p {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(99, 91, 255, 0.18);
    border: 1px solid rgba(99, 91, 255, 0.30);
    color: #ffffff;
}

.crm-ai-user-avatar {
    order: 2;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}


/* =========================================================
   12. Importação Excel / mapeamento
========================================================= */

.crm-import-map-modal .modal-xl {
    max-width: 1180px;
}

.crm-import-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.crm-import-summary > div {
    padding: 14px 16px;
    border-radius: var(--crm-radius-sm);
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--crm-border-soft);
}

.crm-import-summary span {
    display: block;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

.crm-import-summary strong {
    display: block;
    color: var(--crm-text-strong);
    font-size: 15px;
    font-weight: 600;
    word-break: break-word;
}

.crm-import-map-table td {
    vertical-align: middle;
}

.crm-import-map-table .crm-form-control {
    min-height: 40px;
    font-size: 13px;
}


/* =========================================================
   13. Light mode
========================================================= */

html[data-theme="light"] {
    --crm-bg-card: #ffffff;
    --crm-bg-card-soft: rgba(0, 0, 0, 0.025);
    --crm-border: rgba(0, 0, 0, 0.10);
    --crm-border-soft: rgba(0, 0, 0, 0.08);
    --crm-text: rgba(0, 0, 0, 0.78);
    --crm-text-strong: #111111;
    --crm-text-muted: rgba(0, 0, 0, 0.55);
    --crm-text-faint: rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] .crm-index-title h2,
html[data-theme="light"] .crm-page-title .title,
html[data-theme="light"] .crm-page-title h2,
html[data-theme="light"] .crm-page-title h4,
html[data-theme="light"] .crm-form-card-title,
html[data-theme="light"] .crm-permission-group h6,
html[data-theme="light"] .crm-detail-value,
html[data-theme="light"] .crm-summary-item strong,
html[data-theme="light"] .crm-entity-item strong,
html[data-theme="light"] .crm-dashboard-list-item strong,
html[data-theme="light"] .crm-ai-message-content h4,
html[data-theme="light"] .crm-import-summary strong {
    color: #111111;
}

html[data-theme="light"] .crm-index-title p,
html[data-theme="light"] .crm-page-title p,
html[data-theme="light"] .crm-form-label,
html[data-theme="light"] .crm-check,
html[data-theme="light"] .crm-ai-message-content p {
    color: rgba(0, 0, 0, 0.76);
}

html[data-theme="light"] .crm-help-text,
html[data-theme="light"] .crm-detail-label,
html[data-theme="light"] .crm-summary-item span,
html[data-theme="light"] .crm-empty-text,
html[data-theme="light"] .crm-chunk-meta,
html[data-theme="light"] .crm-import-summary span {
    color: rgba(0, 0, 0, 0.56);
}

html[data-theme="light"] .crm-table-card,
html[data-theme="light"] .crm-form-card,
html[data-theme="light"] .crm-dashboard-card,
html[data-theme="light"] .crm-dashboard-action,
html[data-theme="light"] .crm-import-summary > div,
html[data-theme="light"] .crm-modal-entity-box,
html[data-theme="light"] .crm-action-choice,
html[data-theme="light"] .crm-chunk-item {
    background: var(--crm-bg-card-soft);
    border-color: var(--crm-border-soft);
}

html[data-theme="light"] .crm-table-card,
html[data-theme="light"] .crm-form-card,
html[data-theme="light"] .crm-dashboard-card {
    background: #ffffff;
}

html[data-theme="light"] .crm-dashboard-card:hover,
html[data-theme="light"] .crm-dashboard-action:hover {
    border-color: rgba(99, 91, 255, 0.34);
    background: rgba(99, 91, 255, 0.08);
}

html[data-theme="light"] .crm-dashboard-card-icon,
html[data-theme="light"] .crm-dashboard-action-icon,
html[data-theme="light"] .crm-dashboard-product-icon,
html[data-theme="light"] .crm-avatar-initial,
html[data-theme="light"] .crm-ai-message-avatar {
    background: rgba(99, 91, 255, 0.12);
    border-color: rgba(99, 91, 255, 0.38);
    color: #4f46e5;
}

html[data-theme="light"] .crm-table thead th,
html[data-theme="light"] table.dataTable.crm-table > thead > tr > th,
html[data-theme="light"] table.dataTable.crm-table > thead > tr > td {
    color: rgba(0, 0, 0, 0.65);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .crm-table tbody td {
    color: rgba(0, 0, 0, 0.78);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .crm-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.025);
}

html[data-theme="light"] .crm-summary-item,
html[data-theme="light"] .crm-entity-item,
html[data-theme="light"] .crm-dashboard-list-item {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .crm-entity-item small,
html[data-theme="light"] .crm-dashboard-list-item small {
    color: rgba(0, 0, 0, 0.48);
}

html[data-theme="light"] .crm-form input[type="text"],
html[data-theme="light"] .crm-form input[type="email"],
html[data-theme="light"] .crm-form input[type="password"],
html[data-theme="light"] .crm-form input[type="tel"],
html[data-theme="light"] .crm-form input[type="number"],
html[data-theme="light"] .crm-form input[type="search"],
html[data-theme="light"] .crm-form input[type="file"],
html[data-theme="light"] .crm-form textarea,
html[data-theme="light"] .crm-form select,
html[data-theme="light"] .crm-form .form-control,
html[data-theme="light"] .crm-form .crm-form-control {
    border-color: rgba(0, 0, 0, 0.22) !important;
    background: rgba(0, 0, 0, 0.035) !important;
    color: #111111 !important;
}

html[data-theme="light"] .crm-form input[type="text"]:hover,
html[data-theme="light"] .crm-form input[type="email"]:hover,
html[data-theme="light"] .crm-form input[type="password"]:hover,
html[data-theme="light"] .crm-form input[type="tel"]:hover,
html[data-theme="light"] .crm-form input[type="number"]:hover,
html[data-theme="light"] .crm-form input[type="search"]:hover,
html[data-theme="light"] .crm-form input[type="file"]:hover,
html[data-theme="light"] .crm-form textarea:hover,
html[data-theme="light"] .crm-form select:hover,
html[data-theme="light"] .crm-form .form-control:hover,
html[data-theme="light"] .crm-form .crm-form-control:hover {
    border-color: rgba(0, 0, 0, 0.34) !important;
    background: rgba(0, 0, 0, 0.055) !important;
}

html[data-theme="light"] .crm-form input[type="text"]:focus,
html[data-theme="light"] .crm-form input[type="email"]:focus,
html[data-theme="light"] .crm-form input[type="password"]:focus,
html[data-theme="light"] .crm-form input[type="tel"]:focus,
html[data-theme="light"] .crm-form input[type="number"]:focus,
html[data-theme="light"] .crm-form input[type="search"]:focus,
html[data-theme="light"] .crm-form input[type="file"]:focus,
html[data-theme="light"] .crm-form textarea:focus,
html[data-theme="light"] .crm-form select:focus,
html[data-theme="light"] .crm-form .form-control:focus,
html[data-theme="light"] .crm-form .crm-form-control:focus {
    border-color: rgba(99, 91, 255, 0.9) !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.14) !important;
}

html[data-theme="light"] .crm-form input::placeholder,
html[data-theme="light"] .crm-form textarea::placeholder,
html[data-theme="light"] .crm-form .form-control::placeholder,
html[data-theme="light"] .crm-form .crm-form-control::placeholder,
html[data-theme="light"] .crm-ai-form input::placeholder {
    color: rgba(0, 0, 0, 0.42) !important;
}

html[data-theme="light"] .crm-form select.crm-form-control {
    color: #111111 !important;
    background-color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.22) !important;
}

html[data-theme="light"] .crm-form select.crm-form-control option,
html[data-theme="light"] div.dt-container .dt-length select option {
    color: #111111 !important;
    background-color: #ffffff !important;
}

html[data-theme="light"] .crm-form select.crm-form-control option:checked {
    color: #ffffff !important;
    background-color: var(--crm-primary) !important;
}

html[data-theme="light"] .crm-badge-secondary,
html[data-theme="light"] .crm-badge-light {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.68);
}

html[data-theme="light"] .crm-theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .dash-board-main-wrapper .left-side-bar .bottom-user .user-wrapper .info .crm-user-role-inline {
    background: rgba(99, 91, 255, 0.12);
    color: #4f46e5;
}

/* Light mode - botões */
html[data-theme="light"] .crm-action-btn-view,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-view,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-view[type="submit"] {
    border-color: rgba(99, 91, 255, 0.45) !important;
    color: #4f46e5 !important;
}

html[data-theme="light"] .crm-action-btn-view:hover,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-view:hover,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-view[type="submit"]:hover {
    background: rgba(99, 91, 255, 0.12) !important;
    color: #312e81 !important;
}

html[data-theme="light"] .crm-action-btn-edit,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-edit,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-edit[type="submit"] {
    border-color: rgba(217, 119, 6, 0.45) !important;
    color: #b45309 !important;
}

html[data-theme="light"] .crm-action-btn-edit:hover,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-edit:hover,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-edit[type="submit"]:hover {
    background: rgba(217, 119, 6, 0.12) !important;
    color: #78350f !important;
}

html[data-theme="light"] .crm-action-btn-danger,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-danger,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-danger[type="submit"],
html[data-theme="light"] .crm-btn-danger-inline {
    border-color: rgba(220, 38, 38, 0.45) !important;
    color: #b91c1c !important;
}

html[data-theme="light"] .crm-action-btn-danger:hover,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-danger:hover,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-danger[type="submit"]:hover,
html[data-theme="light"] .crm-btn-danger-inline:hover {
    background: rgba(220, 38, 38, 0.10) !important;
    color: #7f1d1d !important;
}

/* Light mode - DataTables */
html[data-theme="light"] div.dt-container,
html[data-theme="light"] div.dt-container .dt-length,
html[data-theme="light"] div.dt-container .dt-search,
html[data-theme="light"] div.dt-container .dt-info,
html[data-theme="light"] div.dt-container .dt-paging {
    color: rgba(0, 0, 0, 0.68) !important;
}

html[data-theme="light"] div.dt-container .dt-search input,
html[data-theme="light"] div.dt-container .dt-length select,
html[data-theme="light"] div.dt-container .dt-input {
    border-color: rgba(0, 0, 0, 0.20) !important;
    background: rgba(0, 0, 0, 0.035) !important;
    color: #111111 !important;
}

html[data-theme="light"] table.dataTable thead th .dt-column-order::before,
html[data-theme="light"] table.dataTable thead td .dt-column-order::before,
html[data-theme="light"] table.dataTable thead th .dt-column-order::after,
html[data-theme="light"] table.dataTable thead td .dt-column-order::after {
    color: rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] table.dataTable thead th.dt-ordering-asc .dt-column-order::before,
html[data-theme="light"] table.dataTable thead td.dt-ordering-asc .dt-column-order::before,
html[data-theme="light"] table.dataTable thead th.dt-ordering-desc .dt-column-order::after,
html[data-theme="light"] table.dataTable thead td.dt-ordering-desc .dt-column-order::after {
    color: #111111;
}

html[data-theme="light"] div.dt-container .dt-paging .dt-paging-button {
    border-color: rgba(0, 0, 0, 0.10) !important;
    background: rgba(0, 0, 0, 0.025) !important;
    color: rgba(0, 0, 0, 0.70) !important;
}

html[data-theme="light"] div.dt-container .dt-paging .dt-paging-button:hover {
    border-color: rgba(99, 91, 255, 0.45) !important;
    background: rgba(99, 91, 255, 0.12) !important;
    color: #312e81 !important;
}

html[data-theme="light"] div.dt-container .dt-paging .dt-paging-button.current,
html[data-theme="light"] div.dt-container .dt-paging .dt-paging-button.current:hover {
    border-color: rgba(99, 91, 255, 0.55) !important;
    background: rgba(99, 91, 255, 0.16) !important;
    color: #312e81 !important;
}

html[data-theme="light"] div.dt-container .dt-paging .dt-paging-button.disabled,
html[data-theme="light"] div.dt-container .dt-paging .dt-paging-button.disabled:hover,
html[data-theme="light"] div.dt-container .dt-paging .dt-paging-button.disabled:active {
    border-color: rgba(0, 0, 0, 0.06) !important;
    background: rgba(0, 0, 0, 0.015) !important;
    color: rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="light"] div.dt-container .dt-paging .ellipsis {
    color: rgba(0, 0, 0, 0.45);
}

/* Light mode - modals e AI */
html[data-theme="light"] .crm-modal .modal-content {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.10);
    color: rgba(0, 0, 0, 0.78);
}

html[data-theme="light"] .crm-modal .modal-header,
html[data-theme="light"] .crm-modal .modal-footer {
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .crm-modal .modal-title {
    color: #111111;
}

html[data-theme="light"] .crm-modal .modal-body p {
    color: rgba(0, 0, 0, 0.78);
}

html[data-theme="light"] .crm-modal .btn-close {
    filter: none;
}

html[data-theme="light"] .crm-action-choice-danger {
    border-color: rgba(220, 38, 38, 0.22);
}

html[data-theme="light"] .crm-action-choice-danger strong {
    color: #b91c1c;
}

html[data-theme="light"] .crm-ai-suggestion {
    border-color: rgba(0, 0, 0, 0.10);
    background: rgba(0, 0, 0, 0.025);
    color: rgba(0, 0, 0, 0.70);
}

html[data-theme="light"] .crm-ai-suggestion:hover {
    border-color: rgba(99, 91, 255, 0.45);
    background: rgba(99, 91, 255, 0.10);
    color: #312e81;
}

html[data-theme="light"] .crm-ai-form input {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.10);
    color: #111111;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .crm-ai-message-user .crm-ai-message-content p {
    background: rgba(99, 91, 255, 0.12);
    border-color: rgba(99, 91, 255, 0.22);
    color: #111111;
}

html[data-theme="light"] .crm-ai-user-avatar {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}


/* =========================================================
   14. Responsivo
========================================================= */

@media (min-width: 1600px) {
    .crm-ai-message-content,
    .crm-ai-suggestions,
    .crm-ai-form {
        max-width: 1480px;
    }
}

@media (max-width: 1399px) {
    .crm-dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-dashboard-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1199px) {
    .crm-index-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-index-actions {
        justify-content: flex-start;
    }

    .crm-ai-message-content,
    .crm-ai-suggestions {
        max-width: none;
    }

    .crm-ai-form {
        width: calc(100% - 60px);
        max-width: none;
        margin-left: 60px;
    }

    .crm-ai-suggestions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .crm-list-page,
    .crm-dashboard-page {
        padding: 20px 15px 40px 15px;
    }

    .crm-table-card,
    .crm-form-card,
    .crm-dashboard-card {
        padding: 18px;
    }

    .crm-table {
        min-width: 860px;
    }

    .crm-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .crm-form-actions .rts-btn {
        width: 100%;
        justify-content: center;
    }

    .crm-page-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 767px) {
    .crm-detail-grid,
    .crm-import-summary,
    .crm-dashboard-grid,
    .crm-dashboard-actions,
    .crm-ai-suggestions {
        grid-template-columns: 1fr;
    }

    .crm-ai-form {
        width: calc(100% - 50px);
        margin-left: 50px;
    }

    .crm-dashboard-list-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .crm-dashboard-list-meta {
        justify-content: flex-start;
        text-align: left;
    }

    div.dt-container .dt-paging {
        justify-content: center;
        margin-top: 14px;
    }

    div.dt-container .dt-paging .dt-paging-button {
        min-width: 28px !important;
        height: 28px !important;
        padding: 0 7px !important;
        font-size: 11px !important;
    }

    div.dt-container .dt-paging .dt-paging-button.first,
    div.dt-container .dt-paging .dt-paging-button.previous,
    div.dt-container .dt-paging .dt-paging-button.next,
    div.dt-container .dt-paging .dt-paging-button.last {
        width: 28px !important;
        min-width: 28px !important;
        font-size: 15px !important;
    }
}

@media (max-width: 575px) {
    .crm-index-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-filter-actions {
        width: 100%;
    }

    .crm-filter-btn {
        flex: 1 1 auto;
    }

    .crm-new-btn {
        width: 100%;
        justify-content: center;
    }

    .crm-entity-item,
    .crm-summary-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .crm-entity-meta {
        justify-content: flex-start;
        text-align: left;
    }

    .crm-ai-agent-page {
        padding: 16px 12px 0 12px;
    }

    .crm-ai-message {
        flex-direction: column;
    }

    .crm-ai-form {
        width: 100%;
        margin: 10px 0 24px 0;
    }

    .crm-ai-form input {
        min-height: 56px;
        border-radius: 14px;
    }

    .crm-ai-form button {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
}
/* =========================================================
   15. Header e logos por tema
   ---------------------------------------------------------
   Regras isoladas para impedir filtros do template sobre os
   logos e para trocar corretamente entre dark/light.
========================================================= */

.header-area-one .left-logo-area .logo img {
    display: block;
    width: auto;
    max-height: 80px;
    object-fit: contain;
}

.auth-logo-head {
    text-align: center;
}

.auth-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    text-decoration: none;
}

.auth-logo-img {
    display: block;
    width: auto;
    max-width: 220px;
    height: auto;
    object-fit: contain;
}

/* Tema padrão/dark: mostra logo preparada para fundo escuro. */
.auth-logo-light {
    display: none;
}

.auth-logo-dark {
    display: block;
}

/* Tema light: troca para logo preparada para fundo claro. */
html[data-theme="light"] .auth-logo-dark {
    display: none;
}

html[data-theme="light"] .auth-logo-light {
    display: block;
}

.auth-logo-head span {
    display: block;
}

/* Os logos já vêm exportados para o fundo correto; não devem receber filtros. */
#crmHeaderLogo,
.auth-logo-img,
.header-area-one .left-logo-area .logo img,
.auth-logo-link img,
html[data-theme="light"] #crmHeaderLogo,
html[data-theme="light"] .auth-logo-img,
html[data-theme="light"] .header-area-one .left-logo-area .logo img,
html[data-theme="light"] .auth-logo-link img {
    filter: none !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
}


/* =========================================================
   16. Agente AI - construtor de perguntas
   ---------------------------------------------------------
   Mantém o formulário acessível e preparado para selects
   normais ou Select2.
========================================================= */

.crm-ai-question-builder {
    margin-bottom: 24px;
}

.crm-help-text,
.crm-field-help {
    display: block;
    color: var(--crm-text-muted);
    font-family: var(--crm-font);
    font-size: 13px;
    line-height: 1.45;
}

.crm-help-text {
    margin: 6px 0 0 0;
}

.crm-field-help {
    margin-top: 6px;
}

.crm-fieldset {
    margin: 0 0 18px 0;
    padding: 0;
    border: 0;
}

.crm-fieldset-legend {
    display: block;
    margin: 0 0 12px 0;
    padding: 0;
    color: var(--crm-text-strong);
    font-family: var(--crm-font);
    font-size: 15px;
    line-height: 1.35;
    font-weight: 600;
}

.crm-label {
    display: block;
    margin-bottom: 7px;
    color: var(--crm-text);
    font-family: var(--crm-font);
    font-size: 14px;
    line-height: 1.35;
    font-weight: 600;
}

.crm-question-builder-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.crm-ai-question-builder textarea.crm-form-control {
    min-height: 92px;
    resize: vertical;
}

.crm-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 991px) {
    .crm-question-builder-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   17. Agente AI - selects nativos de fallback
   ---------------------------------------------------------
   Usado caso o Select2 não esteja carregado. Quando Select2
   está ativo, o select original fica oculto pela biblioteca.
========================================================= */

.crm-ai-agent-page .crm-ai-question-builder select.crm-form-control,
.crm-ai-agent-page select#questionType,
.crm-ai-agent-page select#questionProducts,
.crm-ai-agent-page select#questionClients,
.crm-ai-agent-page select#questionCompanies {
    width: 100%;
    min-height: 46px;
    background-color: rgba(255, 255, 255, 0.095) !important;
    border: 1px solid rgba(255, 255, 255, 0.24) !important;
    color: #ffffff !important;
    border-radius: 12px;
    padding: 10px 12px;
    font-family: var(--crm-font);
    font-size: 14px;
    line-height: 1.35;
    outline: none;
    box-shadow: none;
}

.crm-ai-agent-page .crm-ai-question-builder select.crm-form-control[multiple],
.crm-ai-agent-page select#questionProducts,
.crm-ai-agent-page select#questionClients,
.crm-ai-agent-page select#questionCompanies {
    min-height: 190px;
    padding: 8px;
    overflow-y: auto;
}

.crm-ai-agent-page .crm-ai-question-builder select.crm-form-control option,
.crm-ai-agent-page select#questionType option,
.crm-ai-agent-page select#questionProducts option,
.crm-ai-agent-page select#questionClients option,
.crm-ai-agent-page select#questionCompanies option {
    padding: 8px 10px;
    background: #151f39;
    color: #ffffff;
}

.crm-ai-agent-page .crm-ai-question-builder select.crm-form-control option:checked,
.crm-ai-agent-page select#questionProducts option:checked,
.crm-ai-agent-page select#questionClients option:checked,
.crm-ai-agent-page select#questionCompanies option:checked {
    background: var(--crm-primary) !important;
    color: #ffffff !important;
}

.crm-ai-agent-page .crm-ai-question-builder select.crm-form-control:focus,
.crm-ai-agent-page select#questionType:focus,
.crm-ai-agent-page select#questionProducts:focus,
.crm-ai-agent-page select#questionClients:focus,
.crm-ai-agent-page select#questionCompanies:focus {
    border-color: rgba(99, 91, 255, 0.85) !important;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.22);
}

.crm-ai-agent-page .crm-ai-question-builder select.crm-form-control:hover,
.crm-ai-agent-page select#questionType:hover,
.crm-ai-agent-page select#questionProducts:hover,
.crm-ai-agent-page select#questionClients:hover,
.crm-ai-agent-page select#questionCompanies:hover {
    border-color: rgba(255, 255, 255, 0.36) !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="light"] .crm-ai-agent-page .crm-ai-question-builder select.crm-form-control,
html[data-theme="light"] .crm-ai-agent-page select#questionType,
html[data-theme="light"] .crm-ai-agent-page select#questionProducts,
html[data-theme="light"] .crm-ai-agent-page select#questionClients,
html[data-theme="light"] .crm-ai-agent-page select#questionCompanies {
    background-color: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.22) !important;
    color: #0f172a !important;
}

html[data-theme="light"] .crm-ai-agent-page .crm-ai-question-builder select.crm-form-control option,
html[data-theme="light"] .crm-ai-agent-page select#questionType option,
html[data-theme="light"] .crm-ai-agent-page select#questionProducts option,
html[data-theme="light"] .crm-ai-agent-page select#questionClients option,
html[data-theme="light"] .crm-ai-agent-page select#questionCompanies option {
    background: #ffffff;
    color: #0f172a;
}

html[data-theme="light"] .crm-ai-agent-page .crm-ai-question-builder select.crm-form-control option:checked,
html[data-theme="light"] .crm-ai-agent-page select#questionProducts option:checked,
html[data-theme="light"] .crm-ai-agent-page select#questionClients option:checked,
html[data-theme="light"] .crm-ai-agent-page select#questionCompanies option:checked {
    background: var(--crm-primary) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .crm-ai-agent-page .crm-ai-question-builder select.crm-form-control:focus,
html[data-theme="light"] .crm-ai-agent-page select#questionType:focus,
html[data-theme="light"] .crm-ai-agent-page select#questionProducts:focus,
html[data-theme="light"] .crm-ai-agent-page select#questionClients:focus,
html[data-theme="light"] .crm-ai-agent-page select#questionCompanies:focus {
    border-color: rgba(99, 91, 255, 0.85) !important;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18);
}


/* =========================================================
   18. Botões e badges adicionais
   ---------------------------------------------------------
   Agrupa variações adicionadas depois: botões com border,
   download e melhorias de contraste em light mode.
========================================================= */

/* Garante border visível nos botões border do template. */
.rts-btn.btn-border,
.btn-border {
    border: 1px solid currentColor !important;
}

.rts-btn.btn-border:hover,
.btn-border:hover {
    border-color: currentColor !important;
}

.rts-btn.btn-border.btn-border-success,
.btn-border.btn-border-success {
    color: var(--crm-success-text) !important;
    border-color: var(--crm-success-border) !important;
    background: transparent !important;
}

.rts-btn.btn-border.btn-border-success:hover,
.btn-border.btn-border-success:hover {
    color: #ffffff !important;
    border-color: var(--crm-success-border) !important;
    background: var(--crm-success-soft) !important;
}

.rts-btn.btn-border.btn-border-primary,
.btn-border.btn-border-primary {
    color: var(--crm-primary-text) !important;
    border-color: var(--crm-primary-border) !important;
    background: transparent !important;
}

.rts-btn.btn-border.btn-border-primary:hover,
.btn-border.btn-border-primary:hover {
    color: #ffffff !important;
    border-color: var(--crm-primary-border) !important;
    background: var(--crm-primary-soft) !important;
}

.rts-btn.btn-border.btn-border-warning,
.btn-border.btn-border-warning {
    color: var(--crm-warning-text) !important;
    border-color: var(--crm-warning-border) !important;
    background: transparent !important;
}

.rts-btn.btn-border.btn-border-warning:hover,
.btn-border.btn-border-warning:hover {
    color: #ffffff !important;
    border-color: var(--crm-warning-border) !important;
    background: var(--crm-warning-soft) !important;
}

.rts-btn.btn-border.btn-border-danger,
.btn-border.btn-border-danger {
    color: var(--crm-danger-text) !important;
    border-color: var(--crm-danger-border) !important;
    background: transparent !important;
}

.rts-btn.btn-border.btn-border-danger:hover,
.btn-border.btn-border-danger:hover {
    color: #ffffff !important;
    border-color: var(--crm-danger-border) !important;
    background: var(--crm-danger-soft) !important;
}

.crm-action-btn-download,
.crm-table-actions button.crm-action-btn-download,
.crm-table-actions input.crm-action-btn-download[type="submit"] {
    border-color: var(--crm-success-border) !important;
    color: var(--crm-success-text) !important;
}

.crm-action-btn-download:hover,
.crm-table-actions button.crm-action-btn-download:hover,
.crm-table-actions input.crm-action-btn-download[type="submit"]:hover {
    background-color: var(--crm-success-soft) !important;
    border-color: var(--crm-success-border) !important;
    color: #ffffff !important;
}

.crm-action-btn-download .fa,
.crm-action-btn-download .fa-solid,
.crm-action-btn-download .fas {
    font-family: "Font Awesome 6 Pro", "Font Awesome 6 Free", "FontAwesome" !important;
    font-weight: 900 !important;
}

/* Badges: define border real para as cores de light mode funcionarem. */
.crm-badge {
    border: 1px solid transparent;
}

.crm-badge-warning {
    background: var(--crm-warning-soft);
    color: var(--crm-warning-text);
}

.crm-badge-muted {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .crm-action-btn-add,
html[data-theme="light"] .crm-action-btn-download,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-add,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-download,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-add[type="submit"],
html[data-theme="light"] .crm-table-actions input.crm-action-btn-download[type="submit"] {
    border-color: rgba(18, 128, 88, 0.42) !important;
    color: #087443 !important;
}

html[data-theme="light"] .crm-action-btn-add:hover,
html[data-theme="light"] .crm-action-btn-download:hover,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-add:hover,
html[data-theme="light"] .crm-table-actions button.crm-action-btn-download:hover,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-add[type="submit"]:hover,
html[data-theme="light"] .crm-table-actions input.crm-action-btn-download[type="submit"]:hover {
    background: rgba(49, 196, 141, 0.18) !important;
    border-color: rgba(18, 128, 88, 0.48) !important;
    color: #065f46 !important;
}

html[data-theme="light"] .crm-filter-btn {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.16);
    color: rgba(15, 23, 42, 0.72);
}

html[data-theme="light"] .crm-filter-btn:hover {
    background: rgba(99, 91, 255, 0.08);
    border-color: rgba(99, 91, 255, 0.35);
    color: #0f172a;
}

html[data-theme="light"] .crm-filter-btn.active {
    background: rgba(99, 91, 255, 0.12);
    border-color: rgba(99, 91, 255, 0.45);
    color: #3f3eed;
}

html[data-theme="light"] .crm-badge {
    border-width: 1px;
    font-weight: 700;
}

html[data-theme="light"] .crm-badge-success {
    background: rgba(49, 196, 141, 0.22) !important;
    border-color: rgba(18, 128, 88, 0.42) !important;
    color: #087443 !important;
}

html[data-theme="light"] .crm-badge-primary {
    background: rgba(99, 91, 255, 0.16) !important;
    border-color: rgba(99, 91, 255, 0.42) !important;
    color: #3730a3 !important;
}

html[data-theme="light"] .crm-badge-warning {
    background: rgba(245, 158, 11, 0.22) !important;
    border-color: rgba(180, 83, 9, 0.42) !important;
    color: #92400e !important;
}

html[data-theme="light"] .crm-badge-danger {
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(185, 28, 28, 0.38) !important;
    color: #991b1b !important;
}

html[data-theme="light"] .crm-badge-muted,
html[data-theme="light"] .crm-badge-secondary,
html[data-theme="light"] .crm-badge-light {
    background: rgba(15, 23, 42, 0.08) !important;
    border-color: rgba(15, 23, 42, 0.18) !important;
    color: #334155 !important;
}

html[data-theme="light"] .crm-dashboard-action,
html[data-theme="light"] .crm-dashboard-action span,
html[data-theme="light"] .crm-dashboard-action strong,
html[data-theme="light"] .crm-dashboard-action i {
    color: #0f172a !important;
}

html[data-theme="light"] .crm-dashboard-action:hover,
html[data-theme="light"] .crm-dashboard-action:hover span,
html[data-theme="light"] .crm-dashboard-action:hover strong,
html[data-theme="light"] .crm-dashboard-action:hover i {
    color: #3730a3 !important;
}

/* =========================================================
   19. Select2 - Agente AI
   ---------------------------------------------------------
   Versão única e sem duplicações.

   Notas importantes:
   - Não aplicar display:flex ao .select2-selection--multiple.
     Isso empurra o textarea interno de pesquisa para a direita.
   - O flex deve ficar apenas em .select2-selection__rendered.
   - O botão .select2-selection__clear fica absoluto à direita.
========================================================= */

.crm-ai-agent-page .select2-container {
    width: 100% !important;
    font-family: var(--crm-font);
}

/* Caixa principal do Select2 */
.crm-ai-agent-page .select2-container--default .select2-selection--multiple {
    position: relative;
    min-height: 46px;
    background-color: rgba(255, 255, 255, 0.095);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 12px;
    padding: 10px 42px 10px 10px !important;
}

/* Estado focus */
.crm-ai-agent-page .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: rgba(99, 91, 255, 0.85);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.22);
}

/* Lista interna: pills + pesquisa */
.crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
}

/* Pill individual */
.crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    max-width: min(100%, 360px);
    min-height: 28px;
    margin: 0 !important;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--crm-primary-soft);
    border: 1px solid var(--crm-primary-border);
    color: var(--crm-primary-text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* X individual da pill */
.crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    position: static !important;
    order: 2;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 20px !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    margin: 0 0 0 6px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10) !important;
    color: var(--crm-primary-text) !important;
    font-size: 16px !important;
    line-height: 1 !important;
    cursor: pointer;
}

    .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
        background: rgba(255, 255, 255, 0.20) !important;
        color: #ffffff !important;
    }

/* X global para limpar tudo */
.crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__clear {
    position: absolute !important;
    top: 50% !important;
    right: 9px !important;
    transform: translateY(-50%) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10) !important;
    color: var(--crm-text-muted) !important;
    font-size: 18px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    cursor: pointer;
    z-index: 2;
}

    .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__clear:hover {
        background: rgba(255, 255, 255, 0.20) !important;
        color: #ffffff !important;
    }

/* Área de pesquisa interna */
.crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-search--inline {
    flex: 1 1 180px !important;
    min-width: 160px !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* Textarea interno criado pelo Select2 */
.crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-search__field {
    width: 100% !important;
    min-height: 28px !important;
    height: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--crm-text-strong) !important;
    font-family: var(--crm-font) !important;
    font-size: 14px !important;
    line-height: 28px !important;
    resize: none !important;
}

/* Dropdown pode ser anexado ao body; por isso estas regras são globais. */
.select2-container--default .select2-dropdown,
.crm-select2-dropdown {
    background: #151f39;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    font-family: var(--crm-font);
}

.select2-container--default .select2-results__option {
    padding: 8px 12px;
    color: #ffffff;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--crm-primary);
    color: #ffffff;
}

/* Light mode */
html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.18);
    color: #0f172a;
}

    html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__choice {
        background: rgba(99, 91, 255, 0.12);
        border-color: rgba(99, 91, 255, 0.35);
        color: #3730a3;
    }

    html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
        background: rgba(99, 91, 255, 0.12) !important;
        color: #3730a3 !important;
    }

        html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
            background: rgba(99, 91, 255, 0.22) !important;
            color: #312e81 !important;
        }

    html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__clear {
        background: rgba(15, 23, 42, 0.08) !important;
        color: rgba(15, 23, 42, 0.58) !important;
    }

        html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__clear:hover {
            background: rgba(99, 91, 255, 0.16) !important;
            color: #3730a3 !important;
        }

    html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-search__field {
        color: #0f172a !important;
    }

        html[data-theme="light"] .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
            color: rgba(15, 23, 42, 0.55) !important;
        }

html[data-theme="light"] .select2-container--default .select2-dropdown,
html[data-theme="light"] .crm-select2-dropdown {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.18);
    color: #0f172a;
}

html[data-theme="light"] .select2-container--default .select2-results__option {
    color: #0f172a;
}

html[data-theme="light"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: rgba(99, 91, 255, 0.14);
    color: #3730a3;
}

@media (max-width: 575px) {
    .crm-ai-agent-page .select2-container--default .select2-selection--multiple .select2-selection__choice {
        max-width: 240px;
    }
}