body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    height: 100vh;
    overflow: hidden;
}

.wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 310px;
    min-width: 310px;
    height: 100%;
    z-index: 100;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 transparent;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: #dee2e6;
    border-radius: 10px;
}

.main-panel {
    flex-grow: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-bar {
    height: 60px;
    min-height: 60px;
    background-color: #ffffff;
}

.mode-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    color: #6c757d !important;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.mode-card:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.mode-card.active {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: #ffffff !important;
}

.mode-card .icon-box {
    color: #6c757d;
}

.mode-card.active .icon-box,
.mode-card.active .title,
.mode-card.active .desc,
.mode-card.active .arrow {
    color: #ffffff !important;
}

.mode-card .title {
    font-size: 0.95rem;
    color: #343a40;
}

.mode-card .desc {
    font-size: 0.75rem;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem !important;
    border-radius: 8px;
    color: #334155 !important;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    margin-bottom: 4px;
    text-decoration: none;
}

.nav-link-custom i {
    color: #64748b;
    transition: color 0.2s ease;
}

.nav-link-custom:hover {
    background-color: #f1f5f9;
    color: #198754 !important;
}

.nav-link-custom:hover i {
    color: #198754;
}

.nav-link-custom.active {
    background-color: #198754 !important;
    color: #ffffff !important;
    border-left: 4px solid #ffc107 !important;
    box-shadow: 0 4px 6px -1px rgba(25, 135, 84, 0.2);
}

.nav-link-custom.active i {
    color: #ffffff !important;
}

.form-ficha {
    transition: all 0.3s ease;
}

.table-laudo th {
    background-color: #f1f3f5;
    font-size: 0.8rem;
}

/* Estilos customizados para as novas imagens da sidebar */
.brand-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 6px;
}

.sidebar-logos-container {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed #dee2e6;
}

.sidebar-logo-item {
    max-width: 100%;
    height: auto;
    max-height: 45px;
    object-fit: contain;
    mix-blend-mode: multiply;
    /* Suaviza fundos brancos mantendo a logo limpa */
}

@media print {
    @page {
        size: A4 portrait;
        margin: 15mm;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        min-height: auto;
        height: auto !important;
        overflow: visible !important;
        width: auto !important;
        background: #ffffff;
    }

    body>*:not(#print-area) {
        display: none !important;
    }

    #print-area,
    #print-area * {
        visibility: visible;
    }

    #print-area {
        display: block !important;
        position: static !important;
        width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0;
        padding: 18px;
        box-sizing: border-box;
        background: #ffffff;
    }

    #print-area>* {
        max-width: 100% !important;
    }

    #print-header {
        border-bottom: 2px solid #0d6efd;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    #print-footer {
        border-top: 1px solid #dee2e6;
        padding-top: 10px;
        margin-top: 24px;
        font-size: 0.9rem;
        color: #495057;
    }

    .print-summary {
        width: 100%;
        border-collapse: collapse;
        margin-top: 12px;
        margin-bottom: 18px;
        table-layout: fixed;
    }

    .print-summary td {
        padding: 6px 8px;
        vertical-align: top;
        word-break: break-word;
        white-space: normal;
    }

    .print-summary td:first-child {
        width: 160px;
        font-weight: 700;
    }

    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 8px;
        page-break-inside: auto;
        table-layout: auto;
    }

    .print-table th,
    .print-table td {
        border: 1px solid #adb5bd;
        padding: 6px 10px;
        text-align: left;
        word-break: break-word;
        white-space: normal;
    }

    .print-table th:first-child,
    .print-table td:first-child {
        width: 60%;
    }

    .print-table th:nth-child(2),
    .print-table td:nth-child(2),
    .print-table th:nth-child(3),
    .print-table td:nth-child(3) {
        width: 20%;
    }

    .print-table th {
        background: #f8f9fa;
    }

    .print-table thead {
        display: table-header-group;
    }

    .print-table tbody {
        display: table-row-group;
    }

    .print-table tr {
        page-break-inside: avoid;
    }

    .print-break {
        page-break-before: always;
    }
}

/* RESPONSIVIDADE PARA TABLETS E CELULARES */
@media (max-width: 991.98px) {
    body {
        height: auto !important;
        overflow: visible !important;
    }

    .wrapper {
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
    }

    .sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        border-right: none !important;
        border-bottom: 1px solid #dee2e6 !important;
        overflow-y: visible !important;
        padding: 1.5rem !important;
    }

    .sidebar-logos-container {
        flex-direction: row !important;
        justify-content: center !important;
        gap: 1.5rem !important;
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .sidebar-logo-item {
        height: 45px !important;
        width: auto !important;
    }

    .main-panel {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    .top-bar {
        height: auto !important;
        padding: 1rem !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
}

.show-on-mobile-portrait,
.show-on-mobile-portrait-flex {
    display: none !important;
}

@media (max-width: 991.98px) and (orientation: portrait) {
    .hide-on-mobile-portrait {
        display: none !important;
    }

    .show-on-mobile-portrait {
        display: block !important;
    }

    .show-on-mobile-portrait-flex {
        display: flex !important;
    }
}

/* Estilos para Assinatura Digital e Modais */
.signature-display-box {
    display: inline-block;
    vertical-align: top;
    margin: 15px auto;
    text-align: center;
    padding: 10px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.signature-display-box img {
    mix-blend-mode: multiply;
    /* Faz o fundo branco do canvas sumir e parecer assinado no papel */
    filter: contrast(1.2);
}

.signature-display-box:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.preview-assinatura {
    max-height: 70px;
    display: block;
    margin: 0 auto 5px auto;
    mix-blend-mode: multiply;
}

#conteudo-revisao-documento {
    font-size: 13px !important;
    line-height: 1.6 !important;
    border: 1px solid #ddd;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* No modal de revisão, habilitar apenas cliques em botões de assinar */
#conteudo-revisao-documento .btn {
    pointer-events: auto !important;
}

#conteudo-revisao-documento table {
    font-size: 12px !important;
}

/* Ajustes responsivos para assinaturas e local/data na revisão e histórico */
@media (max-width: 768px) {
    #conteudo-revisao-documento {
        padding: 12px !important;
    }

    .tabela-assinaturas,
    .tabela-assinaturas tbody,
    .tabela-assinaturas tr,
    .tabela-assinaturas td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }

    .tabela-assinaturas td {
        margin-bottom: 25px !important;
    }

    .tabela-assinaturas td:last-child {
        margin-bottom: 0 !important;
    }

    .tabela-assinaturas td:empty {
        display: none !important;
    }

    .bloco-assinaturas-flex {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .bloco-assinaturas-flex .col-assinatura {
        width: 100% !important;
    }

    /* Ajustar tamanho da assinatura digital e remover margem excessiva */
    .signature-display-box {
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 10px 0 !important;
    }
}

/* Section Card & Logos Footer */
.section-card {
    background: white;
    border-radius: 16px;
    padding: 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8edf2;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.section-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.logos-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem;
    background: white;
    flex-wrap: wrap;
}

.section-card>.logos-footer:first-child {
    border-top: none;
}

.logos-footer img {
    height: 44px;
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
    transition: opacity 0.2s;
}