:root {
    --pe-primary: #2563eb;
    --pe-primary-mid: #1d4ed8;
    --pe-primary-dark: #1e40af;
    --pe-accent: #3b82f6;
    --pe-bg: #f0f4f8;
    --pe-card: #ffffff;
    --pe-text: #1f2937;
    --pe-muted: #6b7280;
    --pe-border: #e5e7eb;
    --pe-input: #f0f4f8;
    --pe-navy: #0a2540;
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: #2563eb;
    --bs-link-hover-color: #1d4ed8;
}

/*
 * Botões — convenção semântica (Bootstrap 5)
 * btn-success           criar / salvar / confirmar / finalizar / ativar / enviar
 * btn-primary           filtrar / buscar / CTA de hub (Abrir / Gerenciar)
 * btn-outline-primary   ver / editar / continuar
 * btn-outline-secondary voltar / limpar / imprimir / adicionar linha / dismiss
 * btn-outline-danger    excluir / cancelar destrutivo / encerrar
 * btn-danger            baixa irreversível (perda/vencimento)
 * btn-warning           pendência que exige atenção (ver rascunhos, exceção)
 * btn-outline-warning   atalho de pendência / conferir / reabrir
 * btn-pe-ajuste         ajuste de estoque (sólido, alto contraste)
 */

