/* F6 - Clima Organizacional */
.f6_climate_page_wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.f6_climate_panel,
.f6_climate_employee_section,
.f6_climate_json_panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.f6_climate_panel_head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.f6_climate_panel_actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.f6_climate_hint,
.f6_climate_trace,
.f6_climate_empty {
    color: var(--text-secondary);
    font-size: 13px;
}

.f6_climate_no_data_banner {
    background: #fff8e1;
    border: 1px solid #f9a825;
    border-left: 4px solid #f9a825;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 8px 0 14px;
    font-size: 13px;
    color: #5d4037;
    line-height: 1.5;
}

/* Laboratório de teste — resultado após ingestão */
.f6_climate_lab_result {
    margin-top: 16px;
    border-top: 1px solid #e0e0e0;
    padding-top: 16px;
}

.f6_climate_lab_result_grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

@media (max-width: 900px) {
    .f6_climate_lab_result_grid {
        grid-template-columns: 1fr;
    }
}

.f6_climate_lab_panel {
    background: #f9f9fb;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
}

.f6_climate_lab_panel h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #333);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.f6_climate_lab_panel_head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.f6_climate_lab_panel_head h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #333);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.f6_climate_kpi_row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.f6_climate_kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary, #333);
    line-height: 1.1;
}

.f6_climate_kpi small {
    font-size: 11px;
    font-weight: 400;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.f6_climate_table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.f6_climate_table th,
.f6_climate_table td {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid #e0e0e0;
}

.f6_climate_table th {
    font-weight: 600;
    color: #555;
    background: #f0f0f0;
}

.f6_climate_topics_list {
    margin: 0;
    padding-left: 16px;
    font-size: 13px;
    line-height: 1.8;
}

.f6_climate_plain_explain {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.f6_climate_guide {
    background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}

.f6_climate_guide_list {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.f6_climate_controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.f6_climate_controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 12px;
}

.f6_climate_controls input,
.f6_climate_controls select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    color: var(--text-primary);
    background: #ffffff;
}

.f6_climate_textarea_label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 12px;
    margin-top: 12px;
}

.f6_climate_textarea_label textarea {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-primary);
    font-family: inherit;
    padding: 10px 11px;
}

.f6_climate_filters_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.f6_climate_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.f6_climate_chip_btn {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-primary);
    padding: 8px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.f6_climate_chip_btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.f6_climate_chip_btn_primary {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.f6_climate_chip_btn_primary:hover {
    color: #ffffff;
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.f6_climate_chip_btn_warn {
    border-color: rgba(231, 76, 60, 0.35);
    color: var(--danger-color);
}

.f6_climate_grid,
.f6_climate_employee_grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.f6_climate_result {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.f6_climate_metric_card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #f8fbff;
}

.f6_climate_metric_rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.f6_climate_metric_row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
    padding-bottom: 4px;
}

.f6_climate_metric_label {
    color: var(--text-secondary);
    font-size: 12px;
}

.f6_climate_metric_value {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.f6_climate_metric_head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.f6_climate_metric_head span {
    border-radius: 999px;
    background: rgba(33, 150, 243, 0.12);
    color: var(--primary-dark);
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.f6_climate_metric_card dl,
.f6_climate_ops_list {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) 1fr;
    gap: 6px 10px;
}

.f6_climate_status_badge {
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.f6_climate_inline_level {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.f6_climate_legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.f6_climate_legend_item {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.f6_climate_level_good {
    border-color: rgba(39, 174, 96, 0.45);
    background: rgba(39, 174, 96, 0.15);
    color: #1f7f47;
}

.f6_climate_level_attention {
    border-color: rgba(243, 156, 18, 0.45);
    background: rgba(243, 156, 18, 0.14);
    color: #946200;
}

.f6_climate_level_warning {
    border-color: rgba(230, 126, 34, 0.45);
    background: rgba(230, 126, 34, 0.15);
    color: #9a5316;
}

.f6_climate_level_critical {
    border-color: rgba(231, 76, 60, 0.45);
    background: rgba(231, 76, 60, 0.13);
    color: #a03022;
}

.f6_climate_level_neutral {
    border-color: rgba(127, 140, 141, 0.35);
    background: rgba(127, 140, 141, 0.11);
    color: #5c6e70;
}

.f6_climate_metric_card.f6_climate_level_good {
    border-left: 4px solid #27ae60;
}

.f6_climate_metric_card.f6_climate_level_attention {
    border-left: 4px solid #f39c12;
}

.f6_climate_metric_card.f6_climate_level_warning {
    border-left: 4px solid #e67e22;
}

.f6_climate_metric_card.f6_climate_level_critical {
    border-left: 4px solid #e74c3c;
}

.f6_climate_metric_card.f6_climate_level_neutral {
    border-left: 4px solid #95a5a6;
}

.f6_climate_metric_card dt,
.f6_climate_ops_list dt {
    color: var(--text-secondary);
    font-size: 12px;
}

.f6_climate_metric_card dd,
.f6_climate_ops_list dd {
    color: var(--text-primary);
    font-weight: 700;
}

.f6_climate_subpanel {
    border-top: 1px dashed var(--border-color);
    margin-top: 10px;
    padding-top: 10px;
}

.f6_climate_subsection_title {
    margin: 16px 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.f6_climate_subpanel h4 {
    margin-bottom: 6px;
}

.f6_climate_inline_list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-secondary);
}

.f6_climate_technical {
    margin-top: 10px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.f6_climate_technical summary {
    cursor: pointer;
    padding: 10px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.f6_climate_technical_analysis {
    padding: 10px 12px;
    border-top: 1px dashed var(--border-color);
    border-bottom: 1px dashed var(--border-color);
    background: #f8fafc;
    color: var(--text-primary);
}

.f6_climate_technical_analysis h5 {
    margin: 0 0 6px;
}

.f6_climate_technical_analysis ul {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.f6_climate_technical_analysis p {
    margin: 0;
}

.f6_climate_technical pre {
    margin: 0;
    overflow: auto;
    max-height: 260px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: #0f172a;
    color: #e2e8f0;
    padding: 10px 12px;
    font-size: 12px;
}

.f6_climate_raw {
    overflow: auto;
    max-height: 360px;
    border-radius: var(--radius-sm);
    background: #111827;
    color: #e5e7eb;
    padding: 14px;
    font-size: 12px;
}

@media (max-width: 900px) {
    .f6_climate_panel_head {
        flex-direction: column;
    }
    .f6_climate_grid,
    .f6_climate_employee_grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .f6_climate_metric_row {
        flex-direction: column;
        align-items: flex-start;
    }
    .f6_climate_metric_value {
        text-align: left;
    }
}

/* =============================================================================
   Estilos Melhorados para Interface Web de Teste LLM
   =============================================================================
   Design moderno, elegante e responsivo com melhor UX.
   ============================================================================= */

/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* O atributo hidden ganha sempre a classes com display (flex/grid) */
[hidden] {
    display: none !important;
}

/* Variáveis CSS para cores e espaçamentos (inspiradas no dashboard time.track) */
:root {
    --sidebar-bg: #1f242d;
    --sidebar-accent: #e53935;
    --sidebar-accent-soft: rgba(229, 57, 53, 0.2);
    --primary-color: #2196f3;
    --primary-dark: #1976d2;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --bg-main: #f5f6fa;
    --bg-card: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e0e4eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: all 0.2s ease-in-out;
    --header-height: 62px;
    --sidebar-left-width: 240px;
    --sidebar-right-width: 320px;
}

/* Configurações do corpo da página */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    height: 100vh;
    padding: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* Container principal - Grid com 3 colunas */
.container {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: grid;
    grid-template-columns: var(--sidebar-left-width) 1fr 0fr;
    grid-template-rows: var(--header-height) 1fr;
    height: calc(100vh - 32px);
    max-height: calc(100vh - 32px);
    position: relative;
    transition: grid-template-columns 0.3s ease-in-out;
}

/* Quando o painel de configurações está aberto */
.container.config-open {
    grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-width);
}

/* Sidebar esquerda (menu) */
.sidebar-left {
    grid-row: 1 / -1;
    background: var(--sidebar-bg);
    color: #e9ecf1;
    border-right: 1px solid #151821;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-left::-webkit-scrollbar {
    width: 6px;
}

.sidebar-left::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-left::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-left::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid #151821;
    background: rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    color: #f5f7fb;
    font-weight: 700;
    font-size: 16px;
}

.logo i {
    font-size: 20px;
    color: var(--primary-color);
}

.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo-image {
    width: 100px;
    height: auto;
    display: block;
}

.sidebar-product {
    display: flex;
    justify-content: center;
    width: 100%;
}

.sidebar-product label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 0;
    color: #f5f7fb;
    font-size: 13px;
}

.sidebar-header .menu-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.sidebar-product .select_product {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid #2c323f;
    background: #2c323f; /* Cinza escuro para contraste */
    color: #ffffff;       /* Texto branco para legibilidade */
    font-size: 12px;
    cursor: pointer;
}

.sidebar-product .select_product:focus,
.sidebar-product .select_product:active {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.3);
    background: #1f242d !important;
    color: #ffffff !important;
}

.sidebar-product .select_product option {
    background: #1f242d !important;
    color: #ffffff !important;
    padding: 8px;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #c7cbd4;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 12px;
    flex: 1;
}

.menu-item {
    color: #c7cbd4;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    font-weight: 600;
    font-size: 14px;
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.menu-item.active {
    background: var(--sidebar-accent-soft);
    color: #ffffff;
    border-left: 3px solid var(--sidebar-accent);
    padding-left: 11px;
}

/*
 * Grupos colapsáveis: heading e bloco de itens são irmãos no flex
 * de .sidebar-menu (mesmo gap:6px que F2→F3). Itens abertos usam
 * display:contents para os filhos partilharem esse gap.
 */
.sidebar-nav-group-items {
    display: contents;
}

.sidebar-nav-group-items[hidden] {
    display: none !important;
}

button.menu-item.sidebar-nav-group-heading {
    /* Mesmo box que a.menu-item: UA do button usa line-height:normal */
    width: 100%;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    color: #c7cbd4;
    -webkit-appearance: none;
    appearance: none;
}

button.menu-item.sidebar-nav-group-heading:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

button.menu-item.sidebar-nav-group-heading > i:not(.sidebar-nav-group-chevron) {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-nav-group-heading .sidebar-nav-group-chevron {
    margin-left: auto;
    width: auto;
    flex-shrink: 0;
    font-size: 12px;
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.sidebar-nav-group-heading.sidebar-nav-group--collapsed .sidebar-nav-group-chevron {
    transform: rotate(-90deg);
}

/* Filhos: mesma tipografia que F2–F7; ícone alinhado sob o texto do heading */
.menu-item.menu-sub {
    font-weight: 600;
    font-size: 14px;
    padding: 12px 14px 12px 46px;
    margin-left: 0;
}

.menu-item.menu-sub i {
    font-size: 16px;
    opacity: 1;
}

.menu-item.menu-sub.active {
    background: var(--sidebar-accent-soft);
    color: #ffffff;
    border-left: 3px solid var(--sidebar-accent);
    padding-left: 43px;
}

/* Página /product-config/email */
.ec-page-header {
    padding: 20px 24px 8px;
    flex-shrink: 0;
}

.ec-page-header h1 {
    margin: 0 0 10px 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary, #1a1d24);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ec-main .ec-panels {
    padding: 0 24px 32px;
}

.ec-email-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    margin-top: 16px;
}

.ec-email-actions .btn-primary {
    flex: 1 1 200px;
    justify-content: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #151821;
    background: rgba(0, 0, 0, 0.08);
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    text-align: center;
}

.app-name {
    font-weight: 600;
    font-size: 13px;
    color: #f5f7fb;
}

.copyright {
    font-size: 11px;
    color: #7f8c8d;
}

.sidebar-footer .btn-secondary {
    font-size: 12px;
}

.sidebar-footer > a {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    color: #f5f7fb;
}

.sidebar-footer > a:hover {
    color: #ffffff;
    opacity: 0.9;
}

/* Cabeçalho melhorado */
.header {
    grid-column: 2;
    grid-row: 1;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    min-height: var(--header-height);
}

.header-content {
    flex: 1;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 2px 0;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.test_account_switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
}

.test_account_switcher[hidden] {
    display: none !important;
}

.test_account_switcher_label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.test_account_select {
    min-width: 180px;
    max-width: 240px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 13px;
}

/* Atalho admin: repor chat da conta teste sem abrir o painel de config */
.test_account_reset_btn[hidden] {
    display: none !important;
}

.btn-icon {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 15px;
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
    background: var(--bg-card);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-icon.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-icon:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Sidebar direita (configurações) */
.sidebar-right {
    grid-column: 3;
    grid-row: 1 / -1;
    background: var(--sidebar-bg);
    color: #e9ecf1;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    width: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.container.config-open .sidebar-right {
    width: var(--sidebar-right-width);
    opacity: 1 !important;
    visibility: visible !important;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    display: flex !important;
}

.sidebar-right::-webkit-scrollbar {
    width: 6px;
}

.sidebar-right::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-right::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-right::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.config-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Config header in chat-card (evaluation page) - more compact */
.chat-card .config-header {
    padding: 12px 16px; /* More compact */
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    background: transparent; /* No dark background in light card */
}

.chat-card .config-header h2 {
    font-size: 15px; /* Slightly smaller */
    margin: 0;
    color: var(--text-primary);
    font-weight: 600; /* Less bold */
}

.config-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: #f5f7fb;
    display: flex;
}

/* Config header h2 in chat-card (evaluation page) */
.chat-card .config-header h2 {
    color: var(--text-primary); /* Dark text on light background */
    font-size: 15px; /* Slightly smaller */
    font-weight: 600; /* Less bold */
}

.config-header h2 i {
    color: var(--primary-color);
    font-size: 18px;
}

/* Config header inside chat-card (for evaluation page) */
.chat-card .config-header {
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    padding: 16px 20px;
}

.chat-card .config-header h2 {
    color: var(--text-primary);
    font-size: 18px;
}

/* Ensure selects in config-content are readable */
.sidebar-right .config-group select.select_product {
    width: 100%;
    padding: 12px 14px;
    padding-right: 36px;
    border: 1px solid #2c323f;
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #f5f7fb;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f5f7fb' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: var(--transition);
    margin-top: 4px;
}

.sidebar-right .config-group select.select_product:focus,
.sidebar-right .config-group select.select_product:active {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background-color: #1f242d !important;
    color: #f5f7fb !important;
}

.sidebar-right .config-group select.select_product option {
    background: #1f242d !important;
    color: #f5f7fb !important;
    padding: 8px;
}

.btn-close {
    background: transparent;
    border: none;
    color: #c7cbd4;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.config-content {
    padding: 24px 20px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.config-content::-webkit-scrollbar {
    width: 8px;
}

.config-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.config-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.config-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.config-group {
    margin-bottom: 20px; /* Reduced from 28px */
    padding-bottom: 12px; /* Reduced from 20px */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Config groups in chat-card (evaluation page) - more compact */
.chat-card .config-group {
    margin-bottom: 16px; /* Even more compact */
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.config-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.config-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #f5f7fb;
    font-size: 14px;
    line-height: 1.5;
}

/* Labels in chat-card (main area) - dark text on light background */
.chat-card .config-group label {
    color: var(--text-primary) !important; /* Dark text for readability on white background */
    font-weight: 600;
}

/* Labels in sidebar-right (dark background) - light text */
.sidebar-right .config-group label {
    color: #f5f7fb;
    font-weight: 600;
}

.sidebar-right .config-group label i {
    color: var(--primary-color);
    width: 18px;
    text-align: center;
}

.ui_context_group .ui_context_custom_field {
    margin-top: 8px;
    width: 100%;
    box-sizing: border-box;
}

.ui_context_hint {
    margin-top: 6px;
    margin-bottom: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(245, 247, 251, 0.75);
}

.value-display {
    margin-left: auto;
    font-weight: 700;
    color: #f5f7fb;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    flex: 1;
    padding-right: 40px;
    color: #e9ecf1;
    background: rgba(255, 255, 255, 0.05);
    border-color: #2c323f;
}

.icon-btn {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: #c7cbd4;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    color: #ffffff;
}

.config-group input[type="text"],
.config-group input[type="number"],
.config-group input[type="password"],
.config-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #2c323f;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    color: #f5f7fb;
    margin-top: 4px;
}

/* Inputs and selects in chat-card (main area) - dark text on light background */
.chat-card .config-group input[type="text"],
.chat-card .config-group input[type="number"],
.chat-card .config-group input[type="password"],
.chat-card .config-group input[type="file"],
.chat-card .config-group select {
    color: var(--text-primary) !important; /* Dark text for readability */
    background: var(--bg-card) !important; /* White background */
    border: 1px solid var(--border-color) !important; /* Light border */
}

/* When chat-card select is open, use dark background for dropdown */
.chat-card .config-group select:focus,
.chat-card .config-group select:active {
    background: #1f242d !important;
    color: #f5f7fb !important;
}

.chat-card .config-group select option {
    background: #1f242d !important;
    color: #f5f7fb !important;
    padding: 8px;
}

.chat-card .config-group input[type="file"] {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}

.chat-card .config-group input[type="file"]::file-selector-button {
    padding: 6px 12px;
    margin-right: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.chat-card .config-group input[type="file"]::file-selector-button:hover {
    background: var(--primary-dark);
}

.config-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f5f7fb' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.config-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Fix dropdown background when open - ensure dark background */
.config-group select:focus,
.config-group select:active,
.config-group select:hover {
    background-color: #1f242d !important;
    color: #f5f7fb !important;
}

/* Options in dropdown - dark background with light text */
.config-group select option {
    background: #1f242d !important;
    color: #f5f7fb !important;
    padding: 8px;
}

.config-group input[type="number"]::-webkit-inner-spin-button,
.config-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.config-group input[type="number"] {
    -moz-appearance: textfield;
}

.config-group input[type="text"]:focus,
.config-group input[type="number"]:focus,
.config-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Checkbox styling */
.config-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
    margin-right: 8px;
}

.config-group label[for*="enabled"] {
    cursor: pointer;
    user-select: none;
}

/* Warning message styling */
.warning-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(243, 156, 18, 0.15);
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: var(--radius-sm);
    color: #f39c12;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 8px;
}

.warning-message i {
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.warning-message span {
    flex: 1;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #2c323f;
    outline: none;
    -webkit-appearance: none;
    margin: 12px 0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 4px;
}

.config-group small {
    display: block;
    color: #a0a8b0;
    font-size: 12px;
    margin-top: 8px;
    line-height: 1.5;
    font-style: italic;
}

/* Small text in chat-card - darker for readability */
.chat-card .config-group small {
    color: var(--text-secondary) !important; /* Darker gray for better contrast */
}

/* Status cards and other info elements in chat-card */
.chat-card .legal-status-card,
.chat-card .status-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 8px;
}

.chat-card .status-item,
.chat-card .legal-status-card .status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.chat-card .status-item:last-child {
    border-bottom: none;
}

.chat-card .status-label,
.chat-card .legal-status-card .status-label {
    color: var(--text-secondary) !important;
    font-size: 14px;
    font-weight: 500;
}

.chat-card .status-value,
.chat-card .legal-status-card .status-value {
    color: var(--text-primary) !important;
    font-size: 14px;
    font-weight: 600;
}

.chat-card .status-value i {
    margin-right: 6px;
}

/* File input text in chat-card */
.chat-card .config-group input[type="file"] + label,
.chat-card .config-group label + input[type="file"] {
    color: var(--text-primary) !important;
}

/* Placeholder text in inputs */
.chat-card .config-group input::placeholder,
.chat-card .config-group textarea::placeholder {
    color: var(--text-secondary) !important;
    opacity: 0.7;
}

.config-actions-chunks,
.config-actions {
    flex-shrink: 0;
}
.config-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 12px; /* Reduced from 20px */
    padding-top: 12px; /* Reduced from 20px */
    border-top: 1px solid var(--border-color); /* Use CSS variable */
}

/* Config actions in chat-card (evaluation page) */
.chat-card .config-actions {
    border-top: 1px solid var(--border-color);
}

/* Botões melhorados */
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    border: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: #f5f7fb;
    border: 1px solid #2c323f;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-color);
    color: #ffffff;
}

.config-actions .btn-primary,
.config-actions .btn-secondary {
    width: auto;
    flex: 1;
}

/* Linha do contador de chunks (BD produto; mantido para compatibilidade) */
.config-actions-chunks {
    margin-bottom: 8px;
    min-height: 1.5em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.knowledge-chunks-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}
/* Sufixo de chunks indexados no título (BD produto) */
.knowledge-chunks-count {
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
}
.knowledge-chunks-count.knowledge-chunks-none {
    color: var(--warning-color, #b8860b);
    font-weight: 500;
}

.availability_btn_available {
    border-color: rgba(39, 174, 96, 0.65);
    color: #9fe6bf;
}

.availability_btn_available.availability_btn_active {
    background: linear-gradient(135deg, #1d8f4f 0%, #27ae60 100%);
    color: #ffffff;
    border-color: #27ae60;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.35);
}

.availability_btn_unavailable {
    border-color: rgba(231, 76, 60, 0.65);
    color: #f4b4ac;
}

.availability_btn_unavailable.availability_btn_active {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: #ffffff;
    border-color: #e74c3c;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.35);
}

/* Bloco de disponibilidade no painel direito (substitui o espaçamento de .config-actions) */
.availability_toggle_section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Texto de apoio sob o rótulo Disponibilidade (dashboard de atendimento) */
.availability_toggle_hint {
    margin: 0 0 10px 0;
    font-size: 12px;
    line-height: 1.4;
    color: #b8c0d0;
    font-weight: 600;
}

.availability_toggle_hint_available {
    color: #a8e9c4;
}

.availability_toggle_hint_unavailable {
    color: #f5b4aa;
}

/* Controlo segmentado: só o botão activo usa verde/vermelho forte */
.availability_toggle {
    display: flex;
    gap: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.28);
}

.availability_toggle .btn-secondary {
    flex: 1;
    margin: 0;
    border-radius: 0;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    flex-direction: row;
    gap: 8px;
}

.availability_toggle .btn-secondary:last-child {
    border-right: none;
}

/* Opção não seleccionada: neutra (evita o vermelho a parecer sempre “ligado”) */
.availability_toggle .availability_btn_available:not(.availability_btn_active),
.availability_toggle .availability_btn_unavailable:not(.availability_btn_active) {
    background: rgba(255, 255, 255, 0.05);
    color: #9aa3b5;
    border-color: transparent;
    box-shadow: none;
    font-weight: 500;
}

.availability_toggle .availability_btn_available:not(.availability_btn_active):hover,
.availability_toggle .availability_btn_unavailable:not(.availability_btn_active):hover {
    background: rgba(255, 255, 255, 0.12);
    color: #eef1f6;
}

.availability_toggle .availability_btn_active {
    font-weight: 700;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

/* Ícone de confirmação só no estado activo */
.availability_toggle .availability_btn_check {
    font-size: 12px;
    width: 1em;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.availability_toggle .availability_btn_active .availability_btn_check {
    opacity: 1;
    transform: scale(1);
}

.sessions_tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

/* Botão rotulado no cabeçalho — evita ícone só (AC «Actualizar fila»). */
.refresh_sessions_btn {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
}

.sidebar-right .config-content {
    display: flex;
    flex-direction: column;
    min-height: 0; /* permite que o flex item encolha e mostre scroll */
    overflow-y: auto;
    overflow-x: hidden;
}

.sessions_group {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#sessions_list {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
}

.sessions_tab_btn {
    flex: 1;
    min-width: 0;
    padding: 8px 8px;
    font-size: 11px;
}

.sessions_tab_btn.sessions_tab_btn_active {
    background: rgba(52, 152, 219, 0.25);
    border-color: rgba(52, 152, 219, 0.65);
    color: #dbefff;
}

.support_session_card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    text-align: left;
    border: 1px solid #c4d0de;
    border-radius: 10px;
    background: #f5f8fc;
    padding: 10px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.support_session_card:hover:not(:disabled) {
    border-color: #4aa4e7;
    background: #eef5fb;
}

.support_session_card:disabled {
    opacity: 1;
    cursor: not-allowed;
}

.support_session_header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.support_session_badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 1 1 100%;
    min-width: 0;
}

.support_session_title {
    flex: 1 1 100%;
    min-width: 0;
    font-size: 12px;
    font-weight: 700;
    color: #1d3349;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-break: break-word;
}

.support_session_meta {
    font-size: 11px;
    color: #425a73;
    line-height: 1.35;
}

.support_session_assigned {
    color: #ffc971;
    font-weight: 700;
}

.session_status_badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: normal;
    text-align: center;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Estados únicos de atendimento: um estado por sessão */
.session_status_automatico {
    background: rgba(74, 144, 217, 0.22);
    border-color: rgba(74, 144, 217, 0.6);
    color: #a8d4ff;
}

.session_status_em_fila {
    background: rgba(230, 126, 34, 0.22);
    border-color: rgba(230, 126, 34, 0.7);
    color: #ffd0a0;
}

/* Fila só com IA: laranja, sem animação de alerta */
.session_status_em_fila_automatico {
    background: rgba(230, 126, 34, 0.28);
    border-color: rgba(217, 119, 6, 0.9);
    color: #ffcc80;
}

/* Visitante pediu humano: vermelho (alerta sonoro no dashboard) */
.session_status_em_fila_humano {
    background: rgba(192, 57, 43, 0.28);
    border-color: rgba(231, 76, 60, 0.9);
    color: #ffc4bc;
}

/* Agente convidou; à espera de Aceitar/Recusar do visitante */
.session_status_convite_pendente {
    background: rgba(155, 89, 182, 0.28);
    border-color: rgba(142, 68, 173, 0.9);
    color: #e0b3f0;
}

.session_status_em_atendimento {
    background: rgba(52, 152, 219, 0.22);
    border-color: rgba(52, 152, 219, 0.65);
    color: #9fd5ff;
}

.session_status_resolvido {
    background: rgba(39, 174, 96, 0.22);
    border-color: rgba(39, 174, 96, 0.65);
    color: #9fe6bf;
}

.support_session_automatico.support_session_card {
    border-color: rgba(74, 144, 217, 0.5);
}

.support_session_em_fila.support_session_card {
    border-color: rgba(230, 126, 34, 0.55);
}

.support_session_em_fila_automatico.support_session_card {
    border-color: rgba(217, 119, 6, 0.65);
    background: linear-gradient(145deg, rgba(255, 247, 237, 0.55) 0%, rgba(254, 243, 199, 0.25) 100%);
}

.support_session_em_fila_humano.support_session_card {
    border-color: rgba(231, 76, 60, 0.75);
    background: rgba(231, 76, 60, 0.07);
    animation: support_em_fila_humano_pulse 1.2s ease-in-out infinite;
}

.support_session_em_atendimento.support_session_card {
    border-color: rgba(41, 128, 185, 0.75);
    background: rgba(52, 152, 219, 0.08);
}

.support_session_resolvido.support_session_card {
    border-color: rgba(39, 174, 96, 0.5);
}

/* Estado terminada: sessão fechada pelo assistente (status closed) */
.session_status_terminada {
    background: rgba(108, 117, 125, 0.22);
    border-color: rgba(73, 80, 87, 0.65);
    color: #c5ccd4;
}

.support_session_terminada.support_session_card {
    border-color: rgba(73, 80, 87, 0.55);
    background: rgba(108, 117, 125, 0.06);
}

.session_status_other_agent {
    background: rgba(230, 126, 34, 0.22);
    border-color: rgba(230, 126, 34, 0.7);
    color: #ffd0a0;
}

.session_status_pending_data {
    background: rgba(243, 156, 18, 0.22);
    border-color: rgba(243, 156, 18, 0.65);
    color: #ffd69a;
}

.support_session_other_agent {
    border-color: rgba(230, 126, 34, 0.52);
    background: rgba(230, 126, 34, 0.1);
}

/*
 * Cartões da fila usam fundo claro no painel escuro: texto dos badges deve ser escuro
 * (as classes .session_status_* acima usam cores claras pensadas para fundo escuro).
 */
.sidebar-right .support_session_card .session_status_badge {
    font-size: 11px;
    padding: 4px 10px;
    line-height: 1.25;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar-right .support_session_card .session_status_automatico {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e3a5f;
}

.sidebar-right .support_session_card .session_status_em_fila {
    background: #ffedd5;
    border-color: #ea580c;
    color: #9a3412;
}

.sidebar-right .support_session_card .session_status_em_fila_automatico {
    background: #fef3c7;
    border-color: #d97706;
    color: #92400e;
}

.sidebar-right .support_session_card .session_status_em_fila_humano {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
}

.sidebar-right .support_session_card .session_status_convite_pendente {
    background: #f3e8ff;
    border-color: #9333ea;
    color: #6b21a8;
}

.sidebar-right .support_session_card .session_status_em_atendimento {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
}

.sidebar-right .support_session_card .session_status_resolvido {
    background: #dcfce7;
    border-color: #16a34a;
    color: #166534;
}

.sidebar-right .support_session_card .session_status_terminada {
    background: #f1f5f9;
    border-color: #64748b;
    color: #334155;
}

.sidebar-right .support_session_card .session_status_other_agent {
    background: #ffedd5;
    border-color: #c2410c;
    color: #7c2d12;
}

.sidebar-right .support_session_card .session_status_pending_data {
    background: #fef9c3;
    border-color: #ca8a04;
    color: #713f12;
}

.sidebar-right .support_session_card .support_session_assigned {
    color: #b45309;
}

@keyframes support_em_fila_pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(230, 126, 34, 0.25);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.06);
    }
}

@keyframes support_em_fila_humano_pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(231, 76, 60, 0.1);
    }
}

.support_session_selected {
    border-color: #2f90da;
    box-shadow: 0 0 0 2px rgba(47, 144, 218, 0.2);
}

.support_session_unread .support_session_title {
    color: #10283f;
}

.session_unread_count {
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #20d35c;
    color: #0e2f1a;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px rgba(32, 211, 92, 0.14);
    animation: support_unread_pulse 1.2s ease-in-out infinite;
}

@keyframes support_unread_pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.86);
        opacity: 0.72;
    }
}

