﻿/* -----------------------------------------------------------
   BASE DO TEMPLATE
------------------------------------------------------------ */

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
    overflow-x: hidden;
}

/* Página pública (login) */
.public-page {
    min-height: 100vh;
    display: flex;
}

.public-container {
    margin: auto;
    max-width: 400px;
    padding: 2rem;
}

/* -----------------------------------------------------------
   LAYOUT GERAL
------------------------------------------------------------ */

.layout-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    flex: 0 0 auto;
}

.app-body {
    display: flex;
    flex: 1 1 auto; /* <-- adicionar */
    min-height: 0;
}

/* -----------------------------------------------------------
   SIDEBAR – SEMPRE ESCURO (mesmo no tema claro)
------------------------------------------------------------ */

#sidebar {
    background: #161a1d;
    border-right: 1px solid #2b2f33;
    width: 240px; /* largura normal */
    transition: width .25s ease-in-out;
    overflow: hidden;
}

    #sidebar .sidebar-content {
        width: 240px;
        padding: .5rem .75rem;
        height: 100%;
    }

/* Links de segundo nível */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: .40rem .75rem;
    color: #e4e4e4;
    font-size: .92rem;
    border-radius: .25rem;
    transition: background-color .15s ease, transform .1s ease;
}

    .sidebar-link:hover {
        background: #22272b;
        transform: translateX(1px);
    }
    /* Ícone dentro dos links filhos */
    .sidebar-link i {
        width: 1.3rem;
        margin-right: .4rem;
        font-size: 1rem;
        color: inherit;
    }

/* Botão principal do acordeon (título de módulo) */
.sidebar-accordion-button {
    padding: .55rem .75rem;
    color: #e4e4e4;
    background: transparent;
    font-size: .92rem;
    box-shadow: none;
    transition: background-color .15s ease;
}

    .sidebar-accordion-button:not(.collapsed) {
        background: #1f2428;
    }

    .sidebar-accordion-button:focus {
        box-shadow: none;
    }

    .sidebar-accordion-button::after {
        transform: scale(.8);
        filter: invert(1) brightness(1.2);
        opacity: .85;
    }

/* Ícone de módulo */
.sidebar-icon {
    font-size: 1.25rem;
}

/* -----------------------------------------------------------
   SIDEBAR – COLAPSADO (apenas ícones de primeiro nível)
------------------------------------------------------------ */

#sidebar.collapsed {
    width: 60px !important; /* apenas faixa de ícones */
}

    #sidebar.collapsed .sidebar-content {
        width: 60px !important;
        padding: .5rem .25rem;
    }

    /* Esconde labels de texto e seta do accordion */
    #sidebar.collapsed .nav-label,
    #sidebar.collapsed .accordion-button::after,
    #sidebar.collapsed .sidebar-title {
        display: none !important;
    }

    /* Esconde completamente os submenus no modo colapsado */
    #sidebar.collapsed .accordion-collapse,
    #sidebar.collapsed .accordion-body {
        display: none !important;
    }

    /* Mantém os headers (ícones) visíveis */
    #sidebar.collapsed .accordion-item > .accordion-header {
        display: block !important;
    }

    /* Ajusta links no modo colapsado (centraliza ícones) */
    #sidebar.collapsed .sidebar-link {
        justify-content: center;
        padding: .65rem 0;
    }

        #sidebar.collapsed .sidebar-link i {
            margin: 0;
        }

    /* Botão principal do accordion no modo colapsado (só ícone) */
    #sidebar.collapsed .sidebar-accordion-button {
        justify-content: center;
        padding: .65rem 0;
    }

        #sidebar.collapsed .sidebar-accordion-button i {
            margin: 0;
        }

        /* leve hover mesmo colapsado */
        #sidebar.collapsed .sidebar-accordion-button:hover {
            background-color: #22272b;
        }

/* ===== Sidebar group title (seu menu atual) ===== */
#sidebar .sidebar-group-title {
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

    #sidebar .sidebar-group-title:hover {
        background: #22272b;
    }

/* ===== Colapsado: esconder filhos e centralizar ícone do grupo ===== */
#sidebar.collapsed .sidebar-children {
    display: none !important;
}