.pe-body {
    font-family: "Source Sans 3", system-ui, -apple-system, sans-serif;
    background: var(--pe-bg);
    color: var(--pe-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.pe-body .btn-primary {
    --bs-btn-bg: var(--pe-primary);
    --bs-btn-border-color: var(--pe-primary);
    --bs-btn-hover-bg: var(--pe-primary-mid);
    --bs-btn-hover-border-color: var(--pe-primary-mid);
    --bs-btn-active-bg: var(--pe-primary-dark);
    --bs-btn-active-border-color: var(--pe-primary-dark);
    --bs-btn-disabled-bg: var(--pe-primary);
    --bs-btn-disabled-border-color: var(--pe-primary);
}

.pe-body .btn-outline-primary {
    --bs-btn-color: var(--pe-primary);
    --bs-btn-border-color: var(--pe-primary);
    --bs-btn-hover-bg: var(--pe-primary);
    --bs-btn-hover-border-color: var(--pe-primary);
    --bs-btn-active-bg: var(--pe-primary-mid);
    --bs-btn-active-border-color: var(--pe-primary-mid);
}

.pe-body .form-control,
.pe-body .form-select {
    background-color: var(--pe-input);
    border-color: #d5dee8;
    color: var(--pe-text);
}

.pe-body .form-control:focus,
.pe-body .form-select:focus {
    background-color: #e8eef5;
    border-color: var(--pe-primary);
    color: var(--pe-text);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
}

.pe-body .card {
    background: var(--pe-card);
    border-color: var(--pe-border);
    box-shadow: 0 8px 24px rgba(13, 40, 71, 0.08);
}

.pe-body .page-item.active .page-link,
.pe-body .form-check-input:checked {
    background-color: var(--pe-primary);
    border-color: var(--pe-primary);
}

.pe-topbar {
    background: var(--pe-navy);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.pe-topbar-inner {
    border-top: 4px solid var(--pe-primary);
    padding-left: 1rem;
    padding-right: 1rem;
}

.pe-topbar-grid {
    position: relative;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pe-topbar-left,
.pe-topbar-right {
    z-index: 1;
}

.pe-topbar-left {
    min-width: 0;
    flex: 1 1 auto;
}

.pe-topbar-right {
    min-width: 0;
    flex: 0 1 auto;
    justify-content: flex-end;
}

.pe-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.pe-brand-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: block;
}

.pe-brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.pe-brand-center {
    position: static;
    transform: none;
    width: auto;
}

.pe-brand-title {
    display: block;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.pe-brand-sub {
    display: block;
    font-size: 0.78rem;
    opacity: 0.88;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(520px, 46vw);
}

.pe-link-light {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
}

.pe-theme-toggle {
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
}

.pe-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.7);
}
.pe-link-light:hover {
    color: var(--pe-accent);
    text-decoration: underline;
}

.pe-unit-badge {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.2rem 0.65rem;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.pe-lotacao-select {
    max-width: 280px;
    min-width: 160px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.pe-subnav {
    background: #fff;
    border-bottom: 1px solid var(--pe-border);
}

.pe-subnav .nav-link {
    color: var(--pe-text);
    font-weight: 600;
    border-radius: 4px;
    margin-right: 0.25rem;
    border: 1px solid transparent;
    font-size: 0.83rem;
    padding: 0.35rem 0.7rem;
    letter-spacing: 0.01em;
}

.pe-subnav .nav-link:hover {
    background: #e8eef5;
    border-color: #d5dee8;
}

.pe-subnav .nav-link.active {
    background: var(--pe-primary);
    color: #fff;
    border-color: var(--pe-primary-mid);
}

.pe-context-bar {
    background: #e8eef5;
    border-bottom: 1px solid #d0dae6;
}

.pe-main {
    flex: 1;
}

.pe-footer {
    background: var(--pe-navy);
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2rem;
    border-top: 2px solid var(--pe-primary);
}

.pe-footer-text {
    font-size: 0.8rem;
    line-height: 1.35;
    align-items: center;
    text-align: center;
}

.pe-footer-text span {
    opacity: 0.95;
}

.pe-footer-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.8rem;
}

.pe-footer-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pe-footer-col-left {
    text-align: left;
}

.pe-footer-col-center {
    text-align: center;
    min-width: 250px;
}

.pe-footer-col-right {
    text-align: right;
}

.pe-footer-label {
    font-weight: 600;
}

.pe-footer-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.pe-dark,
html.pe-dark,
html.pe-dark body.pe-body {
    --pe-bg: #0f1318;
    --pe-card: #161f2a;
    background: #0f1318;
    color: #dfe7ef;
    color-scheme: dark;
}

html.pe-dark body.pe-body.pe-odonto {
    --pe-bg: #0f1318;
    background: #0f1318;
}

html.pe-dark .pe-main,
.pe-dark .pe-main {
    color: #dfe7ef;
}

html.pe-dark .pe-subnav,
.pe-dark .pe-subnav {
    background: #131a22;
    border-bottom-color: #263140;
}

html.pe-dark .pe-subnav .nav-link,
.pe-dark .pe-subnav .nav-link {
    color: #cfe3f2;
}

html.pe-dark .pe-subnav .nav-link:hover,
.pe-dark .pe-subnav .nav-link:hover {
    background: #1a2430;
    border-color: #2a3b4f;
}

html.pe-dark .pe-subnav .nav-link.active,
.pe-dark .pe-subnav .nav-link.active {
    background: #1f7a4c;
    border-color: #2a8f5c;
    color: #fff;
}

html.pe-dark body.pe-odonto .pe-subnav .nav-link.active {
    background: #0d6e8c;
    border-color: #0a5a73;
}

html.pe-dark .pe-context-bar,
.pe-dark .pe-context-bar {
    background: #151c26;
    border-bottom-color: #263140;
    color: #cfe3f2;
}

html.pe-dark .card,
html.pe-dark .table,
html.pe-dark .modal-content,
html.pe-dark .dropdown-menu,
html.pe-dark .offcanvas,
html.pe-dark .accordion-item,
html.pe-dark .form-control,
html.pe-dark .form-select,
html.pe-dark .input-group-text,
.pe-dark .card,
.pe-dark .table,
.pe-dark .modal-content,
.pe-dark .dropdown-menu,
.pe-dark .offcanvas,
.pe-dark .accordion-item,
.pe-dark .form-control,
.pe-dark .form-select,
.pe-dark .input-group-text {
    background-color: #161f2a;
    color: #e3ebf5;
    border-color: #2a3a4d;
}

html.pe-dark .card-header,
html.pe-dark .card-footer,
html.pe-dark .modal-header,
html.pe-dark .modal-footer,
.pe-dark .card-header,
.pe-dark .card-footer,
.pe-dark .modal-header,
.pe-dark .modal-footer {
    background-color: #1a2430;
    color: #e3ebf5;
    border-color: #2a3a4d;
}

html.pe-dark .table > :not(caption) > * > *,
.pe-dark .table > :not(caption) > * > * {
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
    --bs-table-striped-color: #e3ebf5;
    --bs-table-hover-color: #e3ebf5;
    background-color: transparent !important;
    box-shadow: none !important;
    color: #e3ebf5;
    border-color: #2a3a4d;
}

html.pe-dark .table thead th,
.pe-dark .table thead th {
    background-color: #1a2430;
    color: #e3ebf5;
    border-color: #2a3a4d;
}

html.pe-dark .table-bordered,
html.pe-dark .table-bordered > :not(caption) > *,
.pe-dark .table-bordered,
.pe-dark .table-bordered > :not(caption) > * {
    border-color: #2a3a4d;
}

html.pe-dark .table-hover > tbody > tr:hover > *,
.pe-dark .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.06);
    color: #e3ebf5;
}

html.pe-dark .text-muted,
html.pe-dark .form-text,
html.pe-dark .pe-dashboard-pie-label em,
.pe-dark .text-muted,
.pe-dark .form-text,
.pe-dark .pe-dashboard-pie-label em {
    color: #9db0c4 !important;
}

html.pe-dark a:not(.btn):not(.nav-link):not(.pe-link-light):not(.page-link):not(.alert-link):not(.dropdown-item):not(.list-group-item),
.pe-dark a:not(.btn):not(.nav-link):not(.pe-link-light):not(.page-link):not(.alert-link):not(.dropdown-item):not(.list-group-item) {
    color: #8ec5ff;
}

html.pe-dark a:not(.btn):not(.nav-link):not(.pe-link-light):not(.page-link):not(.alert-link):not(.dropdown-item):not(.list-group-item):hover,
.pe-dark a:not(.btn):not(.nav-link):not(.pe-link-light):not(.page-link):not(.alert-link):not(.dropdown-item):not(.list-group-item):hover {
    color: #b5daff;
}

html.pe-dark .breadcrumb-item a,
.pe-dark .breadcrumb-item a {
    color: #8ec5ff;
}

html.pe-dark .breadcrumb-item.active,
.pe-dark .breadcrumb-item.active {
    color: #9db0c4;
}

html.pe-dark .breadcrumb-item + .breadcrumb-item::before,
.pe-dark .breadcrumb-item + .breadcrumb-item::before {
    color: #5f748b;
}

html.pe-dark .nav-pills .nav-link,
.pe-dark .nav-pills .nav-link {
    color: #cfe3f2;
}

html.pe-dark .nav-pills .nav-link:hover,
.pe-dark .nav-pills .nav-link:hover {
    background: #1a2430;
    color: #e3ebf5;
}

html.pe-dark .nav-pills .nav-link.active,
.pe-dark .nav-pills .nav-link.active {
    background: #1f7a4c;
    color: #fff;
}

html.pe-dark body.pe-odonto .nav-pills .nav-link.active {
    background: #0d6e8c;
}

.form-control::placeholder,
.form-control::-webkit-input-placeholder,
.form-select::placeholder {
    color: #5f7388;
    opacity: 1;
}

html.pe-dark .form-control::placeholder,
html.pe-dark .form-control::-webkit-input-placeholder,
.pe-dark .form-control::placeholder {
    color: #9aafc2;
    opacity: 1;
}

html.pe-dark .form-control:focus,
html.pe-dark .form-select:focus,
.pe-dark .form-control:focus,
.pe-dark .form-select:focus {
    background-color: #1a2430;
    color: #e3ebf5;
    border-color: #4f7dbf;
    box-shadow: 0 0 0 0.2rem rgba(79, 125, 191, 0.25);
}

html.pe-dark .form-select,
.pe-dark .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c8d4e2' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

html.pe-dark .form-control:disabled,
html.pe-dark .form-select:disabled,
html.pe-dark .form-control[readonly],
.pe-dark .form-control:disabled,
.pe-dark .form-select:disabled,
.pe-dark .form-control[readonly] {
    background-color: #121820;
    color: #9db0c4;
    opacity: 1;
}

html.pe-dark .form-check-input,
.pe-dark .form-check-input {
    background-color: #1a2430;
    border-color: #5f748b;
}

html.pe-dark .form-check-input:checked,
.pe-dark .form-check-input:checked {
    background-color: var(--pe-primary);
    border-color: var(--pe-primary);
}

html.pe-dark .btn-outline-secondary,
.pe-dark .btn-outline-secondary {
    color: #c8d4e2;
    border-color: #5f748b;
}

html.pe-dark .btn-outline-secondary:hover,
.pe-dark .btn-outline-secondary:hover {
    background: #2a3a4d;
    color: #fff;
    border-color: #5f748b;
}

html.pe-dark .btn-outline-primary,
.pe-dark .btn-outline-primary {
    color: #9fc8ff;
    border-color: #4f7dbf;
}

html.pe-dark .btn-outline-primary:hover,
.pe-dark .btn-outline-primary:hover {
    background: #2a4a70;
    color: #fff;
    border-color: #4f7dbf;
}

html.pe-dark .btn-outline-success,
.pe-dark .btn-outline-success {
    color: #75b798;
    border-color: #3d8b66;
}

html.pe-dark .btn-outline-success:hover,
.pe-dark .btn-outline-success:hover {
    background: #1f7a4c;
    color: #fff;
    border-color: #1f7a4c;
}

html.pe-dark .btn-outline-danger,
.pe-dark .btn-outline-danger {
    color: #ea868f;
    border-color: #a9444e;
}

html.pe-dark .btn-outline-danger:hover,
.pe-dark .btn-outline-danger:hover {
    background: #b02a37;
    color: #fff;
    border-color: #b02a37;
}

html.pe-dark .btn-outline-warning,
.pe-dark .btn-outline-warning {
    color: #ffda6a;
    border-color: #997404;
}

html.pe-dark .btn-outline-warning:hover,
.pe-dark .btn-outline-warning:hover {
    background: #997404;
    color: #1a1a1a;
    border-color: #997404;
}

html.pe-dark .btn-dark,
.pe-dark .btn-dark {
    background-color: #3a4a5c;
    border-color: #3a4a5c;
    color: #fff;
}

html.pe-dark .list-group-item,
.pe-dark .list-group-item {
    background-color: #161f2a;
    color: #e3ebf5;
    border-color: #2a3a4d;
}

html.pe-dark .list-group-item-action:hover,
html.pe-dark .list-group-item-action:focus,
.pe-dark .list-group-item-action:hover,
.pe-dark .list-group-item-action:focus {
    background-color: #1e2a3b;
    color: #e3ebf5;
}

html.pe-dark .alert-success,
.pe-dark .alert-success {
    background-color: rgba(25, 135, 84, 0.15);
    color: #75b798;
    border-color: #0f5132;
}

html.pe-dark .alert-danger,
.pe-dark .alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    color: #ea868f;
    border-color: #842029;
}

