/*
 * Isola o chrome Tailwind (sidebar/navbar) do reset global do webfactor
 * (style.css: font-size 11px / padding 0 em body, div, li, p, input…).
 * Carregar DEPOIS de legacy/webfactor/css/style.css.
 */

body.fi-body aside.painel-chrome,
body.fi-body aside.painel-chrome div,
body.fi-body aside.painel-chrome p,
body.fi-body aside.painel-chrome ul,
body.fi-body aside.painel-chrome ol,
body.fi-body aside.painel-chrome li,
body.fi-body aside.painel-chrome span,
body.fi-body aside.painel-chrome a,
body.fi-body aside.painel-chrome button,
body.fi-body aside.painel-chrome label,
body.fi-body header.painel-chrome,
body.fi-body header.painel-chrome div,
body.fi-body header.painel-chrome p,
body.fi-body header.painel-chrome span,
body.fi-body header.painel-chrome a,
body.fi-body header.painel-chrome button {
    margin: 0 !important;
    padding: 0;
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    line-height: 1.15rem !important;
    border-style: solid;
}

body.fi-body aside.painel-chrome input,
body.fi-body aside.painel-chrome select {
    font-family: inherit !important;
    font-size: 0.8125rem !important;
    line-height: 1.2rem !important;
    font-weight: 400 !important;
    margin: 0 !important;
    outline: none;
    border: 1px solid #495057 !important;
    border-radius: 0.375rem !important;
    background-color: #2b3035 !important;
    color: #f8f9fa !important;
    padding: 0.35rem 0.6rem !important;
    height: auto !important;
    width: 100%;
    box-sizing: border-box;
}

body.fi-body aside.painel-chrome select option {
    background-color: #343a40 !important;
    color: #f8f9fa !important;
}

body.fi-body aside.painel-chrome input[type="search"] {
    background-color: #2b3035 !important;
    padding-left: 0.75rem !important;
    padding-right: 2.75rem !important;
}

/* Select do módulo ao lado da estrela — não ocupar 100% sozinho */
body.fi-body aside.painel-chrome .flex.items-center > select,
body.fi-body aside.painel-chrome select#troca-modulo {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

/* Lista própria: o popup nativo do select caía no primeiro item com a lista maior. */
body.fi-body aside.painel-chrome .modulo-picker {
    position: relative;
    min-width: 0;
    flex: 1 1 auto;
}

body.fi-body aside.painel-chrome button.modulo-picker-btn {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.35rem 0.6rem !important;
    border: 1px solid #495057 !important;
    border-radius: 0.375rem !important;
    background-color: #2b3035 !important;
    color: #f8f9fa !important;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

body.fi-body aside.painel-chrome .modulo-picker-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.fi-body aside.painel-chrome .modulo-picker-caret {
    flex: 0 0 auto;
    opacity: 0.75;
}

body.fi-body aside.painel-chrome .modulo-picker-list {
    display: none;
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 16rem;
    margin: 0 !important;
    padding: 0.25rem !important;
    overflow-y: auto;
    list-style: none;
    border: 1px solid #495057 !important;
    border-radius: 0.375rem;
    background: #2b3035;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

body.fi-body aside.painel-chrome .modulo-picker.is-open .modulo-picker-list {
    display: block;
}

body.fi-body aside.painel-chrome .modulo-picker-list li {
    margin: 0 !important;
    padding: 0 !important;
}

body.fi-body aside.painel-chrome button.modulo-picker-item {
    display: block;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.4rem 0.55rem !important;
    border: 0 !important;
    border-radius: 0.25rem !important;
    background: transparent !important;
    color: #f8f9fa !important;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.fi-body aside.painel-chrome button.modulo-picker-item:hover,
body.fi-body aside.painel-chrome button.modulo-picker-item.is-current {
    background: rgba(255, 255, 255, 0.1) !important;
}

body.fi-body aside.painel-chrome .space-y-1 > :not([hidden]) ~ :not([hidden]),
body.fi-body aside.painel-chrome .space-y-2 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.1rem !important;
}

body.fi-body aside.painel-chrome nav.space-y-1 > :not([hidden]) ~ :not([hidden]),
body.fi-body aside.painel-chrome nav.space-y-2 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.25rem !important;
}

/* Itens do menu (full width). Não aplicar em botões absolutos (lupa) nem na estrela. */
body.fi-body aside.painel-chrome button.flex:not([data-sidebar-search-btn]):not([data-modulo-favorito]):not(.painel-sidebar-cp),
body.fi-body aside.painel-chrome a.flex {
    padding: 0.4rem 0.65rem !important;
    border: 0 !important;
    border-radius: 0.3rem !important;
    background: transparent;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    color: #f8f9fa !important;
}

body.fi-body aside.painel-chrome button.painel-menu-item:hover,
body.fi-body aside.painel-chrome a.painel-menu-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.fi-body aside.painel-chrome .painel-menu-item.is-active {
    background: #495057 !important;
    color: #fff !important;
}

body.fi-body aside.painel-chrome .painel-menu-item.is-active i,
body.fi-body aside.painel-chrome .painel-menu-item.is-active span {
    color: #fff !important;
}

body.fi-body aside.painel-chrome button[data-sidebar-search-btn] {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    bottom: 0 !important;
    width: auto !important;
    min-width: 2.5rem !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 0.75rem !important;
    border: 0 !important;
    border-left: 1px solid #495057 !important;
    border-radius: 0 0.375rem 0.375rem 0 !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
    z-index: 2;
    color: #adb5bd !important;
}

body.fi-body aside.painel-chrome button[data-modulo-favorito] {
    width: auto !important;
    min-width: 2rem !important;
    padding: 0.35rem 0.45rem !important;
    border: 1px solid #495057 !important;
    border-radius: 0.375rem !important;
    background: #2b3035 !important;
    color: #adb5bd !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
}

body.fi-body aside.painel-chrome button[data-modulo-favorito]:hover {
    color: #ffc107 !important;
    background: #3d444b !important;
}

body.fi-body aside.painel-chrome .gap-1 {
    gap: 0.25rem !important;
}

body.fi-body aside.painel-chrome .gap-2 {
    gap: 0.4rem !important;
}

body.fi-body aside.painel-chrome .ml-3 {
    margin-left: 0.55rem !important;
}

body.fi-body aside.painel-chrome .painel-menu-children {
    padding-left: 0.35rem !important;
    border-left: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-sizing: border-box;
}

body.fi-body aside.painel-chrome .mt-1 {
    margin-top: 0.15rem !important;
}

body.fi-body aside.painel-chrome .mb-1 {
    margin-bottom: 0.25rem !important;
}

body.fi-body aside.painel-chrome .mb-2 {
    margin-bottom: 0.35rem !important;
}

body.fi-body aside.painel-chrome .p-2 {
    padding: 0.4rem !important;
}

body.fi-body aside.painel-chrome .px-3 {
    padding-left: 0.6rem !important;
    padding-right: 0.6rem !important;
}

body.fi-body aside.painel-chrome .py-1\.5,
body.fi-body aside.painel-chrome .py-2 {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
}

body.fi-body aside.painel-chrome i {
    font-size: 0.85rem !important;
    width: 1.1rem !important;
    text-align: center;
    line-height: 1 !important;
    display: inline-block !important;
}

body.fi-body aside.painel-chrome .h-16:not(.painel-sidebar-logo-wrap) {
    height: 3.5rem !important;
    padding: 0 !important;
}

body.fi-body aside.painel-chrome .border-b {
    border-bottom-width: 1px !important;
    border-bottom-color: #495057 !important;
}

body.fi-body aside.painel-chrome .border-r {
    border-right-width: 1px !important;
    border-right-color: #2b3035 !important;
}

body.fi-body aside.painel-chrome .bg-sky-900 {
    background-color: #495057 !important;
    color: #fff !important;
}

body.fi-body aside.painel-chrome .bg-sky-900 i,
body.fi-body aside.painel-chrome .bg-sky-900 span {
    color: #fff !important;
}

body.fi-body aside.painel-chrome .bg-gray-300 {
    background-color: #495057 !important;
}

body.fi-body aside.painel-chrome .text-gray-500 {
    color: #ced4da !important;
}

/* Sidebar escura (#343a40) */
body.fi-body aside.painel-chrome.painel-sidebar-dark {
    background: #343a40 !important;
    color: #f8f9fa !important;
    border-color: #2b3035 !important;
}

body.fi-body aside.painel-chrome.painel-sidebar-dark .painel-menu-label,
body.fi-body aside.painel-chrome.painel-sidebar-dark .painel-menu-chevron {
    color: #f8f9fa !important;
}

body.fi-body aside.painel-chrome.painel-sidebar-dark a.painel-menu-item {
    color: #ced4da !important;
}

body.fi-body aside.painel-chrome .painel-sidebar-cp {
    width: 100% !important;
    margin: 0 0 0.35rem 0 !important;
    padding: 0.4rem 0.6rem !important;
    border: 1px solid #495057 !important;
    border-radius: 0.375rem !important;
    background: #2b3035 !important;
    color: #adb5bd !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}

body.fi-body aside.painel-chrome .painel-sidebar-cp:hover {
    background: #3d444b !important;
    color: #f8f9fa !important;
}

body.fi-body aside.painel-chrome .painel-sidebar-cp i {
    color: inherit !important;
}

body.fi-body aside.painel-chrome .painel-sidebar-cp-kbd {
    background: #343a40 !important;
    border-color: #495057 !important;
    color: #adb5bd !important;
}

body.fi-body header.painel-chrome.border-b {
    border-bottom-width: 1px !important;
    border-bottom-color: #e5e7eb !important;
}

body.fi-body header.painel-chrome {
    position: relative !important;
    /* Acima do miolo/legado (≤10); abaixo da sidebar (40) e modais de busca (80+). */
    z-index: 35 !important;
    height: 4rem !important;
    background: #fff !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding: 0 !important;
    overflow: visible !important;
}

body.fi-body header.painel-chrome .painel-topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box !important;
    gap: 0.75rem !important;
}

/* Toggle do menu: nao usar Tailwind lg:inline-flex (pode nao estar no build Vite).
 * z-index garante clique mesmo se acoes do topbar invadirem a area. */
body.fi-body .painel-topbar-start {
    position: relative !important;
    z-index: 5 !important;
    min-width: 0 !important;
}

/* Um único sanduíche no topbar (mobile + desktop). Spec > .painel-icon-btn. */
body.fi-body header.painel-chrome .painel-sidebar-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.35rem !important;
    border: 0 !important;
    background: transparent !important;
    cursor: pointer !important;
    color: #4b5563 !important;
    position: relative !important;
    z-index: 6 !important;
}