#sidebar.collapsed .sidebar-group-title {
    justify-content: center;
    padding: .65rem 0;
}

    #sidebar.collapsed .sidebar-group-title .sidebar-icon {
        margin: 0;
    }

/* -----------------------------------------------------------
   CONTEÚDO PRINCIPAL
------------------------------------------------------------ */

.main-content {
    flex: 1 1 auto;
    min-width: 0; /* <-- evita overflow horizontal em tabelas largas */
}

.breadcrumb {
    background: transparent;
    padding-left: 0;
}

/* -----------------------------------------------------------
   AVATAR DO USUÁRIO
------------------------------------------------------------ */

.user-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: .85rem;
    font-weight: bold;
}

/* Avatar na lista de usuários */
.user-avatar-circle-list {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Grupo de ações na tabela de usuários */
.table-action-group {
    display: inline-flex; /* garante linha contínua */
}

    /* Remove margens dos wrappers (a, form) */
    .table-action-group > a,
    .table-action-group > form {
        margin: 0;
    }

    /* Botões dentro do grupo: tamanho mais compacto e sem raio por padrão */
    .table-action-group .btn {
        padding: .35rem .55rem;
        min-width: auto;
        border-radius: 0; /* zera tudo, depois ajusto primeiro/último */
    }

    /* Primeiro botão do grupo (pode ser <a> ou <form><button>) */
    .table-action-group > a.btn:first-child,
    .table-action-group > form:first-child .btn {
        border-top-left-radius: .25rem;
        border-bottom-left-radius: .25rem;
    }

    /* Último botão do grupo (pode ser <a> ou <form><button>) */
    .table-action-group > a.btn:last-child,
    .table-action-group > form:last-child .btn {
        border-top-right-radius: .25rem;
        border-bottom-right-radius: .25rem;
    }

    /* Evita “vão” entre os botões */
    .table-action-group .btn + .btn {
        margin-left: -1px; /* junta as bordas */
    }

/* -----------------------------------------------------------
   RODAPÉ
------------------------------------------------------------ */

.footer {
    font-size: .85rem;
}

/* -----------------------------------------------------------
   TEMA ESCURO
------------------------------------------------------------ */

body.theme-dark {
    background: #121212;
    color: #e4e4e4;
}

    /* Topo */
    body.theme-dark .navbar {
        background: #1f1f1f !important;
    }

    /* Sidebar (mantém escuro e só ajusta levemente) */
    body.theme-dark #sidebar {
        background: #141414;
        border-right-color: #333;
    }

        body.theme-dark #sidebar .sidebar-link,
        body.theme-dark #sidebar .sidebar-group-title,
        body.theme-dark #sidebar .sidebar-accordion-button {
            color: #e4e4e4;
        }

            body.theme-dark #sidebar .sidebar-link:hover,
            body.theme-dark #sidebar .sidebar-group-title:hover,
            body.theme-dark #sidebar .sidebar-accordion-button:hover {
                background: #2a2a2a;
            }

            body.theme-dark #sidebar .sidebar-accordion-button:not(.collapsed) {
                background: #2a2a2a;
            }

        /* Colapsado: manter hover coerente */
        body.theme-dark #sidebar.collapsed .sidebar-accordion-button:hover,
        body.theme-dark #sidebar.collapsed .sidebar-group-title:hover {
            background: #2a2a2a;
        }

    /* Rodapé */
    body.theme-dark .footer {
        background: #1f1f1f;
        border-top-color: #333;
        color: #ccc;
    }

    /* Links */
    body.theme-dark a {
        color: #66b2ff;
    }

        body.theme-dark a:hover {
            color: #99ccff;
        }

    /* Cards / containers */
    body.theme-dark .card,
    body.theme-dark .modal-content,
    body.theme-dark .dropdown-menu {
        background: #1b1b1b;
        color: #e4e4e4;
        border-color: #333;
    }

    /* Tabelas (corrige Index/Lists no dark) */
    body.theme-dark .table {
        --bs-table-color: #e4e4e4;
        --bs-table-bg: #1b1b1b;
        --bs-table-border-color: #333;
        --bs-table-striped-bg: rgba(255,255,255,.03);
        --bs-table-hover-bg: rgba(255,255,255,.06);
    }

        /* garante cor de célula mesmo com utilitários do Bootstrap */
        body.theme-dark .table > :not(caption) > * > * {
            color: #e4e4e4;
        }

    /* <thead class="table-light"> no dark precisa virar escuro */
    body.theme-dark .table-light {
        --bs-table-color: #cfcfcf;
        --bs-table-bg: #202020;
        --bs-table-border-color: #333;
    }

    /* Bootstrap text utilities no Dark (evita “texto apagado”) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Inputs */
    body.theme-dark .form-control,
    body.theme-dark .form-select,
    body.theme-dark .input-group-text {
        background: #1b1b1b;
        color: #e4e4e4;
        border-color: #444;
    }

        body.theme-dark .form-control::placeholder {
            color: #9aa0a6;
        }

    /* Bootstrap text utilities no Dark (evita texto apagado) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Tabela: garante contraste mesmo com classes utilitárias */
    body.theme-dark .table > :not(caption) > * > * {
        color: inherit;
    }

    /* Bootstrap text utilities no Dark (evita texto apagado) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Tabela: garante contraste mesmo com classes utilitarias */
    body.theme-dark .table > :not(caption) > * > * {
        color: inherit;
    }

    /* Bootstrap text utilities no Dark (evita texto apagado) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Tabela: garante contraste mesmo com classes utilitarias */
    body.theme-dark .table > :not(caption) > * > * {
        color: inherit;
    }

    /* Bootstrap text utilities no Dark (evita texto apagado) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Tabela: garante contraste mesmo com classes utilitarias */
    body.theme-dark .table > :not(caption) > * > * {
        color: inherit;
    }

    /* Bootstrap text utilities no Dark (evita texto apagado) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Tabela: garante contraste mesmo com classes utilitarias */
    body.theme-dark .table > :not(caption) > * > * {
        color: inherit;
    }

    /* Bootstrap text utilities no Dark (evita texto apagado) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Tabela: garante contraste mesmo com classes utilitarias */
    body.theme-dark .table > :not(caption) > * > * {
        color: inherit;
    }

    /* Bootstrap text utilities no Dark (evita texto apagado) */
    body.theme-dark .text-dark,
    body.theme-dark .text-body,
    body.theme-dark .text-body-emphasis {
        color: #e4e4e4 !important;
    }

    body.theme-dark .text-muted,
    body.theme-dark .text-secondary,
    body.theme-dark .text-body-secondary {
        color: #b8b8b8 !important;
    }

    /* Tabela: garante contraste mesmo com classes utilitarias */
    body.theme-dark .table > :not(caption) > * > * {
        color: inherit;
    }

    /* Flyout flutuante no dark */
    body.theme-dark .sidebar-flyout {
        background: #1b1b1b;
        color: #e4e4e4;
        border-color: rgba(255,255,255,.10);
        box-shadow: 0 12px 28px rgba(0,0,0,.55);
    }

        body.theme-dark .sidebar-flyout .flyout-title {
            border-bottom-color: rgba(255,255,255,.10);
        }

        body.theme-dark .sidebar-flyout .nav-link:hover {
            background: #242424;
        }