.selected_session_info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f6f9fc;
}

.selected_session_info_line {
    font-size: 12px;
    color: #2d4156;
    line-height: 1.35;
}

/* CodeMirror custom highlighting for knowledge base sections */
/* Enhanced colors with stronger backgrounds for better visual separation */
.cm-kb-s {
    color: #3498db !important; /* Strong blue */
    background: rgba(52, 152, 219, 0.35) !important; /* Increased opacity from 0.15 to 0.35 */
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    border-left: 3px solid #3498db;
}

.cm-kb-ss {
    color: #2ecc71 !important; /* Strong green */
    background: rgba(46, 204, 113, 0.35) !important; /* Increased opacity from 0.15 to 0.35 */
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    border-left: 3px solid #2ecc71;
}

.cm-kb-sss {
    color: #9b59b6 !important; /* Strong purple */
    background: rgba(155, 89, 182, 0.35) !important; /* Increased opacity from 0.15 to 0.35 */
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    border-left: 3px solid #9b59b6;
}

.cm-kb-p {
    color: #e67e22 !important; /* Strong orange */
    background: rgba(230, 126, 34, 0.35) !important; /* Increased opacity from 0.15 to 0.35 */
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
    border-left: 3px solid #e67e22;
}

.cm-kb-r {
    color: #1abc9c !important; /* Strong turquoise/cyan */
    background: rgba(26, 188, 156, 0.35) !important; /* Increased opacity from 0.15 to 0.35 */
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
    border-left: 3px solid #1abc9c;
}

.cm-kb-sql {
    color: #f1c40f !important;
    background: rgba(241, 196, 15, 0.18) !important;
    font-family: Consolas, "Courier New", monospace;
    font-weight: 600;
    padding: 1px 3px;
    border-radius: 3px;
}

/* CodeMirror Search Toggle Button */
.codemirror-search-toggle-btn {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-left: 12px;
}

.codemirror-search-toggle-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.codemirror-search-toggle-btn i {
    font-size: 14px;
}

/* CodeMirror Search Bar */
.codemirror-search-container {
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    padding: 8px;
    box-shadow: var(--shadow-sm);
}

.codemirror-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.codemirror-search-icon {
    color: var(--text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

.codemirror-search-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
}

.codemirror-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.codemirror-search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.codemirror-search-count {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.codemirror-search-btn {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.codemirror-search-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.codemirror-search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.codemirror-search-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.codemirror-search-close:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

/* CodeMirror search highlighting */
.CodeMirror-searching {
    background: rgba(255, 255, 0, 0.4) !important;
    color: #000 !important;
    font-weight: 600;
    border-radius: 2px;
    padding: 1px 2px;
}

.CodeMirror-selectedtext {
    background: rgba(33, 150, 243, 0.4) !important;
}

/* Ensure search overlay works with section highlighting */
.CodeMirror .cm-searching {
    background: rgba(255, 255, 0, 0.4) !important;
    color: #000 !important;
    font-weight: 600;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--primary-color);
    min-width: 300px;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.info {
    border-left-color: var(--primary-color);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--primary-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.toast-message {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* Loading Modal */
.loading-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 20000;
    align-items: center;
    justify-content: center;
}

.loading-modal.active {
    display: flex;
}

.loading-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.loading-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.loading-progress-info {
    margin: 16px 0;
    padding: 12px;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.loading-progress-stats {
    display: flex;
    justify-content: space-around;
    gap: 16px;
    flex-wrap: wrap;
}

.progress-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.progress-stat .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-stat .stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-stat .stat-total {
    font-size: 14px;
    color: var(--text-secondary);
}

.loading-current-question {
    margin: 16px 0;
    padding: 12px;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary-color);
    text-align: left;
}

.loading-current-question .question-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 600;
}

.loading-current-question .question-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.loading-progress {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0;
    position: relative;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.loading-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.loading-steps {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: left;
    margin-top: 16px;
}

.loading-step {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.loading-step.active {
    opacity: 1;
    font-weight: 600;
    color: var(--primary-color);
}

.loading-step.completed {
    opacity: 0.7;
}

.loading-step-icon {
    width: 16px;
    text-align: center;
}

.loading-step-text {
    flex: 1;
}

/* CodeMirror full height for knowledge base editor */
.chat-card .config-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Keep the product editor visible (do not let HESK history shrink it away). */
.chat-card .knowledge-editor-group {
    flex: 0 0 auto;
}

.chat-card .knowledge-editor-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Same CodeMirror sizing as BD Legal */
.CodeMirror {
    flex: 1;
    height: auto;
    min-height: 500px;
}

/* CodeMirror text color - ensure readable text on dark monokai theme */
.CodeMirror,
.CodeMirror pre,
.CodeMirror-lines,
.CodeMirror-lines pre,
.CodeMirror-lines pre span {
    color: #f8f8f2 !important; /* Light gray text for readability */
}

/* CodeMirror default text (not highlighted) */
.CodeMirror .cm-default {
    color: #f8f8f2 !important; /* Ensure default text is readable */
}

/* CodeMirror line numbers */
.CodeMirror-linenumber {
    color: #75715e !important; /* Muted color for line numbers */
}

/* CodeMirror cursor */
.CodeMirror-cursor {
    border-left: 1px solid #f8f8f2 !important; /* Visible cursor */
}

/* Textarea fallback (when CodeMirror is not initialized) */
#knowledge-textarea,
#legal-preview-textarea {
    color: var(--text-primary) !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    padding: 12px !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}

/* Textarea in dark theme (monokai-like) */
.CodeMirror.cm-s-monokai,
.CodeMirror.cm-s-monokai .CodeMirror-gutters {
    background-color: #272822 !important;
}

.CodeMirror.cm-s-monokai .CodeMirror-lines,
.CodeMirror.cm-s-monokai .CodeMirror-lines pre,
.CodeMirror.cm-s-monokai .CodeMirror-lines pre span {
    color: #f8f8f2 !important; /* Light text on dark background */
}

/* Ensure all text in CodeMirror is readable */
.CodeMirror.cm-s-monokai .CodeMirror-line span:not(.cm-kb-s):not(.cm-kb-ss):not(.cm-kb-sss):not(.cm-kb-p):not(.cm-kb-r):not(.cm-kb-sql) {
    color: #f8f8f2 !important; /* Default text color for non-highlighted content */
}

/* Área de chat melhorada */
.chat-area {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    background: var(--bg-main);
    position: relative;
    padding: 16px;
    /* Keep overflow hidden; individual pages provide their own scroll containers. */
    overflow: hidden;
    min-height: 0;
}

.chat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    position: relative;
}

.messages-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: var(--bg-main);
    scroll-behavior: smooth;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Mensagem de boas-vindas melhorada */
.welcome-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    max-width: 520px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
    opacity: 0.85;
}

.welcome-message h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
}

.welcome-message p {
    margin-bottom: 8px;
    font-size: 15px;
}

.hint {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Estilos para mensagens melhorados */
.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.25s ease-out;
}

.message-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}

.message-role {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.message-role.user {
    background: rgba(33, 150, 243, 0.15);
    color: var(--primary-dark);
}

.message-role.assistant {
    background: rgba(46, 204, 113, 0.18);
    color: var(--success-color);
}

.message-time {
    color: var(--text-secondary);
    font-size: 11px;
}

.message-content {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    line-height: 1.7;
    font-size: 15px;
    max-width: 85%;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.message-content strong {
    font-weight: 700;
    color: inherit;
}

/* Links seguros no transcript do dashboard de atendimento */
.message-content a {
    color: #0f766e;
    text-decoration: underline;
}

/* Markdown das respostas do ChatAI (chat_markdown.js) */
.message-content p,
.message-content ul,
.message-content ol {
    margin: 0 0 0.6em;
}

.message-content > :last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    padding-left: 1.4em;
}

.message-content li + li {
    margin-top: 0.25em;
}

.message-content h4 {
    margin: 0.9em 0 0.35em;
    font-size: 1.02em;
    font-weight: 700;
}

.message-content > h4:first-child {
    margin-top: 0;
}

.message-content code {
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.06);
    font-size: 0.92em;
}

.message.user .message-content {
    background: #e8f3ff;
    color: #114b8a;
    margin-left: auto;
    text-align: left;
    border: 1px solid #d3e5ff;
}

.message.assistant .message-content {
    background: #fdfefe;
    color: var(--text-primary);
    border: 1px solid #d7e3ee;
    box-shadow: var(--shadow-sm);
}

.message.error .message-content {
    background: #fdecea;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

/* Container for intent and sources in the same line */
.message-intent-sources {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Container for intent and sources in the same line */
.message-intent-sources {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Intent badge for assistant messages */
.message-intent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid #90caf9;
}

.intent-sources-separator {
    color: var(--text-secondary);
    opacity: 0.5;
    margin: 0 2px;
}

.message-intent i {
    font-size: 10px;
}

.message-intent .intent-sources {
    color: #64b5f6;
    font-weight: 400;
    font-size: 10px;
}

/* Sources container (legacy - kept for compatibility) */
.message-sources {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    border-left: 3px solid #2196f3;
}

/* Sources list inside intent-sources container */
.message-intent-sources .sources-list {
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    border-left: 3px solid #2196f3;
    list-style: none;
}

.message-intent-sources .sources-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #90caf9;
    font-size: 11px;
    font-weight: 500;
    user-select: none;
    padding: 4px 10px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 12px;
}

.sources-header i {
    font-size: 11px;
    transition: transform 0.2s;
}

.sources-list {
    margin-top: 8px;
    padding-left: 20px;
    list-style: decimal;
    color: #b0bec5;
    font-size: 11px;
    line-height: 1.6;
}

.sources-list li {
    margin-bottom: 4px;
    word-break: break-word;
}

/* Metrics container for performance information */
.message-metrics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(33, 150, 243, 0.08);
    border-radius: 6px;
    border-left: 3px solid #2196f3;
    font-size: 11px;
    color: #1565c0;
}