body.fi-body header.painel-chrome .painel-breadcrumb,
body.fi-body header.painel-chrome .painel-breadcrumb b {
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #6c757d !important;
}

body.fi-body header.painel-chrome .painel-breadcrumb b {
    font-weight: 600 !important;
    color: #495057 !important;
}

/* Dropdown do usuário — o reset do header zera margin/padding e força
 * border-style:solid em todo div/p; por isso o layout Axis precisa de
 * classes próprias com !important (Tailwind utilitário não “vence”).
 *
 * top:100% é obrigatório: .painel-top-actions > div vira flex+align-items
 * center, e com top:auto o menu usa a posição estática (centrado no botão),
 * sobrando para cima da viewport. */
body.fi-body header.painel-chrome .painel-user-menu-wrap {
    position: relative !important;
    overflow: visible !important;
    z-index: 60 !important;
}

body.fi-body header.painel-chrome .painel-user-trigger {
    padding: 0.35rem 0.5rem !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
}

body.fi-body header.painel-chrome .painel-user-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    bottom: auto !important;
    margin: 0.5rem 0 0 !important;
    padding: 0 !important;
    width: 16rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    background: #fff !important;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important;
    z-index: 60 !important;
    overflow: hidden !important;
}

body.fi-body header.painel-chrome .painel-user-menu-body {
    padding: 1rem !important;
    border: 0 !important;
    border-bottom: 1px solid #e5e7eb !important;
}

body.fi-body header.painel-chrome .painel-user-menu-section {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

body.fi-body header.painel-chrome .painel-user-menu-section + .painel-user-menu-section {
    margin-top: 1rem !important;
}

body.fi-body header.painel-chrome .painel-user-menu-label {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    line-height: 1rem !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: #9ca3af !important;
}

body.fi-body header.painel-chrome .painel-user-menu-name {
    margin: 0.35rem 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    line-height: 1.25rem !important;
    color: #111827 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.fi-body header.painel-chrome .painel-user-menu-server {
    margin-top: 0.5rem !important;
    padding: 0.65rem 0.75rem !important;
    border: 1px solid #f3f4f6 !important;
    border-radius: 0.5rem !important;
    background: #f9fafb !important;
    box-shadow: none !important;
}

body.fi-body header.painel-chrome .painel-user-menu-row {
    display: flex !important;
    align-items: baseline !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    margin: 0 !important;
    padding: 0.35rem 0 !important;
    border: 0 !important;
    border-top: 1px solid #e5e7eb !important;
}

body.fi-body header.painel-chrome .painel-user-menu-row:first-child {
    border-top: 0 !important;
    padding-top: 0 !important;
}

body.fi-body header.painel-chrome .painel-user-menu-row:last-child {
    padding-bottom: 0 !important;
}

body.fi-body header.painel-chrome .painel-user-menu-row-k {
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 400 !important;
    line-height: 1.15rem !important;
    color: #6b7280 !important;
}

body.fi-body header.painel-chrome .painel-user-menu-row-v {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    line-height: 1.15rem !important;
    color: #1f2937 !important;
    text-align: right !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.fi-body header.painel-chrome .painel-user-menu-row-v.is-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    font-size: 0.6875rem !important;
    font-weight: 400 !important;
    color: #374151 !important;
}

body.fi-body header.painel-chrome .painel-user-menu-server-unavailable {
    margin-top: 0.5rem !important;
    padding: 0.65rem 0.75rem !important;
    border: 1px solid #fef3c7 !important;
    border-radius: 0.5rem !important;
    background: #fffbeb !important;
}

body.fi-body header.painel-chrome .painel-user-menu-server-unavailable-title {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #78350f !important;
}

body.fi-body header.painel-chrome .painel-user-menu-server-unavailable-text {
    display: block !important;
    margin: 0.25rem 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 400 !important;
    line-height: 1.2rem !important;
    color: #92400e !important;
}

body.fi-body header.painel-chrome .painel-user-menu-footer {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    border: 0 !important;
    border-top: 1px solid #f3f4f6 !important;
    background: #f9fafb !important;
}

body.fi-body header.painel-chrome .painel-user-menu-footer a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.55rem 0.75rem !important;
    border: 0 !important;
    border-radius: 0.5rem !important;
    color: #374151 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    line-height: 1.25rem !important;
    text-decoration: none !important;
    background: transparent !important;
}

body.fi-body header.painel-chrome .painel-user-menu-footer a:hover {
    color: #111827 !important;
    background: #f3f4f6 !important;
}

body.fi-body header.painel-chrome .painel-user-menu-footer a.is-logout {
    color: #b91c1c !important;
}

body.fi-body header.painel-chrome .painel-user-menu-footer a.is-logout:hover {
    color: #991b1b !important;
    background: #fef2f2 !important;
}

body.fi-body header.painel-chrome .painel-user-menu-footer a i {
    font-size: 0.875rem !important;
    opacity: 0.9;
}

/* Campos legado (.form03) — Tailwind preflight + reset webfactor.
 * Nao aplicar a checkbox/radio: appearance:none + height vira "fenda" vertical. */
body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]),
body.fi-body .legado-embed select.form03:not([multiple]),
body.fi-body .legado-embed textarea.form03 {
    font-family: Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif !important;
    font-size: 11px !important;
    padding: 1px 3px !important;
    margin: 0 0 5px 0 !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
    border-radius: 3px !important;
    color: #00c !important;
    box-sizing: border-box !important;
}

/* Altura fixa so nos campos de linha unica; textarea segue o atributo rows
 * (ex.: Descricao do cobranca/cobranca.tela.php, rows=10).
 * Nao usar height:auto !important — isso impede o resize nativo (ol.sacado Detalhes). */
body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]),
body.fi-body .legado-embed select.form03:not([multiple]) {
    height: 24px !important;
}

body.fi-body .legado-embed textarea.form03 {
    resize: both;
}

/* appearance:none so em input de texto — no select mata a flechinha nativa. */
body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]) {
    -webkit-appearance: none;
    appearance: none;
}

body.fi-body .legado-embed select.form03 {
    -webkit-appearance: auto !important;
    appearance: auto !important;
}

body.fi-body .legado-embed input.form03[type="button"],
body.fi-body .legado-embed input.form03[type="submit"] {
    height: auto !important;
    min-height: 24px !important;
    cursor: pointer !important;
    padding: 2px 8px !important;
}

body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]):hover,
body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]):focus {
    background: #d9edfd !important;
}

body.fi-body .legado-embed input[type="checkbox"],
body.fi-body .legado-embed input[type="radio"] {
    -webkit-appearance: auto !important;
    appearance: auto !important;
    width: auto !important;
    min-width: 13px !important;
    height: auto !important;
    min-height: 13px !important;
    padding: 0 !important;
    margin: 0 4px 0 0 !important;
    border: initial !important;
    border-radius: 0 !important;
    background: initial !important;
    vertical-align: middle !important;
    display: inline-block !important;
}

/* Embed legado: tipografia/campos; padding do shell ~15% menor que px-4/py-4 e md:px-6/md:py-6.
 * Fundo branco: o body do webfactor antigo era branco — sobre o #f4f6f9 do
 * painel, as telas legadas (tabelas com gaps/celulas claras) ficam "lavadas". */