/* ===========================
   TOASTS FLUTUANTES (EFC STYLE)
   =========================== */

.toast {
    border-radius: 0.5rem;
    box-shadow: 0 0.75rem 1.5rem rgba(0,0,0,0.25);
    color: #fff;
    opacity: 0;
    animation: slideInRight 0.4s ease-out forwards, fadeOut 0.4s ease-in 4.6s forwards;
    backdrop-filter: blur(4px);
}

.toast-success {
    background-color: #28a745;
}

.toast-error {
    background-color: #dc3545;
}

.toast-warning {
    background-color: #ffc107;
    color: #212529;
}

.toast-info {
    background-color: #17a2b8;
}

.toast .d-flex {
    align-items: center;
    padding: 0.25rem 0.5rem;
}

.toast-icon {
    font-size: 1.7rem;
    margin-left: 0.75rem;
    margin-right: 0.75rem;
}

/* Animações */
@keyframes slideInRight {
    from {
        transform: translateX(100%) translateY(-50%);
        opacity: 0;
    }

    to {
        transform: translateX(0) translateY(-50%);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%) translateY(-50%);
    }
}

/* Tema escuro: ajustar contraste dos toasts */
body.theme-dark .toast {
    box-shadow: 0 0.75rem 1.5rem rgba(0,0,0,0.6);
}