.metric-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.metric-separator {
    color: var(--text-secondary);
    opacity: 0.5;
    margin: 0 4px;
}

.metric-item i {
    font-size: 10px;
    opacity: 0.8;
}

/* Suggestions container for follow-up quick replies */
.message-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

/* Widget q.track: texto “Escolhe uma opção” no mesmo bloco dos botões, sem segunda bolha */
.widget-flow-suggestions {
    align-items: flex-start;
}

.widget-suggestions-lead {
    flex: 1 0 100%;
    margin: 0;
    padding: 0 0 4px 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-secondary);
    border: none;
    background: none;
    box-shadow: none;
    max-width: 100%;
}

.suggestion-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border: 1px solid #90caf9;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    max-width: 100%;
    text-align: left;
    word-break: break-word;
}

.suggestion-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
    border-color: #64b5f6;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.2);
}

.suggestion-btn:active:not(:disabled) {
    transform: translateY(0);
}

.suggestion-btn:disabled,
.suggestion-btn.used {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e0e0e0;
    border-color: #bdbdbd;
    color: #757575;
}

/* Área de input melhorada - Campo de escrita moderno */
.input-area {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
    flex: 0 0 auto;
    flex-shrink: 0;
    flex-grow: 0;
    z-index: 10;
    position: relative;
    order: 999;
}

.loading-indicator {
    margin-bottom: 12px;
    display: none;
}

.loading-indicator[style*="display: flex"],
.loading-indicator[style*="display:block"] {
    display: flex !important;
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced from 12px */
    padding: 10px 12px; /* More compact */
    background: #e7f3ff;
    border-radius: var(--radius-sm);
    color: #004085;
    font-size: 13px; /* Reduced from 14px */
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e7f3ff;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper {
    display: flex;
    gap: 0;
    align-items: flex-end;
    width: 100%;
}

.input-box {
    flex: 1;
    display: flex;
    align-items: flex-end;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4px;
    transition: var(--transition);
    min-height: 56px;
}

.input-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

#message-input {
    flex: 1;
    padding: 12px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    transition: var(--transition);
    background: transparent;
    min-height: 48px;
    max-height: 200px;
    line-height: 1.6;
    overflow-y: auto;
    box-sizing: border-box;
    color: var(--text-primary);
}

#message-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#message-input:focus {
    outline: none;
}

#message-input::-webkit-scrollbar {
    width: 6px;
}

#message-input::-webkit-scrollbar-track {
    background: transparent;
}

#message-input::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#message-input::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.input-actions {
    display: flex;
    align-items: center;
    padding: 4px;
}

.btn-send {
    background: var(--primary-color);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 16px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-send:active:not(:disabled) {
    transform: translateY(0);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 4px;
}

/* Rodapé do composer no dashboard de atendimento: dicas numa linha, acções noutra */
.input_footer_with_session_actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.input_footer_top_row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

/* Resolvida e Terminar: mesmo formato; só a cor muda */
.session_action_buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.session_action_btn {
    width: auto;
    flex: 0 0 auto;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    color: #ffffff;
}

.session_action_btn_resolve {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.session_action_btn_end {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.session_action_btn_email {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
}

.session_action_btn_email:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.session_action_btn_resolve:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.session_action_btn_end:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.session_action_btn:active:not(:disabled) {
    transform: translateY(0);
}

.session_action_btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Estado após fecho / sem sessão: ambos com o mesmo estilo neutro */
.session_action_btn_inactive {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: #f8fafc;
    box-shadow: none;
    opacity: 0.85;
}

.session_action_btn_inactive:hover:not(:disabled) {
    transform: none;
    box-shadow: none;
}

.input-footer .btn-secondary {
    width: auto;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #8dbfe4;
    background: #eaf5ff;
    color: #0b5e99;
    font-size: 12px;
}

.input-footer .btn-secondary:hover {
    background: #d9ecfc;
    border-color: #68a7d6;
    color: #084c7b;
}

.char-count {
    font-weight: 500;
}

.hint-text {
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 4px;
}

.hint-text i {
    font-size: 11px;
}

/* Responsividade melhorada */
@media (max-width: 1024px) {
    .container.config-open {
        grid-template-columns: var(--sidebar-left-width) 1fr;
    }
    
    .sidebar-right {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: var(--sidebar-right-width);
        z-index: 1000;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr;
        min-height: 100vh;
        border-radius: 0;
    }
    
    .container.config-open {
        grid-template-columns: 1fr;
    }

    .sidebar-left {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: var(--sidebar-left-width);
        z-index: 1000;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    }
    
    .sidebar-left.active {
        display: flex;
    }
    
    .sidebar-right {
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: 0;
        width: var(--sidebar-right-width);
        z-index: 1000;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    }
    
    .container.config-open .sidebar-right {
        width: var(--sidebar-right-width);
        opacity: 1;
        visibility: visible;
    }

    .header {
        grid-column: 1 / -1;
    }
    
    .container.config-open .header {
        grid-column: 1 / -1;
    }

    .chat-area {
        grid-column: 1 / -1;
        grid-row: 2;
        padding: 12px;
    }

    .messages-container {
        padding: 12px;
    }

    .message-content {
        max-width: 100%;
    }

    .input-box {
        min-height: 52px;
    }
    
    #message-input {
        min-height: 44px;
        font-size: 14px;
    }
    
    .btn-send {
        width: 40px;
        height: 40px;
    }
}

/* Animações adicionais */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading .spinner {
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

/* Melhorias de acessibilidade */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Melhorias para inputs desabilitados */
input:disabled,
textarea:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Melhorias para scroll suave */
html {
    scroll-behavior: smooth;
}

/* Prevenir seleção de texto em botões */
.btn-primary,
.btn-secondary,
.btn-icon,
.btn-send {
    user-select: none;
    -webkit-user-select: none;
}

/* Melhorias para impressão */
@media print {
    .sidebar-left,
    .sidebar-right,
    .header-actions,
    .input-area {
        display: none;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* =============================================================================
   RAG Evaluation Page Styles
   ============================================================================= */

/* Evaluation cards inside messages-container should stack properly */
.messages-container > .chat-card {
    margin-bottom: 12px; /* Reduced from 16px */
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
}

.messages-container > .chat-card:last-child {
    margin-bottom: 0;
}

.evaluation_card {
    margin-bottom: 16px;
    /* In the evaluation page we stack multiple cards; avoid flex-stretching. */
    flex: 0 0 auto;
    /* Let evaluation panels grow with content (page scroll handles overflow). */
    max-height: none;
    overflow: visible;
}

.evaluation_content {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduced from 12px for more compact layout */
}

.evaluation_config_row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.evaluation_config_item {
    flex: 1;
    min-width: 200px;
}

.evaluation_config_item label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.evaluation_select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}

.evaluation_select:focus,
.evaluation_select:active {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background: #1f242d !important;
    color: #f5f7fb !important;
}

.evaluation_select option {
    background: #1f242d !important;
    color: #f5f7fb !important;
    padding: 8px;
}

.evaluation_select[multiple] {
    min-height: 100px;
}

.evaluation_questions_group {
    flex: 1;
}

.evaluation_hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.evaluation_questions_container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Slightly smaller min width */
    gap: 10px; /* Compact grid layout */
    margin-bottom: 8px;
    /* Let the page scroll container handle vertical scrolling */
    max-height: none;
    overflow: visible;
}

/* Responsive grid for smaller screens */
@media (max-width: 768px) {
    .evaluation_questions_container {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
}

.evaluation_question_item {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
}

.evaluation_question_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.evaluation_question_number {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 13px; /* Reduced from 14px */
}

.evaluation_question_remove {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.evaluation_question_remove:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.evaluation_question_fields {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Reduced from 8px */
}

.evaluation_field label {
    display: block;
    font-size: 11px; /* Reduced from 12px */
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px; /* Reduced from 4px */
}

.evaluation_required {
    color: var(--danger-color);
}

.evaluation_question_input,
.evaluation_ground_truth_input {
    width: 100%;
    padding: 6px 10px; /* Reduced vertical padding */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px; /* Slightly smaller font */
    font-family: inherit;
    resize: vertical;
    background: var(--bg-card);
    color: var(--text-primary);
    min-height: 32px; /* Compact height */
    line-height: 1.4;
}

.evaluation_question_input:focus,
.evaluation_ground_truth_input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.evaluation_add_btn {
    align-self: flex-start;
}

.evaluation_actions {
    border-top: 1px solid var(--border-color);
    padding-top: 12px; /* Reduced from 20px */
    display: flex;
    gap: 10px; /* Reduced from 12px */
}

.evaluation_run_btn {
    flex: 2;
}

.evaluation_results_section {
    margin-top: 12px;
}

/* Aggregate Scores - More compact and modern */
.evaluation_aggregate_scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Even smaller min width */
    gap: 8px; /* Reduced from 10px */
    margin-bottom: 12px; /* Reduced from 16px */
}

/* Responsive grid for aggregate scores */
@media (max-width: 768px) {
    .evaluation_aggregate_scores {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    }
}

@media (max-width: 480px) {
    .evaluation_aggregate_scores {
        grid-template-columns: 1fr; /* Single column on very small screens */
    }
}

.evaluation_score_card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); /* Smaller radius */
    padding: 10px 12px; /* More compact padding */
    display: flex;
    align-items: center; /* Center align for compact look */
    gap: 10px; /* Reduced from 12px */
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.evaluation_score_card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px); /* Subtle lift effect */
}

.evaluation_score_card.evaluation_score_good {
    border-left: 3px solid var(--success-color); /* Reduced from 4px */
}

.evaluation_score_card.evaluation_score_medium {
    border-left: 3px solid var(--warning-color); /* Reduced from 4px */
}

.evaluation_score_card.evaluation_score_low {
    border-left: 3px solid var(--danger-color); /* Reduced from 4px */
}

.evaluation_score_card.evaluation_score_na {
    border-left: 3px solid var(--text-secondary); /* Reduced from 4px */
}

.evaluation_score_icon {
    width: 36px; /* Reduced from 40px */
    height: 36px; /* Reduced from 40px */
    border-radius: 50%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px; /* Reduced from 18px */
    color: var(--primary-color);
    flex-shrink: 0;
}

.evaluation_score_good .evaluation_score_icon {
    color: var(--success-color);
}

.evaluation_score_medium .evaluation_score_icon {
    color: var(--warning-color);
}

.evaluation_score_low .evaluation_score_icon {
    color: var(--danger-color);
}

.evaluation_score_content {
    flex: 1;
}

.evaluation_score_label {
    font-weight: 600;
    font-size: 12px; /* Reduced from 13px */
    color: var(--text-secondary);
    margin-bottom: 2px; /* Reduced from 4px */
}

.evaluation_score_value {
    font-size: 18px; /* Reduced from 20px */
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px; /* Reduced from 4px */
    line-height: 1.2;
}

.evaluation_score_description {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.evaluation_no_scores {
    color: var(--text-secondary);
    font-style: italic;
}

/* Detailed Results */
.evaluation_details_header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.evaluation_result_item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); /* Smaller radius */
    margin-bottom: 10px; /* Reduced from 12px */
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.evaluation_result_item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px); /* Subtle lift effect */
}

.evaluation_item_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px; /* Reduced from 10px */
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.evaluation_item_number {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 13px; /* Reduced from 14px */
}

.evaluation_item_scores {
    display: flex;
    gap: 6px; /* Reduced from 8px */
    flex-wrap: wrap;
}

.evaluation_item_score {
    padding: 3px 8px; /* More compact */
    border-radius: 10px; /* Smaller radius */
    font-size: 10px; /* Slightly smaller */
    font-weight: 600;
    background: var(--bg-main);
}

.evaluation_item_score.evaluation_score_good {
    background: rgba(39, 174, 96, 0.15);
    color: var(--success-color);
}

.evaluation_item_score.evaluation_score_medium {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning-color);
}

.evaluation_item_score.evaluation_score_low {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger-color);
}

.evaluation_item_content {
    padding: 10px 12px; /* Reduced vertical padding */
}

.evaluation_item_question,
.evaluation_item_answer,
.evaluation_item_ground_truth,
.evaluation_item_contexts {
    margin-bottom: 10px; /* Reduced from 12px */
}

.evaluation_item_question strong,
.evaluation_item_answer strong,
.evaluation_item_ground_truth strong,
.evaluation_item_contexts strong {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.evaluation_item_question p,
.evaluation_item_answer p,
.evaluation_item_ground_truth p {
    margin: 0;
    font-size: 12px; /* Reduced from 13px */
    line-height: 1.5; /* Reduced from 1.6 */
    color: var(--text-primary);
    white-space: pre-wrap;
}

.evaluation_item_ground_truth {
    background: rgba(39, 174, 96, 0.08);
    padding: 8px 10px; /* More compact */
    border-radius: var(--radius-sm);
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.evaluation_item_ground_truth .evaluation_field_toggle {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
}

.evaluation_contexts_list {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Reduced from 8px */
    margin-top: 6px; /* Reduced from 8px */
}

.evaluation_context_item {
    display: flex;
    gap: 8px;
    padding: 6px 10px; /* Reduced vertical padding */
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px; /* Reduced from 13px */
}

.evaluation_context_num {
    background: var(--primary-color);
    color: white;
    width: 18px; /* Reduced from 20px */
    height: 18px; /* Reduced from 20px */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px; /* Reduced from 11px */
    font-weight: 600;
    flex-shrink: 0;
}

.evaluation_context_text {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Errors */
.evaluation_errors {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.evaluation_errors_header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--danger-color);
    margin-bottom: 8px; /* Reduced from 12px */
    font-size: 14px; /* Slightly smaller */
}

.evaluation_errors_list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-primary);
    font-size: 13px;
}

.evaluation_errors_list li {
    margin-bottom: 4px;
}

/* Histórico de avaliações RAG gravadas na BD */
.eval_history_list {
    font-size: 13px;
}
.eval_history_empty {
    color: var(--text-secondary);
    padding: 12px;
    text-align: center;
}
.eval_history_row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    background: var(--bg-card);
    transition: var(--transition);
}
.eval_history_row:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}
.eval_history_row:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.eval_history_row_meta {
    flex: 1;
    min-width: 160px;
}
.eval_history_row_scores {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: ui-monospace, monospace, Consolas, monospace;
}

/* =============================================================================
   Estilos Adicionais para Avaliação RAG - Badges de Categoria
   ============================================================================= */

/* Caixa de informação sobre as perguntas */
.evaluation_info_box {
    display: flex;
    align-items: flex-start;
    gap: 10px; /* Reduced from 12px */
    padding: 10px 12px; /* More compact */
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    border-radius: var(--radius-sm); /* Smaller radius */
    margin-bottom: 12px; /* Reduced from 20px */
}

.evaluation_info_box > i {
    font-size: 20px;
    color: var(--primary-color);
    margin-top: 2px;
}

.evaluation_info_text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.evaluation_info_text strong {
    width: 100%;
    color: var(--text-primary);
    font-size: 12px; /* Reduced from 13px */
    margin-bottom: 4px;
    font-weight: 600;
}

/* Badges de categoria */
.evaluation_category_badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px; /* More compact */
    border-radius: 10px; /* Smaller radius */
    font-size: 10px; /* Reduced from 11px */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.evaluation_badge_technical {
    background: rgba(33, 150, 243, 0.15);
    color: #1565c0;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.evaluation_badge_legal {
    background: rgba(156, 39, 176, 0.15);
    color: #7b1fa2;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.evaluation_badge_action {
    background: rgba(255, 152, 0, 0.15);
    color: #e65100;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.evaluation_badge_general {
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* Cabeçalho da pergunta actualizado */
.evaluation_question_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px; /* Reduced from 10px */
}

.evaluation_question_header_left {
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced from 10px */
}

/* Estados de carregamento e erro */
.evaluation_loading_questions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px; /* Reduced from 40px */
    color: var(--text-secondary);
    gap: 12px;
}

.evaluation_loading_questions .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.evaluation_error_loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--danger-color);
    gap: 12px;
    text-align: center;
}

.evaluation_error_loading i {
    font-size: 32px;
    opacity: 0.7;
}

.evaluation_error_loading .btn-secondary {
    margin-top: 8px;
    width: auto;
}

.evaluation_no_questions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    gap: 12px;
    text-align: center;
}

.evaluation_no_questions i {
    font-size: 32px;
    opacity: 0.5;
}

/* Campo colapsável de ground truth */
.evaluation_field_collapsed .evaluation_field_toggle {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 6px 0;
}

.evaluation_field_collapsed .evaluation_field_toggle:hover {
    color: var(--primary-color);
}

.evaluation_field_toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 6px 0;
}

.evaluation_field_toggle i {
    font-size: 10px;
    transition: transform 0.2s ease;
}

/* Textarea readonly */
.evaluation_question_input[readonly] {
    background: var(--bg-main);
    cursor: default;
}

/* Botão de reload no header em rotação */
.btn-icon.rotating i {
    animation: spin 1s linear infinite;
}