body.fi-body .legado-embed {
    padding: 0.85rem !important; /* was 1rem (py-4/px-4) */
    margin: 0 !important;
    box-sizing: border-box;
    background: #fff;
    min-height: 100%;
}

@media (min-width: 768px) {
    body.fi-body .legado-embed {
        padding: 1.275rem !important; /* was 1.5rem (md:py-6/md:px-6) */
    }
}

body.fi-body .legado-embed #tudo {
    min-height: 0 !important;
    position: static !important;
}

/*
 * Largura do miolo legado.
 *
 * O webfactor antigo envolvia toda tela numa <table width="970"> alinhada a
 * esquerda (application_top) — os formularios foram desenhados nessa medida. No
 * embed esse wrapper virou width="100%", e em 1920/2560 as telas esticam: o
 * rotulo fica numa ponta e o campo na outra, e as caixas de multiselect viram
 * faixas enormes.
 *
 * Aqui o wrapper volta para a largura de projeto. Como e tabela de layout auto,
 * ainda cresce quando o conteudo exige (listagens largas) e o max-width a faz
 * encolher em tela estreita — sem o scroll horizontal que o width fixo de
 * 1000px causava em 1366x768 com a sidebar aberta.
 *
 * Ajuste a medida em --wf-conteudo-largura. Tela que realmente precise de toda
 * a largura marca o proprio #conteudo com a classe .wf-largura-total.
 */
body.fi-body .legado-embed {
    --wf-conteudo-largura: 970px;
}

body.fi-body .legado-embed #conteudo {
    padding-bottom: 0 !important;
    /* NÃO usar overflow-x/y aqui: no Chrome, overflow-x:auto força overflow-y
     * computado como auto e o popup nativo do <select> fecha no mesmo clique. */
    overflow: visible;
}

/*
 * Largura literal (alem da var) — alguns browsers/cache antigos falhavam em
 * aplicar so o custom property e o miolo voltava a width:100% do HTML,
 * esticando formularios e espremendo colunas das listagens.
 */
body.fi-body .legado-embed #conteudo > table.wf-conteudo-wrap {
    width: 970px !important;
    width: var(--wf-conteudo-largura, 970px) !important;
    max-width: 100% !important;
}

body.fi-body .legado-embed #conteudo.wf-largura-total > table.wf-conteudo-wrap {
    width: 100% !important;
}

/* Tabelas com width fixo (1000/970/…) — cabem no miolo sem forçar scroll da viewport. */
body.fi-body .legado-embed #conteudo table[width="970"],
body.fi-body .legado-embed #conteudo table[width="1000"],
body.fi-body .legado-embed #conteudo table[width="1000px"],
body.fi-body .legado-embed #conteudo table[width="1024"] {
    width: 100% !important;
    max-width: 100% !important;
}

body.fi-body .legado-embed .box-topo {
    width: auto !important;
    max-width: 100% !important;
    float: none !important;
}

body.fi-body .legado-embed .box-topo-right {
    min-width: 0 !important;
    max-width: 100% !important;
    float: none !important;
}

/*
 * Tailwind preflight: img/svg { display:block; max-width:100% }.
 * No webfactor os ícones 16x16 ficam na mesma linha do input (inline).
 */
body.fi-body .legado-embed img,
body.fi-body .legado-embed svg {
    display: inline !important;
    max-width: none !important;
    height: auto !important;
    vertical-align: middle !important;
}

/*
 * Dialogs jQuery UI sao movidos para o <body> ao abrir — fora do .legado-embed
 * o preflight volta a valer e o img display:block quebra a linha (ex.: icone
 * do clipe na confirmacao de parametros do novacao.divida.php).
 */
body.fi-body .ui-dialog img,
body.fi-body .ui-dialog svg {
    display: inline !important;
    max-width: none !important;
    height: auto !important;
    vertical-align: middle !important;
}

/*
 * Utilitarios de float do Bootstrap 3 usados pelas telas legadas (ex.:
 * checkbox a direita nos itens da confirmacao do novacao.divida.php) —
 * o embed nao carrega o bootstrap.min.css que os definia.
 */
body.fi-body .legado-embed .pull-right,
body.fi-body .ui-dialog .pull-right {
    float: right !important;
}

body.fi-body .legado-embed .pull-left,
body.fi-body .ui-dialog .pull-left {
    float: left !important;
}

/*
 * Preflight colapsa todas as tabelas (border-collapse: collapse). As telas
 * legadas usam cellspacing/border-radius nos td (ex.: lista de tarefas do
 * cadastros/index.php) — colapsado, o espacamento e os cantos arredondados
 * somem. Restaura o default legado; tabelas com classe propria (.tabela)
 * seguem definindo o seu.
 *
 * Importante: com border-collapse definido em CSS, o atributo HTML cellspacing
 * deixa de valer — por isso #formulario/#listagem precisam de border-spacing
 * explicito (style.css ja define, mas a regra generica abaixo + !important
 * garantem o visual de "celulas cinza" no embed).
 */
body.fi-body .legado-embed table {
    border-collapse: separate !important;
}

body.fi-body .legado-embed table#formulario,
body.fi-body .legado-embed table#listagem {
    border-spacing: 1px !important;
}

/* Formularios (cadastros): celulas cinza-claro padrao. */
body.fi-body .legado-embed table#formulario td {
    background: #F8F8F8 !important;
    padding: 1px 10px !important;
    font-size: 11px !important;
    height: 25px !important;
    border-radius: 3px !important;
    -moz-border-radius: 3px !important;
    -webkit-border-radius: 3px !important;
}

body.fi-body .legado-embed table#formulario tr.dif td {
    background: #F0F0F0 !important;
}

/* Listagens: cinza um pouco mais escuro no padrao (invertido vs formulario). */
body.fi-body .legado-embed table#listagem td {
    background: #F0F0F0 !important;
    padding: 3px 10px 3px 6px !important;
    font-size: 11px !important;
    border-radius: 3px !important;
    -moz-border-radius: 3px !important;
    -webkit-border-radius: 3px !important;
}

body.fi-body .legado-embed table#listagem tr.dif td {
    background: #F8F8F8 !important;
}

body.fi-body .legado-embed table#formulario tr.white td,
body.fi-body .legado-embed table#listagem tr.white td {
    background: #FFFFFF !important;
}

body.fi-body .legado-embed table#formulario tr.dest td {
    background: #F1D57E !important;
}

body.fi-body .legado-embed table#formulario tr.error td {
    background: #FFCCCC !important;
}

body.fi-body .legado-embed table#formulario tr.aviso_ok td,
body.fi-body .legado-embed table#listagem tr.aviso_ok td,
body.fi-body .legado-embed table#titulo tr.aviso_ok td {
    background: #28B62C !important;
    color: #FFF !important;
}

body.fi-body .legado-embed table#formulario tr.aviso_alerta td,
body.fi-body .legado-embed table#listagem tr.aviso_alerta td,
body.fi-body .legado-embed table#titulo tr.aviso_alerta td {
    background: #FF851B !important;
    color: #FFF !important;
}

body.fi-body .legado-embed table#formulario tr.aviso_erro td,
body.fi-body .legado-embed table#listagem tr.aviso_erro td,
body.fi-body .legado-embed table#titulo tr.aviso_erro td {
    background: #FF4136 !important;
    color: #FFF !important;
}

body.fi-body .legado-embed table#formulario tr.aviso_erro_suave td,
body.fi-body .legado-embed table#listagem tr.aviso_erro_suave td,
body.fi-body .legado-embed table#titulo tr.aviso_erro_suave td {
    background: #f6a4a0 !important;
    color: #FFF !important;
}

body.fi-body .legado-embed table#formulario tr.aviso_info td,
body.fi-body .legado-embed table#listagem tr.aviso_info td,
body.fi-body .legado-embed table#titulo tr.aviso_info td {
    background: #69b9ee !important;
    color: #FFF !important;
}

/*
 * Contador de chamados nao lidos (tarefas.lista.include.php usa .badge do
 * Bootstrap 3, que o embed nao carrega — so o style.css do webfactor).
 */
body.fi-body .legado-embed .badge {
    display: inline-block;
    min-width: 10px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    background-color: #d9534f;
    border-radius: 10px;
}

/*
 * Labels do Bootstrap 3 (tarefas.php usa .label label-default/primary/danger
 * nos destaques de usuario/participantes do historico do chamado — o embed
 * nao carrega o bootstrap.min.css que as definia no webfactor antigo).
 */
body.fi-body .legado-embed .label {
    display: inline;
    padding: 0.2em 0.6em 0.3em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25em;
}

body.fi-body .legado-embed .label:empty {
    display: none;
}

/*
 * As telas legadas ajustam o tamanho com .label-small/.label-x-small em
 * <style> proprio (especificidade menor que o escopo acima — reaplica aqui
 * para nao ficarem presas nos 75% da base).
 */