html.pe-dark .alert-warning,
.pe-dark .alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: #ffda6a;
    border-color: #664d03;
}

html.pe-dark .alert-info,
.pe-dark .alert-info {
    background-color: rgba(13, 202, 240, 0.15);
    color: #6edff6;
    border-color: #087990;
}

html.pe-dark .alert-secondary,
.pe-dark .alert-secondary {
    background-color: #1d2631;
    color: #c8d4e2;
    border-color: #2a3a4d;
}

html.pe-dark .alert-link,
.pe-dark .alert-link {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

html.pe-dark .alert-success .alert-link,
.pe-dark .alert-success .alert-link {
    color: #a3e4c1;
}

html.pe-dark .alert-danger .alert-link,
.pe-dark .alert-danger .alert-link {
    color: #f1aeb5;
}

html.pe-dark .alert-warning .alert-link,
.pe-dark .alert-warning .alert-link {
    color: #ffe69c;
}

html.pe-dark .alert-info .alert-link,
.pe-dark .alert-info .alert-link {
    color: #9eeaf9;
}

html.pe-dark .bg-warning-subtle,
html.pe-dark .modal-header.bg-warning-subtle,
.pe-dark .bg-warning-subtle,
.pe-dark .modal-header.bg-warning-subtle {
    background-color: rgba(255, 193, 7, 0.18) !important;
    color: #ffda6a;
}

html.pe-dark .badge.bg-success,
html.pe-dark .badge.text-bg-success,
.pe-dark .badge.bg-success,
.pe-dark .badge.text-bg-success {
    background-color: #1f7a4c !important;
    color: #fff !important;
}

html.pe-dark .badge.bg-danger,
html.pe-dark .badge.text-bg-danger,
.pe-dark .badge.bg-danger,
.pe-dark .badge.text-bg-danger {
    background-color: #b02a37 !important;
    color: #fff !important;
}

html.pe-dark .badge.text-bg-light,
html.pe-dark .badge.bg-light,
.pe-dark .badge.text-bg-light,
.pe-dark .badge.bg-light {
    background-color: #2a3a4d !important;
    color: #e3ebf5 !important;
}

html.pe-dark .badge.text-bg-secondary,
html.pe-dark .badge.bg-secondary,
.pe-dark .badge.text-bg-secondary,
.pe-dark .badge.bg-secondary {
    background-color: #3a4a5c !important;
    color: #e3ebf5 !important;
}

html.pe-dark .badge.text-bg-primary,
html.pe-dark .badge.bg-primary,
.pe-dark .badge.text-bg-primary,
.pe-dark .badge.bg-primary {
    background-color: #0d6e8c !important;
    color: #fff !important;
}

html.pe-dark .text-dark,
.pe-dark .text-dark {
    color: #e3ebf5 !important;
}

html.pe-dark .badge.text-bg-warning,
html.pe-dark .badge.text-bg-warning.text-dark,
html.pe-dark .badge.bg-warning,
html.pe-dark .badge.bg-warning.text-dark,
.pe-dark .badge.text-bg-warning,
.pe-dark .badge.text-bg-warning.text-dark,
.pe-dark .badge.bg-warning,
.pe-dark .badge.bg-warning.text-dark {
    background-color: #d4a106 !important;
    color: #1a1a1a !important;
}

html.pe-dark .text-warning-emphasis,
.pe-dark .text-warning-emphasis {
    color: #ffda6a !important;
}

html.pe-dark .table-striped > tbody > tr:nth-of-type(odd) > *,
.pe-dark .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03);
    color: #e3ebf5;
}

html.pe-dark .pe-farmacia-ac-list,
.pe-dark .pe-farmacia-ac-list {
    background-color: #161f2a;
    border-color: #2a3a4d;
}

html.pe-dark .pe-farmacia-ac-item,
.pe-dark .pe-farmacia-ac-item {
    background-color: #161f2a;
    color: #e3ebf5;
    border-bottom-color: #2a3a4d;
}

html.pe-dark .pe-farmacia-ac-item:hover,
.pe-dark .pe-farmacia-ac-item:hover {
    background-color: #1e2a3b;
}

html.pe-dark .pe-login-card,
.pe-dark .pe-login-card {
    background-color: #161f2a;
    border-color: #2a3a4d;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

html.pe-dark .pe-login-card .pe-login-input,
html.pe-dark .pe-login-card .form-control.pe-login-input,
.pe-dark .pe-login-card .pe-login-input,
.pe-dark .pe-login-card .form-control.pe-login-input {
    background-color: #ffffff;
    border-color: #d5ddd8;
    color: #1a2a20;
}

html.pe-dark .pe-login-footer-links a,
.pe-dark .pe-login-footer-links a {
    color: #8ec5ff;
}

html.pe-dark .pe-card-stat,
.pe-dark .pe-card-stat {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    background-color: #161f2a;
}

html.pe-dark .hr,
html.pe-dark hr,
.pe-dark hr {
    border-color: #2a3a4d;
    opacity: 1;
}

html.pe-dark .btn-close,
.pe-dark .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

html.pe-dark .page-link,
.pe-dark .page-link {
    background-color: #161f2a;
    border-color: #2a3a4d;
    color: #8ec5ff;
}

html.pe-dark .page-link:hover,
.pe-dark .page-link:hover {
    background-color: #1e2a3b;
    border-color: #2a3a4d;
    color: #b5daff;
}

html.pe-dark .page-item.active .page-link,
.pe-dark .page-item.active .page-link {
    background-color: var(--pe-primary);
    border-color: var(--pe-primary);
    color: #fff;
}

html.pe-dark .page-item.disabled .page-link,
.pe-dark .page-item.disabled .page-link {
    background-color: #121820;
    border-color: #2a3a4d;
    color: #5f748b;
}

html.pe-dark .pe-lotacao-select,
.pe-dark .pe-lotacao-select {
    background: #1a2430;
    color: #e3ebf5;
    border-color: rgba(255, 255, 255, 0.35);
}

html.pe-dark .shadow-sm,
.pe-dark .shadow-sm {
    box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.45) !important;
}

html.pe-dark .bg-white,
html.pe-dark .bg-light,
.pe-dark .bg-white,
.pe-dark .bg-light {
    background-color: #161f2a !important;
    color: #e3ebf5 !important;
}