/* Responsividade para badges */
@media (max-width: 768px) {
    .evaluation_info_text {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .evaluation_category_badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .evaluation_question_header_left {
        flex-wrap: wrap;
    }
}

/* =============================================================================
   ESTILOS PARA PÁGINA DE HISTÓRICO
   ============================================================================= */

.history-content {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    min-height: 500px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding: 12px;
    font-size: 12px;
    line-height: 1.5;
}

.history-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.history-placeholder h3 {
    margin: 20px 0 10px 0;
    color: var(--text-primary);
}

.history-placeholder p {
    margin: 0;
    font-size: 14px;
}

.history-groups {
    padding: 8px;
}

.history-group {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    overflow: hidden;
}

.history-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.history-group-header:hover {
    background: var(--bg-main);
}

.history-group-info h4 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.history-group-info p {
    margin: 2px 0;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.4;
}

.history-group-info i {
    width: 16px;
    margin-right: 8px;
    color: var(--primary-color);
}

.history-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.history-toggle:hover {
    background: var(--bg-main);
    color: var(--primary-color);
}

.history-group-content {
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.history-message {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.history-message:last-child {
    border-bottom: none;
}

.history-message.user {
    background: #f8f9fa;
    border-left: 3px solid var(--success-color);
}

.history-message.assistant {
    background: #ffffff;
    border-left: 3px solid var(--primary-color);
}

.history-message.highlighted {
    background: rgba(255, 193, 7, 0.1);
}

.history-message.current-highlight {
    background: rgba(33, 150, 243, 0.15);
    box-shadow: inset 0 0 0 2px rgba(33, 150, 243, 0.3);
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.message-role {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
}

.message-role:before {
    margin-right: 6px;
}

.message-time {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 400;
}

.message-content {
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 12px;
    padding: 2px 0;
}

/* Search functionality styles */
.codemirror-search-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.codemirror-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.codemirror-search-icon {
    color: var(--text-secondary);
    font-size: 14px;
}

.codemirror-search-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 13px;
    background: var(--bg-main);
    color: var(--text-primary);
}

.codemirror-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.codemirror-search-count {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

.codemirror-search-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    transition: var(--transition);
}

.codemirror-search-btn:hover {
    background: var(--bg-main);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.codemirror-search-close {
    color: var(--danger-color);
}

.codemirror-search-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
}

.codemirror-search-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 8px;
    font-size: 12px;
    transition: var(--transition);
}

.codemirror-search-toggle-btn:hover {
    background: var(--bg-main);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Loading modal */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-message {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.loading-progress {
    background: var(--bg-main);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.loading-progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.loading-steps {
    text-align: left;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Estatísticas compactas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.stat-card:hover {
    background: var(--bg-card);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: white;
    border-radius: 6px;
    font-size: 14px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Responsividade para histórico */
@media (max-width: 768px) {
    .history-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-group-info h4 {
        font-size: 12px;
    }

    .history-group-info p {
        font-size: 10px;
    }

    .message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================================================
   Product Config Admin Page
   ============================================================================= */

.pc-topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 20px;
    background: #f5f6f8;
    border-bottom: 1px solid #dde0e5;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pc-product-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-product-picker label {
    color: #444;
    font-size: 13px;
    white-space: nowrap;
}

.pc-mode-tabs {
    display: flex;
    gap: 4px;
}

.pc-mode-tab {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fff;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.pc-mode-tab:hover {
    background: #e8edf4;
    color: #333;
}

.pc-mode-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.pc-panels {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #fff;
}

.pc-panel {
    background: #fafbfc;
    border: 1px solid #e0e3e8;
    border-radius: 10px;
    padding: 18px 20px;
}

.pc-panel h3 {
    margin: 0 0 14px 0;
    font-size: 15px;
    color: #222;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-panel h3 i {
    font-size: 14px;
    color: #3a7bd5;
}

.pc-hint {
    color: #667;
    font-size: 12px;
    margin: 0 0 12px 0;
}

.pc-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Linha da API key no formulário LLM (sem estilos embutidos no HTML) */
.pc-api-key-row {
    display: flex;
    gap: 6px;
}

.pc-api-key-row #pc-api-key {
    flex: 1;
}

.pc-field label {
    color: #444;
    font-size: 12px;
    font-weight: 500;
}

.pc-field input[type="text"],
.pc-field input[type="number"],
.pc-field input[type="password"],
.pc-field input[type="range"],
.pc-field select,
.pc-field textarea {
    background: #fff;
    border: 1px solid #ccd0d8;
    border-radius: 6px;
    padding: 8px 10px;
    color: #222;
    font-size: 13px;
    font-family: inherit;
}

.pc-field input:focus,
.pc-field select:focus,
.pc-field textarea:focus {
    border-color: #3a7bd5;
    outline: none;
    box-shadow: 0 0 0 2px rgba(58,123,213,0.15);
}

.pc-field small {
    color: #667;
    font-size: 11px;
}

.pc-field textarea {
    resize: vertical;
    min-height: 60px;
}

#pc-prompts-panel textarea {
    min-height: 160px;
    line-height: 1.5;
}

#pc-prompt-system,
#pc-prompt-kb {
    min-height: 220px;
}

#pc-support-dynamic-prompt {
    min-height: 200px;
    line-height: 1.45;
}

#pc-support-flow-json.pc_support_flow_json {
    min-height: 520px;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 12px;
    line-height: 1.4;
}

.pc-field-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pc-field-row > .pc-field {
    flex: 1;
    min-width: 120px;
}

/* Later override of the shared button: keep the compact shape, take the colour from
   the product accent so the selected product drives every primary button. */
.btn-primary {
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-sm {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: #e8edf4;
    color: #333;
}

.pc-actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.pc-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e0e3e8;
}

.pc-action-row .pc-action-name {
    flex: 1;
    font-size: 13px;
    color: #222;
    font-weight: 500;
}

.pc-action-row .pc-action-desc {
    flex: 2;
    font-size: 12px;
    color: #667;
}

.pc-action-toggle {
    position: relative;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}

.pc-action-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pc-action-slider {
    position: absolute;
    inset: 0;
    background: #ccd0d8;
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.25s;
}

.pc-action-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s, background 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.pc-action-toggle input:checked + .pc-action-slider {
    background: #27ae60;
}

.pc-action-toggle input:checked + .pc-action-slider::before {
    transform: translateX(20px);
    background: #27ae60;
}

.pc-access-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.pc-access-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e0e3e8;
    font-size: 13px;
    color: #333;
}

.pc-access-row span {
    min-width: 80px;
}

.pc-access-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 4px;
}

.pc-access-badge.yes {
    background: #e8f8ef;
    color: #1e8449;
}

.pc-access-badge.no {
    background: #fde9e7;
    color: #c0392b;
}

.pc-modes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pc-mode-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e0e3e8;
}

.pc-mode-row .pc-mode-name {
    flex: 1;
    font-size: 13px;
    color: #333;
}

.pc-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 20px;
    border-radius: 8px;
    background: #27ae60;
    color: #fff;
    font-size: 13px;
    z-index: 9999;
    transition: opacity 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pc-toast.error {
    background: #e74c3c;
}

/* =============================================================================
   Página resumo importações (ETL F2 / F4)
   ============================================================================= */
.import_summary_page_wrap {
    padding: 20px 24px 32px;
}

.import_summary_hint {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.import_summary_status {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.import_summary_status_error {
    color: var(--danger-color);
}

.import_summary_errors {
    display: none;
    background: #fdecea;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
}

.import_summary_error_list {
    margin: 0;
    padding-left: 18px;
    color: #721c24;
    font-size: 13px;
}

.import_summary_module_card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.import_summary_module_title {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.import_summary_unavailable {
    color: var(--warning-color);
    font-size: 14px;
}

.import_summary_sql_line {
    margin-bottom: 14px;
}

.import_summary_badge_ok {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: #e8f5e9;
    color: #1b5e20;
    font-size: 12px;
    font-weight: 600;
}

.import_summary_badge_warn {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: #fff8e1;
    color: #f57f17;
    font-size: 12px;
    font-weight: 600;
}

.import_summary_kpi_grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 0 0 14px 0;
}

.import_summary_kpi_card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f9fbff;
    padding: 10px 12px;
}

.import_summary_kpi_label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
}

.import_summary_kpi_value {
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 700;
}

.import_summary_table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 14px;
}

.import_summary_table th,
.import_summary_table td {
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    text-align: left;
}

.import_summary_table th {
    background: #f0f2f7;
    color: var(--text-primary);
}

.import_summary_table_small {
    font-size: 12px;
}

.import_summary_cell_muted {
    color: var(--text-secondary);
    font-style: italic;
}

.import_summary_row_warn td {
    background: rgba(255, 193, 7, 0.08);
}

.import_summary_rej_block {
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    font-size: 13px;
}

.import_summary_rej_title {
    margin-bottom: 6px;
    color: var(--text-primary);
}

.import_summary_rej_list {
    margin: 0 0 8px 16px;
    color: var(--text-primary);
}

.import_summary_rej_total {
    color: var(--text-secondary);
}

.import_summary_rej_zero {
    color: var(--text-secondary);
    margin: 0;
}

.import_summary_job_status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.import_summary_job_status_running {
    background: #e3f2fd;
    color: #1565c0;
}

.import_summary_job_status_finished {
    background: #e8f5e9;
    color: #1b5e20;
}

.import_summary_job_status_failed {
    background: #ffebee;
    color: #b71c1c;
}

.import_summary_job_status_skipped {
    background: #fff8e1;
    color: #f57f17;
}

.import_summary_job_status_cancelled {
    background: #f3e5f5;
    color: #6a1b9a;
}

.import_summary_job_status_never_run {
    background: #eceff1;
    color: #455a64;
}

.f2_vig_page_wrap {
    padding: 14px;
}

.f2_vig_filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.f2_vig_filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.f2_vig_filters input,
.f2_vig_filters select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 13px;
    background: #fff;
    color: var(--text-primary);
}

.f2_vig_filters_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.f2_vig_chip_btn {
    border: 1px solid #d8e1f2;
    background: #f5f8ff;
    color: #1f2f46;
    border-radius: 14px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.f2_vig_chip_btn:hover {
    background: #eaf1ff;
}

.f2_vig_chip_btn_warn {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.f2_vig_chip_btn_warn:hover {
    background: #ffedd5;
}

.f2_vig_hint {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.f2_vig_pipeline_hint {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    background: rgba(241, 196, 15, 0.12);
    border: 1px solid rgba(241, 196, 15, 0.45);
    color: var(--text-primary);
}

.f2_vig_pipeline_hint a {
    color: var(--accent-color);
}

.import_summary_pipeline_hint {
    margin-bottom: 14px;
}

.f2_vig_pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.f2_vig_pagination button {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f5f7fb;
    color: var(--text-primary);
    padding: 4px 8px;
    cursor: pointer;
}

.f2_vig_pagination button:hover {
    background: #edf2ff;
}

.f2_vig_pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.f2_vig_table_actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 8px 0;
}

.f2_vig_small_btn {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f8fafc;
    color: #1f2937;
    padding: 3px 9px;
    font-size: 12px;
    cursor: pointer;
}

.f2_vig_small_btn:hover {
    background: #eef2ff;
}

.f2_vig_sort_btn {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    font-weight: 700;
}

.f2_vig_sort_btn:hover {
    color: #1d4ed8;
}

.f2_vig_detail_btn {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e3a8a;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.f2_vig_detail_btn:hover {
    background: #eff6ff;
}

.f2_vig_detail_row > td {
    background: #f8fafc;
}

.f2_vig_sev_badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .2px;
}

.f2_vig_sev_critical { background: #ffe8e8; color: #b10000; }
.f2_vig_sev_high { background: #fff3e0; color: #b45309; }
.f2_vig_sev_medium { background: #fff8e1; color: #a16207; }
.f2_vig_sev_low { background: #e8f5e9; color: #166534; }
.f2_vig_sev_unknown { background: #eceff1; color: #455a64; }

.f2_vig_explain_wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 280px;
}

.f2_vig_explain_row {
    line-height: 1.35;
}

.f2_vig_explain_block {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px 10px;
}

.f2_vig_explain_title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.f2_vig_reason_chip {
    display: inline-block;
    margin: 1px 4px 1px 0;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #1f2937;
    font-size: 11px;
}

.f2_vig_explain_missing {
    color: #6b7280;
    font-style: italic;
}

.f2_vig_source_count {
    font-weight: 700;
}

.f2_vig_truncated_flag {
    color: #9a3412;
    font-size: 11px;
    font-weight: 700;
}

.f2_vig_clockings_details {
    margin-top: 4px;
}

.f2_vig_clockings_details summary {
    cursor: pointer;
    color: #1d4ed8;
    font-weight: 600;
}

.f2_vig_clockings_list {
    margin: 6px 0 0 16px;
    padding: 0;
}

.f2_vig_clockings_list li {
    margin-bottom: 4px;
    line-height: 1.35;
}

.f2_vig_clocking_time {
    font-weight: 600;
    color: #0f172a;
}

.f2_vig_clocking_type {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    color: #374151;
}

.f2_vig_clocking_meta {
    color: #6b7280;
    font-size: 11px;
}

.f2_vig_model_bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.f2_vig_model_bar_row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(130px, 2fr) auto;
    gap: 8px;
    align-items: center;
}

.f2_vig_model_bar_label {
    font-size: 12px;
    color: #1f2937;
    font-weight: 600;
}

.f2_vig_model_bar_meter {
    width: 100%;
    height: 10px;
}

.f2_vig_model_bar_value {
    font-size: 12px;
    color: #334155;
    font-weight: 700;
}

.f2_vig_explain_narrative {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.f2_vig_explain_narrative_text {
    margin: 0;
    line-height: 1.5;
    color: #0f172a;
    font-size: 13px;
}

.f2_vig_explain_hint {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: #475569;
    font-style: italic;
}

.f2_vig_reason_friendly_list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.f2_vig_reason_friendly {
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    background: #fffbeb;
}

.f2_vig_reason_friendly_title {
    font-weight: 700;
    color: #78350f;
    font-size: 12px;
}

.f2_vig_reason_friendly_text {
    color: #1f2937;
    font-size: 12px;
    line-height: 1.4;
}

.f2_vig_reason_friendly_empty {
    color: #6b7280;
    font-style: italic;
    padding: 4px 0;
}

.f2_vig_explain_technical {
    margin-top: 4px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    padding: 6px 10px;
}

.f2_vig_explain_technical summary {
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
}

.f2_vig_explain_technical .f2_vig_explain_row {
    font-size: 12px;
    color: #334155;
    margin-top: 6px;
}

.f2_vig_model_tech {
    margin-top: 10px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 8px;
}

.f2_vig_model_tech summary {
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
}

.f2_vig_model_tech_list {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.f2_vig_model_tech_item {
    border: 1px solid #e2e8f0;
    border-left: 3px solid #6366f1;
    border-radius: 6px;
    padding: 8px 10px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.f2_vig_model_tech_header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.f2_vig_model_tech_name {
    font-weight: 700;
    color: #1e1b4b;
    font-size: 13px;
}

.f2_vig_model_tech_code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    color: #64748b;
    background: #eef2ff;
    border-radius: 4px;
    padding: 1px 6px;
}

.f2_vig_model_tech_metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #334155;
}

.f2_vig_model_tech_desc {
    font-size: 12px;
    color: #1f2937;
    line-height: 1.4;
}

.f2_vig_model_tech_meaning {
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
}

.f2_vig_rule_fired_badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #7c2d12;
    background: #fed7aa;
    border: 1px solid #fb923c;
    border-radius: 999px;
    vertical-align: middle;
}

.f2_vig_rule_quiet_badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    color: #475569;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    vertical-align: middle;
}

.f2_vig_th_info {
    color: #64748b;
    font-weight: 400;
    cursor: help;
}

.f2_vig_ack_yes {
    color: #166534;
    font-weight: 700;
}

.f2_vig_ack_no {
    color: #9a3412;
    font-weight: 700;
}

.f4_fc_page_wrap {
    padding: 14px;
}

/* Lab Fx no shell chat-card (padding:0): mesmo inset interior que F2/F4. */
.f3_ob_page_wrap,
.f5_opt_page_wrap,
.f6_climate_page_wrap,
.f7_visualization_page_wrap {
    padding: 14px;
}

/* F5 - página técnica de criação de escalas */
.f5_opt_page_wrap {
    max-width: 1280px;
    width: 100%;
}

.f5_opt_intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.f5_opt_intro h2 {
    margin: 0 0 6px;
    color: var(--text-primary);
}

.f5_opt_hint {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.f5_opt_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.f5_opt_chip_btn {
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-primary);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
}

.f5_opt_chip_btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.f5_opt_chip_btn_warn {
    border-color: #f3c46b;
    color: #9a6500;
}

.f5_opt_chip_btn_primary {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
}

.f5_opt_chip_btn_primary:hover {
    background: var(--primary-dark);
    color: #ffffff;
}

.f5_opt_config_panel,
.f5_opt_json_panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 16px;
    margin-bottom: 14px;
}

.f5_opt_config_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.f5_opt_config_head h3 {
    margin: 0 0 4px;
    color: var(--text-primary);
}

.f5_opt_config_head p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.f5_opt_config_subhead {
    margin: 16px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.f5_opt_config_subhead h4 {
    margin: 0 0 4px;
    color: var(--text-primary);
    font-size: 14px;
}

.f5_opt_config_subhead p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.f5_opt_controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.f5_opt_controls label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.f5_opt_controls input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: #f8fafc;
}

.f5_opt_json_panel {
    padding: 0;
    overflow: hidden;
}

.f5_opt_json_panel summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 800;
    color: var(--text-primary);
    background: #f8fafc;
}

.f5_opt_json_panel summary small {
    color: var(--text-secondary);
    font-weight: 500;
}

.f5_opt_json_actions {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px 0;
}

.f5_opt_panel {
    min-width: 0;
}

.f5_opt_payload {
    width: 100%;
    min-height: 360px;
    resize: vertical;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #1f2937;
    background: #f8fafc;
}

.f5_opt_payload:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.12);
}

.f5_opt_empty,
.f5_opt_result {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 360px;
    background: #ffffff;
}

.f5_opt_empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
}

.f5_opt_result_head {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.f5_opt_result_head h3,
.f5_opt_section h3 {
    margin: 0 0 8px;
    color: var(--text-primary);
}

.f5_opt_result_head p {
    margin: 4px 0;
    color: var(--text-secondary);
}

.f5_opt_result_head span {
    display: inline-block;
    min-width: 86px;
    font-weight: 700;
    color: var(--text-primary);
}

.f5_opt_section {
    margin-top: 16px;
}

.f5_opt_solution_selector {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 12px;
    margin-bottom: 14px;
}

.f5_opt_solution_selector span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 2px;
}

.f5_opt_solution_buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.f5_opt_solution_btn {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary);
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 800;
    text-align: left;
}

.f5_opt_solution_btn.active {
    border-color: var(--primary-color);
    background: #e8f2ff;
    color: var(--primary-dark);
}

.f5_opt_solution_btn small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-weight: 600;
}

.f5_opt_warning_list {
    margin: 0;
    padding-left: 18px;
    color: #9a6500;
}

.f5_opt_raw {
    margin-top: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    background: #f8fafc;
}

.f5_opt_raw summary {
    cursor: pointer;
    font-weight: 700;
}

.f5_opt_raw pre {
    overflow: auto;
    margin: 12px 0 0;
    white-space: pre-wrap;
    font-size: 12px;
}

.f5_opt_schedule_table_wrap {
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.f5_opt_schedule_table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: #ffffff;
}

.f5_opt_schedule_table th,
.f5_opt_schedule_table td {
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    padding: 10px 12px;
    vertical-align: top;
    text-align: left;
    font-size: 13px;
}

.f5_opt_schedule_table th {
    background: #f8fafc;
    color: var(--text-primary);
    font-weight: 800;
}

.f5_opt_schedule_table td {
    color: var(--text-primary);
    line-height: 1.45;
}

.f5_opt_schedule_table small {
    display: block;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 1100px) {
    .f5_opt_config_head,
    .f5_opt_json_panel summary,
    .f5_opt_solution_selector {
        flex-direction: column;
        align-items: stretch;
    }

    .f5_opt_payload,
    .f5_opt_empty,
    .f5_opt_result {
        min-height: 420px;
    }
}

/* F3 - página técnica de onboarding e OCR */
.f3_ob_page_wrap {
    max-width: 1280px;
    width: 100%;
}

.f3_ob_intro,
.f3_ob_config_head,
.f3_ob_result_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.f3_ob_intro h2,
.f3_ob_config_head h3,
.f3_ob_panel h3,
.f3_ob_result_head h3 {
    margin: 0 0 6px;
    color: var(--text-primary);
}

.f3_ob_hint,
.f3_ob_config_head p,
.f3_ob_result_head p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.f3_ob_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.f3_ob_chip_btn {
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-primary);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
}

.f3_ob_chip_btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.f3_ob_chip_btn_warn {
    border-color: #f3c46b;
    color: #9a6500;
}

.f3_ob_chip_btn_danger {
    border-color: #f1a7a0;
    color: #a83228;
}

.f3_ob_chip_btn_primary {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
}

.f3_ob_chip_btn_primary:hover {
    background: var(--primary-dark);
    color: #ffffff;
}

.f3_ob_config_panel,
.f3_ob_panel,
.f3_ob_json_panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 16px;
    margin-bottom: 14px;
}

.f3_ob_controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.f3_ob_controls label,
.f3_ob_field_card label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.f3_ob_controls input,
.f3_ob_controls select,
.f3_ob_field_card input,
.f3_ob_payload {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: #f8fafc;
}

.f3_ob_payload {
    width: 100%;
    min-height: 220px;
    margin-top: 12px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    line-height: 1.45;
}

.f3_ob_file_drop {
    margin-top: 14px;
    border: 1px dashed var(--primary-color);
    border-radius: var(--radius-md);
    background: #f4f9ff;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.f3_ob_file_drop span {
    color: var(--primary-dark);
    font-weight: 800;
}

.f3_ob_file_drop small {
    color: var(--text-secondary);
}

.f3_ob_file_drop input {
    margin-top: 8px;
}

.f3_ob_grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 14px;
}

.f3_ob_empty {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 16px;
}

.f3_ob_job_line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.f3_ob_job_line strong {
    color: var(--text-primary);
    word-break: break-word;
    text-align: right;
}

.f3_ob_badge {
    border-radius: 999px;
    padding: 3px 9px;
    font-weight: 800;
    font-size: 12px;
}

.f3_ob_badge_ok {
    background: #e8f7ef;
    color: #1d7f46;
}