body.fi-body .legado-embed .label-small {
    font-size: small;
}

body.fi-body .legado-embed .label-x-small {
    font-size: x-small;
}

/*
 * Tela de chamados (tarefas/tarefas.php): o texto base da era 11px fica
 * pequeno demais ao lado das bolhas do historico. Sobe o texto das
 * tabelas (titulo, Remetente/Assunto/..., "Historico") para a escala dos
 * destaques. Bolhas (.label-chamados) e campos (.form03) tem tamanho proprio.
 *
 * Historico: webfont + geometricPrecision no Linux (FreeType) remove hinting
 * e o texto fica "borrado/tremido". Usa fonte do SO + subpixel.
 */
body.fi-body .legado-embed.legado-pg-tarefas-tarefas td {
    font-size: 13px;
}

body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-chamados,
body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-chamados * {
    font-family: Inter, "Segoe UI", system-ui, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: auto !important;
    text-shadow: none !important;
}

body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-chamados {
    font-size: 14px !important;
    font-weight: 400 !important;
    font-synthesis: none;
    color: #111 !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    transform: none !important;
}

body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-chamados b,
body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-chamados strong {
    font-weight: 600 !important;
}

body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-por,
body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label.label-small.label-por {
    font-family: Inter, "Segoe UI", system-ui, sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    font-style: normal !important;
    font-synthesis: none;
    letter-spacing: 0.01em !important;
    line-height: 1.35 !important;
    padding: 0.3em 0.65em !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: auto !important;
    text-shadow: none !important;
}

body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-por *,
body.fi-body .legado-embed.legado-pg-tarefas-tarefas .label-por i {
    font-style: normal !important;
    font-weight: inherit !important;
}

body.fi-body .legado-embed .label-default { background-color: #777; }
body.fi-body .legado-embed .label-primary { background-color: #337ab7; }
body.fi-body .legado-embed .label-success { background-color: #5cb85c; }
body.fi-body .legado-embed .label-info    { background-color: #5bc0de; }
body.fi-body .legado-embed .label-warning { background-color: #f0ad4e; }
body.fi-body .legado-embed .label-danger  { background-color: #d9534f; }

/*
 * Botoes Bootstrap 3 (reativacao.tela.php e outras telas com btn btn-primary/…).
 * O embed nao carrega bootstrap.min.css; o preflight do Tailwind zera
 * padding/margin/background dos <button>, e os rotulos colam numa faixa.
 */
body.fi-body .legado-embed .btn {
    display: inline-block !important;
    margin: 0 6px 6px 0 !important;
    padding: 6px 12px !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.42857143 !important;
    text-align: center !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
    cursor: pointer !important;
    user-select: none !important;
    border: 1px solid transparent !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
}

body.fi-body .legado-embed a.btn {
    color: inherit !important;
}

body.fi-body .legado-embed .btn-default {
    color: #333 !important;
    background-color: #fff !important;
    border-color: #ccc !important;
}

body.fi-body .legado-embed .btn-primary {
    color: #fff !important;
    background-color: #337ab7 !important;
    border-color: #2e6da4 !important;
}

body.fi-body .legado-embed .btn-success {
    color: #fff !important;
    background-color: #5cb85c !important;
    border-color: #4cae4c !important;
}

body.fi-body .legado-embed .btn-info {
    color: #fff !important;
    background-color: #5bc0de !important;
    border-color: #46b8da !important;
}

body.fi-body .legado-embed .btn-warning {
    color: #fff !important;
    background-color: #f0ad4e !important;
    border-color: #eea236 !important;
}

body.fi-body .legado-embed .btn-danger {
    color: #fff !important;
    background-color: #d9534f !important;
    border-color: #d43f3a !important;
}

body.fi-body .legado-embed .btn-primary:hover,
body.fi-body .legado-embed .btn-primary:focus {
    background-color: #286090 !important;
    border-color: #204d74 !important;
    color: #fff !important;
}

body.fi-body .legado-embed .btn-success:hover,
body.fi-body .legado-embed .btn-success:focus {
    background-color: #449d44 !important;
    border-color: #398439 !important;
    color: #fff !important;
}

body.fi-body .legado-embed .btn-info:hover,
body.fi-body .legado-embed .btn-info:focus {
    background-color: #31b0d5 !important;
    border-color: #269abc !important;
    color: #fff !important;
}

body.fi-body .legado-embed .btn-warning:hover,
body.fi-body .legado-embed .btn-warning:focus {
    background-color: #ec971f !important;
    border-color: #d58512 !important;
    color: #fff !important;
}

body.fi-body .legado-embed .btn-danger:hover,
body.fi-body .legado-embed .btn-danger:focus {
    background-color: #c9302c !important;
    border-color: #ac2925 !important;
    color: #fff !important;
}

body.fi-body .legado-embed .btn-default:hover,
body.fi-body .legado-embed .btn-default:focus {
    background-color: #e6e6e6 !important;
    border-color: #adadad !important;
    color: #333 !important;
}

/*
 * Blinkers do application_bottom (chamados urgentes, observador, mobile):
 * o urgente (#b_notify) agora vive no chrome ao lado do logo — esconde o legado.
 * Observador / mobile mantem ancora; no desktop o sino empilha com o urgente.
 */
body.fi-body .legado-embed #b_notify {
    display: none !important;
}

body.fi-body .legado-embed #b_notify_observador,
body.fi-body .legado-embed #c_notify {
    position: fixed !important;
    left: auto !important;
    top: 76px !important;
    z-index: 25 !important;
}

/* Sino do observador (mobile / popup): canto do conteudo. */
body.fi-body .legado-embed #b_notify_observador {
    right: 48px !important;
}

/*
 * Desktop: area do logo mais alta para caber urgente + sino empilhados.
 * Sem urgente → sino centralizado; com urgente → sino desce abaixo do badge.
 */
body.fi-body .painel-sidebar-logo-wrap {
    position: relative !important;
    height: 5.25rem !important; /* 84px */
    min-height: 5.25rem !important;
    padding: 0.35rem 0.5rem !important;
    box-sizing: border-box !important;
}

body.fi-body .legado-embed #c_notify {
    right: 96px !important;
}

/* Badge de chamado urgente — ao lado do logo (sidebar) / ao lado do hamburger (mobile). */
body.fi-body .painel-b-notify {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 1.25rem !important;
    height: 1.25rem !important;
    padding: 0 0.3rem !important;
    border-radius: 0.25rem !important;
    background: #dc2626 !important;
    color: #fff !important;
    font-family: Verdana, Geneva, sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.35) !important;
    animation: painel-b-notify-blink 1s steps(1, end) infinite !important;
    z-index: 42 !important;
}

body.fi-body .painel-b-notify[hidden] {
    display: none !important;
}

body.fi-body .painel-b-notify-count {
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    line-height: 1 !important;
}

body.fi-body .painel-b-notify--sidebar {
    position: absolute !important;
    top: 0.4rem !important;
    right: 0.55rem !important;
    transform: none !important;
}

body.fi-body .painel-b-notify--nav {
    display: none !important;
    flex-shrink: 0 !important;
}

@media (max-width: 1023px) {
    body.fi-body .painel-b-notify--sidebar {
        display: none !important;
    }

    body.fi-body .painel-b-notify--nav:not([hidden]) {
        display: inline-flex !important;
    }
}

@media (min-width: 1024px) {
    /*
     * Sino alinhado na mesma coluna da badge (right: 0.55rem na sidebar w-64).
     * filter deixa o GIF escuro branco sobre o fundo da sidebar.
     */
    body.fi-body .legado-embed #b_notify_observador {
        left: calc(16rem - 0.55rem - 32px) !important;
        right: auto !important;
        top: 1.625rem !important; /* centro quando sozinho */
        z-index: 41 !important;
        transition: top 0.2s ease !important;
    }

    body.fi-body .legado-embed #b_notify_observador img {
        filter: brightness(0) invert(1) !important;
        opacity: 0.95 !important;
    }

    /* Com chamado urgente visivel, o sino desce — mesma coluna horizontal. */
    body.fi-body:has(.painel-b-notify--sidebar:not([hidden])) .legado-embed #b_notify_observador {
        top: 2.85rem !important;
    }

    aside.painel-chrome.is-collapsed .painel-b-notify--sidebar {
        right: 0.2rem !important;
    }

    /* Sidebar recolhida (w-16): mesma coluna da badge. */
    body.fi-body:has(aside.painel-chrome.is-collapsed) .legado-embed #b_notify_observador {
        left: calc(4rem - 0.2rem - 32px) !important;
    }
}

@keyframes painel-b-notify-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ---- Top actions (busca / ícones) ---- */
body.fi-body header.painel-chrome .painel-top-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.625rem !important;
    min-height: 2.5rem;
    position: relative !important;
    /* Precisa ser >= .painel-topbar-start (5), senão o menu do usuário
     * fica atrás do miolo/breadcrumb quando transborda o header. */
    z-index: 10 !important;
}