html.pe-dark .pe-estoque-ajuste-preview,
.pe-dark .pe-estoque-ajuste-preview {
    background: #1a2430;
    border-color: #2a3a4d;
    color: #e3ebf5;
}

html.pe-dark .spinner-border,
.pe-dark .spinner-border {
    color: #9fc8ff;
}

html.pe-dark .form-control option,
html.pe-dark .form-select option,
.pe-dark .form-control option,
.pe-dark .form-select option {
    background-color: #161f2a;
    color: #e3ebf5;
}

html.pe-dark .form-control-plaintext,
.pe-dark .form-control-plaintext {
    color: #e3ebf5;
}

html.pe-dark .form-control:-webkit-autofill,
html.pe-dark .form-control:-webkit-autofill:hover,
html.pe-dark .form-control:-webkit-autofill:focus,
.pe-dark .form-control:-webkit-autofill,
.pe-dark .form-control:-webkit-autofill:hover,
.pe-dark .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #e3ebf5;
    caret-color: #e3ebf5;
    transition: background-color 99999s ease-out;
    box-shadow: 0 0 0 1000px #161f2a inset;
}

html.pe-dark .table-warning > *,
html.pe-dark .table-warning > :not(caption) > * > *,
.pe-dark .table-warning > *,
.pe-dark .table-warning > :not(caption) > * > * {
    --bs-table-bg: rgba(255, 193, 7, 0.18);
    --bs-table-accent-bg: rgba(255, 193, 7, 0.18);
    background-color: rgba(255, 193, 7, 0.18) !important;
    box-shadow: none !important;
    color: #ffda6a !important;
    border-color: #664d03 !important;
}

html.pe-dark .table-danger > *,
html.pe-dark .table-danger > :not(caption) > * > *,
.pe-dark .table-danger > *,
.pe-dark .table-danger > :not(caption) > * > * {
    --bs-table-bg: rgba(220, 53, 69, 0.18);
    --bs-table-accent-bg: rgba(220, 53, 69, 0.18);
    background-color: rgba(220, 53, 69, 0.18) !important;
    box-shadow: none !important;
    color: #ea868f !important;
    border-color: #842029 !important;
}

html.pe-dark .table-success > *,
html.pe-dark .table-success > :not(caption) > * > *,
.pe-dark .table-success > *,
.pe-dark .table-success > :not(caption) > * > * {
    --bs-table-bg: rgba(25, 135, 84, 0.18);
    --bs-table-accent-bg: rgba(25, 135, 84, 0.18);
    background-color: rgba(25, 135, 84, 0.18) !important;
    box-shadow: none !important;
    color: #75b798 !important;
    border-color: #0f5132 !important;
}

html.pe-dark .table-info > *,
html.pe-dark .table-info > :not(caption) > * > *,
.pe-dark .table-info > *,
.pe-dark .table-info > :not(caption) > * > * {
    --bs-table-bg: rgba(13, 202, 240, 0.15);
    --bs-table-accent-bg: rgba(13, 202, 240, 0.15);
    background-color: rgba(13, 202, 240, 0.15) !important;
    box-shadow: none !important;
    color: #6edff6 !important;
    border-color: #087990 !important;
}

html.pe-dark .dropdown-item,
.pe-dark .dropdown-item {
    color: #e3ebf5;
}

html.pe-dark .dropdown-item:hover,
html.pe-dark .dropdown-item:focus,
.pe-dark .dropdown-item:hover,
.pe-dark .dropdown-item:focus {
    background-color: #1e2a3b;
    color: #e3ebf5;
}

html.pe-dark .dropdown-divider,
.pe-dark .dropdown-divider {
    border-top-color: #2a3a4d;
}

html.pe-dark .accordion-button,
.pe-dark .accordion-button {
    background-color: #1a2430;
    color: #e3ebf5;
    box-shadow: none;
}

html.pe-dark .accordion-button:not(.collapsed),
.pe-dark .accordion-button:not(.collapsed) {
    background-color: #1e2a3b;
    color: #e3ebf5;
}

html.pe-dark .accordion-button::after,
.pe-dark .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

html.pe-dark .accordion-body,
.pe-dark .accordion-body {
    background-color: #161f2a;
    color: #e3ebf5;
}

html.pe-dark .progress,
.pe-dark .progress {
    background-color: #1a2430;
}

html.pe-dark .toast,
.pe-dark .toast {
    background-color: #161f2a;
    color: #e3ebf5;
    border-color: #2a3a4d;
}

html.pe-dark .toast-header,
.pe-dark .toast-header {
    background-color: #1a2430;
    color: #e3ebf5;
    border-bottom-color: #2a3a4d;
}

html.pe-dark .text-bg-light,
html.pe-dark .text-bg-light.text-dark,
.pe-dark .text-bg-light,
.pe-dark .text-bg-light.text-dark {
    background-color: #2a3a4d !important;
    color: #e3ebf5 !important;
}

html.pe-dark .bg-body,
html.pe-dark .bg-body-tertiary,
html.pe-dark .bg-body-secondary,
.pe-dark .bg-body,
.pe-dark .bg-body-tertiary,
.pe-dark .bg-body-secondary {
    background-color: #161f2a !important;
    color: #e3ebf5 !important;
}

html.pe-dark .text-body,
.pe-dark .text-body {
    color: #e3ebf5 !important;
}

html.pe-dark .text-body-secondary,
html.pe-dark .text-secondary,
.pe-dark .text-body-secondary,
.pe-dark .text-secondary {
    color: #9db0c4 !important;
}

html.pe-dark .border,
html.pe-dark .border-top,
html.pe-dark .border-bottom,
html.pe-dark .border-start,
html.pe-dark .border-end,
.pe-dark .border,
.pe-dark .border-top,
.pe-dark .border-bottom,
.pe-dark .border-start,
.pe-dark .border-end {
    border-color: #2a3a4d !important;
}

/* Bordas semânticas após .border genérico (evita perder border-primary etc.) */
html.pe-dark .border.border-primary,
html.pe-dark .border-primary,
.pe-dark .border.border-primary,
.pe-dark .border-primary {
    border-color: #4f7dbf !important;
}

html.pe-dark .border.border-danger,
html.pe-dark .border-danger,
.pe-dark .border.border-danger,
.pe-dark .border-danger {
    border-color: #842029 !important;
}

html.pe-dark .border.border-warning,
html.pe-dark .border-warning,
.pe-dark .border.border-warning,
.pe-dark .border-warning {
    border-color: #997404 !important;
}

html.pe-dark .border.border-success,
html.pe-dark .border-success,
.pe-dark .border.border-success,
.pe-dark .border-success {
    border-color: #0f5132 !important;
}

html.pe-dark .border.border-info,
html.pe-dark .border-info,
.pe-dark .border.border-info,
.pe-dark .border-info {
    border-color: #087990 !important;
}

html.pe-dark .pe-risco-badge,
.pe-dark .pe-risco-badge {
    background: #2a3a4d;
    color: #c8d4e2;
}

html.pe-dark .pe-risco-baixo,
.pe-dark .pe-risco-baixo {
    background: rgba(25, 135, 84, 0.22);
    color: #75b798;
}