.f3_ob_badge_warn {
    background: #fff7e6;
    color: #9a6500;
}

.f3_ob_badge_danger {
    background: #fdecea;
    color: #a83228;
}

.f3_ob_progress {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: #edf2f7;
    overflow: hidden;
    margin-top: 12px;
}

.f3_ob_progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #68b8ff);
}

.f3_ob_progress small {
    display: block;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.f3_ob_error_box {
    margin-top: 12px;
    border: 1px solid #f1a7a0;
    border-radius: var(--radius-md);
    background: #fdecea;
    color: #a83228;
    padding: 10px 12px;
}

.f3_ob_error_box p {
    margin: 4px 0 0;
}

.f3_ob_quality_score {
    font-size: 36px;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.f3_ob_warning_list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.f3_ob_warning_list span {
    border-radius: 999px;
    background: #fff7e6;
    color: #9a6500;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.f3_ob_fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.f3_ob_field_card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 14px;
}

.f3_ob_recruitment_result {
    margin-top: 12px;
}

.f3_ob_recruitment_result h4 {
    margin: 0 0 8px;
    color: var(--text-primary);
}

.f3_ob_recruitment_result pre {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--text-primary);
}

.f3_ob_ranking_list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.f3_ob_rank_card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 14px;
}

.f3_ob_rank_card p,
.f3_ob_trace {
    color: var(--text-secondary);
    margin: 8px 0;
}

.f3_ob_rank_card dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 6px 10px;
    margin: 12px 0 0;
    font-size: 13px;
}

.f3_ob_rank_card dt {
    color: var(--text-secondary);
    font-weight: 800;
}

.f3_ob_rank_card dd {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
}

.f3_ob_field_head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.f3_ob_field_head strong {
    color: var(--text-primary);
}

.f3_ob_field_head span {
    color: var(--primary-dark);
    font-weight: 800;
}

.f3_ob_field_card dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 6px 10px;
    margin: 12px 0 0;
    font-size: 13px;
}

.f3_ob_field_card dt {
    color: var(--text-secondary);
    font-weight: 800;
}

.f3_ob_field_card dd {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
}

.f3_ob_json_panel {
    padding: 0;
    overflow: hidden;
}

.f3_ob_json_panel summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 800;
    color: var(--text-primary);
    background: #f8fafc;
}

.f3_ob_json_panel summary small {
    color: var(--text-secondary);
    font-weight: 500;
}

.f3_ob_raw {
    overflow: auto;
    margin: 0;
    padding: 16px;
    white-space: pre-wrap;
    font-size: 12px;
    background: #111827;
    color: #e5e7eb;
    max-height: 420px;
}

@media (max-width: 1100px) {
    .f3_ob_intro,
    .f3_ob_config_head,
    .f3_ob_result_head {
        flex-direction: column;
        align-items: stretch;
    }

    .f3_ob_grid {
        grid-template-columns: 1fr;
    }
}

.f4_fc_filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.f4_fc_filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.f4_fc_filters input,
.f4_fc_filters select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 13px;
    background: #fff;
    color: var(--text-primary);
}

.f4_fc_filters_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.f4_fc_chip_btn {
    border: 1px solid #d8e1f2;
    background: #f5f8ff;
    color: #1f2f46;
    border-radius: 14px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.f4_fc_chip_btn:hover {
    background: #eaf1ff;
}

.f4_fc_chip_btn_warn {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.f4_fc_chip_btn_warn:hover {
    background: #ffedd5;
}

.f4_fc_horizon_hint {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    color: #1f2f46;
    background: #eef3fb;
    border: 1px solid #d8e1f2;
    margin-right: 4px;
}

.f4_fc_hint {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.f4_fc_active_badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #166534;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.f4_fc_shadow_badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.f4_fc_canary_badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.f4_fc_canary_mape_regression_blocked {
    background: #fee2e2;
    color: #991b1b;
}

.f4_fc_canary_mape_within_tolerance {
    background: #dcfce7;
    color: #166534;
}

.f4_fc_card {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    margin: 12px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.f4_fc_card_head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
}

.f4_fc_card_title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #111827);
}

.f4_fc_card_body {
    padding: 14px 16px;
}

.f4_fc_card_context .f4_fc_card_head,
.f4_fc_card_model .f4_fc_card_head {
    background: #f3f4f6;
}

.f4_fc_active_none {
    padding: 12px 14px;
    background: #fef3c7;
    border: 1px solid #f59e0b33;
    border-radius: 8px;
    color: #92400e;
    font-size: 13px;
    margin: 10px 0;
}

.f4_fc_context_empty {
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #3b82f633;
    border-radius: 8px;
    color: #1e3a8a;
    font-size: 13px;
    margin: 10px 0;
}

.f4_fc_grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 18px;
    margin-bottom: 12px;
}

.f4_fc_grid_item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.f4_fc_label {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.f4_fc_code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 12px;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
    color: #111827;
    word-break: break-all;
}

.f4_fc_target_def {
    margin: 10px 0;
    padding: 10px 12px;
    background: #f9fafb;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
}

.f4_fc_target_def p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-primary, #111827);
}

.f4_fc_metrics_grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.f4_fc_metric_card {
    padding: 10px 12px;
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.f4_fc_metric_label {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.f4_fc_metric_value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #111827);
}

.f4_fc_metric_hint {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
}

.f4_fc_technical {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
}

.f4_fc_technical summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    list-style: none;
}

.f4_fc_technical summary::-webkit-details-marker {
    display: none;
}

.f4_fc_technical summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.15s ease;
}

.f4_fc_technical[open] summary::before {
    transform: rotate(90deg);
}

.f4_fc_technical_text {
    margin: 8px 0;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.f4_fc_regressor_list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.f4_fc_regressor_list li code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 11px;
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 8px;
    border-radius: 999px;
}

.f4_fc_weekday_wrap {
    margin-top: 10px;
}