body.fi-body header.painel-chrome .painel-top-actions > div,
body.fi-body header.painel-chrome .painel-top-actions > form,
body.fi-body header.painel-chrome .painel-top-actions > a {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

/* Desktop-only no topbar.
 * O reset display:flex acima anulava utilitários Tailwind (hidden/md:flex). */
@media (max-width: 1023px) {
    body.fi-body header.painel-chrome .painel-top-actions > .painel-top-desktop-only {
        display: none !important;
    }
}

/* Busca mobile: lupa ao lado do ☰ (mesmo padrão do badge urgente). */
body.fi-body .painel-busca-mobile-nav {
    display: none !important;
    position: relative !important;
    flex-shrink: 0 !important;
    align-items: center !important;
    z-index: 6 !important;
}

@media (max-width: 1023px) {
    body.fi-body .painel-busca-mobile-nav {
        display: inline-flex !important;
    }
}

body.fi-body .painel-busca-mobile-nav-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 2.25rem !important;
    min-height: 2.25rem !important;
    color: #4b5563 !important;
}

body.fi-body .painel-busca-mobile-nav-form {
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    align-items: center !important;
    gap: 0.25rem !important;
    margin: 0 !important;
    padding: 0.25rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.375rem !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12) !important;
    z-index: 20 !important;
}

body.fi-body .painel-busca-mobile-nav-form .painel-search-input,
body.fi-body .painel-busca-mobile-nav-form input.painel-search-input {
    width: min(58vw, 12rem) !important;
    min-width: 8rem !important;
}

body.fi-body .painel-busca-mobile-close {
    min-width: 2rem !important;
    min-height: 2rem !important;
    padding: 0.35rem !important;
}

body.fi-body header.painel-chrome .painel-icon-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.375rem !important;
    min-width: 2.25rem !important;
    min-height: 2.25rem !important;
    padding: 0.5rem 0.625rem !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0.375rem !important;
    background: transparent !important;
    color: #6b7280 !important;
    font-size: 0.875rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

body.fi-body header.painel-chrome .painel-icon-btn:hover {
    background: #f3f4f6 !important;
    color: #374151 !important;
}

body.fi-body header.painel-chrome .painel-icon-btn > i {
    display: inline-block !important;
    width: 1rem !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1rem !important;
    line-height: 1rem !important;
    text-align: center !important;
}

/* Telefone mantém a indicação verde/vermelha apesar da cor-base dos botões. */
body.fi-body header.painel-chrome .painel-icon-btn > i.text-emerald-600 {
    color: #059669 !important;
}

body.fi-body header.painel-chrome .painel-icon-btn > i.text-red-500 {
    color: #ef4444 !important;
}

body.fi-body header.painel-chrome .painel-user-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    min-height: 2.25rem !important;
    margin-left: 0.125rem !important;
    padding: 0.5rem 0.625rem !important;
    border-radius: 0.375rem !important;
}

body.fi-body header.painel-chrome .painel-user-trigger:hover {
    background: #f3f4f6 !important;
}

/* Input/select do header — o reset webfactor (input { padding:0; border:0; font-size:11px })
 * não era coberto pelo bloco genérico do header (só div/span/a/button). */
body.fi-body header.painel-chrome input,
body.fi-body header.painel-chrome select {
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    line-height: 1.25rem !important;
    margin: 0 !important;
    outline: none !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    background-color: #fff !important;
    color: #374151 !important;
    padding: 0.5rem 0.75rem !important;
    height: auto !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

body.fi-body header.painel-chrome .painel-search-input,
body.fi-body header.painel-chrome input.painel-search-input,
body.fi-body header.painel-chrome input#campo-busca {
    display: inline-block !important;
    vertical-align: middle !important;
    width: 10rem !important;
    min-width: 10rem !important;
    max-width: 14rem !important;
    height: 2.25rem !important;
    min-height: 2.25rem !important;
    padding: 0.375rem 0.75rem !important;
    margin: 0 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    background: #f9fafb !important;
    color: #374151 !important;
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    line-height: 1.25rem !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

@media (min-width: 1024px) {
    body.fi-body header.painel-chrome .painel-search-input,
    body.fi-body header.painel-chrome input.painel-search-input,
    body.fi-body header.painel-chrome input#campo-busca {
        width: 12rem !important;
        min-width: 12rem !important;
    }
}

@media (max-width: 767px) {
    body.fi-body header.painel-chrome .painel-top-actions {
        gap: 0.375rem !important;
    }

    body.fi-body header.painel-chrome .painel-icon-btn,
    body.fi-body header.painel-chrome .painel-user-trigger {
        min-width: 2rem !important;
        min-height: 2rem !important;
        padding: 0.4375rem !important;
    }
}

body.fi-body header.painel-chrome .painel-search-input:focus,
body.fi-body header.painel-chrome input.painel-search-input:focus,
body.fi-body header.painel-chrome input#campo-busca:focus {
    outline: 2px solid #93c5fd !important;
    outline-offset: 1px !important;
    border-color: #93c5fd !important;
    background: #fff !important;
}

body.fi-body header.painel-chrome .painel-select,
body.fi-body header.painel-chrome select.painel-select,
body.fi-body header.painel-chrome select#troca_sistema {
    display: block !important;
    width: 100% !important;
    min-height: 2.25rem !important;
    height: auto !important;
    padding: 0.5rem 0.75rem !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    background: #fff !important;
    color: #374151 !important;
    font-size: 0.8125rem !important;
    line-height: 1.25rem !important;
    box-sizing: border-box !important;
}

body.fi-body header.painel-chrome .painel-dropdown {
    margin: 0 !important;
    padding: 0 !important;
}

body.fi-body header.painel-chrome .painel-badge {
    font-size: 10px !important;
    line-height: 1.1rem !important;
    font-weight: 600 !important;
}

body.fi-body .painel-busca-mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(17, 24, 39, 0.45);
}

body.fi-body .painel-busca-mask.is-on {
    display: block;
}

/* Modal de tipo da busca rápida
 * Shell flex centra o painel sem transform — evita glitch com x-transition do Alpine.
 */
body.fi-body .painel-busca-modal-shell {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}

body.fi-body .painel-busca-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
}

body.fi-body .painel-busca-modal {
    position: relative;
    z-index: 1;
    width: min(36rem, calc(100vw - 1.5rem));
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

body.fi-body .painel-busca-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

body.fi-body .painel-busca-modal-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

body.fi-body .painel-busca-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

body.fi-body .painel-busca-modal-hint {
    margin: 0;
    font-size: 0.9375rem;
    color: #4b5563;
}

body.fi-body .painel-busca-tipo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

body.fi-body .painel-busca-tipo-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    background: #fff;
    text-align: center;
    line-height: 1.2;
}

body.fi-body .painel-busca-tipo-opt.is-active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

body.fi-body .painel-busca-modal-input {
    width: 100% !important;
    min-height: 2.75rem !important;
    padding: 0.65rem 0.85rem !important;
    border: 2px solid #2563eb !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #fff !important;
    font-size: 0.9375rem !important;
    line-height: 1.3 !important;
    box-sizing: border-box !important;
}

body.fi-body .painel-busca-modal-input:focus {
    border-color: #1d4ed8 !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28);
    outline: none;
}

body.fi-body header.painel-chrome button.painel-search-input {
    appearance: none;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
}

body.fi-body .painel-busca-modal-digitos {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: #6b7280;
}

body.fi-body .painel-busca-modal-digitos.is-incomplete {
    color: #dc2626;
}

body.fi-body .painel-busca-modal-actions {
    display: flex;
    justify-content: flex-end;
}

body.fi-body .painel-busca-modal-submit {
    appearance: none;
    border: 0;
    border-radius: 0.5rem;
    background: #2563eb;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    cursor: pointer;
}

body.fi-body .painel-busca-modal-submit:hover {
    background: #1d4ed8;
}

body.fi-body .painel-busca-modal-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: #2563eb;
}

body.fi-body .painel-busca-modal-avancada {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #6b7280;
}

body.fi-body .painel-busca-modal-escopo {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #dc2626;
    font-weight: 500;
}

body.fi-body .painel-busca-modal-avancada a {
    color: #2563eb;
    text-decoration: underline;
}

/*
 * Sticky footer do shell (Livewire + legado) SEM clip no miolo.
 *
 * Antes: height:100vh + overflow:hidden/auto no shell/main. Isso prende o
 * footer na base, mas no Chrome/Linux qualquer ancestral com overflow !=
 * visible faz o popup nativo do <select> abrir e fechar no mesmo clique
 * (bonusclub/mensalidade etc. ok no mini-app antigo; quebrava no embed Laravel).
 *
 * Agora: min-height:100vh + overflow:visible; o documento rola. Footer continua
 * no fim da coluna (mt-auto) quando o miolo é curto.
 */
body.fi-body {
    margin: 0 !important;
    min-height: 100vh !important;
    /* overflow no body também quebra o <select> nativo no Chrome — deixar visible. */
    overflow: visible !important;
}

