:root {
    --sensedia-orange: #FF875A;
    --sensedia-orange-light: #FFE6D8;
    --sensedia-orange-dark: #D56431;
    --sensedia-purple: #9C7BFF;
    --sensedia-purple-light: #E8E1FF;
    --sensedia-purple-dark: #7B5DE0;
    --primary: var(--sensedia-orange);
    --primary-dark: var(--sensedia-orange-dark);
    --primary-light: var(--sensedia-orange-light);
    --accent: #5BC9B1;
    --accent-light: #E4F6F1;
    --warning: #EFBF5A;
    --warning-light: #FCECD1;
    --danger: #EE6A6A;
    --danger-light: #FDE1E1;
    --page-background: #F4F6F9;
    --surface-header: #FAFBFC;
    --surface-navbar: #F3F5F8;
    --surface-card: #FFFFFF;
    --border-color: #E2E5F3;
    --icon-bg-orange: var(--sensedia-orange-light);
    --icon-bg-purple: var(--sensedia-purple-light);
    --icon-bg-blue: #DBEAFE;
    --hint-orange-bg: #FFF6EE;
    --hint-orange-border: #FFE0CC;
    --hint-purple-bg: #F5F2FC;
    --hint-purple-border: #E4DDF5;
    --code-orange-bg: #FFE6D8;
    --code-orange-text: #C35A28;
    --code-purple-bg: #E8E1FF;
    --code-purple-text: #7B5DE0;
    --chip-purple-bg: #E8E1FF;
    --chip-purple-hover: #DCD3FF;
    --chip-purple-text: #6C4FD1;
    --brand-color: var(--sensedia-purple-dark);
    --brand-pill-bg: #F1F5FF;
    --brand-pill-text: #475569;
    --brand-pill-border: rgba(226, 232, 240, 0.6);
    --text-primary: #0F172A;
    --text-secondary: #46526B;
    --text-muted: #9AA3BA;
    --card-shadow: 0 4px 10px -4px rgba(15, 23, 42, 0.12), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
    --card-shadow-hover: 0 12px 24px -6px rgba(15, 23, 42, 0.18), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}

body[data-theme="dark"] {
    --page-background: #0F172A;
    --surface-header: #141C2C;
    --surface-navbar: #111A28;
    --surface-card: #1A2433;
    --border-color: rgba(148, 163, 184, 0.25);
    --text-primary: #E2E8F0;
    --text-secondary: #CAD2E2;
    --text-muted: #94A3B8;
    --sensedia-orange-light: rgba(255, 135, 90, 0.18);
    --sensedia-purple-light: rgba(156, 123, 255, 0.22);
    --icon-bg-orange: rgba(255, 135, 90, 0.22);
    --icon-bg-purple: rgba(156, 123, 255, 0.26);
    --icon-bg-blue: rgba(59, 130, 246, 0.22);
    --hint-orange-bg: rgba(255, 135, 90, 0.16);
    --hint-orange-border: rgba(255, 135, 90, 0.32);
    --hint-purple-bg: rgba(156, 123, 255, 0.16);
    --hint-purple-border: rgba(156, 123, 255, 0.3);
    --code-orange-bg: rgba(255, 135, 90, 0.18);
    --code-orange-text: #FFB89A;
    --code-purple-bg: rgba(156, 123, 255, 0.2);
    --code-purple-text: #CDBBFF;
    --chip-purple-bg: rgba(156, 123, 255, 0.22);
    --chip-purple-hover: rgba(156, 123, 255, 0.32);
    --chip-purple-text: #CDBBFF;
    --brand-color: #E8E1FF;
    --brand-pill-bg: rgba(148, 163, 184, 0.16);
    --brand-pill-text: #E2E8F0;
    --brand-pill-border: rgba(148, 163, 184, 0.3);
    --card-shadow: 0 8px 16px -8px rgba(2, 6, 23, 0.6), 0 2px 8px -3px rgba(2, 6, 23, 0.45);
    --card-shadow-hover: 0 18px 28px -10px rgba(2, 6, 23, 0.7), 0 6px 16px -6px rgba(2, 6, 23, 0.5);
}