.f4_fc_weekday_list {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.f4_fc_weekday_list li {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    background: #f3f4f6;
    border-radius: 6px;
    gap: 2px;
}

.f4_fc_wk_label {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    font-weight: 600;
}

.f4_fc_wk_value {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.f4_fc_cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.f4_fc_explanations_head {
    margin-top: 18px;
}

.f4_fc_section_heading {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #111827);
}

.f4_fc_card_forecast {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    background: var(--bg-primary, #fff);
    overflow: hidden;
}

.f4_fc_card_forecast[open] {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.f4_fc_forecast_summary {
    cursor: pointer;
    list-style: none;
    padding: 0;
}

.f4_fc_forecast_summary::-webkit-details-marker {
    display: none;
}

.f4_fc_forecast_head {
    display: grid;
    grid-template-columns: minmax(110px, 150px) minmax(160px, 1fr) minmax(160px, 210px) 20px;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid transparent;
}

.f4_fc_card_forecast[open] .f4_fc_forecast_head {
    border-bottom-color: var(--border-color, #e5e7eb);
}

.f4_fc_forecast_date {
    display: flex;
    flex-direction: column;
}

.f4_fc_forecast_date strong {
    font-size: 14px;
    color: var(--text-primary, #111827);
}

.f4_fc_weekday {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.f4_fc_client_badge {
    margin-top: 4px;
}

.f4_fc_client_badge .f4_fc_code {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--surface-muted, #f3f4f6);
}

.f4_fc_forecast_pred {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.f4_fc_pred_value {
    font-size: 22px;
    font-weight: 800;
    color: #1d4ed8;
}

.f4_fc_interval {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.f4_fc_forecast_conf {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.f4_fc_conf_badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.f4_fc_conf_high {
    background: #dcfce7;
    color: #166534;
}

.f4_fc_conf_medium {
    background: #fef3c7;
    color: #92400e;
}

.f4_fc_conf_low {
    background: #fee2e2;
    color: #991b1b;
}

.f4_fc_interval_rel {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
}

.f4_fc_caret {
    color: var(--text-secondary, #6b7280);
    transition: transform 0.15s ease;
    font-size: 12px;
}

.f4_fc_card_forecast[open] .f4_fc_caret {
    transform: rotate(180deg);
}

.f4_fc_forecast_body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.f4_fc_section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.f4_fc_section_title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary, #111827);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.f4_fc_two_cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.f4_fc_narrative {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary, #111827);
    line-height: 1.4;
}

.f4_fc_uncertainty {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    font-style: italic;
}

.f4_fc_bullets {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-primary, #111827);
    line-height: 1.55;
}

.f4_fc_bullets li {
    margin: 2px 0;
}

.f4_fc_chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 8px;
}

.f4_fc_chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: #f3f4f6;
    color: #374151;
}

.f4_fc_chip_on {
    background: #dbeafe;
    color: #1e40af;
}

.f4_fc_driver_row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
}

.f4_fc_driver_row strong {
    color: var(--text-primary, #111827);
}

.f4_fc_delta {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    font-weight: 500;
}

.f4_fc_delta_up {
    color: #b45309;
}

.f4_fc_delta_down {
    color: #166534;
}

.f4_fc_regressors_line {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 10px 0 0;
    font-size: 12px;
}

.f4_fc_regressors_line .f4_fc_code {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11px;
}

/* Página /product-config/backups */
.backup_status_main {
    display: flex;
    flex-direction: column;
    overflow: auto;
    grid-column: 2;
    grid-row: 1 / -1;
    min-height: 0;
}

.backup_status_logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.backup_status_logo_inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.backup_status_logo_img {
    width: 100px;
}

.backup_status_header_actions {
    margin-top: 12px;
}

.backup_status_loading {
    padding: 16px 0;
    color: var(--text-secondary, #5c6370);
}

.backup_status_alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.backup_status_alert_error {
    background: #fdecea;
    color: #b42318;
    border: 1px solid #f5c2c0;
}

.backup_status_alert_info {
    background: #eef4ff;
    color: #1d4ed8;
    border: 1px solid #c7d7fe;
}

.backup_status_kpi_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.backup_status_kpi_card {
    background: #f8fafc;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 12px 14px;
}

.backup_status_kpi_label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    margin-bottom: 6px;
}

.backup_status_kpi_value {
    font-size: 1.05rem;
    color: var(--text-primary, #1a1d24);
}

.backup_status_scope_list {
    display: grid;
    gap: 10px;
}

.backup_status_scope_item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: #fff;
}

.backup_status_scope_item span {
    font-size: 13px;
    color: var(--text-secondary, #64748b);
}

.backup_status_runs_table {
    width: 100%;
}

.backup_status_run_row {
    cursor: pointer;
}

.backup_status_run_row_active td {
    background: #fef3f2;
}

.backup_status_badge_ok {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 600;
}

.backup_status_badge_error {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 12px;
    font-weight: 600;
}

.backup_status_badge_warn {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef9c3;
    color: #854d0e;
    font-size: 12px;
    font-weight: 600;
}

.backup_status_badge_muted {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}

.backup_status_steps {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.backup_status_step {
    border-left: 3px solid #cbd5e1;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
}

.backup_status_step_error {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.backup_status_step_warn {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.backup_status_step_info {
    border-left-color: #3b82f6;
}

.backup_status_step_head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.backup_status_step_component {
    font-weight: 600;
    font-size: 13px;
}

.backup_status_step_ts {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
}

.backup_status_step_message {
    margin: 0;
    font-size: 13px;
    color: var(--text-primary, #1a1d24);
    word-break: break-word;
}

.backup_status_log_pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.45;
    overflow: auto;
    max-height: 360px;
    white-space: pre-wrap;
    word-break: break-word;
}

.backup_status_artifact_block {
    margin-bottom: 18px;
}

.backup_status_artifact_block h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.backup_status_unavailable {
    color: var(--text-secondary, #64748b);
    font-size: 13px;
}

.backup_status_cell_muted {
    color: var(--text-secondary, #64748b);
    font-size: 12px;
}

.backup_status_offsite_hint {
    margin-bottom: 14px;
}

.backup_status_subheading {
    margin: 18px 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1a1d24);
}

.backup_status_offsite_config {
    margin-bottom: 8px;
}

.backup_status_config_table th {
    width: 180px;
    font-weight: 600;
    vertical-align: top;
    white-space: nowrap;
}

.backup_status_env_details {
    margin-top: 14px;
}

.backup_status_env_details summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 8px;
}

.backup_status_kpi_card_wide {
    grid-column: 1 / -1;
}

.backup_status_view_btn {
    padding: 6px 10px;
    font-size: 12px;
}

/* ----- F7 Visualização ----- */
.f7_visualization_page_wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.f7_visualization_panel,
.f7_visualization_json_panel {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.f7_visualization_panel_head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.f7_visualization_hint,
.f7_visualization_empty,
.f7_visualization_subtitle {
    color: var(--text-secondary, #6b7a8d);
    font-size: 13px;
    margin: 6px 0 0;
}

.f7_visualization_subtitle {
    font-weight: 600;
    margin-top: 14px;
}

.sidebar-right .f7_visualization_hint,
.sidebar-right .f7_visualization_subtitle {
    color: #b8c0cc;
}

.f7_visualization_controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.f7_visualization_controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6b7a8d);
}

.f7_visualization_controls input,
.f7_visualization_controls select {
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 8px;
}

.f7_visualization_forecast_controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: var(--bg-secondary, #f8f9fb);
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 8px;
}

.f7_visualization_forecast_controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6b7a8d);
    min-width: 140px;
}

.f7_visualization_forecast_controls input {
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 8px;
    width: 100px;
}

.f7_visualization_filters_actions,
.f7_visualization_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.f7_visualization_chip_btn {
    border: 1px solid var(--border, #e3e6ea);
    background: #fff;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
}

.f7_visualization_chip_btn:hover {
    border-color: #c93a32;
    color: #c93a32;
}

.f7_visualization_chip_btn_primary {
    background: #e8483f;
    border-color: #e8483f;
    color: #fff;
}

.f7_visualization_chip_btn_primary:hover {
    background: #c93a32;
    border-color: #c93a32;
    color: #fff;
}

.f7_visualization_grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.f7_visualization_section_title {
    margin: 22px 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    border-bottom: 1px solid #e8eaed;
    padding-bottom: 6px;
}

.f7_chart_plot {
    width: 100%;
    min-height: 320px;
    margin-top: 6px;
}

.f7_geo_map {
    min-height: 460px;
}

.f7_geo_pending {
    margin-top: 14px;
    border-top: 1px solid #e8eaed;
    padding-top: 12px;
}

.f7_geo_pending_row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 110px 110px auto;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f1f2f4;
}

.f7_geo_pending_row input {
    padding: 5px 8px;
    border: 1px solid #d7dbe0;
    border-radius: 6px;
    font-size: 13px;
    width: 100%;
}

.f7_geo_pending_label {
    font-size: 13px;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.f7_geo_pending_label small {
    color: #7f8c8d;
}

.f7_geo_manual_tag {
    color: #e8483f;
    font-weight: 600;
}

.f7_visualization_kpi_row {
    margin: 4px 0;
}

.f7_visualization_result {
    margin-top: 10px;
}

.f7_visualization_list {
    margin: 8px 0 0 18px;
    font-size: 13px;
}

.f7_visualization_json_panel summary {
    cursor: pointer;
    font-weight: 600;
}

.f7_visualization_raw {
    margin-top: 10px;
    max-height: 320px;
    overflow: auto;
    font-size: 12px;
    background: #f8f9fb;
    padding: 12px;
    border-radius: 8px;
}

.f7_visualization_bar_chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.f7_visualization_bar_row {
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) 2fr auto;
    gap: 8px;
    align-items: center;
}

.f7_visualization_bar_label {
    font-size: 12px;
    color: var(--text-primary, #1a2332);
    word-break: break-word;
}

.f7_visualization_bar_track {
    height: 10px;
    background: #eef1f5;
    border-radius: 6px;
    overflow: hidden;
}

.f7_visualization_bar_fill {
    height: 100%;
    background: linear-gradient(90deg, #e8483f, #f39c12);
    border-radius: 6px;
    min-width: 2px;
}

.f7_visualization_bar_value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6b7a8d);
}

.f7_visualization_bar_w_0 { width: 0%; }
.f7_visualization_bar_w_5 { width: 5%; }
.f7_visualization_bar_w_10 { width: 10%; }
.f7_visualization_bar_w_15 { width: 15%; }
.f7_visualization_bar_w_20 { width: 20%; }
.f7_visualization_bar_w_25 { width: 25%; }
.f7_visualization_bar_w_30 { width: 30%; }
.f7_visualization_bar_w_35 { width: 35%; }
.f7_visualization_bar_w_40 { width: 40%; }
.f7_visualization_bar_w_45 { width: 45%; }
.f7_visualization_bar_w_50 { width: 50%; }
.f7_visualization_bar_w_55 { width: 55%; }
.f7_visualization_bar_w_60 { width: 60%; }
.f7_visualization_bar_w_65 { width: 65%; }
.f7_visualization_bar_w_70 { width: 70%; }
.f7_visualization_bar_w_75 { width: 75%; }
.f7_visualization_bar_w_80 { width: 80%; }
.f7_visualization_bar_w_85 { width: 85%; }
.f7_visualization_bar_w_90 { width: 90%; }
.f7_visualization_bar_w_95 { width: 95%; }
.f7_visualization_bar_w_100 { width: 100%; }


/* Debug/Trace — config as right-side overlay (no layout resize) */
.debug_trace_config_backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.debug_trace_config_backdrop.debug_trace_config_open {
    opacity: 1;
    visibility: visible;
}

.debug_trace_config_drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(var(--sidebar-right-width, 320px), 92vw);
    z-index: 1201;
    background: var(--sidebar-bg);
    color: #e9ecf1;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow: hidden;
}

.debug_trace_config_drawer.debug_trace_config_open {
    transform: translateX(0);
}

.debug_trace_config_drawer .config-content {
    flex: 1;
    overflow-y: auto;
}

/* HESK Tickets page: accepted FAQ blocks for the selected product */
.hesk_kb_review_panel {
    margin-top: 8px;
}

.hesk_kb_review_status {
    margin-top: 4px;
}

.knowledge_upload_row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.knowledge_hesk_file_input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.hesk_kb_review_layout {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.4fr);
    gap: 12px;
    margin-top: 8px;
}

.hesk_kb_review_list {
    min-height: 240px;
    max-height: 420px;
    overflow-y: auto;
}

.hesk_kb_review_detail {
    min-height: 420px;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    padding: 16px 18px;
    box-sizing: border-box;
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: var(--hesk_archive_product_color, var(--border-color));
}

.hesk_kb_review_detail > .evaluation_hint {
    margin: 0;
}

.hesk_kb_review_detail:has(> .evaluation_hint:only-child) {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* The panel mirrors the card that is rising: product colour plus decision state. */
.hesk_kb_review_detail .hesk_kb_review_detail_title {
    color: var(--hesk_archive_product_color, var(--text-secondary));
}

.hesk_kb_review_detail_accept .hesk_kb_review_detail_section:first-child {
    border-left: 3px solid var(--success-color);
    padding-left: 10px;
}

.hesk_kb_review_detail_decline .hesk_kb_review_detail_section:first-child {
    border-left: 3px solid var(--danger-color);
    padding-left: 10px;
}

.hesk_kb_review_detail_exception .hesk_kb_review_detail_section:first-child {
    border-left: 3px solid var(--warning-color);
    padding-left: 10px;
}

.hesk_kb_review_item {
    cursor: pointer;
    margin-bottom: 8px;
    position: relative;
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: var(--border-color);
}

.hesk_kb_review_item:hover {
    border-color: var(--primary-color);
    border-left-color: var(--hesk_archive_product_color, var(--primary-color));
}

.hesk_kb_review_item_track {
    color: var(--hesk_archive_product_color, var(--primary-color));
}

.hesk_kb_review_item_time_track {
    --hesk_archive_product_color: #ef3f32;
    border-left-color: #ef3f32;
}

.hesk_kb_review_item_access_track {
    --hesk_archive_product_color: #781e49;
    border-left-color: #781e49;
}

.hesk_kb_review_item_q_track {
    --hesk_archive_product_color: #2595d2;
    border-left-color: #2595d2;
}

.hesk_kb_review_item_fleet_track {
    --hesk_archive_product_color: #1c74a5;
    border-left-color: #1c74a5;
}

.hesk_kb_review_item_logicpos {
    --hesk_archive_product_color: #a3c749;
    border-left-color: #a3c749;
}

.hesk_kb_review_item_logicpulse {
    --hesk_archive_product_color: #16a7d9;
    border-left-color: #16a7d9;
}

.hesk_kb_review_card_actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.hesk_kb_review_card_action {
    padding: 2px 6px;
    min-width: auto;
    line-height: 1.2;
}

.hesk_kb_review_detail_section {
    margin-bottom: 16px;
}

.hesk_kb_review_detail_title {
    margin: 0 0 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.hesk_kb_review_detail_body {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 900px) {
    .hesk_kb_review_layout {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   HESK Tickets: product accent, loop bar, activity toast and exception queue
   ============================================================================= */

/* The selected product drives the sidebar highlight and the primary buttons.
   JS only swaps the body class; every colour stays here. */
body.product_accent_time_track {
    --sidebar-accent: #ef3f32;
    --sidebar-accent-soft: rgba(239, 63, 50, 0.2);
    --primary-color: #ef3f32;
    --primary-dark: #c9281c;
}

body.product_accent_access_track {
    --sidebar-accent: #781e49;
    --sidebar-accent-soft: rgba(120, 30, 73, 0.28);
    --primary-color: #781e49;
    --primary-dark: #5a1637;
}

body.product_accent_q_track {
    --sidebar-accent: #2595d2;
    --sidebar-accent-soft: rgba(37, 149, 210, 0.22);
    --primary-color: #2595d2;
    --primary-dark: #1b73a6;
}

body.product_accent_fleet_track {
    --sidebar-accent: #1c74a5;
    --sidebar-accent-soft: rgba(28, 116, 165, 0.24);
    --primary-color: #1c74a5;
    --primary-dark: #145878;
}

body.product_accent_logicpos {
    --sidebar-accent: #a3c749;
    --sidebar-accent-soft: rgba(163, 199, 73, 0.24);
    --primary-color: #a3c749;
    --primary-dark: #85a634;
}

body.product_accent_logicpulse {
    --sidebar-accent: #16a7d9;
    --sidebar-accent-soft: rgba(22, 167, 217, 0.22);
    --primary-color: #16a7d9;
    --primary-dark: #0f82ab;
}

/* Painel ChatAI / Ação (TurnTrace C3) em /debug/trace */
.debug_trace_main .config-group > label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 8px;
}

/* Contador junto ao título do painel (sem parênteses soltos) */
.debug_trace_count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Barras de acção: kit — width auto (btn-primary/btn-sm não esticam) */
.debug_trace_action_btn,
.chat_turn_trace_bar .btn-primary,
.chat_turn_trace_bar .btn-sm,
.hesk_loop_bar .btn-primary,
.hesk_decision_mode_bar .btn-primary,
.hesk_exception_actions .btn-primary,
.hesk_exception_actions .btn-sm {
    width: auto;
    flex: 0 0 auto;
    min-height: 36px;
    align-self: center;
}

.chat_turn_trace_bar .btn-sm,
.hesk_exception_actions .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.chat_turn_trace_panel {
    margin-top: 8px;
}

.chat_turn_trace_bar {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.chat_turn_trace_list {
    max-height: 420px;
    overflow-y: auto;
    margin-top: 8px;
}

.chat_turn_trace_list .history-placeholder,
.hesk_decision_stream .history-placeholder,
.hesk_exceptions_list .history-placeholder {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-secondary);
}

.chat_turn_trace_list .history-placeholder h3,
.hesk_decision_stream .history-placeholder h3,
.hesk_exceptions_list .history-placeholder h3 {
    margin: 12px 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat_turn_trace_list .history-placeholder p,
.hesk_decision_stream .history-placeholder p,
.hesk_exceptions_list .history-placeholder p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.chat_turn_trace_card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--bg-card);
}

.chat_turn_trace_card_head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat_turn_trace_card_when {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat_turn_trace_card_msg {
    font-weight: 600;
    word-break: break-word;
    color: var(--text-primary);
}

.chat_turn_trace_card_meta {
    margin: 4px 0 8px;
}

.chat_turn_trace_steps {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.85rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chat_turn_trace_steps li {
    margin-bottom: 4px;
}

.chat_turn_trace_step_portal {
    color: var(--primary-dark);
}

.chat_turn_trace_step_clarificacao {
    color: var(--warning-color);
}

.hesk_loop_panel {
    margin-top: 8px;
}

.hesk_loop_bar {
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.hesk_loop_state,
.hesk_loop_kb_write {
    margin: 0;
}

.hesk_loop_kb_write_off {
    color: var(--warning-color);
    font-weight: 600;
}

/* =============================================================================
   HESK Tickets: live decision stream
   Cards enter at the bottom, rise slowly and swipe out at the top.
   The rise is applied in debug_trace.js from wall time, so a background tab does
   not freeze it: viewport 420px minus the 1px borders leaves 418px, card 64px,
   so the rise stops at -354px. The release interval keeps the cards apart.
   ============================================================================= */
.hesk_decision_panel {
    margin-top: 8px;
}

.hesk_decision_mode_bar {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.hesk_decision_mode_button {
    opacity: 0.55;
}

.hesk_decision_mode_button_active {
    opacity: 1;
}

.hesk_decision_mode_hint {
    margin: 0;
}

.hesk_decision_stream {
    position: relative;
    height: 420px;
    min-height: 420px;
    max-height: 420px;
    overflow: hidden;
    /* Isola layout/paint dos cartões que sobem — menos reflow na página. */
    contain: layout paint;
}

/* The same rising cards, kept on the other pages while Ciclo automático is on. */
.hesk_cycle_dock {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    width: min(380px, calc(100vw - 40px));
    padding: 10px 12px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.18));
}

.hesk_cycle_dock[hidden] {
    display: none !important;
}

.hesk_cycle_dock_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.hesk_cycle_dock_head_main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.hesk_cycle_dock_hesk_link {
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.hesk_cycle_dock_toggle {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-top: 0;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
}

.hesk_cycle_dock_toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.hesk_cycle_dock_state {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.hesk_cycle_dock_stream {
    position: relative;
    height: 200px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary, #fff);
    /* Isola layout/paint do dock — o rAF não suja o resto da página. */
    contain: layout paint;
}

.hesk_cycle_dock_card {
    height: 64px;
}

/* Barra compacta: esconde stream e link HESK; título + estado na mesma linha. */
.hesk_cycle_dock_collapsed {
    width: min(320px, calc(100vw - 40px));
    padding: 8px 10px;
}

.hesk_cycle_dock_collapsed .hesk_cycle_dock_head {
    align-items: center;
}

.hesk_cycle_dock_collapsed .hesk_cycle_dock_head_main {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

.hesk_cycle_dock_collapsed .hesk_cycle_dock_state {
    display: inline;
}

.hesk_cycle_dock_collapsed .hesk_cycle_dock_hesk_link {
    display: none;
}

.hesk_cycle_dock_collapsed .hesk_cycle_dock_stream {
    display: none;
}

.hesk_decision_stream .hesk_decision_placeholder {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.hesk_decision_stream_busy .hesk_decision_placeholder {
    display: none;
}

.hesk_decision_card {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    cursor: pointer;
    /* Rise is set from wall time in debug_trace.js. A CSS animation pauses while the tab is hidden. */
    transform: translateY(64px);
}

/* will-change só enquanto o cartão sobe (classe retirada no swipe). */
.hesk_decision_card_rising {
    will-change: transform;
}

.hesk_decision_card_inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 8px 14px;
    overflow: hidden;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.hesk_decision_card_kind {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.hesk_decision_card_body {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card colour comes from the product of that decision, not the selected one. */
.hesk_decision_card_time_track .hesk_decision_card_inner {
    border-left-color: #ef3f32;
}

.hesk_decision_card_access_track .hesk_decision_card_inner {
    border-left-color: #781e49;
}

.hesk_decision_card_q_track .hesk_decision_card_inner {
    border-left-color: #2595d2;
}

.hesk_decision_card_fleet_track .hesk_decision_card_inner {
    border-left-color: #1c74a5;
}

.hesk_decision_card_logicpos .hesk_decision_card_inner {
    border-left-color: #a3c749;
}

.hesk_decision_card_logicpulse .hesk_decision_card_inner {
    border-left-color: #16a7d9;
}

/* Exit at the top: green left when accepted, red right when not useful,
   yellow up when the ticket goes to the exception queue. */
.hesk_decision_card_accept .hesk_decision_card_inner {
    border-left-color: var(--success-color);
    background: rgba(39, 174, 96, 0.9);
    animation: hesk_decision_swipe_left 0.6s ease forwards;
}

.hesk_decision_card_decline .hesk_decision_card_inner {
    border-left-color: var(--danger-color);
    background: rgba(231, 76, 60, 0.9);
    animation: hesk_decision_swipe_right 0.6s ease forwards;
}

.hesk_decision_card_exception .hesk_decision_card_inner {
    border-left-color: var(--warning-color);
    background: rgba(243, 156, 18, 0.9);
    animation: hesk_decision_swipe_up 0.6s ease forwards;
}

.hesk_decision_card_accept .hesk_decision_card_kind,
.hesk_decision_card_accept .hesk_decision_card_body,
.hesk_decision_card_decline .hesk_decision_card_kind,
.hesk_decision_card_decline .hesk_decision_card_body,
.hesk_decision_card_exception .hesk_decision_card_kind,
.hesk_decision_card_exception .hesk_decision_card_body {
    color: #ffffff;
}

@keyframes hesk_decision_swipe_left {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-130%);
        opacity: 0;
    }
}

@keyframes hesk_decision_swipe_right {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(130%);
        opacity: 0;
    }
}

@keyframes hesk_decision_swipe_up {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-160%);
        opacity: 0;
    }
}

/* Ticket detail modal: a click on an archive, pending or exception card opens it. */
.hesk_ticket_modal {
    z-index: 10002;
}

.hesk_ticket_modal_content {
    max-width: 860px;
    width: 94%;
    max-height: 88vh;
    overflow: auto;
    text-align: left;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border-left: 4px solid var(--hesk_archive_product_color, var(--primary-color));
    box-shadow: var(--shadow-lg);
}

.hesk_ticket_modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hesk_ticket_modal_title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--hesk_archive_product_color, var(--primary-color));
}

.hesk_ticket_modal_meta {
    margin: 4px 0 14px 0;
}

.hesk_ticket_modal_body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-primary);
}

/* Por Aceitar: the only panel whose buttons write the product knowledge base. */
.hesk_pending_panel {
    margin-top: 8px;
}

.hesk_pending_bar {
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.hesk_pending_status {
    margin: 0;
}

.hesk_pending_list {
    max-height: 420px;
    overflow-y: auto;
}

.hesk_pending_item {
    cursor: pointer;
    margin-bottom: 8px;
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: var(--hesk_archive_product_color, var(--border-color));
}

.hesk_pending_item:hover {
    border-color: var(--primary-color);
    border-left-color: var(--hesk_archive_product_color, var(--primary-color));
}

.hesk_pending_actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

/* BD Produto: what the human accepts on HESK Tickets wrote into this product base. */
.hesk_history_panel {
    margin-top: 8px;
}

.hesk_history_status {
    margin-top: 4px;
}

.hesk_history_list {
    min-height: 0;
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    padding: 8px;
}

.hesk_history_list .history-placeholder {
    padding: 24px 12px;
}

.hesk_history_table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.hesk_history_head_cell {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.hesk_history_row:nth-child(even) {
    background: var(--bg-main);
}

.hesk_history_row_clickable {
    cursor: pointer;
}

.hesk_history_row_clickable:hover {
    background: var(--bg-hover, var(--bg-secondary));
}

.hesk_history_cell {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

.hesk_history_modal {
    z-index: 10002;
}

.hesk_history_modal_content {
    max-width: 860px;
    width: 94%;
    text-align: left;
    max-height: 90vh;
    overflow: auto;
}

.hesk_history_modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hesk_history_modal_title {
    margin: 0;
}

.hesk_history_modal_meta {
    margin: 8px 0 12px;
}

.hesk_history_modal_body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hesk_history_faq_item {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.hesk_history_faq_track {
    font-weight: 600;
    color: var(--text-primary);
}

.hesk_history_faq_question,
.hesk_history_faq_answer {
    margin: 6px 0 0;
    white-space: pre-wrap;
    color: var(--text-primary);
}

.hesk_exceptions_panel {
    margin-top: 8px;
}

.hesk_exceptions_status {
    margin-top: 4px;
}

.hesk_exceptions_sr_only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hesk_exceptions_toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.hesk_exceptions_toolbar_row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.hesk_exceptions_search_label,
.hesk_exceptions_product_label {
    display: flex;
    flex: 1 1 180px;
    min-width: 160px;
    margin: 0;
}

.hesk_exceptions_track_search,
.hesk_exceptions_product_filter {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    font: inherit;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
}

.hesk_exceptions_reason_chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.hesk_exceptions_reason_chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.hesk_exceptions_reason_chip:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.hesk_exceptions_reason_chip_active {
    color: var(--primary-dark, var(--primary-color));
    border-color: var(--primary-color);
    background: var(--sidebar-accent-soft, rgba(0, 0, 0, 0.04));
}

.hesk_exceptions_reason_chip_count {
    font-weight: 700;
    color: var(--text-primary);
}

.hesk_exceptions_summary_row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
}

.hesk_exceptions_showing {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.hesk_exceptions_reason_breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.hesk_exceptions_breakdown_item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
}

.hesk_exceptions_breakdown_item:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.hesk_exceptions_bulk_bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
}

.hesk_exceptions_bulk_bar[hidden] {
    display: none !important;
}

.hesk_exceptions_bulk_count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 4px;
}

.hesk_exceptions_bulk_btn {
    width: auto;
    flex: 0 0 auto;
}

.hesk_exceptions_list {
    max-height: 420px;
    overflow-y: auto;
}

.hesk_exception_item {
    margin-bottom: 10px;
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: var(--hesk_archive_product_color, var(--border-color));
    /* Fila longa (~79 cartões): não pintar fora do viewport a cada poll. */
    content-visibility: auto;
    contain-intrinsic-size: auto 180px;
}

.hesk_exception_item_header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.hesk_exception_select_box {
    flex: 0 0 auto;
    margin-top: 4px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.hesk_exception_header_body {
    flex: 1 1 auto;
    min-width: 0;
}

.hesk_exception_header_top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.hesk_exception_badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.hesk_exception_badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.hesk_exception_badge_reason {
    background: #fef9c3;
    color: #854d0e;
}

.hesk_exception_badge_product {
    background: #f1f5f9;
    color: #475569;
}

.hesk_exception_badge_kind {
    background: #e0f2fe;
    color: #075985;
}

.hesk_exception_badge_kind_no_product {
    background: #fee2e2;
    color: #991b1b;
}

.hesk_exception_badge_kind_content {
    background: #dcfce7;
    color: #166534;
}

.hesk_exception_meta {
    margin-top: 2px;
}

.hesk_exception_reason {
    margin: 6px 0 0;
    font-weight: 600;
    color: var(--text-primary);
}

.hesk_exception_ticket_wrap {
    margin-top: 8px;
}

.hesk_exception_ticket_toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    min-height: 28px;
    padding: 2px 0;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    background: transparent;
    border: none;
    cursor: pointer;
}

.hesk_exception_ticket_toggle:hover {
    text-decoration: underline;
}

.hesk_exception_ticket_text {
    margin: 6px 0 0;
    padding: 8px;
    max-height: 160px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.hesk_exception_ticket_text[hidden] {
    display: none !important;
}

.hesk_exception_note {
    width: 100%;
    margin-top: 8px;
    min-height: 56px;
    resize: vertical;
    font: inherit;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    box-sizing: border-box;
}

.hesk_exception_actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.hesk_exception_select {
    min-width: 150px;
}

.hesk_exception_actions .btn-primary,
.hesk_exception_actions .btn-sm,
.hesk_exceptions_bulk_bar .btn-sm {
    width: auto;
    flex: 0 0 auto;
}

.kb_duplicate_modal {
    z-index: 10001;
}

.kb_duplicate_modal_content {
    max-width: 980px;
    width: 94%;
    text-align: left;
    max-height: 90vh;
    overflow: auto;
}

.kb_duplicate_list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 12px 0 20px;
}

.header_reindex_all {
    width: auto;
    flex: 0 0 auto;
    align-self: center;
    white-space: nowrap;
    height: 38px;
}

.kb_duplicate_pair {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--bg-main);
}

/* Accent stays on each pair so one review can show several products at once.
   Values match body.product_accent_*; selected side and Fundir use --primary-color. */
.kb_duplicate_pair.product_accent_time_track {
    --sidebar-accent: #ef3f32;
    --sidebar-accent-soft: rgba(239, 63, 50, 0.2);
    --primary-color: #ef3f32;
    --primary-dark: #c9281c;
}

.kb_duplicate_pair.product_accent_access_track {
    --sidebar-accent: #781e49;
    --sidebar-accent-soft: rgba(120, 30, 73, 0.28);
    --primary-color: #781e49;
    --primary-dark: #5a1637;
}

.kb_duplicate_pair.product_accent_q_track {
    --sidebar-accent: #2595d2;
    --sidebar-accent-soft: rgba(37, 149, 210, 0.22);
    --primary-color: #2595d2;
    --primary-dark: #1b73a6;
}

.kb_duplicate_pair.product_accent_fleet_track {
    --sidebar-accent: #1c74a5;
    --sidebar-accent-soft: rgba(28, 116, 165, 0.24);
    --primary-color: #1c74a5;
    --primary-dark: #145878;
}

.kb_duplicate_pair.product_accent_logicpos {
    --sidebar-accent: #a3c749;
    --sidebar-accent-soft: rgba(163, 199, 73, 0.24);
    --primary-color: #a3c749;
    --primary-dark: #85a634;
}

.kb_duplicate_pair.product_accent_logicpulse {
    --sidebar-accent: #16a7d9;
    --sidebar-accent-soft: rgba(22, 167, 217, 0.22);
    --primary-color: #16a7d9;
    --primary-dark: #0f82ab;
}

.kb_duplicate_pair_meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.kb_duplicate_pair_sides {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
    align-items: stretch;
}

.kb_duplicate_side {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    background: var(--bg-card);
    cursor: pointer;
    min-height: 180px;
    max-height: 320px;
    overflow: auto;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.kb_duplicate_side:hover {
    border-color: var(--primary-color);
}

.kb_duplicate_side_selected {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 8%, var(--bg-card));
    box-shadow: 0 0 0 1px var(--primary-color);
}

.kb_duplicate_side_label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.kb_duplicate_side_question {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.kb_duplicate_side_answer {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.kb_duplicate_pair_choices {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.kb_duplicate_keep_both,
.kb_duplicate_merge {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 16px;
    cursor: pointer;
}

.kb_duplicate_keep_both:hover,
.kb_duplicate_merge:hover {
    border-color: var(--primary-color);
}

.kb_duplicate_keep_both_active,
.kb_duplicate_merge_active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.kb_duplicate_merge_editor {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kb_duplicate_merge_editor[hidden] {
    display: none;
}

.kb_duplicate_merge_status {
    font-size: 12px;
    color: var(--text-secondary);
}

.kb_duplicate_merge_field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.kb_duplicate_merge_field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    padding: 8px 10px;
    resize: vertical;
    min-height: 48px;
    font-family: inherit;
}

.kb_duplicate_actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 700px) {
    .kb_duplicate_pair_sides {
        grid-template-columns: 1fr;
    }

    .kb_duplicate_side {
        min-height: 140px;
        max-height: 260px;
    }
}

/* ---- Consola Ops (#286) — layout variante A (ops_*) ---- */
.ops_main {
    background: var(--bg-main, #f5f6fa);
}

.ops_header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 20px 24px 16px;
}

.ops_header h1 {
    margin: 0 0 4px 0;
}

.ops_header_sub {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary, #7f8c8d);
}

.ops_header_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Kit .btn-primary / .btn-sm no cabeçalho (width:auto — web-ui-kit) */
.ops_header_actions .ops_action_btn,
.ops_card_head .ops_action_btn {
    width: auto;
    flex: 0 0 auto;
    min-height: 40px;
    text-decoration: none;
}

.ops_card_head .ops_action_btn {
    min-height: 32px;
}

/* Grelha reage à largura do conteúdo (container query) */
.ec-main .ops_layout {
    container: ops_a / inline-size;
    background: transparent;
    padding: 0 24px 104px;
    gap: 16px;
    display: flex;
    flex-direction: column;
}

.ops_banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e0e4eb);
    border-left: 4px solid var(--text-secondary);
    border-radius: var(--radius-md, 10px);
    box-shadow: var(--shadow-sm);
}

.ops_banner_ok {
    border-left-color: var(--success-color);
}

.ops_banner_warn {
    border-left-color: var(--warning-color);
}

.ops_banner_error {
    border-left-color: var(--danger-color);
}

.ops_banner_unknown,
.ops_banner_muted {
    border-left-color: var(--text-secondary);
}

.ops_banner_icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
}

.ops_banner_ok .ops_banner_icon {
    background: color-mix(in srgb, var(--success-color) 18%, var(--bg-card));
    color: var(--success-color);
}

.ops_banner_warn .ops_banner_icon {
    background: color-mix(in srgb, var(--warning-color) 22%, var(--bg-card));
    color: var(--warning-color);
}

.ops_banner_error .ops_banner_icon {
    background: color-mix(in srgb, var(--danger-color) 18%, var(--bg-card));
    color: var(--danger-color);
}

.ops_banner_text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ops_banner_text strong {
    font-size: 15px;
    color: var(--text-primary, #2c3e50);
}

.ops_banner_text span {
    font-size: 13px;
    color: var(--text-secondary, #7f8c8d);
}

.ops_kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

.ops_hosts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.ops_host {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e0e4eb);
    border-radius: var(--radius-md, 10px);
    padding: 12px 16px;
}

.ops_host_title {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
}

.ops_host_metrics {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary, #7f8c8d);
}

.ops_host_metrics em {
    font-style: normal;
    font-weight: 650;
    color: var(--text-primary, #2c3e50);
    font-variant-numeric: tabular-nums;
}

.ops_alert_note {
    margin: 0 0 12px;
    font-size: 13px;
    color: #9a6b00;
    background: #fffbf2;
    border: 1px solid #f0e0a0;
    border-radius: var(--radius-sm, 6px);
    padding: 8px 12px;
}

.ops_col_mem,
.ops_col_age {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ops_age_stale {
    color: var(--warning-color, #f39c12);
    font-weight: 600;
}

.ops_kpi,
.ops_card {
    min-width: 0;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e0e4eb);
    border-radius: var(--radius-md, 10px);
    box-shadow: var(--shadow-sm);
}

.ops_kpi {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
}

.ops_kpi_placeholder {
    opacity: 0.72;
}

.ops_kpi_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px 8px;
    min-width: 0;
}

.ops_kpi_label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #7f8c8d);
}

.ops_kpi_label i {
    flex-shrink: 0;
    color: var(--primary-color, #2196f3);
}

/* Badges curtos nos KPIs: 5 colunas — evitar overlap com o título */
.ops_kpi_head [class^="backup_status_badge_"] {
    flex: 0 0 auto;
    max-width: 46%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1.3;
}

.ops_kpi_value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.5px;
    color: var(--text-primary, #2c3e50);
    font-variant-numeric: tabular-nums;
}

.ops_kpi_value small {
    margin-left: 4px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-secondary, #7f8c8d);
}

.ops_kpi_caption {
    min-height: 1.35em;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-secondary, #7f8c8d);
}

.ops_meter {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--border-color) 70%, var(--bg-main));
}

.ops_meter_fill {
    height: 100%;
    border-radius: inherit;
    background: var(--primary-color, #2196f3);
}

.ops_meter_fill_ok {
    background: var(--success-color);
}

.ops_meter_fill_warn {
    background: var(--warning-color);
}

.ops_meter_fill_muted {
    width: 0%;
    background: var(--border-color);
}

.ops_body {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr);
    gap: 16px;
    align-items: stretch;
}

.ops_card {
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
}

.ops_card_placeholder {
    opacity: 0.75;
}

.ops_card_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ops_card_head h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #2c3e50);
}

.ops_card_head h3 i {
    font-size: 14px;
    color: var(--primary-color, #2196f3);
}

.ops_card_meta {
    font-size: 12px;
    color: var(--text-secondary, #7f8c8d);
}

.ops_placeholder_note {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary, #7f8c8d);
}


.ops_ctrls {
    container: ops_ctrls / inline-size;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.ops_ctrl {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: color-mix(in srgb, var(--bg-main) 80%, var(--bg-card));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 10px);
}

.ops_ctrl_icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 8px;
    font-size: 14px;
}

.ops_ctrl_on .ops_ctrl_icon {
    background: color-mix(in srgb, var(--success-color) 18%, var(--bg-card));
    color: var(--success-color);
}

.ops_ctrl_off .ops_ctrl_icon {
    background: var(--border-color);
    color: var(--text-secondary);
}

.ops_ctrl_shadow .ops_ctrl_icon {
    background: color-mix(in srgb, var(--warning-color, #c9a227) 18%, var(--bg-card));
    color: var(--warning-color, #c9a227);
}

.ops_seg_triple .ops_seg_btn {
    padding: 6px 10px;
}

.ops_ctrl_text {
    flex: 1 1 150px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ops_ctrl_text strong {
    font-size: 13px;
    color: var(--text-primary, #2c3e50);
}

.ops_ctrl_text span {
    font-size: 12px;
    color: var(--text-secondary, #7f8c8d);
}

.ops_seg {
    display: inline-flex;
    flex-shrink: 0;
    gap: 2px;
    padding: 3px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--border-color) 70%, var(--bg-main));
}

.ops_seg_btn {
    min-height: 30px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-secondary, #7f8c8d);
    cursor: pointer;
}

.ops_seg_btn:hover:not(:disabled) {
    color: var(--text-primary, #2c3e50);
}

.ops_seg_btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ops_seg_btn_active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.ops_ctrl_note {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: auto 0 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.ops_ctrl_disabled_msg {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: var(--warning-color);
}

.ops_ctrl_unavailable {
    opacity: 0.72;
}

#ops_ctrl_error:not([hidden]) {
    color: var(--danger-color);
    border-top: none;
    padding-top: 0;
    margin-bottom: 8px;
}

@container ops_ctrls (max-width: 440px) {
    .ops_seg {
        width: 100%;
    }

    .ops_seg_btn {
        flex: 1 1 0;
    }
}

.ops_table_wrap {
    overflow-x: auto;
}

.ops_table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ops_table th {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color, #e0e4eb);
    text-align: left;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary, #7f8c8d);
}

.ops_table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary, #2c3e50);
}

.ops_table th:first-child,
.ops_table td:first-child {
    padding-left: 0;
}

.ops_table th:last-child,
.ops_table td:last-child {
    padding-right: 0;
}

.ops_table tbody tr:last-child td {
    border-bottom: none;
}

.ops_table tbody tr:hover td {
    background: color-mix(in srgb, var(--bg-main) 70%, var(--bg-card));
}

.ops_table_empty {
    text-align: center;
    color: var(--text-secondary, #7f8c8d);
}

.ops_col_load {
    width: 28%;
    min-width: 7.5rem;
}

.ops_svc {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ops_svc strong {
    font-weight: 600;
}

.ops_svc span {
    font-size: 12px;
    color: var(--text-secondary, #7f8c8d);
}

/* Grelha fixa: barra e % alinhados em todas as linhas (sem «1m» a variar a largura) */
.ops_load {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 3.25rem;
    align-items: center;
    column-gap: 10px;
    width: 100%;
}

.ops_load .ops_meter {
    width: 100%;
    min-width: 0;
}

.ops_load_pct {
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ops_load_warn {
    color: var(--warning-color);
}

.ops_load_na {
    color: var(--text-secondary, #7f8c8d);
    font-size: 12px;
}

@container ops_a (max-width: 900px) {
    .ops_kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ops_hosts {
        grid-template-columns: minmax(0, 1fr);
    }

    .ops_body {
        grid-template-columns: minmax(0, 1fr);
    }
}

@container ops_a (max-width: 560px) {
    .ops_col_uptime,
    .ops_col_age {
        display: none;
    }

    .ops_col_load {
        width: 34%;
    }

    .ops_banner .backup_status_badge_ok,
    .ops_banner .backup_status_badge_warn,
    .ops_banner .backup_status_badge_error,
    .ops_banner .backup_status_badge_muted {
        display: none;
    }

    .ops_kpis {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-height: 780px) {
    .ops_header {
        padding-top: 14px;
        padding-bottom: 10px;
    }

    .ec-main .ops_layout {
        gap: 12px;
    }

    .ops_banner {
        padding: 10px 14px;
    }

    .ops_kpi {
        gap: 8px;
        padding: 12px 14px;
    }

    .ops_kpi_value {
        font-size: 24px;
    }

    .ops_table td {
        padding-top: 7px;
        padding-bottom: 7px;
    }
}

.ops_meter_w0 { width: 0%; }
.ops_meter_w1 { width: 1%; }
.ops_meter_w2 { width: 2%; }
.ops_meter_w3 { width: 3%; }
.ops_meter_w4 { width: 4%; }
.ops_meter_w5 { width: 5%; }
.ops_meter_w6 { width: 6%; }
.ops_meter_w7 { width: 7%; }
.ops_meter_w8 { width: 8%; }
.ops_meter_w9 { width: 9%; }
.ops_meter_w10 { width: 10%; }
.ops_meter_w11 { width: 11%; }
.ops_meter_w12 { width: 12%; }
.ops_meter_w13 { width: 13%; }
.ops_meter_w14 { width: 14%; }
.ops_meter_w15 { width: 15%; }
.ops_meter_w16 { width: 16%; }
.ops_meter_w17 { width: 17%; }
.ops_meter_w18 { width: 18%; }
.ops_meter_w19 { width: 19%; }
.ops_meter_w20 { width: 20%; }
.ops_meter_w21 { width: 21%; }
.ops_meter_w22 { width: 22%; }
.ops_meter_w23 { width: 23%; }
.ops_meter_w24 { width: 24%; }
.ops_meter_w25 { width: 25%; }
.ops_meter_w26 { width: 26%; }
.ops_meter_w27 { width: 27%; }
.ops_meter_w28 { width: 28%; }
.ops_meter_w29 { width: 29%; }
.ops_meter_w30 { width: 30%; }
.ops_meter_w31 { width: 31%; }
.ops_meter_w32 { width: 32%; }
.ops_meter_w33 { width: 33%; }
.ops_meter_w34 { width: 34%; }
.ops_meter_w35 { width: 35%; }
.ops_meter_w36 { width: 36%; }
.ops_meter_w37 { width: 37%; }
.ops_meter_w38 { width: 38%; }
.ops_meter_w39 { width: 39%; }
.ops_meter_w40 { width: 40%; }
.ops_meter_w41 { width: 41%; }
.ops_meter_w42 { width: 42%; }
.ops_meter_w43 { width: 43%; }
.ops_meter_w44 { width: 44%; }
.ops_meter_w45 { width: 45%; }
.ops_meter_w46 { width: 46%; }
.ops_meter_w47 { width: 47%; }
.ops_meter_w48 { width: 48%; }
.ops_meter_w49 { width: 49%; }
.ops_meter_w50 { width: 50%; }
.ops_meter_w51 { width: 51%; }
.ops_meter_w52 { width: 52%; }
.ops_meter_w53 { width: 53%; }
.ops_meter_w54 { width: 54%; }
.ops_meter_w55 { width: 55%; }
.ops_meter_w56 { width: 56%; }
.ops_meter_w57 { width: 57%; }
.ops_meter_w58 { width: 58%; }
.ops_meter_w59 { width: 59%; }
.ops_meter_w60 { width: 60%; }
.ops_meter_w61 { width: 61%; }
.ops_meter_w62 { width: 62%; }
.ops_meter_w63 { width: 63%; }
.ops_meter_w64 { width: 64%; }
.ops_meter_w65 { width: 65%; }
.ops_meter_w66 { width: 66%; }
.ops_meter_w67 { width: 67%; }
.ops_meter_w68 { width: 68%; }
.ops_meter_w69 { width: 69%; }
.ops_meter_w70 { width: 70%; }
.ops_meter_w71 { width: 71%; }
.ops_meter_w72 { width: 72%; }
.ops_meter_w73 { width: 73%; }
.ops_meter_w74 { width: 74%; }
.ops_meter_w75 { width: 75%; }
.ops_meter_w76 { width: 76%; }
.ops_meter_w77 { width: 77%; }
.ops_meter_w78 { width: 78%; }
.ops_meter_w79 { width: 79%; }
.ops_meter_w80 { width: 80%; }
.ops_meter_w81 { width: 81%; }
.ops_meter_w82 { width: 82%; }
.ops_meter_w83 { width: 83%; }
.ops_meter_w84 { width: 84%; }
.ops_meter_w85 { width: 85%; }
.ops_meter_w86 { width: 86%; }
.ops_meter_w87 { width: 87%; }
.ops_meter_w88 { width: 88%; }
.ops_meter_w89 { width: 89%; }
.ops_meter_w90 { width: 90%; }
.ops_meter_w91 { width: 91%; }
.ops_meter_w92 { width: 92%; }
.ops_meter_w93 { width: 93%; }
.ops_meter_w94 { width: 94%; }
.ops_meter_w95 { width: 95%; }
.ops_meter_w96 { width: 96%; }
.ops_meter_w97 { width: 97%; }
.ops_meter_w98 { width: 98%; }
.ops_meter_w99 { width: 99%; }
.ops_meter_w100 { width: 100%; }

/* Assistente de resposta a ticket — Consola C (produção)
 */
.ticket_reply_main {
    --tr-space-1: 4px;
    --tr-space-2: 8px;
    --tr-space-3: 12px;
    --tr-space-4: 16px;
    --tr-space-5: 24px;
    --tr-muted: #5f6b76;
    --tr-surface: #f7f8fb;
    --tr-surface-elevated: #ffffff;
    --tr-line: var(--border-color);
    --tr-focus: rgba(33, 150, 243, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    grid-column: 2;
    grid-row: 1 / -1;
    min-height: 0;
    padding-bottom: var(--tr-space-4);
    color: var(--text-primary);
}

.ticket_reply_main .pc-panel,
.ticket_reply_draft_panel,
.ticket_reply_cause_panel,
.ticket_reply_refine_panel,
.ticket_reply_loaded_panel,
.ticket_reply_col_intake.pc-panel {
    background: var(--tr-surface-elevated);
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-md);
    padding: var(--tr-space-4);
    box-shadow: none;
}

.ticket_reply_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tr-space-4);
    flex-shrink: 0;
    padding-bottom: var(--tr-space-3);
    margin-bottom: var(--tr-space-2);
    border-bottom: 1px solid var(--tr-line);
}

.ticket_reply_header_text {
    min-width: 0;
}

.ticket_reply_header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.ticket_reply_hint {
    margin: var(--tr-space-1) 0 0;
    max-width: 68ch;
    font-size: 13px;
    line-height: 1.45;
    color: var(--tr-muted);
}

.ticket_reply_header_status {
    flex-shrink: 0;
}

.ticket_reply_panels {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-bottom: var(--tr-space-5);
    scroll-padding-bottom: 88px;
}

.ticket_reply_workspace {
    display: grid;
    gap: var(--tr-space-4);
    align-items: stretch;
}

/* A — Bancada: controlos | ticket+composer (padrão inbox|reply) */



/* CTA primaria colada ao fundo do painel de entrada (menos vazio assimétrico). */



/* B — Fluxo vertical focado */





/* C — Consola três carris (Intercom/Zendesk) */
[data-tr-variant="C"] .ticket_reply_workspace {
    grid-template-columns: minmax(240px, 24%) minmax(0, 1fr) minmax(280px, 28%);
    grid-template-areas: "intake main meta";
    gap: var(--tr-space-4);
    min-height: calc(100vh - 210px);
}

[data-tr-variant="C"] .ticket_reply_col_intake { grid-area: intake; }
[data-tr-variant="C"] .ticket_reply_col_main { grid-area: main; }
[data-tr-variant="C"] .ticket_reply_col_meta { grid-area: meta; }

[data-tr-variant="C"] .ticket_reply_col_intake,
[data-tr-variant="C"] .ticket_reply_col_main,
[data-tr-variant="C"] .ticket_reply_col_meta {
    min-height: 0;
    max-height: calc(100vh - 210px);
    overflow: auto;
}

[data-tr-variant="C"] .ticket_reply_col_main,
[data-tr-variant="C"] .ticket_reply_col_meta {
    display: flex;
    flex-direction: column;
    gap: var(--tr-space-3);
}

[data-tr-variant="C"] .ticket_reply_draft_panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

[data-tr-variant="C"] .ticket_reply_draft_body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

[data-tr-variant="C"] .ticket_reply_draft {
    flex: 1;
    min-height: 180px;
}

[data-tr-variant="C"] .ticket_reply_paste {
    min-height: 96px;
}

[data-tr-variant="C"] .ticket_reply_evidence_details {
    margin-top: var(--tr-space-3);
    padding: var(--tr-space-3);
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-sm);
    background: var(--tr-surface);
}

.ticket_reply_col {
    display: flex;
    flex-direction: column;
    gap: var(--tr-space-3);
    min-width: 0;
}

.ticket_reply_col > .pc-panel,
.ticket_reply_draft_panel,
.ticket_reply_cause_panel,
.ticket_reply_refine_panel,
.ticket_reply_loaded_panel,
.ticket_reply_col_intake {
    margin: 0;
}

.ticket_reply_panel_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tr-space-3);
    margin-bottom: var(--tr-space-3);
}

.ticket_reply_panel_header h3,
.ticket_reply_cause_panel > h3,
.ticket_reply_refine_panel > h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.ticket_reply_panel_header h3 i,
.ticket_reply_cause_panel > h3 i,
.ticket_reply_refine_panel > h3 i {
    color: var(--primary-color);
    margin-right: var(--tr-space-2);
    width: 1.1em;
    text-align: center;
}

.ticket_reply_header_actions {
    display: flex;
    gap: var(--tr-space-2);
    flex-shrink: 0;
}

.ticket_reply_label {
    display: block;
    margin: 0 0 var(--tr-space-2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tr-muted);
}

.ticket_reply_paste,
.ticket_reply_draft,
.ticket_reply_cause,
.ticket_reply_hesk_ref,
.ticket_reply_produto,
.ticket_reply_open_tickets,
.ticket_reply_refine_message {
    width: 100%;
    min-height: 140px;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-sm);
    background: var(--tr-surface-elevated);
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ticket_reply_paste:focus,
.ticket_reply_draft:focus,
.ticket_reply_cause:focus,
.ticket_reply_hesk_ref:focus,
.ticket_reply_produto:focus,
.ticket_reply_open_tickets:focus,
.ticket_reply_refine_message:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--tr-focus);
}

.ticket_reply_hesk_ref,
.ticket_reply_produto,
.ticket_reply_open_tickets {
    min-height: 40px;
    height: 40px;
    margin-bottom: var(--tr-space-3);
    resize: none;
}

/* #577: Produto incerto — pedir confirmação antes de confiar na Evidência. */
.ticket_reply_produto.ticket_reply_produto_needs_confirmation {
    border-color: var(--warning-color, #c47b1a);
    box-shadow: 0 0 0 2px rgba(196, 123, 26, 0.2);
}

.ticket_reply_cause,
.ticket_reply_refine_message {
    min-height: 72px;
}

/* #926: lista lab de Causas candidatas (1.ª = activa no textarea). */
.ticket_reply_causes {
    list-style: none;
    margin: var(--tr-space-3) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ticket_reply_causes_item {
    margin: 0;
}

.ticket_reply_causes_pick {
    width: 100%;
    text-align: left;
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-sm);
    background: var(--tr-surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    line-height: 1.35;
    padding: 8px 10px;
    cursor: pointer;
}

.ticket_reply_causes_item_active .ticket_reply_causes_pick {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--tr-focus);
}

.ticket_reply_actions {
    display: flex;
    gap: var(--tr-space-2);
    margin-top: var(--tr-space-3);
    flex-wrap: wrap;
    align-items: center;
}

.ticket_reply_actions_intake .ticket_reply_generate_btn {
    width: 100%;
}

.ticket_reply_generate_btn,
.ticket_reply_evidence_btn,
.ticket_reply_refine_btn,
.ticket_reply_copy_btn {
    width: auto;
    min-height: 40px;
    padding-left: 14px;
    padding-right: 14px;
    border-radius: var(--radius-sm);
    font-weight: 650;
}

.ticket_reply_generate_btn,
.ticket_reply_refine_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tr-space-2);
}

.ticket_reply_copy_btn:disabled,
.ticket_reply_generate_btn:disabled,
.ticket_reply_refine_btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ticket_reply_btn_label,
.ticket_reply_btn_loading {
    display: inline-flex;
    align-items: center;
    gap: var(--tr-space-2);
}

.ticket_reply_spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ticket_reply_spin 0.7s linear infinite;
}

.ticket_reply_spinner_dark {
    width: 22px;
    height: 22px;
    border-color: rgba(33, 150, 243, 0.25);
    border-top-color: var(--primary-color);
}

.ticket_reply_loading_state {
    border-style: solid;
    border-color: rgba(33, 150, 243, 0.25);
    background: rgba(33, 150, 243, 0.04);
}

@keyframes ticket_reply_spin {
    to { transform: rotate(360deg); }
}

.ticket_reply_meta {
    margin: 0 0 var(--tr-space-3);
    color: var(--tr-muted);
    font-size: 13px;
    line-height: 1.45;
}

.ticket_reply_confidence {
    margin-top: var(--tr-space-2);
    margin-bottom: 0;
}

.ticket_reply_confidence_low {
    /* Banner dedicado leva a mensagem; linha fica discreta */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ticket_reply_confidence_medium {
    color: #6d4c00;
    font-size: 13px;
}

.ticket_reply_low_banner {
    display: flex;
    gap: var(--tr-space-3);
    align-items: flex-start;
    margin: var(--tr-space-3) 0;
    padding: var(--tr-space-3) var(--tr-space-4);
    border-radius: var(--radius-sm);
    background: #fff8e1;
    border: 1px solid #e2b93d;
    border-left: 4px solid #c9920a;
    color: #5d4037;
    font-size: 13px;
    line-height: 1.45;
}

.ticket_reply_low_banner i {
    color: #c9920a;
    margin-top: 2px;
}

.ticket_reply_low_banner strong {
    display: block;
    margin-bottom: 2px;
    color: #4e342e;
}

.ticket_reply_subheading {
    margin: var(--tr-space-4) 0 var(--tr-space-2);
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
}

.ticket_reply_subheading i {
    color: var(--primary-color);
    margin-right: var(--tr-space-2);
}

.ticket_reply_questions,
.ticket_reply_evidence_list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--tr-surface-elevated);
}

.ticket_reply_questions:empty,
.ticket_reply_evidence_list:empty {
    display: none;
}

.ticket_reply_questions li,
.ticket_reply_evidence_list li {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--tr-line);
    font-size: 13px;
    line-height: 1.45;
    background: transparent;
}

.ticket_reply_questions li:last-child,
.ticket_reply_evidence_list li:last-child {
    border-bottom: 0;
}

.ticket_reply_evidence_item {
    display: flex;
    align-items: flex-start;
    gap: var(--tr-space-2);
}

.ticket_reply_evidence_item i {
    margin-top: 2px;
    color: var(--tr-muted);
    width: 1em;
    text-align: center;
}

.ticket_reply_evidence_list a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 550;
}

.ticket_reply_evidence_list a:hover {
    text-decoration: underline;
}

.ticket_reply_empty_state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--tr-space-2);
    min-height: 168px;
    padding: var(--tr-space-5);
    text-align: center;
    color: var(--tr-muted);
    background: var(--tr-surface);
    border: 1px dashed #cfd6e0;
    border-radius: var(--radius-md);
}

.ticket_reply_empty_state i {
    font-size: 26px;
    color: #9aa3b0;
}

.ticket_reply_empty_state p {
    margin: 0;
    max-width: 34ch;
    font-size: 13px;
    line-height: 1.45;
}

.ticket_reply_empty_inline,
.ticket_reply_evidence_empty {
    margin: 0 0 var(--tr-space-2);
    color: var(--tr-muted);
    font-size: 13px;
}

.ticket_reply_alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--tr-space-4);
    background: var(--tr-surface-elevated);
    color: var(--danger-color);
    border: 1px solid var(--tr-line);
    font-size: 13px;
    line-height: 1.45;
}

.ticket_reply_alert_error {
    background: #fdecea;
    border-color: #e7b0b6;
    color: #8f1d28;
}

.ticket_reply_alert_warn {
    background: #fff8e1;
    border-color: #e2b93d;
    color: #5d4037;
}

.ticket_reply_alert_ok {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #1b5e20;
}

/* Segmented control (Linear/Front) em vez de pills soltas */
.ticket_reply_input_modes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin-bottom: var(--tr-space-4);
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--tr-surface);
}