html.pe-dark .pe-risco-medio,
.pe-dark .pe-risco-medio {
    background: rgba(255, 193, 7, 0.22);
    color: #ffda6a;
}

html.pe-dark .pe-risco-alto,
.pe-dark .pe-risco-alto {
    background: rgba(220, 53, 69, 0.22);
    color: #ea868f;
}

html.pe-dark .pe-dashboard-pie-legend,
.pe-dark .pe-dashboard-pie-legend {
    color: #c8d4e2;
}

html.pe-dark .pe-dashboard-pie-label,
.pe-dark .pe-dashboard-pie-label {
    color: #e3ebf5;
}

html.pe-dark .bg-success-subtle,
html.pe-dark .bg-danger-subtle,
html.pe-dark .bg-info-subtle,
html.pe-dark .bg-primary-subtle,
html.pe-dark .bg-secondary-subtle,
.pe-dark .bg-success-subtle,
.pe-dark .bg-danger-subtle,
.pe-dark .bg-info-subtle,
.pe-dark .bg-primary-subtle,
.pe-dark .bg-secondary-subtle {
    color: #e3ebf5;
}

html.pe-dark .bg-success-subtle,
.pe-dark .bg-success-subtle {
    background-color: rgba(25, 135, 84, 0.18) !important;
}

html.pe-dark .bg-danger-subtle,
.pe-dark .bg-danger-subtle {
    background-color: rgba(220, 53, 69, 0.18) !important;
}

html.pe-dark .bg-info-subtle,
.pe-dark .bg-info-subtle {
    background-color: rgba(13, 202, 240, 0.15) !important;
}

html.pe-dark .bg-primary-subtle,
.pe-dark .bg-primary-subtle {
    background-color: rgba(13, 110, 140, 0.22) !important;
}

html.pe-dark .bg-secondary-subtle,
.pe-dark .bg-secondary-subtle {
    background-color: rgba(108, 117, 125, 0.22) !important;
}

html.pe-dark .nav-tabs,
.pe-dark .nav-tabs {
    border-bottom-color: #2a3a4d;
}

html.pe-dark .nav-tabs .nav-link,
.pe-dark .nav-tabs .nav-link {
    color: #cfe3f2;
}

html.pe-dark .nav-tabs .nav-link:hover,
.pe-dark .nav-tabs .nav-link:hover {
    border-color: #2a3a4d #2a3a4d transparent;
    color: #e3ebf5;
}

html.pe-dark .nav-tabs .nav-link.active,
.pe-dark .nav-tabs .nav-link.active {
    background-color: #161f2a;
    border-color: #2a3a4d #2a3a4d #161f2a;
    color: #e3ebf5;
}

html.pe-dark .popover,
.pe-dark .popover {
    background-color: #161f2a;
    border-color: #2a3a4d;
    color: #e3ebf5;
}

html.pe-dark .popover-header,
.pe-dark .popover-header {
    background-color: #1a2430;
    border-bottom-color: #2a3a4d;
    color: #e3ebf5;
}

html.pe-dark .popover-body,
.pe-dark .popover-body {
    color: #e3ebf5;
}

html.pe-dark .tooltip .tooltip-inner,
.pe-dark .tooltip .tooltip-inner {
    background-color: #2a3a4d;
    color: #e3ebf5;
}

html.pe-dark .form-floating > label,
.pe-dark .form-floating > label {
    color: #9db0c4;
}

html.pe-dark .input-group-text,
.pe-dark .input-group-text {
    background-color: #1a2430;
}

html.pe-dark code,
html.pe-dark kbd,
html.pe-dark pre,
html.pe-dark samp,
.pe-dark code,
.pe-dark kbd,
.pe-dark pre,
.pe-dark samp {
    background-color: #1a2430;
    color: #e3ebf5;
}

html.pe-dark .pe-table thead th,
.pe-dark .pe-table thead th {
    background: var(--pe-primary-mid);
    color: #fff;
}

html.pe-dark body.pe-odonto .pe-table thead th,
.pe-dark body.pe-odonto .pe-table thead th {
    background: #0d6e8c;
}

.pe-card-stat {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    border-left: 4px solid var(--pe-primary);
}

.pe-card-stat-icon {
    font-size: 1.55rem;
    line-height: 1;
    opacity: 0.85;
    color: var(--pe-primary);
}

.pe-card-stat-danger {
    border-left-color: #dc3545 !important;
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.1) 0%, transparent 55%);
}

.pe-card-stat-warning {
    border-left-color: #fd7e14 !important;
    background: linear-gradient(90deg, rgba(253, 126, 20, 0.12) 0%, transparent 55%);
}

.pe-dashboard-pie-empty {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pe-dashboard-pie-empty-icon {
    font-size: 3rem;
    color: #adb5bd;
    opacity: 0.85;
}

/* Tom Select no filtro de unidade do estoque */
#formFiltroEstoque .ts-wrapper {
    min-width: 220px;
}
#formFiltroEstoque .ts-control {
    min-height: calc(1.5em + 0.5rem + 2px);
    font-size: 0.875rem;
}
html.pe-dark #formFiltroEstoque .ts-wrapper .ts-control,
.pe-dark #formFiltroEstoque .ts-wrapper .ts-control,
html.pe-dark #formFiltroEstoque .ts-dropdown,
.pe-dark #formFiltroEstoque .ts-dropdown {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

html.pe-dark .pe-dashboard-pie-empty-icon,
.pe-dark .pe-dashboard-pie-empty-icon {
    color: #6c757d;
}

html.pe-dark .pe-card-stat-danger,
.pe-dark .pe-card-stat-danger {
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.18) 0%, transparent 55%);
}

html.pe-dark .pe-card-stat-warning,
.pe-dark .pe-card-stat-warning {
    background: linear-gradient(90deg, rgba(253, 126, 20, 0.18) 0%, transparent 55%);
}

.pe-card-stat-clickable {
    cursor: pointer;
}
.pe-card-stat-clickable:focus {
    outline: 2px solid rgba(220, 53, 69, 0.45);
    outline-offset: 2px;
}

.pe-alarm-card {
    animation: peAlarmPulse 1.4s ease-in-out infinite;
}