/* Ajusta alinhamento dos botões */
table .btn {
    padding: .25rem .4rem;
}

/* Hover mais moderno */
.btn-outline-primary:hover {
    background-color: #0d6efd;
    color: white;
}

.btn-outline-warning:hover {
    background-color: #ffc107;
    color: black;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    color: white;
}

.table-hover tbody tr[class^="os-row-"] {
    border-left: 4px solid transparent;
}

/*=== Cores das Etapas ==========================================*/
/* =========================================================
   OS - CORES DAS LINHAS POR ETAPA (Index)
   - A cor precisa ser aplicada nos TD/TH (Bootstrap pinta célula)
   - Usa variáveis por linha: --os-row-bg / --os-row-bg-hover / --os-row-border
   ========================================================= */

/* pinta células da linha (não só o TR) */
.table tbody tr[class^="os-row-"] > th,
.table tbody tr[class^="os-row-"] > td {
    background-color: var(--os-row-bg, transparent) !important;
}

/* hover mantendo a cor */
.table-hover tbody tr[class^="os-row-"]:hover > th,
.table-hover tbody tr[class^="os-row-"]:hover > td {
    background-color: var(--os-row-bg-hover, var(--os-row-bg, transparent)) !important;
}

/* faixa lateral esquerda (na 1ª célula) */
.table tbody tr[class^="os-row-"] > th:first-child,
.table tbody tr[class^="os-row-"] > td:first-child {
    box-shadow: inset 4px 0 0 var(--os-row-border, transparent);
}

/* ====== ETAPAS (novas cores) ====== */
/* 1 - Previsto (#ffffff) */
.os-row-previsto {
    --os-row-bg: rgb(255 255 255 / .12);
    --os-row-bg-hover: rgb(255 255 255 / .20);
    --os-row-border: #ffffff;
}

/* 2 - Recebido (#FFA495) */
.os-row-recebido {
    --os-row-bg: rgb(255 164 149 / .14);
    --os-row-bg-hover: rgb(255 164 149 / .22);
    --os-row-border: #FFA495;
}

/* 3 - Em Análise (#cd6464) */
.os-row-em-analise {
    --os-row-bg: rgb(205 100 100 / .18);
    --os-row-bg-hover: rgb(205 100 100 / .26);
    --os-row-border: #cd6464;
}

/* 4 - Analisado (#FF7F27) */
.os-row-analisado {
    --os-row-bg: rgb(255 127 39 / .14);
    --os-row-bg-hover: rgb(255 127 39 / .22);
    --os-row-border: #FF7F27;
}

/* 5 - Revisado (#FF402D) */
.os-row-revisado {
    --os-row-bg: rgb(255 64 45 / .12);
    --os-row-bg-hover: rgb(255 64 45 / .20);
    --os-row-border: #FF402D;
}

/* 6 - Aguardando Aprovação (#ffffff) */
.os-row-aguardando-aprovacao {
    --os-row-bg: rgb(255 255 255 / .20);
    --os-row-bg-hover: rgb(255 255 255 / .30);
    --os-row-border: #ffffff;
}

/* 7 - Arquivo morto (#ffffff) */
.os-row-arquivo-morto {
    --os-row-bg: rgb(255 255 255 / .14);
    --os-row-bg-hover: rgb(255 255 255 / .22);
    --os-row-border: #ffffff;
}

/* 8 - Pré-aprovado (#79FFC7) */
.os-row-pre-aprovado {
    --os-row-bg: rgb(121 255 199 / .16);
    --os-row-bg-hover: rgb(121 255 199 / .26);
    --os-row-border: #79FFC7;
}