.ticket_reply_mode_btn {
    appearance: none;
    border: 0;
    border-right: 1px solid var(--tr-line);
    background: transparent;
    color: var(--tr-muted);
    border-radius: 0;
    padding: 10px 8px;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
}

.ticket_reply_mode_btn:last-child {
    border-right: 0;
}

.ticket_reply_mode_btn:hover {
    color: var(--text-primary);
    background: rgba(33, 150, 243, 0.04);
}

.ticket_reply_mode_active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: inset 0 -2px 0 var(--primary-color);
}

.ticket_reply_soon_chip {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tr-muted);
    background: #e8edf3;
    border-radius: 999px;
    padding: 2px 5px;
}

.ticket_reply_mode_panel_soon {
    padding: var(--tr-space-3);
    border-radius: var(--radius-sm);
    background: var(--tr-surface);
    border: 1px dashed #cfd6e0;
    margin-bottom: var(--tr-space-3);
}

/* Ticket carregado = painel de conversa (só leitura visual) */
.ticket_reply_loaded_panel {
    background: var(--tr-surface);
    border-left: 3px solid var(--primary-color);
}

.ticket_reply_loaded_badge {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    flex-shrink: 0;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: var(--primary-dark);
    background: rgba(33, 150, 243, 0.12);
    border-radius: 999px;
    padding: 4px 10px;
}