@keyframes peAlarmPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.38);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.pe-login-wrap {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.pe-login-card {
    max-width: 420px;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(13, 40, 71, 0.15);
    border: 1px solid #e0e6ed;
}

.pe-login-header {
    background: linear-gradient(90deg, var(--pe-primary), var(--pe-primary-mid));
    color: #fff;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
    border-bottom: 3px solid var(--pe-accent);
}

.pe-login-btn {
    display: block;
    width: 100%;
    background: var(--pe-primary);
    color: #fff;
    border: none;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 5px;
    line-height: 1.4;
    cursor: pointer;
    text-align: center;
}

.pe-login-btn:hover,
.pe-login-btn:focus,
.pe-login-btn:active {
    background: var(--pe-primary-mid);
    color: #fff;
}

.pe-login-card .pe-login-input,
.pe-login-card .form-control.pe-login-input {
    background-color: var(--pe-input);
    border: 1px solid #d5dee8;
    color: var(--pe-text);
}

.pe-login-card .pe-login-input:focus,
.pe-login-card .form-control.pe-login-input:focus {
    background-color: #e8eef5;
    border-color: var(--pe-primary);
    color: var(--pe-text);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
}

.pe-login-card .pe-login-input:-webkit-autofill,
.pe-login-card .pe-login-input:-webkit-autofill:hover,
.pe-login-card .pe-login-input:-webkit-autofill:focus,
.pe-login-card .pe-login-input:-webkit-autofill:active,
.pe-login-card .form-control.pe-login-input:-webkit-autofill {
    -webkit-text-fill-color: #1a2a20;
    caret-color: #1a2a20;
    box-shadow: inset 0 0 0 9999px #ffffff;
    transition: background-color 99999s ease-out;
}

.pe-password-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.pe-password-wrap .pe-login-input {
    display: block;
    width: 100%;
    padding-right: 42px;
}

.pe-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    color: #5a6b61;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.pe-password-toggle:hover,
.pe-password-toggle:focus {
    color: var(--pe-primary);
    background: transparent;
    outline: none;
}

.pe-login-footer-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    gap: 12px;
}