/* 9 - Aguardando comercial (#F08650) */
.os-row-aguardando-comercial {
    --os-row-bg: rgb(240 134 80 / .16);
    --os-row-bg-hover: rgb(240 134 80 / .26);
    --os-row-border: #F08650;
}

/* 10 - Aprovado (#66ffff) */
.os-row-aprovado {
    --os-row-bg: rgb(102 255 255 / .18);
    --os-row-bg-hover: rgb(102 255 255 / .26);
    --os-row-border: #66ffff;
}

/* 11 - Aprovado aguardar faturamento (#65C6FF) */
.os-row-aprovado-faturamento {
    --os-row-bg: rgb(101 198 255 / .14);
    --os-row-bg-hover: rgb(101 198 255 / .22);
    --os-row-border: #65C6FF;
}

/* 12 - Aprovado aguardando Importação (#65C6FF) */
.os-row-aprovado-importacao {
    --os-row-bg: rgb(101 198 255 / .14);
    --os-row-bg-hover: rgb(101 198 255 / .22);
    --os-row-border: #65C6FF;
}

/* 13 - Reprovado (#949494) */
.os-row-reprovado {
    --os-row-bg: rgb(148 148 148 / .18);
    --os-row-bg-hover: rgb(148 148 148 / .26);
    --os-row-border: #949494;
}

/* 14 - Sem Custo (#949494) */
.os-row-sem-custo {
    --os-row-bg: rgb(148 148 148 / .12);
    --os-row-bg-hover: rgb(148 148 148 / .20);
    --os-row-border: #949494;
}

/* 15 - Expedição (#ffff00) */
.os-row-expedicao {
    --os-row-bg: rgb(255 255 0 / .16);
    --os-row-bg-hover: rgb(255 255 0 / .24);
    --os-row-border: #ffff00;
}

/* 16 - Despacho (#66ff33) */
.os-row-despacho {
    --os-row-bg: rgb(102 255 51 / .20);
    --os-row-bg-hover: rgb(102 255 51 / .30);
    --os-row-border: #66ff33;
}

/* 17 - Standby (#EE8AF8) */
.os-row-standby {
    --os-row-bg: rgb(238 138 248 / .16);
    --os-row-bg-hover: rgb(238 138 248 / .24);
    --os-row-border: #EE8AF8;
}

/* 18 - Concluído (#ffffff) */
.os-row-concluido {
    --os-row-bg: rgb(255 255 255 / .12);
    --os-row-bg-hover: rgb(255 255 255 / .20);
    --os-row-border: #ffffff;
}

/* -----------------------------------------------------------
   OS ROWS - FUNDO VIBRANTE (igual à alça)
   (colar DEPOIS das definições .os-row-*)
------------------------------------------------------------ */