.ticket_reply_loaded_body {
    margin: 0;
    padding: 12px 14px;
    /* Um só scroll no painéis da página; o corpo só scrolla se for muito longo. */
    max-height: min(28vh, 260px);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--tr-surface-elevated);
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}




.ticket_reply_mode_btn .ticket_reply_soon_chip {
    flex-shrink: 0;
}

.ticket_reply_mode_btn {
    flex-wrap: wrap;
}

.ticket_reply_evidence_details {
    margin-top: var(--tr-space-4);
}

.ticket_reply_evidence_summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--tr-space-2);
    font-weight: 650;
    font-size: 13px;
    color: var(--text-primary);
    list-style: none;
    min-height: 36px;
}

.ticket_reply_evidence_summary::-webkit-details-marker {
    display: none;
}

.ticket_reply_evidence_summary::before {
    content: "▸";
    color: var(--tr-muted);
}

.ticket_reply_evidence_details[open] > .ticket_reply_evidence_summary::before {
    content: "▾";
}

.ticket_reply_evidence_count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.ticket_reply_evidence_body {
    margin-top: var(--tr-space-2);
}

.ticket_reply_refine_thread {
    max-height: 112px;
    overflow: auto;
    margin-bottom: var(--tr-space-2);
    display: flex;
    flex-direction: column;
    gap: var(--tr-space-2);
}

.ticket_reply_refine_bubble {
    max-width: 92%;
    padding: 8px 11px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.ticket_reply_refine_user {
    align-self: flex-end;
    background: rgba(33, 150, 243, 0.12);
    color: var(--text-primary);
}

.ticket_reply_refine_bot {
    align-self: flex-start;
    background: var(--tr-surface);
    color: var(--tr-muted);
    border: 1px solid var(--tr-line);
}



.ticket_reply_step {
    display: inline-flex;
    align-items: center;
    gap: var(--tr-space-2);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 650;
    color: var(--tr-muted);
    background: var(--tr-surface);
}

.ticket_reply_step_num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #d9dee7;
    color: #4a5560;
    font-size: 11px;
}

.ticket_reply_step_active {
    background: rgba(33, 150, 243, 0.12);
    color: var(--primary-dark);
}

.ticket_reply_step_active .ticket_reply_step_num {
    background: var(--primary-color);
    color: #fff;
}

.ticket_reply_step_done {
    color: #1e7a45;
}

.ticket_reply_step_done .ticket_reply_step_num {
    background: var(--success-color);
    color: #fff;
}










@media (max-width: 1100px) {
    [data-tr-variant="C"] .ticket_reply_workspace {
        grid-template-columns: 1fr;
        grid-template-areas:
            "intake"
            "main"
            "meta";
        min-height: 0;
    }


    [data-tr-variant="C"] .ticket_reply_col_intake,
    [data-tr-variant="C"] .ticket_reply_col_main,
    [data-tr-variant="C"] .ticket_reply_col_meta {
        max-height: none;
        overflow: visible;
    }


    .ticket_reply_input_modes {
        grid-template-columns: 1fr;
    }

    .ticket_reply_mode_btn {
        border-right: 0;
        border-bottom: 1px solid var(--tr-line);
        justify-content: flex-start;
        padding-left: 12px;
    }

    .ticket_reply_mode_btn:last-child {
        border-bottom: 0;
    }
}

@media (max-width: 720px) {
    .ticket_reply_header {
        flex-direction: column;
        align-items: flex-start;
    }

    [data-tr-variant="C"][data-tr-intake="hidden"] .ticket_reply_workspace {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main"
            "meta";
    }

    [data-tr-variant="C"][data-tr-intake="hidden"] .ticket_reply_col_intake {
        display: none;
    }
}


/* ---- Consola C: cabeçalho Freshdesk + follow-up + citações ---- */
.ticket_reply_sr_only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ticket_reply_sources_summary {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--tr-muted, #5f6b76);
    background: transparent;
    border: 0;
    padding: 0;
    max-width: 42ch;
    text-align: right;
    line-height: 1.35;
}

.ticket_reply_sources_summary_warn {
    color: #8a5a00;
}

.ticket_reply_sources_summary_medium {
    color: #6d4c00;
}

.ticket_reply_fd_header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--tr-space-3);
    margin-bottom: var(--tr-space-2);
}

.ticket_reply_fd_title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.ticket_reply_fd_meta {
    margin: 0 0 var(--tr-space-3);
    font-size: 13px;
    color: var(--tr-muted, #5f6b76);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.ticket_reply_fd_sep {
    opacity: 0.55;
}

.ticket_reply_fd_body {
    max-height: min(32vh, 280px);
    background: transparent;
    border: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}

[data-tr-variant="C"] .ticket_reply_loaded_panel {
    border-left: 0;
    background: var(--tr-surface-elevated);
}

/* Após generate OK: coluna Entrada some e a Resposta ganha largura. */
[data-tr-variant="C"] .ticket_reply_workspace {
    transition: grid-template-columns 0.28s ease;
}

[data-tr-variant="C"][data-tr-intake="hidden"] .ticket_reply_workspace {
    grid-template-columns: 0 minmax(0, 1.55fr) minmax(280px, 30%);
    grid-template-areas: "intake main meta";
}

[data-tr-variant="C"][data-tr-intake="hidden"] .ticket_reply_col_intake {
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    min-width: 0;
    max-width: 0;
    padding: 0;
    margin: 0;
    border-width: 0;
    transition: opacity 0.2s ease, max-width 0.28s ease;
}

[data-tr-variant="C"] .ticket_reply_col_intake {
    transition: opacity 0.2s ease, max-width 0.28s ease;
}

.ticket_reply_novo_ticket_btn {
    white-space: nowrap;
}

.ticket_reply_loaded_toggle {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ticket_reply_loaded_toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.ticket_reply_loaded_compact {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.ticket_reply_loaded_compact_row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.ticket_reply_loaded_compact .ticket_reply_loaded_subject,
.ticket_reply_loaded_compact .ticket_reply_fd_title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket_reply_loaded_compact_meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding-left: 0;
}

.ticket_reply_loaded_chip,
.ticket_reply_loaded_compact_client,
.ticket_reply_loaded_compact_produto {
    display: inline-flex;
    align-items: center;
    max-width: min(42ch, 100%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    color: var(--tr-muted, #5f6b76);
    background: var(--tr-surface, #f4f6f8);
    border: 1px solid var(--tr-line, #e2e6eb);
    border-radius: 999px;
    padding: 2px 10px;
}

.ticket_reply_loaded_chevron {
    color: var(--tr-muted, #5f6b76);
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
}

.ticket_reply_loaded_panel[data-tr-ticket="collapsed"] .ticket_reply_loaded_chevron {
    transform: rotate(-90deg);
}

.ticket_reply_loaded_panel[data-tr-ticket="expanded"] .ticket_reply_loaded_subject {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.ticket_reply_loaded_details {
    margin-top: var(--tr-space-3);
}

.ticket_reply_alterar_btn {
    width: 100%;
}

.ticket_reply_draft_rich {
    width: 100%;
    min-height: 200px;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-sm);
    background: var(--tr-surface-elevated);
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
    overflow: auto;
    white-space: pre-wrap;
}

.ticket_reply_draft_rich:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--tr-focus);
}

.ticket_reply_draft_sync {
    display: none !important;
}

.ticket_reply_cite_badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin: 0 2px;
    border: 0;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
}

.ticket_reply_cite_inline {
    position: relative;
    top: -1px;
}

.ticket_reply_cite_popover {
    position: fixed;
    z-index: 10000;
    max-width: 320px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
}

.ticket_reply_cite_popover_head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--tr-muted, #5f6b76);
    font-size: 12px;
}

.ticket_reply_cite_popover_kind {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ticket_reply_cite_popover_age {
    margin-left: auto;
}

.ticket_reply_cite_popover_title {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.ticket_reply_cite_popover_preview {
    margin: 0;
    color: var(--tr-muted, #5f6b76);
}

.ticket_reply_draft_actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tr-space-2);
    margin-top: var(--tr-space-3);
    align-items: center;
}

.ticket_reply_draft_actions .ticket_reply_copy_btn {
    width: auto;
    min-width: 120px;
}

.ticket_reply_avaliacao_group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

.ticket_reply_avaliacao_btn.ticket_reply_avaliacao_selected {
    border-color: var(--tr-accent, #2f6fed);
    color: var(--tr-accent, #2f6fed);
    font-weight: 700;
}

.ticket_reply_avaliacao_reasons {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.ticket_reply_avaliacao_reason_btn {
    font-weight: 600;
}

.ticket_reply_avaliacao_note_label {
    font-size: 11px;
    color: var(--tr-muted, #5f6b76);
    margin-left: 4px;
}

.ticket_reply_avaliacao_note {
    min-width: 12rem;
    max-width: 18rem;
    padding: 4px 8px;
    font-size: 12px;
    /* Tokens do kit ticket-reply / web-ui-kit (--tr-line → --border-color). */
    border: 1px solid var(--tr-line, var(--border-color));
    border-radius: 4px;
}

.ticket_reply_avaliacao_state {
    font-size: 12px;
    color: var(--tr-muted, #5f6b76);
}

.ticket_reply_regen_btn {
    width: auto;
}

.ticket_reply_edited_tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--tr-muted, #5f6b76);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

[data-tr-variant="C"] .ticket_reply_col_meta {
    display: flex;
    flex-direction: column;
    gap: var(--tr-space-3);
    min-height: 0;
}

[data-tr-variant="C"] .ticket_reply_meta_scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: var(--tr-space-3);
}

[data-tr-variant="C"] .ticket_reply_followup {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--tr-line);
    border-radius: var(--radius-md);
    background: var(--tr-surface-elevated);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.ticket_reply_followup_chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.ticket_reply_chip {
    appearance: none;
    border: 1px solid var(--tr-line);
    background: var(--tr-surface);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 6px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

.ticket_reply_chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.ticket_reply_followup_row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticket_reply_followup_input {
    flex: 1;
    min-height: 40px !important;
    height: 40px;
    margin: 0 !important;
    resize: none;
}

.ticket_reply_followup_send {
    appearance: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--text-primary);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ticket_reply_followup_send:hover {
    background: var(--primary-dark);
}

.ticket_reply_evidence_item .ticket_reply_cite_badge {
    margin-right: 2px;
    flex-shrink: 0;
}

[data-tr-variant="C"] .ticket_reply_evidence_details {
    margin-top: var(--tr-space-3);
}


/* ===== Telemóvel: shell comum (grid, cabeçalho, menu, altura dinâmica) ===== */
.mobile-nav-toggle,
.mobile-nav-backdrop {
    display: none;
}

@media (max-width: 768px) {
    body {
        height: 100dvh;
    }

    /* 1fr = minmax(auto, 1fr): o min-content do cabeçalho alargava a página */
    .container,
    .container.config-open {
        grid-template-columns: minmax(0, 1fr);
        height: 100dvh;
        max-height: 100dvh;
        min-height: 0;
        box-shadow: none;
    }

    .header,
    .chat-area,
    .chat-card {
        min-width: 0;
    }

    .header {
        padding: 8px 12px;
        gap: 8px;
    }

    .header-content {
        min-width: 0;
        flex: 1 1 auto;
    }

    .header-title h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header .subtitle,
    .test_account_switcher_label,
    .input-footer .hint-text {
        display: none;
    }

    .header-actions {
        min-width: 0;
        gap: 4px;
        flex: 0 1 auto;
    }

    .test_account_switcher {
        min-width: 0;
        margin-right: 0;
    }

    .test_account_select {
        min-width: 0;
        max-width: 132px;
        font-size: 16px;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: var(--radius-sm);
        background: transparent;
        color: var(--text-primary);
        font-size: 18px;
        cursor: pointer;
    }

    .mobile-nav-toggle--floating {
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1100;
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
    }

    .has-floating-nav .container {
        padding-top: 56px;
    }

    /* Botões com texto no cabeçalho ficam só com o ícone (o texto continua acessível) */
    .header-actions button:not(.btn-icon):has(> i) {
        font-size: 0;
        padding: 8px 10px;
        gap: 0;
    }

    .header-actions button:not(.btn-icon):has(> i) > i {
        font-size: 15px;
        margin: 0;
    }

    .sidebar-left {
        width: min(var(--sidebar-left-width), 85vw);
    }

    .mobile-nav-open .mobile-nav-backdrop {
        display: block;
        position: fixed;
        inset: var(--header-height) 0 0 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 999;
    }

    .sidebar-right,
    .container.config-open .sidebar-right {
        width: min(var(--sidebar-right-width), 100vw);
    }

    /* 16px evita o zoom automático do iOS ao focar o campo */
    #message-input,
    input,
    select,
    textarea {
        font-size: 16px;
    }

    .chat-area {
        padding: 0;
    }

    .messages-container {
        padding: 12px 10px;
    }

    .input-area {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    }

    .message-content,
    .message-body {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .message-content pre,
    .message-content table {
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }
}