body { 
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--page-background);
    color: var(--text-primary);
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Utilitários semânticos — tokens Sensedia (substituem slate/purple hardcoded no HTML) */
.cde-text-primary { color: var(--text-primary); }
.cde-text-secondary { color: var(--text-secondary); }
.cde-text-muted { color: var(--text-muted); }
.cde-text-purple { color: var(--sensedia-purple-dark); }
.cde-bg-surface { background-color: var(--surface-card); }
.cde-bg-muted { background-color: var(--surface-header); }
.cde-bg-section { background-color: var(--surface-header); }
.cde-bg-pill { background-color: var(--brand-pill-bg); color: var(--brand-pill-text); }
.cde-bg-purple-hint { background-color: var(--hint-purple-bg); }
.cde-border-default { border-color: var(--border-color); }
.cde-input {
    background-color: var(--surface-card);
    border-color: var(--border-color);
}
.cde-input-muted {
    background-color: var(--surface-header);
    border-color: var(--border-color);
}
.cde-focus-sensedia:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--sensedia-orange);
    border-color: var(--sensedia-orange-dark);
}
.cde-focus-purple:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--sensedia-purple);
    border-color: var(--sensedia-purple-dark);
}
body[data-theme="dark"] .cde-text-primary { color: var(--text-primary); }
body[data-theme="dark"] .cde-text-secondary { color: var(--text-secondary); }
body[data-theme="dark"] .cde-text-muted { color: var(--text-muted); }
body[data-theme="dark"] .cde-text-purple { color: var(--chip-purple-text); }
body[data-theme="dark"] .cde-bg-surface,
body[data-theme="dark"] .cde-input { background-color: var(--surface-card); }
body[data-theme="dark"] .cde-bg-muted,
body[data-theme="dark"] .cde-bg-section,
body[data-theme="dark"] .cde-input-muted { background-color: var(--surface-header); }
body[data-theme="dark"] .cde-bg-pill { background-color: var(--brand-pill-bg); color: var(--brand-pill-text); }
body[data-theme="dark"] .cde-bg-purple-hint { background-color: var(--hint-purple-bg); }
body[data-theme="dark"] .cde-border-default { border-color: var(--border-color); }
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    pointer-events: none;
    z-index: -1;
}
.file-drop-zone { border: 2px dashed var(--border-color); transition: all 0.2s ease-in-out; }
.file-drop-zone.dragover { border-color: var(--sensedia-purple); background-color: var(--hint-purple-bg); }
.file-drop-zone:hover { border-color: var(--sensedia-purple); background-color: var(--surface-header); }
.loader { border: 4px solid var(--border-color); border-top: 4px solid var(--sensedia-purple); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
.loader-small { border: 2px solid var(--border-color); border-top: 2px solid var(--sensedia-purple); border-radius: 50%; width: 12px; height: 12px; animation: spin 0.8s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#progress-bar { transition: width 0.5s ease-in-out; background-color: var(--sensedia-purple); }
#usage-cover {
    z-index: 100;
}
#modal {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}
#modal.is-visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}
/* Filhos com pointer-events:auto herdado bloqueavam a capa SSO mesmo com modal “fechado”. */
#modal:not(.is-visible),
#modal:not(.is-visible) * {
    pointer-events: none !important;
}
#modal .modal-backdrop { background-color: rgba(15, 23, 42, 0.8); backdrop-filter: blur(8px); }
#modal .modal-content-window { transform: scale(0.95) translateY(20px); opacity: 0; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease-in-out; background-color: var(--surface-card); }
#modal.is-visible .modal-content-window { transform: scale(1) translateY(0); opacity: 1; }
.truncate-cell { max-width: 350px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-card {
    background-color: var(--surface-card);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}
.main-card:hover {
    box-shadow: var(--card-shadow-hover);
}
fieldset:disabled .group { opacity: 0.5; cursor: not-allowed; }
.main-view { animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
button:not(:disabled) {
    transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}
button:not(:disabled):active {
    transform: translateY(1px);
}

header {
    background-color: var(--surface-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04);
}

body[data-theme="dark"] header {
    border-bottom-color: var(--border-color);
    box-shadow: 0 1px 3px 0 rgba(2, 6, 23, 0.3);
}

.unified-upload-card {
    background-color: var(--surface-card);
    border: 1px dashed #D6DAE8;
    border-radius: 0.75rem;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.12);
}
.unified-upload-card:hover {
    border-color: var(--sensedia-purple);
    background-color: var(--sensedia-purple-light);
    box-shadow: 0 4px 10px -4px rgba(15, 23, 42, 0.16);
}
.unified-upload-card.dragover { 
    border-color: var(--primary); 
    background-color: var(--primary-light);
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(255, 135, 90, 0.15);
}

.top-navbar {
    top: 0; 
    background-color: var(--surface-navbar);
    border-bottom: 1px solid rgba(226, 232, 240, 0.4); 
    box-shadow: 0 2px 4px -1px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(10px);
    overflow-x: hidden;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.top-nav-item { 
    padding: 0.5rem 0.75rem; 
    border-radius: 0.5rem; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    color: var(--text-secondary); 
    font-weight: 500; 
    font-size: 0.8125rem;
    white-space: nowrap;
    position: relative;
    flex-shrink: 0;
}
.top-nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--sensedia-purple);
    transition: width 0.3s ease;
}
.top-nav-item:hover::after {
    width: 60%;
}
.top-nav-item:hover { 
    background-color: var(--sensedia-orange-light);
    color: var(--primary-dark); 
    transform: translateY(-1px);
}
.top-nav-item.active { 
    background-color: var(--sensedia-purple-light);
    color: var(--sensedia-purple-dark); 
    font-weight: 600;
    box-shadow: 0 3px 6px -3px rgba(123, 93, 224, 0.35);
}
.top-nav-item.active::after {
    width: 80%;
}
.top-nav-item svg { 
    width: 1rem; 
    height: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.top-nav-item:hover svg {
    transform: scale(1.1);
}

/* Mobile Menu */
.mobile-menu-button { display: none; }
@media (max-width: 1024px) {
    .mobile-menu-button { display: block; }
    .top-navbar-menu { 
        display: none; 
        position: absolute; 
        top: 100%; 
        left: 0; 
        right: 0; 
        background-color: var(--surface-navbar);
        border-top: 1px solid var(--border-color); 
        box-shadow: 0 8px 16px -4px rgba(15, 23, 42, 0.12);
        backdrop-filter: blur(10px);
        z-index: 40; 
    }
    .top-navbar-menu.open { display: block; }
    .top-nav-item { 
        display: block; 
        width: 100%; 
        padding: 1rem; 
        border-radius: 0; 
        border-bottom: 1px solid #eceef7; 
    }
}

/* Badges e status melhorados */
.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* KPIs cards melhorados */
.kpi-card {
    background-color: var(--surface-card);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
}
.kpi-card:hover {
    box-shadow: var(--card-shadow-hover);
}

/* Garantir que conteúdo principal fique acima do background */
main, .main-view {
    position: relative;
    z-index: 1;
}

/* Animação sutil no logo */
.logo-container {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.logo-container:hover {
    transform: scale(1.05);
}
.logo-container svg {
    transition: filter 0.3s ease;
}
.logo-container:hover svg {
    filter: drop-shadow(0 4px 8px rgba(255, 107, 53, 0.3));
}

/* Melhorias na tipografia */
h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}
h1 {
    font-size: 2rem;
    line-height: 1.2;
}
h2 {
    font-size: 1.5rem;
    line-height: 1.3;
}
.primary-action-button {
    background-color: var(--sensedia-purple);
    color: #FFFFFF;
    box-shadow: 0 12px 24px -10px rgba(123, 93, 224, 0.6);
}
.primary-action-button:hover {
    background-color: var(--sensedia-purple-dark);
    box-shadow: 0 10px 20px -10px rgba(123, 93, 224, 0.5);
}
.primary-action-button:disabled {
    background-color: #DAD6EE;
    color: #FFFFFF;
    box-shadow: none;
}
.secondary-action-button {
    background-color: var(--sensedia-orange);
    color: #FFFFFF;
    box-shadow: 0 10px 18px -12px rgba(255, 135, 90, 0.7);
}
.secondary-action-button:hover {
    background-color: var(--sensedia-orange-dark);
    box-shadow: 0 10px 18px -12px rgba(255, 135, 90, 0.6);
}
.secondary-action-button:disabled {
    background-color: #FAD5C4;
    color: #FFFFFF;
    box-shadow: none;
}
.tertiary-action-button {
    background-color: transparent;
    color: var(--sensedia-purple-dark);
    border: 1px solid rgba(123, 93, 224, 0.35);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.tertiary-action-button:hover {
    background-color: var(--sensedia-purple-light);
    color: var(--sensedia-purple-dark);
    box-shadow: 0 6px 12px -6px rgba(123, 93, 224, 0.4);
}
.tertiary-action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}
.icon-bg-orange {
    background-color: var(--icon-bg-orange);
    color: #C35A28;
}
.icon-bg-purple {
    background-color: var(--icon-bg-purple);
}
.icon-bg-blue {
    background-color: var(--icon-bg-blue);
    color: #5B38B1;
}
.hint-card-orange {
    background-color: var(--hint-orange-bg);
    border: 1px solid var(--hint-orange-border);
    border-radius: 0.75rem;
}
.hint-card-purple {
    background-color: var(--hint-purple-bg);
    border: 1px solid var(--hint-purple-border);
    border-radius: 0.75rem;
}
.code-chip-orange {
    background-color: var(--code-orange-bg);
    color: var(--code-orange-text);
    border-radius: 0.5rem;
    padding: 0.125rem 0.5rem;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 600;
}
.code-chip-purple {
    background-color: var(--code-purple-bg);
    color: var(--code-purple-text);
    border-radius: 0.5rem;
    padding: 0.125rem 0.5rem;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 600;
}
.chip-purple {
    background-color: var(--chip-purple-bg);
    color: var(--chip-purple-text);
    border-radius: 9999px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Highlight para linhas de resultados */
.highlight-row {
    animation: highlightPulse 2s ease-in-out;
    background-color: rgba(34, 197, 94, 0.2) !important;
}

@keyframes highlightPulse {
    0% { background-color: rgba(34, 197, 94, 0.4); }
    50% { background-color: rgba(34, 197, 94, 0.2); }
    100% { background-color: transparent; }
}
.chip-purple:hover {
    background-color: var(--chip-purple-hover);
    color: var(--chip-purple-text);
}
.text-purple-accent {
    color: var(--chip-purple-text);
}
body[data-theme="dark"] .chip-purple:hover {
    background-color: rgba(156, 123, 255, 0.32);
}
body[data-theme="dark"] .text-purple-accent {
    color: #CDBBFF;
}
.brand-title {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: -0.02em;
    color: var(--brand-color);
}
.version-pill {
    background-color: var(--brand-pill-bg);
    color: var(--brand-pill-text);
    border: 1px solid var(--brand-pill-border);
    border-radius: 9999px;
}
.theme-toggle {
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.35rem 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    background-color: transparent;
}
.theme-toggle:hover {
    background-color: var(--sensedia-purple-light);
    color: var(--sensedia-purple-dark);
}
.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}
.theme-toggle [data-icon="moon"] {
    display: none;
}
body[data-theme="dark"] .theme-toggle [data-icon="sun"] {
    display: none;
}
body[data-theme="dark"] .theme-toggle [data-icon="moon"] {
    display: inline;
}
.text-accent-orange {
    color: var(--sensedia-orange-dark);
}
body[data-theme="dark"] .text-accent-orange {
    color: #FFB89A;
}

body[data-theme="dark"] .text-slate-900,
body[data-theme="dark"] .text-slate-800 {
    color: var(--text-primary) !important;
}
body[data-theme="dark"] .text-slate-700,
body[data-theme="dark"] .text-slate-600 {
    color: var(--text-secondary) !important;
}
body[data-theme="dark"] .text-slate-500,
body[data-theme="dark"] .text-slate-400 {
    color: var(--text-muted) !important;
}
body[data-theme="dark"] .bg-white {
    background-color: var(--surface-card) !important;
}
body[data-theme="dark"] .bg-slate-50 {
    background-color: rgba(148, 163, 184, 0.08) !important;
}
body[data-theme="dark"] .bg-slate-100 {
    background-color: rgba(148, 163, 184, 0.12) !important;
}
body[data-theme="dark"] .border-slate-200 {
    border-color: rgba(148, 163, 184, 0.25) !important;
}
body[data-theme="dark"] .divide-slate-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: rgba(148, 163, 184, 0.22);
}
body[data-theme="dark"] .bg-orange-50\/30 {
    background-color: rgba(255, 135, 90, 0.08) !important;
}
body[data-theme="dark"] .bg-orange-100 {
    background-color: rgba(255, 135, 90, 0.18) !important;
    color: #FFE3D6 !important;
}
body[data-theme="dark"] .bg-orange-200 {
    background-color: rgba(255, 135, 90, 0.25) !important;
    color: #FFE3D6 !important;
}
body[data-theme="dark"] .border-orange-200 {
    border-color: rgba(255, 135, 90, 0.32) !important;
}
body[data-theme="dark"] .text-orange-900 {
    color: #FFE3D6 !important;
}
body[data-theme="dark"] .text-orange-700,
body[data-theme="dark"] .text-orange-600 {
    color: #FFB89A !important;
}
body[data-theme="dark"] .bg-orange-600 {
    background-color: rgba(255, 135, 90, 0.75) !important;
}
body[data-theme="dark"] table thead tr {
    background-color: rgba(148, 163, 184, 0.12);
}
body[data-theme="dark"] #modal .bg-slate-100 {
    background-color: rgba(148, 163, 184, 0.2) !important;
}