body.fi-body .painel-shell {
    display: flex !important;
    height: auto !important;
    max-height: none !important;
    min-height: 100vh !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

body.fi-body .painel-shell-col {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    min-height: 100vh !important;
    height: auto !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

body.fi-body .painel-shell-main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* Sidebar acompanha o viewport enquanto a coluna de conteúdo rola. */
@media (min-width: 1024px) {
    body.fi-body aside.painel-chrome.painel-sidebar-dark {
        position: sticky !important;
        top: 0 !important;
        align-self: flex-start !important;
        height: 100vh !important;
        max-height: 100vh !important;
    }
}

/* ---- Footer ---- */
body.fi-body footer.painel-chrome,
body.fi-body footer.painel-chrome div,
body.fi-body footer.painel-chrome span,
body.fi-body footer.painel-chrome a,
body.fi-body footer.painel-chrome strong {
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 0.75rem !important;
    line-height: 1.25rem !important;
}

body.fi-body footer.painel-chrome {
    margin: 0 !important;
    margin-top: auto !important;
    padding: 0 !important;
    border-style: solid !important;
    border-color: #d1d5db !important;
    flex-shrink: 0 !important;
}

body.fi-body footer.painel-chrome .painel-footer-inner {
    padding: 0.5rem 0.75rem !important;
}

@media (min-width: 1024px) {
    body.fi-body footer.painel-chrome .painel-footer-inner {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

body.fi-body footer.painel-chrome .painel-footer-novos {
    color: #dc2626 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
}

body.fi-body footer.painel-chrome .painel-footer-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.2rem 0.85rem !important;
    border-radius: 9999px !important;
    background: #3b82f6 !important;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1.25rem !important;
    border: 0 !important;
}

body.fi-body footer.painel-chrome .painel-footer-btn:hover {
    background: #2563eb !important;
    color: #fff !important;
}

/* Sidebar recolhida (desktop): ícones + tooltip via title; libera ~192px no miolo. */
@media (min-width: 1024px) {
    aside.painel-chrome.is-collapsed .painel-sidebar-logo-full {
        display: none !important;
    }

    aside.painel-chrome.is-collapsed .painel-sidebar-logo-mini {
        display: block !important;
        width: 36px !important;
        height: auto !important;
        max-width: 36px !important;
    }

    aside.painel-chrome.is-collapsed .painel-sidebar-modulo,
    aside.painel-chrome.is-collapsed .painel-sidebar-search,
    aside.painel-chrome.is-collapsed .painel-sidebar-cp,
    aside.painel-chrome.is-collapsed .painel-menu-label,
    aside.painel-chrome.is-collapsed .painel-menu-chevron {
        display: none !important;
    }

    body.fi-body aside.painel-chrome.is-collapsed .painel-menu-children {
        margin-left: 0 !important;
        padding-left: 0 !important;
        border-left: 0 !important;
    }

    aside.painel-chrome.is-collapsed .painel-menu-item {
        justify-content: center !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    aside.painel-chrome.is-collapsed .painel-menu-item > div {
        justify-content: center !important;
        gap: 0 !important;
    }

    aside.painel-chrome.is-collapsed nav {
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }
}

/* --------------------------------------------------------------------------
 * Command palette (Ctrl/Cmd+K)
 * -------------------------------------------------------------------------- */
body.fi-body .painel-cp-root,
body.fi-body .painel-cp-root *:not(i):not([class*="fa-"]) {
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    box-sizing: border-box;
}

body.fi-body .painel-cp-root i,
body.fi-body .painel-cp-root [class*="fa-"] {
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    line-height: 1 !important;
    box-sizing: border-box;
}

body.fi-body .painel-cp-root .far,
body.fi-body .painel-cp-root .fal {
    font-weight: 400 !important;
}

body.fi-body .painel-cp-root .fab {
    font-family: "Font Awesome 5 Brands" !important;
    font-weight: 400 !important;
}

body.fi-body .painel-cp-panel {
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35) !important;
}

body.fi-body .painel-cp-input-wrap {
    border-bottom: 1px solid #e5e7eb !important;
    padding: 0 0.75rem !important;
}

body.fi-body .painel-cp-input {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
    padding: 0.9rem 0 !important;
    width: 100% !important;
    color: #111827 !important;
}

body.fi-body .painel-cp-item {
    border: 0 !important;
    background: transparent !important;
    width: 100% !important;
    cursor: pointer !important;
    border-radius: 0 !important;
}

body.fi-body .painel-cp-item.is-active,
body.fi-body .painel-cp-item:hover {
    background: #f1f5f9 !important;
}

body.fi-body .painel-cp-footer {
    border-top: 1px solid #f3f4f6 !important;
}

body.fi-body kbd.painel-cp-kbd {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 1.35rem !important;
    height: 1.25rem !important;
    margin: 0 0.1rem !important;
    padding: 0 0.35rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.25rem !important;
    background: #f9fafb !important;
    color: #6b7280 !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-transform: lowercase !important;
    box-shadow: none !important;
}

body.fi-body .painel-cp-trigger {
    border: 1px solid #e5e7eb !important;
    background: #f9fafb !important;
    gap: 0.4rem !important;
    padding: 0.35rem 0.6rem !important;
    height: auto !important;
}

/* Flash banner (pagina nao encontrada, etc.) */
body.fi-body .painel-flash-wrap {
    flex-shrink: 0;
}

body.fi-body .painel-flash {
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    margin: 0 0 0.5rem 0 !important;
    padding: 0.65rem 0.9rem !important;
    border-radius: 0.375rem !important;
    font-size: 0.875rem !important;
    line-height: 1.3 !important;
    box-sizing: border-box !important;
}

body.fi-body .painel-flash i {
    flex-shrink: 0;
}

body.fi-body .painel-flash-warning {
    background: #fff8e6 !important;
    border: 1px solid #f0d78c !important;
    color: #7a5b00 !important;
}

body.fi-body .painel-flash-error {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #991b1b !important;
}

body.fi-body .painel-flash-success {
    background: #ecfdf5 !important;
    border: 1px solid #a7f3d0 !important;
    color: #065f46 !important;
}

/* Alternância claro/escuro — fixa no rodapé do menu; o miolo é que rola. */
body.fi-body aside.painel-chrome:has(.painel-theme-bar) {
    overflow: hidden !important;
}

body.fi-body aside.painel-chrome:has(.painel-theme-bar) > nav {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.fi-body aside.painel-chrome .painel-theme-bar {
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    border-top: 1px solid #2b3035 !important;
    background: #2b3035 !important;
}

body.fi-body aside.painel-chrome .painel-theme-switch {
    display: flex !important;
    gap: 0.25rem !important;
    margin: 0 !important;
    padding: 0.2rem !important;
    border: 1px solid #495057 !important;
    border-radius: 0.5rem !important;
    background: #343a40 !important;
}

body.fi-body aside.painel-chrome .painel-theme-opt {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.4rem !important;
    flex: 1 1 0 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0.4rem 0.5rem !important;
    border: 0 !important;
    border-radius: 0.375rem !important;
    background: transparent !important;
    color: #ced4da !important;
    cursor: pointer !important;
    font-size: 0.8125rem !important;
    line-height: 1.15rem !important;
    text-align: center !important;
}

body.fi-body aside.painel-chrome .painel-theme-opt i {
    color: inherit !important;
    font-size: 0.8rem !important;
}

body.fi-body aside.painel-chrome .painel-theme-opt:hover {
    background: #3d444b !important;
    color: #fff !important;
}

html:not(.dark) body.fi-body aside.painel-chrome .painel-theme-opt[data-painel-theme="light"],
html.dark body.fi-body aside.painel-chrome .painel-theme-opt[data-painel-theme="dark"] {
    background: #495057 !important;
    color: #fff !important;
}

@media (min-width: 1024px) {
    aside.painel-chrome.is-collapsed .painel-theme-switch {
        flex-direction: column !important;
    }

    aside.painel-chrome.is-collapsed .painel-theme-bar {
        padding: 0.35rem !important;
    }
}

/* ---- Modo escuro (html.dark) ---- */
html.dark body.fi-body,
html.dark body.fi-body .painel-shell-main {
    background: #1a1d21 !important;
    color: #e5e7eb !important;
}

html.dark body.fi-body header.painel-chrome,
html.dark body.fi-body header.painel-chrome.border-b {
    background: #2b3035 !important;
    border-bottom-color: #3d444b !important;
}

html.dark body.fi-body header.painel-chrome .painel-sidebar-toggle,
html.dark body.fi-body header.painel-chrome .painel-icon-btn,
html.dark body.fi-body header.painel-chrome .painel-user-trigger,
html.dark body.fi-body .painel-busca-mobile-nav-btn {
    color: #e5e7eb !important;
}

html.dark body.fi-body header.painel-chrome .painel-icon-btn:hover,
html.dark body.fi-body header.painel-chrome .painel-user-trigger:hover {
    background: #3d444b !important;
    color: #fff !important;
}

html.dark body.fi-body header.painel-chrome .painel-icon-btn > i.text-emerald-600 {
    color: #34d399 !important;
}

html.dark body.fi-body header.painel-chrome .painel-icon-btn > i.text-red-500 {
    color: #f87171 !important;
}

html.dark body.fi-body header.painel-chrome .painel-breadcrumb,
html.dark body.fi-body header.painel-chrome .painel-breadcrumb b {
    color: #ced4da !important;
}

html.dark body.fi-body header.painel-chrome .painel-breadcrumb b {
    color: #f8f9fa !important;
}

html.dark body.fi-body header.painel-chrome input,
html.dark body.fi-body header.painel-chrome select,
html.dark body.fi-body header.painel-chrome .painel-search-input,
html.dark body.fi-body header.painel-chrome button.painel-search-input {
    background: #1a1d21 !important;
    color: #e5e7eb !important;
    border-color: #495057 !important;
}

html.dark body.fi-body header.painel-chrome .painel-dropdown,
html.dark body.fi-body header.painel-chrome .painel-user-menu {
    background: #2b3035 !important;
    border-color: #495057 !important;
    color: #e5e7eb !important;
}

html.dark body.fi-body header.painel-chrome .painel-dropdown a,
html.dark body.fi-body header.painel-chrome .painel-dropdown p,
html.dark body.fi-body header.painel-chrome .painel-user-menu-name,
html.dark body.fi-body header.painel-chrome .painel-user-menu-row-v {
    color: #e5e7eb !important;
}

html.dark body.fi-body header.painel-chrome .painel-dropdown a:hover {
    background: #3d444b !important;
    color: #fff !important;
}

html.dark body.fi-body header.painel-chrome .painel-user-menu-body,
html.dark body.fi-body header.painel-chrome .painel-user-menu-row {
    border-color: #3d444b !important;
}

html.dark body.fi-body header.painel-chrome .painel-user-menu-server,
html.dark body.fi-body header.painel-chrome .painel-user-menu-footer {
    background: #1a1d21 !important;
    border-color: #3d444b !important;
}

html.dark body.fi-body header.painel-chrome .painel-user-menu-footer a {
    color: #e5e7eb !important;
}

html.dark body.fi-body header.painel-chrome .painel-user-menu-footer a:hover {
    background: #3d444b !important;
    color: #fff !important;
}

html.dark body.fi-body header.painel-chrome .painel-user-menu-footer a.is-logout {
    color: #fca5a5 !important;
}

html.dark body.fi-body header.painel-chrome .painel-user-menu-footer a.is-logout:hover {
    background: #3f1d1d !important;
    color: #fecaca !important;
}

html.dark body.fi-body header.painel-chrome .painel-user-menu-row-k,
html.dark body.fi-body header.painel-chrome .painel-user-menu-label {
    color: #9ca3af !important;
}

html.dark body.fi-body footer.painel-chrome {
    background: #2b3035 !important;
    border-color: #3d444b !important;
    color: #ced4da !important;
}

html.dark body.fi-body footer.painel-chrome span,
html.dark body.fi-body footer.painel-chrome strong {
    color: #ced4da !important;
}

html.dark body.fi-body footer.painel-chrome strong {
    color: #f8f9fa !important;
}

html.dark body.fi-body .painel-busca-modal,
html.dark body.fi-body .painel-cp-panel {
    background: #2b3035 !important;
    border-color: #495057 !important;
    color: #e5e7eb !important;
}

html.dark body.fi-body .painel-busca-modal-header,
html.dark body.fi-body .painel-cp-input-wrap,
html.dark body.fi-body .painel-cp-footer {
    border-color: #3d444b !important;
}

html.dark body.fi-body .painel-busca-modal-header h2,
html.dark body.fi-body .painel-busca-modal-hint,
html.dark body.fi-body .painel-cp-input {
    color: #e5e7eb !important;
}

html.dark body.fi-body .painel-busca-tipo-opt,
html.dark body.fi-body .painel-busca-modal-input,
html.dark body.fi-body .painel-search-input {
    background: #1a1d21 !important;
    color: #e5e7eb !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .painel-busca-tipo-opt.is-active {
    background: #1e3a5f !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}

html.dark body.fi-body .painel-cp-item.is-active,
html.dark body.fi-body .painel-cp-item:hover {
    background: #3d444b !important;
}

html.dark body.fi-body .legado-embed {
    background: #1a1d21 !important;
    color: #e5e7eb !important;
}

html.dark body.fi-body .legado-embed :where(td, th, p, label, li, span, div, a, font, h1, h2, h3, h4):not(.btn):not(.label):not(.badge):not(.aviso):not(.label-chamados):not(.label-por) {
    color: #e5e7eb;
}

html.dark body.fi-body .legado-embed .aviso {
    color: #fca5a5 !important;
}

html.dark body.fi-body .legado-embed .label,
html.dark body.fi-body .legado-embed .badge,
html.dark body.fi-body .legado-embed .btn {
    color: #fff !important;
}

html.dark body.fi-body .legado-embed .label-chamados {
    background-color: #1e3a4c !important;
    color: #e5e7eb !important;
}

html.dark body.fi-body .legado-embed .label-chamados :where(p, div, span, b, strong, a, font):not(.label):not(.badge) {
    color: #e5e7eb !important;
}

html.dark body.fi-body .legado-embed tr.dest :where(td, span, div, a, font),
html.dark body.fi-body .legado-embed tr.error :where(td, span, div, a, font) {
    color: #1f2937 !important;
}

html.dark body.fi-body .legado-embed tr.aviso_ok :where(td, span, div, a, font),
html.dark body.fi-body .legado-embed tr.aviso_alerta :where(td, span, div, a, font),
html.dark body.fi-body .legado-embed tr.aviso_erro :where(td, span, div, a, font),
html.dark body.fi-body .legado-embed tr.aviso_erro_suave :where(td, span, div, a, font),
html.dark body.fi-body .legado-embed tr.aviso_info :where(td, span, div, a, font) {
    color: #fff !important;
}

html.dark body.fi-body .legado-embed .btn-default {
    color: #e5e7eb !important;
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .legado-embed .btn-default:hover,
html.dark body.fi-body .legado-embed .btn-default:focus {
    background-color: #3d444b !important;
    color: #fff !important;
}

html.dark body.fi-body .legado-embed table#formulario tr:not(.dest):not(.error):not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td,
html.dark body.fi-body .legado-embed table#listagem tr:not(.dest):not(.error):not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td {
    background: #2b3035 !important;
}

html.dark body.fi-body .legado-embed table#formulario tr.dif:not(.dest):not(.error):not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td,
html.dark body.fi-body .legado-embed table#listagem tr.dif:not(.dest):not(.error):not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td {
    background: #343a40 !important;
}

html.dark body.fi-body .legado-embed table#formulario tr.white td,
html.dark body.fi-body .legado-embed table#listagem tr.white td {
    background: #1a1d21 !important;
}

/* O diálogo jQuery UI move o conteúdo para fora de .legado-embed. */
html.dark body.fi-body .ui-dialog table#listagem tr:not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td,
html.dark body.fi-body .ui-dialog table#formulario tr:not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td {
    background: #2b3035 !important;
    color: #f8f9fa !important;
}

html.dark body.fi-body .ui-dialog table#listagem tr.dif:not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td,
html.dark body.fi-body .ui-dialog table#formulario tr.dif:not(.aviso_ok):not(.aviso_alerta):not(.aviso_erro):not(.aviso_erro_suave):not(.aviso_info) td {
    background: #343a40 !important;
    color: #f8f9fa !important;
}

html.dark body.fi-body .legado-embed table#titulo {
    background-color: transparent !important;
}