/* fundo = cor da alça */
.table tbody tr[class^="os-row-"] {
    --os-row-bg: var(--os-row-border);
    --os-row-bg-hover: var(--os-row-border);
    /* texto padrão (para cores claras) */
    --os-row-fg: #111;
    /* mantém uma "alça" perceptível (mesma cor, mais escura) */
    --os-row-edge: color-mix(in srgb, var(--os-row-border) 70%, #000);
}

    /* aplica a cor do texto na linha */
    .table tbody tr[class^="os-row-"] > th,
    .table tbody tr[class^="os-row-"] > td {
        color: var(--os-row-fg) !important;
    }

        /* alça (mais forte que o fundo) */
        .table tbody tr[class^="os-row-"] > th:first-child,
        .table tbody tr[class^="os-row-"] > td:first-child {
            box-shadow: inset 4px 0 0 var(--os-row-edge, var(--os-row-border, transparent));
        }


.os-img-card .card {
    transition: transform .08s ease, box-shadow .08s ease;
}

    .os-img-card .card:hover {
        transform: translateY(-2px);
    }

/* Cards das listas */
.os-card {
    border: 1px solid #e9ecef;
    border-radius: .75rem;
    overflow: hidden;
}

    .os-card .card-header {
        padding: .6rem .85rem;
        border-bottom: 1px solid #e9ecef;
    }

    .os-card .card-title {
        font-size: .9rem;
        font-weight: 600;
        margin: 0;
    }

    .os-card .card-body {
        padding: .85rem;
    }

    /* Melhor leitura de tabela dentro do card */
    .os-card .table {
        margin-bottom: 0;
    }

    /* Cards das listas - cores por tema */
    .os-card .card-header,
    .os-card .card-body,
    .os-card .card-header.os-head {
        background: #fff;
        color: #212529;
        border-color: #e9ecef;
    }

    .os-card .table thead th {
        background: #f8f9fa; /* CLARO no tema claro */
        color: #212529;
        border-bottom: 1px solid #dee2e6;
    }

/* Tema escuro: listas com contraste correto */
body.theme-dark .os-card .card-header,
body.theme-dark .os-card .card-body,
body.theme-dark .os-card .card-header.os-head {
    background: #1b1b1b;
    color: #e4e4e4;
    border-color: #333;
}

body.theme-dark .os-card .os-head-sub {
    color: #b8b8b8;
}

body.theme-dark .os-card .table thead th {
    background: #161a1d; /* ESCURO no tema escuro */
    color: #f8f9fa;
    border-bottom-color: rgba(255,255,255,.12);
}


/* Ajuste fino do checkbox do Endereçamento */
.os-inline-check {
    display: flex;
    align-items: center;
    gap: .5rem;
}

    .os-inline-check .form-check {
        margin: 0;
    }

    .os-inline-check label {
        margin: 0;
    }

/* Espaçamento entre cards */
.os-stack {
    display: grid;
    gap: 1rem;
}

/* Header mais “forte” como a galeria */
.os-card .card-header.os-head {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: .65rem .85rem;
}

.os-card .os-head-left {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.os-card .os-head-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e9ecef;
    border-radius: .5rem;
    background: #f1f3f5;
    color: #212529;
}

/* Tema escuro */
body.theme-dark .os-card .os-head-icon {
    background: #161a1d; /* escuro no tema escuro */
    border-color: rgba(255,255,255,.15);
    color: #f8f9fa;
}

.os-card .os-head-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
}

.os-card .os-head-sub {
    font-size: .8rem;
    color: #6c757d;
    margin: 0;
}

/* barrinha de destaque no topo do card */
.os-card.os-accent::before {
    content: "";
    display: block;
    height: 3px;
    background: #0d6efd; /* usa a cor primary do Bootstrap */
}

/* Cards destacados (checklists/endereços/acessórios/componentes/peças/comprovantes/imagens) */
.os-cyan-card.card {
    border-color: rgba(0,0,0,.08);
}

    .os-cyan-card.card > .card-header,
    .os-cyan-card.card > .card-header.os-head,
    .os-cyan-card.card > .card-body {
        background: #67D9FD;
        color: #0b1f27;
        border-color: rgba(0,0,0,.08);
    }

/* Mantém contraste no tema escuro também */
body.theme-dark .os-cyan-card.card > .card-header,
body.theme-dark .os-cyan-card.card > .card-header.os-head,
body.theme-dark .os-cyan-card.card > .card-body {
    background: #67D9FD;
    color: #0b1f27;
    border-color: rgba(0,0,0,.08);
}

/* Tema escuro: header das tabelas dentro dos cards cyan (texto escuro) */
body.theme-dark .os-cyan-card table thead th,
body.theme-dark .os-cyan-card table thead td {
    color: #0b1f27 !important;
}

/* Tema escuro: subtítulo do header dos cards cyan */
body.theme-dark .os-cyan-card .card-header small,
body.theme-dark .os-cyan-card .card-header .text-muted,
body.theme-dark .os-cyan-card .card-header .small {
    color: #0b1f27 !important;
    opacity: .75; /* opcional: mantém “cara de subtítulo” */
}

/* Tema escuro: subtítulo do header dos cards cyan */
body.theme-dark .os-cyan-card.os-card .os-head-sub,
body.theme-dark .os-cyan-card .os-head-sub {
    color: #0b1f27 !important;
    opacity: .75; /* opcional */
}

/* Header das tabelas dentro dos cards cyan (tema claro e escuro) */
.os-cyan-card table thead th,
.os-cyan-card table thead td {
    background: #67D9FD !important;
    color: #0b1f27 !important;
    border-color: rgba(0,0,0,.10) !important;
}