/* Regras adicionais para dark mode - elementos dinâmicos e gerados via JS */
body[data-theme="dark"] .kpi-card {
    background-color: var(--surface-card) !important;
}
body[data-theme="dark"] tbody.bg-white,
body[data-theme="dark"] .bg-white tbody,
body[data-theme="dark"] table tbody.bg-white {
    background-color: var(--surface-card) !important;
}
body[data-theme="dark"] .query-card.bg-white,
body[data-theme="dark"] .category-content.bg-white {
    background-color: var(--surface-card) !important;
}
body[data-theme="dark"] input.bg-white,
body[data-theme="dark"] pre.bg-white {
    background-color: var(--surface-card) !important;
    color: var(--text-primary) !important;
}
body[data-theme="dark"] .modal-content-window.bg-white {
    background-color: var(--surface-card) !important;
}
body[data-theme="dark"] .border-t.border-slate-200.bg-white {
    background-color: var(--surface-card) !important;
}
body[data-theme="dark"] table {
    color: var(--text-primary);
}
body[data-theme="dark"] table td,
body[data-theme="dark"] table th {
    color: var(--text-primary);
}
body[data-theme="dark"] .hover\:bg-slate-50:hover {
    background-color: rgba(148, 163, 184, 0.12) !important;
}
body[data-theme="dark"] .hover\:bg-slate-100:hover {
    background-color: rgba(148, 163, 184, 0.16) !important;
}