html.dark body.fi-body .legado-embed .tabela tr.item_branco td {
    background: #1a1d21 !important;
}

html.dark body.fi-body .legado-embed .tabela tr.item_cinza td {
    background: #2b3035 !important;
}

html.dark body.fi-body .legado-embed .tabela td a {
    color: #7dd3fc !important;
}

html.dark body.fi-body .legado-embed input.form01,
html.dark body.fi-body .legado-embed input.form02,
html.dark body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]),
html.dark body.fi-body .legado-embed select.form01,
html.dark body.fi-body .legado-embed select.form02,
html.dark body.fi-body .legado-embed select.form03,
html.dark body.fi-body .legado-embed textarea.form01,
html.dark body.fi-body .legado-embed textarea.form02,
html.dark body.fi-body .legado-embed textarea.form03,
html.dark body.fi-body .legado-embed .foco {
    background: #111417 !important;
    color: #93c5fd !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]):hover,
html.dark body.fi-body .legado-embed input.form03:not([type="checkbox"]):not([type="radio"]):focus,
html.dark body.fi-body .legado-embed .form01:hover,
html.dark body.fi-body .legado-embed .form01:focus,
html.dark body.fi-body .legado-embed .form03:hover,
html.dark body.fi-body .legado-embed .form03:focus {
    background: #1e3a4c !important;
}

html.dark body.fi-body .ui-dialog,
html.dark body.fi-body .ui-widget-content {
    background: #2b3035 !important;
    color: #e5e7eb !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .ui-widget-header {
    background: #343a40 !important;
    color: #f8f9fa !important;
    border-color: #495057 !important;
}

/* Paginação legada (simple.paginator.css) usa gradiente branco. */
html.dark body.fi-body .simple_paginator li a {
    color: #e5e7eb !important;
    background: #2b3035 !important;
    background-image: none !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .simple_paginator li a:hover {
    color: #fff !important;
    background: #f90 !important;
    border-color: #f70 !important;
}

html.dark body.fi-body .simple_paginator li.off a,
html.dark body.fi-body .simple_paginator li.off a:hover {
    color: #6b7280 !important;
    background: #1a1d21 !important;
    background-image: none !important;
    border-color: #3d444b !important;
}

html.dark body.fi-body .simple_paginator li.active {
    color: #fff !important;
    background: #f90 !important;
    border-color: #f70 !important;
}

/* Títulos das telas Laravel (h1 text-gray-800) somem no fundo escuro. */
html.dark body.fi-body .painel-shell-main h1 {
    color: #f8f9fa !important;
}

/* Overlib: o div nasce com fundo branco e o texto herda o cinza claro do shell. */
html.dark body.fi-body #overDiv {
    background: #2b3035 !important;
    color: #f8f9fa !important;
    border: 1px solid #495057;
}

html.dark body.fi-body #overDiv table,
html.dark body.fi-body #overDiv td {
    background: #2b3035 !important;
    color: #f8f9fa !important;
}