/* Se estiver usando .table-light no thead */
.os-cyan-card .table-light {
    --bs-table-bg: #67D9FD;
    --bs-table-color: #0b1f27;
}


/* Modal de Lookup mais largo */
.modal-dialog.lookup-modal {
    max-width: 1100px; /* ajuste aqui (ex: 900~1400) */
}

/* Lookup: aumentar coluna "Código" */
.lookup-table th.col-codigo,
.lookup-table td.col-codigo {
    width: 260px; /* ajuste aqui */
    min-width: 260px;
    max-width: 260px;
    white-space: normal;
    word-break: break-word;
}

/* Tamanho/área clicável padrão dos itens do menu */
#sidebar .sidebar-link {
    min-height: 42px;
    padding: .55rem .75rem;
    border-radius: .35rem;
}

/* Colapsado: centraliza e melhora “layout de ícones” */
#sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: .65rem 0;
}

#sidebar .sidebar-icon {
    width: 20px;
    text-align: center;
}

/* Colapsado: tira “resquícios” de indentação e espaçamentos */
#sidebar.collapsed .nav-item {
    width: 100%;
}

#sidebar.collapsed .sidebar-group-title {
    margin: 0;
}

/* Destaque de ativo fica bom mesmo sem texto */
#sidebar .sidebar-link.active {
    background: rgba(13,110,253,.18);
    border-left: 3px solid #0d6efd;
    padding-left: calc(.75rem - 3px);
}

#sidebar.collapsed .sidebar-link.active {
    border-left: 0;
    border-radius: .5rem;
}

.sidebar-group-title {
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

/* Botão do grupo (parecer "div" clicável) */
#sidebar .sidebar-group-title {
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .75rem;
    border-radius: .35rem;
    color: #e4e4e4;
}

    #sidebar .sidebar-group-title:hover {
        background: #22272b;
    }

/* Flyout flutuante (sempre coerente com sidebar escuro) */
.sidebar-flyout {
    position: fixed;
    z-index: 2000;
    min-width: 260px;
    max-width: 340px;
    background: #1b1b1b;
    color: #e4e4e4;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: .5rem;
    box-shadow: 0 12px 28px rgba(0,0,0,.55);
    padding: .5rem;
}

    .sidebar-flyout .flyout-title {
        font-weight: 700;
        font-size: .95rem;
        padding: .35rem .5rem .5rem .5rem;
        border-bottom: 1px solid rgba(255,255,255,.10);
        margin-bottom: .35rem;
        color: #fff;
    }

    .sidebar-flyout .nav-link {
        border-radius: .35rem;
        padding: .5rem .6rem;
        color: #e4e4e4;
    }

        .sidebar-flyout .nav-link:hover {
            background: #242424;
        }

        /* Links desabilitados (não “somem”) */
        .sidebar-flyout .nav-link.disabled,
        .sidebar-flyout .nav-link:disabled {
            color: #8f8f8f !important;
            opacity: 1 !important;
        }

    /* No flyout não precisa do label "sumir" */
    .sidebar-flyout .nav-label {
        display: inline !important;
    }


/* aplica o colapsado antes do HTML terminar de renderizar */
.sidebar-collapsed-init #sidebar {
    width: 56px !important;
    flex-basis: 56px !important;
}

    .sidebar-collapsed-init #sidebar .nav-label {
        display: none !important;
    }

    .sidebar-collapsed-init #sidebar .sidebar-children {
        display: none !important;
    }

/* 1) NÃO deixar o sidebar ser esmagado por conteúdo largo */
#sidebar {
    flex: 0 0 240px; /* largura fixa no flex */
    flex-shrink: 0; /* não encolhe */
}

    /* mantém o colapsado fixo também */
    #sidebar.collapsed {
        flex: 0 0 60px; /* largura fixa no flex quando colapsado */
    }

/* 2) Rolagem horizontal no conteúdo (não no body) */
.main-content {
    overflow-x: auto; /* cria scrollbar quando precisar */
    max-width: 100%;
    padding: .2rem .325rem;
}