/* Header Styles */
header {
    background-color: var(--surface-header) !important;
    border-color: var(--border-color) !important;
}

body[data-theme="dark"] header {
    background-color: var(--surface-header) !important;
    border-color: var(--border-color) !important;
}

body[data-theme="dark"] header .text-slate-900,
body[data-theme="dark"] header .text-slate-700,
body[data-theme="dark"] header .text-slate-600,
body[data-theme="dark"] header .text-slate-500 {
    color: var(--text-primary) !important;
}

body[data-theme="dark"] header .bg-slate-100 {
    background-color: rgba(148, 163, 184, 0.16) !important;
}

body[data-theme="dark"] header .text-slate-600 {
    color: var(--text-secondary) !important;
}

/* Sidebar Styles - Alta especificidade para sobrescrever Tailwind */
aside.sidebar {
    background-color: var(--surface-card) !important;
    border-right: 1px solid var(--border-color) !important;
}

aside.sidebar a.sidebar-item {
    color: var(--text-secondary) !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    cursor: pointer !important;
    background-color: transparent !important;
}

aside.sidebar a.sidebar-item:hover {
    background-color: var(--sensedia-purple-light) !important;
    color: var(--sensedia-purple-dark) !important;
    transform: translateX(2px) !important;
}

aside.sidebar a.sidebar-item.active {
    background-color: var(--sensedia-purple-light) !important;
    color: var(--sensedia-purple-dark) !important;
    font-weight: 600 !important;
}