html.dark body.fi-body #overDiv font,
html.dark body.fi-body #overDiv div,
html.dark body.fi-body #overDiv span,
html.dark body.fi-body #overDiv b {
    color: #f8f9fa !important;
}

/* Calendário jQuery UI: os dias usam o vidro azul claro do tema. */
html.dark body.fi-body .ui-datepicker {
    background: #2b3035 !important;
    color: #e5e7eb !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .ui-datepicker .ui-datepicker-header,
html.dark body.fi-body .ui-datepicker .ui-widget-header {
    background: #343a40 !important;
    color: #f8f9fa !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .ui-datepicker select {
    background: #111417 !important;
    color: #e5e7eb !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .ui-datepicker .ui-state-default {
    background: #1a1d21 !important;
    background-image: none !important;
    color: #e5e7eb !important;
    border-color: #3d444b !important;
}

html.dark body.fi-body .ui-datepicker .ui-state-hover,
html.dark body.fi-body .ui-datepicker .ui-state-focus {
    background: #343a40 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #6b7280 !important;
}

html.dark body.fi-body .ui-datepicker .ui-state-active {
    background: #1d4e89 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

html.dark body.fi-body .ui-datepicker .ui-state-highlight {
    background: #f90 !important;
    background-image: none !important;
    color: #111 !important;
    border-color: #f70 !important;
}

html.dark body.fi-body .ui-datepicker .ui-priority-secondary,
html.dark body.fi-body .ui-datepicker .ui-state-disabled {
    color: #6b7280 !important;
}

/* Botões jQuery UI (mesmo tema azul claro do calendário). */
html.dark body.fi-body .ui-button {
    background: #1d4e89 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

html.dark body.fi-body .ui-button:hover,
html.dark body.fi-body .ui-button.ui-state-hover,
html.dark body.fi-body .ui-button:focus {
    background: #2563eb !important;
    background-image: none !important;
    color: #fff !important;
}

/* Cabeçalho de listagem legada (tr.colunas) fica #F0F0F0 com texto claro. */
html.dark body.fi-body .legado-embed table tr.colunas td {
    background: #343a40 !important;
    color: #f8f9fa !important;
    border-color: #495057 !important;
}

/* Células com bgcolor de status: o texto claro do shell some no amarelo/verde/vermelho. */
html.dark body.fi-body .legado-embed td[bgcolor]:not([bgcolor="#FFFFFF"]):not([bgcolor="#ffffff"]):not([bgcolor="#FFF"]):not([bgcolor="#fff"]),
html.dark body.fi-body .legado-embed td[bgcolor]:not([bgcolor="#FFFFFF"]):not([bgcolor="#ffffff"]):not([bgcolor="#FFF"]):not([bgcolor="#fff"]) a {
    color: #111827 !important;
}

html.dark body.fi-body .legado-embed td[bgcolor="#FFFFFF"],
html.dark body.fi-body .legado-embed td[bgcolor="#ffffff"],
html.dark body.fi-body .legado-embed td[bgcolor="#FFF"],
html.dark body.fi-body .legado-embed td[bgcolor="#fff"] {
    background-color: #1a1d21 !important;
    color: #e5e7eb !important;
}

html.dark body.fi-body .legado-embed td[bgcolor="#FFFFFF"] a,
html.dark body.fi-body .legado-embed td[bgcolor="#ffffff"] a,
html.dark body.fi-body .legado-embed td[bgcolor="#FFF"] a,
html.dark body.fi-body .legado-embed td[bgcolor="#fff"] a {
    color: #7dd3fc !important;
}

html.dark body.fi-body .painel-shell-main :is(.bg-white, .fi-modal, .fi-modal-window, [role="dialog"]) h1 {
    color: #111827 !important;
}

/* Select2 (destinatários e outros combos múltiplos). O dropdown é anexado ao body. */
html.dark body.fi-body .select2-container--default .select2-selection--single,
html.dark body.fi-body .select2-container--default .select2-selection--multiple {
    background: #111417 !important;
    color: #e5e7eb !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .select2-container--default .select2-selection--single .select2-selection__rendered,
html.dark body.fi-body .select2-container--default .select2-selection--multiple .select2-selection__rendered,
html.dark body.fi-body .select2-container--default .select2-search--inline .select2-search__field {
    color: #e5e7eb !important;
    background: transparent !important;
}

html.dark body.fi-body .select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: #9ca3af !important;
}

html.dark body.fi-body .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: #2b3035 !important;
    border-color: #495057 !important;
    color: #f8f9fa !important;
}

html.dark body.fi-body .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #9ca3af !important;
}

html.dark body.fi-body .select2-dropdown,
html.dark body.fi-body .select2-results {
    background: #1a1d21 !important;
    color: #e5e7eb !important;
    border-color: #495057 !important;
}

html.dark body.fi-body .select2-container--default .select2-results__option {
    background: transparent !important;
    color: #e5e7eb !important;
}

html.dark body.fi-body .select2-container--default .select2-results__option[aria-selected="true"] {
    background: #343a40 !important;
    color: #fff !important;
}

html.dark body.fi-body .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: #1d4e89 !important;
    color: #fff !important;
}

html.dark body.fi-body .select2-search--dropdown .select2-search__field {
    background: #111417 !important;
    color: #e5e7eb !important;
    border: 1px solid #495057 !important;
}


/* ---- Print: listagens legadas embutidas no shell ----
 * Na impressão expandimos o fluxo para o browser paginar o conteúdo completo
 * (navbar/sidebar/footer do chrome ficam ocultos abaixo).
 */
@media print {
    html,
    body.fi-body {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    body.fi-body .painel-shell,
    body.fi-body .painel-shell-col,
    body.fi-body .painel-shell-main {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        position: static !important;
        flex: none !important;
    }

    body.fi-body .legado-embed,
    body.fi-body .painel-shell-main > * {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    html.dark,
    html.dark body.fi-body,
    html.dark body.fi-body .painel-shell-main,
    html.dark body.fi-body .legado-embed {
        background: #fff !important;
        color: #000 !important;
    }

    html.dark body.fi-body .legado-embed :where(td, th, p, label, li, span, div, a, font, h1, h2, h3, h4) {
        color: #000 !important;
    }

    html.dark body.fi-body .legado-embed table#formulario td,
    html.dark body.fi-body .legado-embed table#listagem td {
        background: #f0f0f0 !important;
        color: #000 !important;
    }

    html.dark body.fi-body .legado-embed input.form03,
    html.dark body.fi-body .legado-embed select.form03,
    html.dark body.fi-body .legado-embed textarea.form03,
    html.dark body.fi-body .select2-container--default .select2-selection--single,
    html.dark body.fi-body .select2-container--default .select2-selection--multiple,
    html.dark body.fi-body .select2-dropdown {
        background: #fff !important;
        color: #000 !important;
        border-color: #ccc !important;
    }

    /* Chrome do painel não entra na impressão da listagem */
    body.fi-body aside.painel-chrome,
    body.fi-body header.painel-chrome,
    body.fi-body footer.painel-chrome,
    body.fi-body .painel-busca-mask,
    body.fi-body .fixed.inset-0,
    body.fi-body [x-cloak],
    #command-palette,
    .painel-dropdown {
        display: none !important;
    }
}