.pe-login-footer-links a {
    color: var(--pe-primary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.pe-login-footer-links a:hover {
    color: var(--pe-primary-mid);
    text-decoration: underline;
}

.table.pe-table thead th {
    background: var(--pe-primary-mid);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Relatórios: título e valor na mesma coluna (esquerda/direita alinhados). */
.table.pe-relatorio-table {
    width: 100%;
    border-collapse: collapse;
}

.table.pe-relatorio-table thead th {
    white-space: nowrap;
    vertical-align: bottom;
}

.table.pe-relatorio-table th,
.table.pe-relatorio-table td {
    vertical-align: middle;
}

.table.pe-relatorio-table th.text-end,
.table.pe-relatorio-table td.text-end {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.pe-farmacia-ac-list {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 3000;
}

.pe-farmacia-ac-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #eee;
    padding: 0.4rem 0.6rem;
    font-size: 0.8125rem;
    background: #fff;
    cursor: pointer;
}

.pe-farmacia-ac-item:last-child {
    border-bottom: 0;
}

.pe-farmacia-ac-item:hover {
    background: #e8f0f8;
}

@media (max-width: 992px) {
    .pe-topbar-inner {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .pe-topbar-grid {
        min-height: auto;
        flex-direction: column;
        gap: 0.35rem;
    }

    .pe-topbar-left,
    .pe-topbar-right {
        min-width: 0;
        width: 100%;
    }

    .pe-topbar-right {
        justify-content: center;
    }

    .pe-brand-center {
        position: static;
        transform: none;
        width: 100%;
        pointer-events: auto;
    }

    .pe-brand-title {
        font-size: 0.88rem;
    }

    .pe-brand-sub {
        font-size: 0.7rem;
        white-space: normal;
        max-width: 100%;
    }

    .pe-subnav .nav {
        gap: 0.2rem;
    }

    .pe-subnav .nav-link {
        font-size: 0.79rem;
        padding: 0.3rem 0.55rem;
        margin-right: 0;
    }

    .pe-footer-text {
        font-size: 0.74rem;
        text-align: center;
    }

    .pe-footer-grid {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .pe-footer-col-left,
    .pe-footer-col-right {
        text-align: center;
    }
}

@media (max-width: 576px) {
    .pe-brand-title {
        font-size: 0.82rem;
    }

    .pe-brand-sub {
        font-size: 0.67rem;
    }

    .pe-link-light {
        font-size: 0.76rem;
    }

    .pe-unit-badge {
        font-size: 0.72rem;
        padding: 0.15rem 0.45rem;
    }

    .pe-subnav .nav-link {
        font-size: 0.75rem;
        padding: 0.28rem 0.5rem;
    }

}

@media print {
    .pe-topbar,
    .pe-subnav,
    .pe-footer,
    .pe-no-print,
    .btn,
    .alert {
        display: none !important;
    }

    .pe-body,
    html.pe-dark,
    html.pe-dark body.pe-body,
    .pe-dark {
        background: #fff !important;
        color: #000 !important;
        display: block !important;
        min-height: auto !important;
    }

    .pe-main {
        padding: 0 !important;
    }

    html.pe-dark .card,
    html.pe-dark .table,
    html.pe-dark .modal-content,
    html.pe-dark .form-control,
    html.pe-dark .form-select,
    html.pe-dark .input-group-text,
    html.pe-dark .list-group-item,
    .pe-dark .card,
    .pe-dark .table,
    .pe-dark .modal-content,
    .pe-dark .form-control,
    .pe-dark .form-select,
    .pe-dark .input-group-text,
    .pe-dark .list-group-item,
    .card {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #bbb !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 0.5rem !important;
    }

    html.pe-dark .table > :not(caption) > * > *,
    html.pe-dark .table thead th,
    .pe-dark .table > :not(caption) > * > *,
    .pe-dark .table thead th {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border-color: #bbb !important;
    }

    .table {
        font-size: 11px;
    }

    .table.pe-table thead th,
    html.pe-dark .table.pe-table thead th,
    .pe-dark .table.pe-table thead th {
        background: #eee !important;
        color: #000 !important;
    }

    html.pe-dark a:not(.btn),
    .pe-dark a:not(.btn) {
        color: #000 !important;
    }
}

/* —— Comprovante de dispensação (modelo Imagem 2 / CAF) —— */
.pe-comprovante-page {
    background: #e9ecef;
    min-height: 100vh;
}

.pe-comprovante {
    background: #fff;
    max-width: 860px;
    margin: 1rem auto;
    padding: 0.85rem 1.1rem 1.75rem;
    color: #000;
    font-family: Arial, Helvetica, "Source Sans 3", sans-serif;
    font-size: 11.5px;
    line-height: 1.35;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}

.pe-comprovante-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid #222;
}

.pe-comprovante-logo {
    flex: 0 0 auto;
    display: block;
    line-height: 0;
}

.pe-comprovante-logo-left {
    width: 210px;
    max-width: 28%;
}

.pe-comprovante-logo-right {
    width: 92px;
    max-width: 14%;
}

.pe-comprovante-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
    image-rendering: auto;
}

.pe-comprovante-logo-fallback {
    width: 78px;
    height: 78px;
    border-radius: 8px;
    border: 2px solid #1a5f9e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #1a5f9e;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.15;
}

.pe-comprovante-logo-pref {
    border-color: #1b6a3a;
    color: #1b6a3a;
    font-size: 0.62rem;
    border-radius: 50%;
}

.pe-comprovante-org {
    flex: 1 1 auto;
    text-align: center;
    font-weight: 700;
    line-height: 1.3;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    min-width: 0;
}

.pe-comprovante-titulo {
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.28rem 0;
    margin: 0.45rem 0 0.15rem;
}

.pe-comprovante-titulo-sub {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 0 0 0.55rem;
    color: #333;
}

.pe-comprovante-dados {
    margin-bottom: 0.55rem;
}

.pe-comp-row {
    display: grid;
    gap: 0.15rem 0.85rem;
    margin-bottom: 0.12rem;
}

.pe-comp-row-2 {
    grid-template-columns: 1fr 1fr;
}

.pe-comp-row-3 {
    grid-template-columns: 1.4fr 0.8fr 1fr;
}

.pe-comp-row-4 {
    grid-template-columns: 0.9fr 1.2fr 1fr 1.4fr;
}

.pe-comp-full {
    grid-column: 1 / -1;
}

.pe-comp-span2 {
    grid-column: span 2;
}

.pe-comp-label {
    font-weight: 700;
}

.pe-comprovante-itens {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.35rem;
    font-size: 11px;
}

.pe-comprovante-itens th,
.pe-comprovante-itens td {
    border: 0;
    border-bottom: 1px solid #c8c8c8;
    padding: 0.22rem 0.3rem;
    vertical-align: top;
}

.pe-comprovante-itens thead th {
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
    font-weight: 700;
    white-space: nowrap;
}

.pe-comprovante-itens .col-cod {
    width: 12%;
    text-align: left;
}

.pe-comprovante-itens .col-desc {
    width: 42%;
    text-align: left;
}

.pe-comprovante-itens .col-unid {
    width: 8%;
    text-align: center;
}

.pe-comprovante-itens .col-qtd,
.pe-comprovante-itens .col-vu,
.pe-comprovante-itens .col-vt {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pe-comprovante-itens .col-qtd { width: 12%; }
.pe-comprovante-itens .col-vu { width: 13%; }
.pe-comprovante-itens .col-vt { width: 13%; }

.pe-comprovante-total {
    text-align: right;
    font-weight: 700;
    font-size: 0.92rem;
    margin-top: 0.65rem;
}

.pe-comprovante-assinatura {
    margin-top: 2.4rem;
    text-align: center;
}

.pe-comprovante-linha {
    width: 52%;
    margin: 0 auto 0.3rem;
    border-top: 1px solid #222;
}

.pe-comprovante-assinatura-nome {
    font-size: 0.82rem;
    font-weight: 600;
}

@media print {
    .pe-comprovante-page .pe-no-print {
        display: none !important;
    }

    .pe-comprovante {
        max-width: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .pe-comprovante-logo img {
        width: 100%;
        height: auto;
        max-height: none;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pe-comprovante-logo-left {
        width: 200px;
        max-width: 28%;
    }

    .pe-comprovante-logo-right {
        width: 88px;
        max-width: 14%;
    }
}

.pe-estoque-scroll {
    max-height: calc(100vh - 14rem);
    overflow: auto;
}

.pe-estoque-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.pe-estoque-lotes-col {
    width: 3.25rem;
    white-space: nowrap;
}

.pe-estoque-num {
    font-variant-numeric: tabular-nums;
}

.pe-estoque-val-vencido {
    background: #fdecea;
    color: #b42318;
    font-weight: 600;
}

.pe-estoque-val-alerta {
    background: #fff8e1;
    color: #8a5a00;
    font-weight: 600;
}

html.pe-dark .pe-estoque-val-vencido,
.pe-dark .pe-estoque-val-vencido {
    background: rgba(180, 35, 24, 0.28);
    color: #ffb4ab;
}

html.pe-dark .pe-estoque-val-alerta,
.pe-dark .pe-estoque-val-alerta {
    background: rgba(180, 130, 0, 0.28);
    color: #ffe08a;
}

.pe-estoque-lotes-btn {
    padding: 0.15rem 0.4rem;
    line-height: 1;
}

.pe-estoque-lotes-modal .modal-content {
    border: 1px solid var(--pe-border);
    border-radius: 0.5rem;
}

.pe-estoque-lotes-modal .modal-header {
    background: var(--pe-input);
    border-bottom-color: var(--pe-border);
}

.pe-estoque-lotes-mini {
    font-size: 0.875rem;
}

.pe-estoque-lotes-mini thead th {
    background: #e8eef5;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.pe-min-w-0 {
    min-width: 0;
}

html.pe-dark .pe-estoque-lotes-modal .modal-content,
.pe-dark .pe-estoque-lotes-modal .modal-content {
    border-color: #2c3a4d;
    background: #1a2330;
}

html.pe-dark .pe-estoque-lotes-modal .modal-header,
.pe-dark .pe-estoque-lotes-modal .modal-header {
    background: #222d3d;
    border-bottom-color: #2c3a4d;
}

html.pe-dark .pe-estoque-lotes-mini thead th,
.pe-dark .pe-estoque-lotes-mini thead th {
    background: #2a3648;
}

.btn-pe-ajuste {
    background: #9a3412;
    border: 1px solid #7c2d12;
    color: #fff;
    font-weight: 600;
}

.btn-pe-ajuste:hover,
.btn-pe-ajuste:focus {
    background: #7c2d12;
    border-color: #7c2d12;
    color: #fff;
}

.btn-pe-ajuste:active {
    background: #6b2710;
    border-color: #6b2710;
    color: #fff;
}

.pe-nav-icon {
    margin-right: 0.35rem;
    font-size: 0.95em;
    opacity: 0.95;
    vertical-align: -0.1em;
}

.pe-entrada-card {
    border: 1px solid var(--pe-border);
    border-radius: 0.5rem;
    background: var(--pe-card, #fff);
    overflow: hidden;
}

.pe-entrada-card-header {
    background: var(--pe-input);
    border-bottom: 1px solid var(--pe-border);
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--pe-primary-dark);
    padding: 0.65rem 1rem;
}

.pe-ac-search {
    position: relative;
}

.pe-ac-search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 2;
}

.pe-ac-search-input {
    padding-left: 2rem !important;
}

.pe-risco-info {
    margin-left: 0.2rem;
    color: var(--pe-primary);
    cursor: help;
    font-size: 0.9em;
}

.table.pe-table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table.pe-table-hover tbody tr:hover {
    background-color: #e8eef5;
}

.pe-estoque-unid-col {
    width: 72px;
    max-width: 80px;
}

.pe-estoque-unid {
    font-size: 0.75rem !important;
    padding: 0.2rem 0.35rem !important;
}

.pe-estoque-entrada th {
    white-space: nowrap;
    font-size: 0.85rem;
}

.pe-risco-badge {
    display: inline-block;
    min-width: 3.2rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
}

.pe-risco-baixo {
    background: #d1e7dd;
    color: #0f5132;
}

.pe-risco-medio {
    background: #fff3cd;
    color: #664d03;
}

.pe-risco-alto {
    background: #f8d7da;
    color: #842029;
}

.pe-estoque-ajuste-preview {
    min-height: 1.5rem;
}

html.pe-dark .btn-pe-ajuste,
.pe-dark .btn-pe-ajuste {
    background: #c2410c;
    border-color: #9a3412;
    color: #fff;
}

html.pe-dark .btn-pe-ajuste:hover,
.pe-dark .btn-pe-ajuste:hover {
    background: #9a3412;
    color: #fff;
}

html.pe-dark .pe-entrada-card,
.pe-dark .pe-entrada-card {
    background: #1a2330;
    border-color: #2c3a4d;
}

html.pe-dark .pe-entrada-card-header,
.pe-dark .pe-entrada-card-header {
    background: #222d3d;
    border-bottom-color: #2c3a4d;
    color: #e8eef5;
}

html.pe-dark .pe-ac-search-icon,
.pe-dark .pe-ac-search-icon {
    color: #9aa8b8;
}

html.pe-dark .pe-risco-info,
.pe-dark .pe-risco-info {
    color: #7dcea0;
}

html.pe-dark .table.pe-table-hover tbody tr:hover,
.pe-dark .table.pe-table-hover tbody tr:hover {
    background-color: #243142;
}

/* Dashboard — gráficos de pizza em tamanho padrão + legendas L/R */
.pe-dashboard-pie-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem 0.75rem;
    width: 100%;
}

.pe-dashboard-pie {
    position: relative;
    width: 200px;
    height: 200px;
    max-width: 100%;
    margin: 0 auto;
}

.pe-dashboard-pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.25;
    color: #334;
}

.pe-dashboard-pie-legend-left {
    text-align: right;
    align-items: flex-end;
}

.pe-dashboard-pie-legend-right {
    text-align: left;
    align-items: flex-start;
}

.pe-dashboard-pie-legend li {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    max-width: 100%;
}

.pe-dashboard-pie-legend-left li {
    flex-direction: row-reverse;
}

.pe-dashboard-pie-swatch {
    flex: 0 0 auto;
    width: 0.65rem;
    height: 0.65rem;
    margin-top: 0.2rem;
    border-radius: 2px;
}

.pe-dashboard-pie-label {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pe-dashboard-pie-label em {
    font-style: normal;
    color: #6c757d;
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .pe-dashboard-pie-wrap {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .pe-dashboard-pie-legend-left,
    .pe-dashboard-pie-legend-right {
        text-align: left;
        align-items: flex-start;
        width: 100%;
        max-width: 280px;
    }

    .pe-dashboard-pie-legend-left li {
        flex-direction: row;
    }

    .pe-dashboard-pie {
        order: -1;
        width: 180px;
        height: 180px;
    }
}

/* —— Matriz Odontológica (sistema visual separado da CAF) —— */
.pe-body.pe-odonto {
    --pe-primary: #0d6e8c;
    --pe-primary-mid: #0a5a73;
    --pe-primary-dark: #084556;
    --pe-accent: #3db8d9;
    --pe-bg: #eef5f8;
}

.pe-body.pe-odonto .pe-topbar {
    background: linear-gradient(90deg, var(--pe-primary) 0%, var(--pe-primary-mid) 55%, var(--pe-primary-dark) 100%);
}

.pe-body.pe-odonto .pe-topbar-inner {
    border-top-color: var(--pe-accent);
}

.pe-body.pe-odonto .btn-primary {
    --bs-btn-bg: #0d6e8c;
    --bs-btn-border-color: #0d6e8c;
    --bs-btn-hover-bg: #0a5a73;
    --bs-btn-hover-border-color: #0a5a73;
    --bs-btn-active-bg: #084556;
    --bs-btn-active-border-color: #084556;
}

.pe-body.pe-odonto .btn-success {
    --bs-btn-bg: #1a8a6a;
    --bs-btn-border-color: #1a8a6a;
    --bs-btn-hover-bg: #157a5c;
    --bs-btn-hover-border-color: #157a5c;
}

html.pe-dark body.pe-body.pe-odonto,
.pe-dark.pe-odonto {
    --pe-bg: #0f1318;
    --pe-card: #161f2a;
    background: #0f1318;
}

html.pe-dark body.pe-odonto .page-item.active .page-link,
.pe-dark.pe-odonto .page-item.active .page-link {
    background-color: #0d6e8c;
    border-color: #0d6e8c;
    color: #fff;
}

html.pe-dark body.pe-odonto .form-check-input:checked,
.pe-dark.pe-odonto .form-check-input:checked {
    background-color: #0d6e8c;
    border-color: #0d6e8c;
}

html.pe-dark body.pe-odonto .btn-outline-success:hover,
.pe-dark.pe-odonto .btn-outline-success:hover {
    background: #1a8a6a;
    border-color: #1a8a6a;
}

.pe-context-bar {
    background: #e8eef5;
    border-bottom: 1px solid #d0dae6;
}
.pe-scope-badge {
    display: inline-flex;
    align-items: center;
    background: #dbeafe;
    color: #1e3a8a;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
}
.pe-scope-badge-matriz {
    background: #dcfce7;
    color: #166534;
}
html.pe-dark .pe-context-bar,
.pe-dark .pe-context-bar {
    background: #1e293b;
    border-bottom-color: #334155;
}
html.pe-dark .pe-scope-badge,
.pe-dark .pe-scope-badge {
    background: #1e3a8a;
    color: #dbeafe;
}
html.pe-dark .pe-scope-badge-matriz,
.pe-dark .pe-scope-badge-matriz {
    background: #14532d;
    color: #bbf7d0;
}

@keyframes pe-pulse-urgent {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.35); }
    50% { box-shadow: 0 0 0 7px rgba(220, 53, 69, 0); }
}
.pe-card-stat-danger {
    border: 1px solid #f1aeb5 !important;
    background: linear-gradient(180deg, #fff5f5 0%, #fff 70%) !important;
    animation: pe-pulse-urgent 2.2s ease-in-out infinite;
}
html.pe-dark .pe-card-stat-danger,
.pe-dark .pe-card-stat-danger {
    background: linear-gradient(180deg, rgba(220, 53, 69, 0.22) 0%, transparent 70%) !important;
    border-color: #9b2c2c !important;
}

.pe-fab-ajuste {
    position: fixed;
    right: 1.2rem;
    bottom: 1.2rem;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 3rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    background: #9a3412;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(154, 52, 18, 0.35);
}
.pe-fab-ajuste:hover,
.pe-fab-ajuste:focus {
    background: #7c2d12;
    color: #fff;
}
.pe-chart-compact,
.pe-bar-wrap {
    min-height: 220px;
    position: relative;
}
.pe-bar-wrap canvas {
    max-height: 260px;
}
.pe-dashboard-empty {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pe-dashboard-empty-icon {
    font-size: 1.85rem;
    color: #adb5bd;
}
.pe-table-alert thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    background: #f8fafc;
    border-bottom-width: 1px;
}
.pe-badge-critico {
    background: #dc3545;
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.35em 0.7em;
}
.pe-alert-grid {
    border-radius: 12px;
}
html.pe-dark .pe-table-alert thead th,
.pe-dark .pe-table-alert thead th {
    background: #1e293b;
    color: #94a3b8;
}

.pe-auto-card {
    border-radius: 0.85rem;
}
.pe-auto-on {
    border-left: 4px solid #198754;
}
.pe-auto-off {
    border-left: 4px solid #94a3b8;
}
.pe-auto-switch .form-check-input {
    width: 2.75rem;
    height: 1.4rem;
    cursor: pointer;
    margin-top: 0.15rem;
}
.pe-auto-switch .form-check-label {
    padding-left: 0.15rem;
}
html.pe-dark .pe-auto-off,
.pe-dark .pe-auto-off {
    border-left-color: #64748b;
}