body[data-theme="dark"] aside.sidebar {
    background-color: var(--surface-card) !important;
    border-right-color: var(--border-color) !important;
}

body[data-theme="dark"] aside.sidebar a.sidebar-item {
    color: var(--text-secondary) !important;
    background-color: transparent !important;
}

body[data-theme="dark"] aside.sidebar a.sidebar-item:hover {
    background-color: rgba(156, 123, 255, 0.22) !important;
    color: var(--sensedia-purple-light) !important;
    transform: translateX(2px) !important;
}

body[data-theme="dark"] aside.sidebar a.sidebar-item.active {
    background-color: rgba(156, 123, 255, 0.22) !important;
    color: var(--sensedia-purple-light) !important;
}

/* =====================================================================
   Capa SSO — redesign sóbrio (diretoria view v4.1)
   Linguagem visual nova: base neutra + marca Sensedia como accent contido,
   sem ripple/scale, hierarquia clara. Tudo via design tokens (dark mode ok).
   Esta capa é a prova de conceito do vocabulário que será propagado.
   ===================================================================== */
.auth-cover {
    background: radial-gradient(125% 125% at 50% -10%, var(--surface-header) 0%, var(--page-background) 60%);
    overflow: hidden;
}
.auth-cover::before {
    content: '';
    position: absolute;
    inset: -25%;
    background:
        radial-gradient(35% 35% at 15% 20%, rgba(255, 135, 90, 0.16), transparent 70%),
        radial-gradient(38% 38% at 85% 80%, rgba(156, 123, 255, 0.18), transparent 72%);
    pointer-events: none;
}
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2.5rem 2.25rem;
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    box-shadow: 0 24px 48px -24px rgba(15, 23, 42, 0.30), 0 8px 24px -16px rgba(15, 23, 42, 0.16);
    animation: authCardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.25rem;
    right: 1.25rem;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--sensedia-orange), var(--sensedia-purple));
}
@keyframes authCardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
.auth-header { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-brand { display: flex; align-items: center; gap: 0.875rem; }
.auth-logo {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sensedia-purple-light), var(--sensedia-orange-light));
    box-shadow: inset 0 0 0 1px var(--border-color);
}
.auth-brand-text { display: flex; flex-direction: column; gap: 0.15rem; }
.auth-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text-primary);
}
.auth-subtitle {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-secondary);
}
.auth-subtitle strong { color: var(--text-primary); font-weight: 600; }
.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-radius: 0.7rem;
    background: var(--surface-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: var(--card-shadow);
}
.auth-hint {
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-muted);
}
.auth-hint strong { color: var(--text-secondary); font-weight: 600; }
.auth-status {
    font-size: 0.8125rem;
    line-height: 1.45;
    margin: 0;
}
.auth-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: 9999px;
    background: var(--sensedia-purple-light);
    color: var(--sensedia-purple-dark);
    font-size: 0.8125rem;
    font-weight: 600;
}
.auth-user-pill::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 201, 177, 0.25);
}
.auth-field { display: flex; flex-direction: column; gap: 0.375rem; }
.auth-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.auth-optional { color: var(--text-muted); font-weight: 500; }
.auth-input {
    width: 100%;
    padding: 0.6875rem 0.875rem;
    border-radius: 0.7rem;
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
    outline: none;
    border-color: var(--sensedia-purple);
    box-shadow: 0 0 0 3px rgba(156, 123, 255, 0.18);
}
.auth-primary-btn {
    width: 100%;
    padding: 0.8125rem 1rem;
    border-radius: 0.7rem;
    background: var(--sensedia-orange);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: 0 12px 22px -12px rgba(255, 135, 90, 0.75);
}
.auth-primary-btn:disabled {
    background: #FAD5C4;
    color: #ffffff;
    cursor: not-allowed;
    box-shadow: none;
}
.auth-signout {
    display: block;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-decoration: none;
}
.auth-signout:hover { color: var(--text-secondary); text-decoration: underline; }
.auth-footer {
    margin: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    text-align: center;
    color: var(--text-muted);
}

/* Capa sóbria: anula o ripple/scale herdados do estilo global de botões */
#usage-cover button::before { display: none !important; }
#usage-cover button:not(:disabled):hover { transform: none; }
#usage-cover .auth-google-btn:hover {
    background: var(--surface-header);
    border-color: var(--text-muted);
    box-shadow: var(--card-shadow-hover);
}
#usage-cover .auth-primary-btn:hover {
    background: var(--sensedia-orange-dark);
    box-shadow: 0 14px 26px -12px rgba(213, 100, 49, 0.7);
}