/* Tabela “1 linha por registro” */
.table-one-line th,
.table-one-line td {
    white-space: nowrap; /* não quebra linha */
    vertical-align: middle;
}

.table-one-line td {
    padding-top: .35rem;
    padding-bottom: .35rem;
    line-height: 1.1;
}

    /* (opcional) corta com reticências quando a coluna for grande */
    .table-one-line td.trunc,
    .table-one-line th.trunc {
        max-width: 220px; /* ajuste depois */
        overflow: hidden;
        text-overflow: ellipsis;
    }

.os-sticky-bar {
    position: fixed;
    top: 0; /* FIXO no topo */
    z-index: 1060;
    background: #212529;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.10);
    padding: .45rem .75rem;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.25);
    /* escondida por padrão (vai aparecer via .is-visible) */
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform .15s ease, opacity .15s ease;
}

    .os-sticky-bar.is-visible {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .os-sticky-bar .text-muted {
        color: rgba(255,255,255,.65) !important;
    }

/* -----------------------------------------------------------
   TEMA ESCURO – AJUSTES EXTRAS
   (utilitários do Bootstrap que deixam texto “apagado”)
------------------------------------------------------------ */

body.theme-dark .text-dark,
body.theme-dark .text-body,
body.theme-dark .text-body-emphasis {
    color: #e4e4e4 !important;
}

body.theme-dark .text-muted,
body.theme-dark .text-secondary,
body.theme-dark .text-body-secondary {
    color: #b8b8b8 !important;
}

/* Tabela: garante contraste mesmo com classes utilitárias */
body.theme-dark .table > :not(caption) > * > * {
    color: inherit;
}

/* ===== Ajuste de contraste das LISTAS no tema escuro ===== */
[data-bs-theme="dark"] .card.bg-white,
[data-bs-theme="dark"] .card.bg-light,
[data-bs-theme="dark"] .bg-white.card,
[data-bs-theme="dark"] .bg-light.card {
    background-color: #111 !important; /* fundo do card */
    color: #e9ecef !important; /* texto padrão */
}

/* Título e subtítulo das listas (estavam ficando claros demais) */
[data-bs-theme="dark"] .card .card-title,
[data-bs-theme="dark"] .card h6,
[data-bs-theme="dark"] .card h5 {
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .card .text-muted,
[data-bs-theme="dark"] .card small {
    color: rgba(248, 249, 250, .70) !important; /* subtítulo visível */
}

/* Cabeçalho das tabelas (Código / Descrição / Qtd) no tema escuro */
[data-bs-theme="dark"] .card .table thead th,
[data-bs-theme="dark"] .card .table thead td {
    background-color: rgba(255, 255, 255, .08) !important;
    color: #f8f9fa !important;
    border-color: rgba(255, 255, 255, .15) !important;
}

/* Corpo da tabela (linhas) */
[data-bs-theme="dark"] .card .table td {
    color: #e9ecef !important;
    border-color: rgba(255, 255, 255, .10) !important;
}

/* ==========================================================
   CONTRASTE: Histórico de evolução de etapas / Histórico de alterações (tema escuro)
   ========================================================== */
body.theme-dark .table {
    --bs-table-color: #e4e4e4;
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(255,255,255,.18);
    --bs-table-striped-bg: rgba(255,255,255,.04);
    --bs-table-hover-bg: rgba(255,255,255,.06);
}

    /* Garante que o texto das células não “apague” por herança */
    body.theme-dark .table > :not(caption) > * > * {
        color: #e4e4e4 !important;
        border-color: rgba(255,255,255,.18) !important;
    }

    /* Cabeçalho legível */
    body.theme-dark .table thead th,
    body.theme-dark .table thead td {
        background: rgba(255,255,255,.08) !important;
        color: #f8f9fa !important;
        border-color: rgba(255,255,255,.18) !important;
    }

/* Se algum header vier com .table-light, mantém coerente no dark */
body.theme-dark .table-light,
body.theme-dark thead.table-light {
    --bs-table-color: #f8f9fa;
    --bs-table-bg: rgba(255,255,255,.08);
    --bs-table-border-color: rgba(255,255,255,.18);
}