/* =====================================================================
   Design-system de conteúdo (.cde-*) — diretoria view (Fase 3)
   Primitivos sóbrios para relatórios/tabelas/forms, via design tokens
   (dark mode automático). Piloto: relatório de Connectors; reusável nas
   demais telas de conteúdo.
   ===================================================================== */

/* Cabeçalho de seção (eyebrow + título + subtítulo + passo numerado) */
.cde-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.6rem;
    font-size: 0.8125rem;
    font-weight: 700;
    background: var(--sensedia-purple-light);
    color: var(--sensedia-purple-dark);
    flex-shrink: 0;
}
.cde-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.cde-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--text-primary);
}
.cde-section-sub {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* Campos de formulário */
.cde-field { display: flex; flex-direction: column; gap: 0.35rem; }
.cde-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.cde-input {
    padding: 0.6rem 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border-color);
    background: var(--surface-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cde-input::placeholder { color: var(--text-muted); }
.cde-input:focus {
    outline: none;
    border-color: var(--sensedia-purple);
    box-shadow: 0 0 0 3px rgba(156, 123, 255, 0.18);
}

/* Cards de métrica */
.cde-metric-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.cde-metric {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
}
.cde-metric__label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.cde-metric__value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-top: 0.25rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Chips / badges */
.cde-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    background: var(--surface-header);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.cde-chip__dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 9999px;
    background: currentColor;
}
.cde-chip--db {
    background: var(--chip-purple-bg);
    color: var(--chip-purple-text);
    border-color: transparent;
}
.cde-chip--muted { color: var(--text-muted); }

/* Tabela refinada */
.cde-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    overflow: hidden;
    background: var(--surface-card);
}
.cde-table-scroll { overflow-x: auto; overflow-y: auto; max-height: 60vh; }
.cde-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}
.cde-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-header);
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.cde-table tbody td {
    padding: 0.7rem 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
.cde-table tbody tr { transition: background-color 0.12s ease; }
.cde-table tbody tr:last-child td { border-bottom: 0; }
.cde-table tbody tr:hover { background: var(--surface-header); }
.cde-table .cde-num { text-align: right; font-variant-numeric: tabular-nums; }
.cde-table .cde-strong { color: var(--text-primary); font-weight: 600; }
.cde-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

/* Botão fantasma (ações secundárias de conteúdo, ex. exportar) */
.cde-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 0.6rem;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--surface-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    white-space: nowrap;
}
.cde-btn-ghost:hover {
    background: var(--surface-header);
    color: var(--text-primary);
    border-color: var(--text-muted);
}
.cde-muted { color: var(--text-muted); }
.cde-panel {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
}

/* =====================================================================
   Copiloto IA — workspace, chat, relatório (contraste Sensedia / WCAG)
   Orange #D56431 + Purple #7B5DE0 sobre superfícies neutras.
   ===================================================================== */
:root {
    --copilot-chat-max: min(72vh, 52rem);
    --copilot-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --copilot-msg-size: 0.9375rem;
    --copilot-msg-leading: 1.65;
    --copilot-sidebar-width: 16rem;
    --copilot-sidebar-collapsed: 3.5rem;
}

.copilot-disclaimer {
    display: grid;
    gap: 0.75rem;
}
@media (min-width: 768px) {
    .copilot-disclaimer { grid-template-columns: 1fr 1fr; }
}
.copilot-disclaimer__fact {
    border-radius: 0.75rem;
    border: 1px solid var(--hint-orange-border);
    background: var(--hint-orange-bg);
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.5;
}
.copilot-disclaimer__fact strong {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sensedia-orange-dark);
    margin-bottom: 0.35rem;
}
.copilot-disclaimer__ai {
    border-radius: 0.75rem;
    border: 1px solid var(--hint-purple-border);
    background: var(--hint-purple-bg);
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.5;
}
.copilot-disclaimer__ai strong {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sensedia-purple-dark);
    margin-bottom: 0.35rem;
}
body[data-theme="dark"] .copilot-disclaimer__fact strong { color: #FFB89A; }
body[data-theme="dark"] .copilot-disclaimer__ai strong { color: var(--chip-purple-text); }

.eai-workspace {
    display: grid;
    gap: 1.25rem;
    align-items: stretch;
}
@media (min-width: 1024px) {
    .eai-workspace {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
        gap: 1.5rem;
        min-height: var(--copilot-chat-max);
    }
}
.eai-panel {
    display: flex;
    flex-direction: column;
    min-height: min(70vh, 40rem);
    max-height: var(--copilot-chat-max);
    font-family: var(--copilot-font);
}
@media (min-width: 1024px) {
    .eai-panel { min-height: var(--copilot-chat-max); }
}
.eai-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.eai-panel__title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-right: auto;
}
.eai-panel--chat { border-top: 4px solid var(--sensedia-purple); }
.eai-panel--report { border-top: 4px solid var(--sensedia-orange); }

#eai-chat-thread {
    flex: 1 1 auto;
    min-height: 14rem;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
    scroll-behavior: smooth;
}
#eai-exec-report {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: var(--copilot-msg-size);
    line-height: var(--copilot-msg-leading);
    color: var(--text-secondary);
    padding-right: 0.25rem;
}
#eai-exec-report section { margin-bottom: 1.75rem; }
#eai-exec-report section:last-child { margin-bottom: 0; }

.eai-chat-msg {
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 0.875rem 1rem;
    margin-bottom: 0.875rem;
    max-width: 100%;
    word-break: break-word;
}
.eai-chat-msg--user {
    border-left: 3px solid var(--sensedia-orange);
    background: var(--hint-orange-bg);
}
.eai-chat-msg--assistant {
    border-left: 3px solid var(--sensedia-purple);
    background: var(--hint-purple-bg);
}
.eai-chat-msg--pending {
    border-left: 3px solid var(--sensedia-purple);
    background: var(--hint-purple-bg);
    opacity: 0.85;
}
.eai-chat-pending-body {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.eai-chat-pending-text {
    font-size: var(--copilot-msg-size);
    line-height: var(--copilot-msg-leading);
    color: var(--text-secondary);
}
.eai-chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.15rem;
}
.eai-chat-typing span {
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 50%;
    background: var(--sensedia-purple);
    animation: eai-chat-dot 1.2s ease-in-out infinite;
}
.eai-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.eai-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes eai-chat-dot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}
.eai-chat-elapsed {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}
.eai-chat-msg__role {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.eai-chat-body {
    font-size: var(--copilot-msg-size);
    line-height: var(--copilot-msg-leading);
    color: var(--text-primary);
}
.eai-chat-body code {
    font-size: 0.8125rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    background: var(--code-purple-bg);
    color: var(--code-purple-text);
    border: 1px solid var(--border-color);
}
.eai-extra-card {
    margin-top: 0.75rem;
    padding: 0.75rem 0.875rem;
    border-radius: 0.65rem;
    border: 1px solid var(--border-color);
    background: var(--surface-card);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.eai-extra-card__title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}
.eai-extra-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}
.eai-sql-block {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.65rem;
    border: 1px solid var(--hint-orange-border);
    background: var(--hint-orange-bg);
}
.eai-sql-block pre {
    margin-top: 0.5rem;
    padding: 0.65rem;
    border-radius: 0.5rem;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.6875rem;
    overflow-x: auto;
}
.eai-kpi-strip {
    display: flex;
    flex-wrap: wrap;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--surface-header);
    overflow: hidden;
}
.eai-kpi-strip__item {
    flex: 1 1 5rem;
    text-align: center;
    padding: 0.65rem 0.75rem;
    border-right: 1px solid var(--border-color);
}
.eai-kpi-strip__item:last-child { border-right: 0; }
.eai-kpi-strip__val {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}
.eai-kpi-strip__lbl {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.copilot-dash-panel {
    background: linear-gradient(145deg, var(--hint-purple-bg) 0%, var(--surface-card) 55%);
    border: 1px solid var(--hint-purple-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}
body[data-theme="dark"] .copilot-dash-panel {
    background: linear-gradient(145deg, rgba(156, 123, 255, 0.12) 0%, var(--surface-card) 50%);
}
.copilot-dash-panel .copilot-disclaimer { margin-bottom: 1rem; }
.copilot-insight-block {
    font-size: var(--copilot-msg-size);
    line-height: var(--copilot-msg-leading);
    color: var(--text-primary);
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem 1.125rem;
    white-space: pre-wrap;
}
.copilot-problem-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
}

.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;
}

/* Sidebar recolhível — modo painel */
#app-layout {
    height: calc(100vh - 5rem);
    min-height: 0;
}
aside.sidebar {
    width: var(--copilot-sidebar-width);
    transition: width 0.22s ease, padding 0.22s ease;
    position: relative;
    overflow: visible;
}
aside.sidebar .sidebar-inner {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}
aside.sidebar .sidebar-label {
    transition: opacity 0.15s ease, width 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
}
body.sidebar-collapsed aside.sidebar {
    width: var(--copilot-sidebar-collapsed);
}
body.sidebar-collapsed aside.sidebar .sidebar-label {
    opacity: 0;
    width: 0;
    display: none;
}
body.sidebar-collapsed aside.sidebar .sidebar-item {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
body.sidebar-collapsed aside.sidebar .sidebar-item svg {
    margin: 0;
}
.sidebar-collapse-btn {
    position: absolute;
    top: 1.25rem;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-card);
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transform: translateX(50%);
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.sidebar-collapse-btn:hover {
    background: var(--sensedia-purple-light);
    color: var(--sensedia-purple-dark);
    border-color: var(--hint-purple-border);
    box-shadow: var(--card-shadow-hover);
}
body[data-theme="dark"] .sidebar-collapse-btn:hover {
    color: var(--chip-purple-text);
}
.sidebar-collapse-btn svg {
    width: 1rem;
    height: 1rem;
    transition: transform 0.22s ease;
}
body.sidebar-collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}
#app-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}
body.sidebar-collapsed #app .max-w-7xl {
    max-width: none;
}
body.sidebar-collapsed #view-embedded-ai {
    max-width: none;
}
#app:has(#view-embedded-ai:not(.hidden)) {
    max-width: none;
    width: 100%;
}

/* Dark mode — inputs e hints do copiloto */
body[data-theme="dark"] #eai-chat-input,
body[data-theme="dark"] #free-sql-input,
body[data-theme="dark"] .cde-llm-model-select {
    background: var(--surface-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}
body[data-theme="dark"] #eai-db-hint {
    background: rgba(148, 163, 184, 0.08) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}
body[data-theme="dark"] .eai-extra-card,
body[data-theme="dark"] #eai-exec-report table {
    background: var(--surface-card) !important;
}
body[data-theme="dark"] #eai-exec-report thead {
    background: rgba(148, 163, 184, 0.1) !important;
}
body[data-theme="dark"] .text-slate-900,
body[data-theme="dark"] .text-slate-800,
body[data-theme="dark"] .text-slate-700 {
    color: var(--text-primary) !important;
}
body[data-theme="dark"] .text-slate-600,
body[data-theme="dark"] .text-slate-500 {
    color: var(--text-secondary) !important;
}
body[data-theme="dark"] .border-slate-200,
body[data-theme="dark"] .border-slate-300 {
    border-color: var(--border-color) !important;
}
body[data-theme="dark"] .bg-slate-50,
body[data-theme="dark"] .bg-slate-50\/80,
body[data-theme="dark"] .bg-slate-100 {
    background-color: rgba(148, 163, 184, 0.1) !important;
}
body[data-theme="dark"] input.bg-white,
body[data-theme="dark"] textarea.bg-white,
body[data-theme="dark"] select.bg-white {
    background-color: var(--surface-card) !important;
    color: var(--text-primary) !important;
}

/* Cards expansíveis do plano IA no dashboard */
.ai-report-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    font-size: 0.875rem;
}
.ai-report-card-header:hover {
    background: var(--surface-header);
}
.ai-report-card-body {
    border-top: 1px solid var(--border-color);
    background: var(--surface-header);
    padding: 0.75rem;
}
.ai-report-card-chevron {
    color: var(--text-muted);
}

/* Menu do usuário + painel lateral de status */
.header-user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 9rem;
    padding: 0.35rem 0.55rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-card);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.header-user-menu-btn:hover {
    background: var(--surface-header);
    border-color: color-mix(in srgb, var(--sensedia-orange) 35%, var(--border-color));
}
.header-user-menu-btn__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-status-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}
.user-status-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 61;
    display: flex;
    flex-direction: column;
    width: min(22rem, 92vw);
    height: 100vh;
    border-left: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--surface-card) 92%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
}
.user-status-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.user-status-panel__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.user-status-panel__subtitle {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.user-status-panel__close {
    padding: 0.35rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
}
.user-status-panel__close:hover {
    background: var(--surface-header);
}
.user-status-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem 1rem;
}
.user-status-panel__section + .user-status-panel__section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}
.user-status-panel__section-title {
    margin-bottom: 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.user-status-panel__meta {
    margin-top: 0.5rem;
    display: grid;
    gap: 0.35rem;
    font-size: 0.75rem;
}
.user-status-panel__meta dt {
    color: var(--text-muted);
}
.user-status-panel__meta dd {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}
.user-status-panel__footer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border-color);
}
.user-status-panel__logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border-color);
    background: var(--surface-header);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}
.user-status-panel__logout:hover {
    color: var(--sensedia-orange-dark);
    border-color: color-mix(in srgb, var(--sensedia-orange) 40%, var(--border-color));
}
.usp-status-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.45rem 0;
}
.usp-status-row__content {
    min-width: 0;
    flex: 1;
}
.usp-status-value {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.usp-status-detail {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.usp-status-dot {
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.3rem;
    border-radius: 9999px;
    background: var(--text-muted);
    flex-shrink: 0;
}
.usp-status-dot--ok { background: #16a34a; }
.usp-status-dot--warn { background: #d97706; }
.usp-status-dot--err { background: #dc2626; }

/* Customer catalog (Clientes & Dump) */
.cl-link { color: var(--sensedia-purple-dark); text-decoration: underline; text-underline-offset: 2px; }
.cl-link:hover { opacity: 0.85; }
.cl-btn-action {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background: var(--surface-card);
    color: var(--text-primary);
    white-space: nowrap;
}
.cl-btn-action:hover { opacity: 0.9; }
.cl-btn-trigger {
    background: linear-gradient(135deg, var(--sensedia-orange) 0%, #e85d04 100%);
    color: #fff;
    border: none;
}
.cl-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 50;
    max-width: 28rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    background: var(--surface-card);
}
.cl-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    font-weight: 500;
}
.cl-chip-ok { background: color-mix(in srgb, #22c55e 12%, var(--surface-card)); color: #15803d; }
.cl-chip-warn { background: var(--hint-orange-bg); color: var(--text-secondary); }
body[data-theme="dark"] .cl-chip-ok { color: #86efac; }
#cl-tbody tr.cl-row-highlight {
    background: color-mix(in srgb, var(--sensedia-orange) 12%, var(--surface-card));
}
#jenkins-advanced-params > summary::-webkit-details-marker { display: none; }