@import url("../fonts/barlow.css");

/* ===================== VARIÁVEIS ===================== */
:root {
    --cor-fundo-topo: #373799;
    --bs-body-bg: #eef0f8;
    --cor-menu-topo-bg: #fff;
    --cor-padrao-letras: #373C37;
    --cor-padrao-letras-hover: #3333ca;
    --cor-rodape: #1d1d66;
    --cor-fundo-card: #fff;
    --cor-fundo-card-header: rgba(0,0,0,.02);
    --borda-card-header: 1px solid rgba(0,0,0,.08);
    --cor-accent: #373799;
    --cor-accent-light: rgba(55, 55, 153, 0.08);
    --radius-card: 10px;
    --shadow-card: 0 2px 8px rgba(55,55,153,.08), 0 1px 3px rgba(0,0,0,.06);
    --shadow-card-hover: 0 8px 24px rgba(55,55,153,.14), 0 2px 8px rgba(0,0,0,.08);
    --transition-base: all .22s ease;
}

/* ===================== RESET / BASE ===================== */
*, ::after, ::before { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    font-family: 'Barlow', 'Segoe UI', Arial, sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.6;
    background-color: var(--bs-body-bg);
    color: var(--cor-padrao-letras);
}

main { flex: 1 0 auto; }

a { transition: color .18s ease; }

/* ===================== HEADER ===================== */
header {
    width: 100%;
    z-index: 999;
    position: sticky;
    top: -1px;
}

/* Barra superior (roxo) */
.bar_top {
    background: var(--cor-fundo-topo);
    color: #b9b9db;
    position: relative;
    z-index: 4;
    height: 40px;
}

.bar_top h1 {
    font-family: 'Barlow', Arial, sans-serif;
    text-transform: uppercase;
    font-size: 20px;
    color: #fff;
    margin: 0 40px 0 0;
    font-weight: 800;
    letter-spacing: 2px;
}

.bar_top .logo {
    position: absolute;
    top: 18px;
    max-width: 70px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,.4));
    transition: transform .2s ease;
}

.bar_top .logo:hover { transform: scale(1.05); }

.bar_top .navbar { padding: 0.3rem 0; }
.bar_top .navbar .nav-item { padding: 0.4rem 0.4rem; margin: 0 0.3rem; }
.bar_top .navbar .nav-item .nav-link {
    padding: 0;
    color: rgba(255,255,255,.85);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .3px;
    transition: color .18s;
}
.bar_top .navbar .nav-item .nav-link:hover { color: #fff; }

.bar_top .navbar .dropdown-menu {
    background-color: #2e2e8a !important;
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    padding: 6px 0;
    margin-top: 6px !important;
}
.bar_top .navbar .dropdown-menu a { padding: 9px 20px; color: rgba(255,255,255,.9); font-size: 13px; }
.bar_top .navbar .dropdown-menu a:hover { color: #fff; background-color: rgba(255,255,255,.1) !important; }
.bar_top .dropdown-toggle::after { display: none; }

/* Menu bar (branco) */
.menu {
    background-color: var(--cor-menu-topo-bg);
    position: relative;
    z-index: 3;
    box-shadow: 0 2px 12px rgba(55,55,153,.1), 0 1px 3px rgba(0,0,0,.06);
    border-bottom: 2px solid rgba(55,55,153,.06);
}

.menu .navbar { padding: 0; }

.menu .nav-item {
    position: relative;
    margin: 0;
    max-height: 44px;
    line-height: 44px;
    width: fit-content;
}

.menu .nav-item .nav-link {
    color: var(--cor-padrao-letras);
    font-size: 14.5px;
    font-weight: 700;
    padding: 0 2px;
    position: relative;
}

.menu .nav-item .nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 2px;
    background: var(--cor-accent);
    transform: scaleX(0);
    transition: transform .2s ease;
    border-radius: 2px 2px 0 0;
}

.menu .nav-item:hover .nav-link { color: var(--cor-accent); }
.menu .nav-item:hover .nav-link::after,
.menu .nav-item .nav-link.active::after { transform: scaleX(1); }
.menu .nav-item .nav-link.active { color: var(--cor-accent); }

.menu .dropdown-menu {
    background-color: #1e1e6a;
    border: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 8px 0;
    min-width: 200px;
    margin-top: 0;
}

.menu .dropdown-menu .dropdown-item {
    padding: 10px 18px;
    color: rgba(255,255,255,.9);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, padding-left .15s;
}

.menu .dropdown-menu .dropdown-item:hover {
    background-color: var(--cor-fundo-topo) !important;
    color: #fff;
    padding-left: 24px;
}

.menu .dropdown-menu .dropdown-item i {
    width: 18px;
    opacity: .8;
}

.menu .dropdown-toggle::after { display: none; }
.menu .dropdown-toggle .fa-chevron-down {
    font-size: 10px;
    margin-left: 5px;
    opacity: .6;
    transition: transform .2s;
}
.menu .nav-item.show .fa-chevron-down { transform: rotate(180deg); }

/* Mobile bar */
.bar_top_mobile {
    background: var(--cor-fundo-topo);
    color: #fff;
    min-height: 44px;
}

.bar_top_mobile h1 {
    font-size: 18px;
    margin: 0;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 44px;
}

/* Título do sistema */
.titulo-sistema {
    font-family: 'Barlow', "Segoe UI", Arial, sans-serif;
    color: var(--cor-padrao-letras);
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: .5px;
    opacity: .7;
    text-transform: uppercase;
    padding: 6px 0 4px;
}

/* ===================== CARDS ===================== */
.card {
    background-color: var(--cor-fundo-card);
    border: none;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: var(--transition-base);
}

.card-header {
    background-color: var(--cor-fundo-card-header);
    border-bottom: var(--borda-card-header);
    border-radius: var(--radius-card) var(--radius-card) 0 0 !important;
}

.card-custom {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: var(--cor-fundo-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border: none;
    border-left: 3px solid transparent;
    transition: var(--transition-base);
}

.card-custom:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

.card.card-custom > .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 1.25rem;
    min-height: 60px;
    background-color: transparent;
    border-bottom: var(--borda-card-header);
}

@media (min-width: 768px) {
    .card.card-custom > .card-header { min-height: 66px; }
}

.card.card-custom > .card-header .card-title {
    display: flex;
    align-items: center;
    margin: 0;
    gap: .6rem;
}

.card.card-custom > .card-header .card-title .card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--cor-accent-light);
    color: var(--cor-accent);
    flex-shrink: 0;
}

.card.card-custom > .card-header .card-title .card-icon i {
    font-size: 1rem;
}

.card.card-custom > .card-header .card-title .card-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--cor-padrao-letras);
    letter-spacing: .1px;
}

.card.card-custom > .card-body { padding: 1.25rem; }

.card.card-custom > .card-footer {
    background: transparent;
    border-top: var(--borda-card-header);
    padding: .85rem 1.25rem;
    border-radius: 0 0 var(--radius-card) var(--radius-card) !important;
}

/* Card com accent colorido */
.card-accent-primary   { border-left-color: var(--cor-accent); }
.card-accent-success   { border-left-color: #3cb521; }
.card-accent-warning   { border-left-color: #f59e0b; }
.card-accent-danger    { border-left-color: #ef4444; }
.card-accent-secondary { border-left-color: #64748b; }

/* KPI / Stats card */
.card-stat {
    border: none;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1.25rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    transition: var(--transition-base);
    overflow: hidden;
    position: relative;
}

.card-stat:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.card-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    border-radius: 10px 0 0 10px;
}

.card-stat.stat-primary::before   { background: var(--cor-accent); }
.card-stat.stat-success::before   { background: #3cb521; }
.card-stat.stat-warning::before   { background: #f59e0b; }
.card-stat.stat-danger::before    { background: #ef4444; }
.card-stat.stat-info::before      { background: #0ea5e9; }

.card-stat .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: rgba(55,55,153,.1); color: var(--cor-accent); }
.stat-success .stat-icon { background: rgba(60,181,33,.1); color: #3cb521; }
.stat-warning .stat-icon { background: rgba(245,158,11,.1); color: #d97706; }
.stat-danger .stat-icon  { background: rgba(239,68,68,.1);  color: #ef4444; }
.stat-info .stat-icon    { background: rgba(14,165,233,.1);  color: #0ea5e9; }

.card-stat .stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
    color: var(--cor-padrao-letras);
}

.card-stat .stat-label {
    font-size: .78rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 3px;
}

.card-stat .stat-delta {
    font-size: .75rem;
    font-weight: 600;
    margin-top: 2px;
}

/* Card botão (acesso rápido) */
.card-botao {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 110px;
    padding: 1.1rem .8rem;
    text-align: center;
    transition: var(--transition-base);
    user-select: none;
    text-decoration: none;
    background-color: #fff;
    border: none;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    gap: .5rem;
    position: relative;
    overflow: hidden;
}

.card-botao::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--cor-accent-light);
    opacity: 0;
    transition: opacity .2s;
}

.card-botao:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-3px);
    color: var(--cor-accent);
}

.card-botao:hover::before { opacity: 1; }

.card-botao .botao-icon {
    font-size: 1.7rem;
    transition: transform .22s ease;
}

.card-botao:hover .botao-icon { transform: scale(1.12); }

.card-botao .botao-label {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--cor-padrao-letras);
    transition: color .2s;
}

.card-botao:hover .botao-label { color: var(--cor-accent); }

.card-botao .adesivo {
    position: absolute;
    top: 8px;
    right: 0;
    border-radius: .25rem 0 0 .25rem;
    font-size: .65rem;
}

.card-botao-desabilitado {
    cursor: not-allowed;
    background: #f5f5f5;
    opacity: .65;
}

.card-botao-desabilitado:hover {
    transform: none !important;
    box-shadow: var(--shadow-card) !important;
}

/* ===================== BREADCRUMB ===================== */
.breadcrumb {
    background: transparent;
    padding: .6rem 0;
    margin-bottom: .5rem;
    font-size: .8rem;
}

.breadcrumb-item { font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.breadcrumb-item + .breadcrumb-item::before { color: #aaa; }
.breadcrumb-item:not(.active) a { color: #666 !important; text-decoration: none; }
.breadcrumb-item:not(.active) a:hover { color: var(--cor-accent) !important; }
.breadcrumb-item.active { color: var(--cor-accent); text-decoration: underline; font-weight: 700; }

/* ===================== BOTÕES ===================== */
.btn { font-weight: 600; letter-spacing: .2px; border-radius: 7px; transition: var(--transition-base); }
.btn-primary {
    background: linear-gradient(135deg, #4040b8 0%, var(--cor-accent) 100%);
    border-color: transparent;
    color: #fff;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--cor-accent) 0%, #2525a0 100%);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(55,55,153,.35);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: #6c757d; border-color: transparent; }
.btn-secondary:hover { background: #5a6268; transform: translateY(-1px); }

.btn-outline-primary { border-color: var(--cor-accent); color: var(--cor-accent); }
.btn-outline-primary:hover {
    background: var(--cor-accent);
    border-color: var(--cor-accent);
    box-shadow: 0 4px 12px rgba(55,55,153,.25);
    transform: translateY(-1px);
}

.btn-sm { border-radius: 6px; font-size: .8rem; }
.btn-lg { border-radius: 9px; font-size: 1rem; padding: .7rem 1.5rem; }

/* ===================== FORMULÁRIOS ===================== */
.form-control, .form-select {
    border: 1.5px solid #dde0ea;
    border-radius: 7px;
    font-size: .92rem;
    padding: .5rem .85rem;
    transition: border-color .18s, box-shadow .18s;
    background-color: #fff;
    color: var(--cor-padrao-letras);
}

.form-control:focus, .form-select:focus {
    border-color: var(--cor-accent);
    box-shadow: 0 0 0 3px rgba(55,55,153,.12);
    outline: none;
}

.form-control-plaintext {
    border-bottom: 1.5px solid #e8eaf0;
    padding: .4rem 0;
    font-size: .92rem;
    color: #555;
    background: transparent;
}

.form-label {
    font-weight: 600;
    font-size: .82rem;
    letter-spacing: .3px;
    color: #555;
    text-transform: uppercase;
    margin-bottom: .3rem;
}

.form-check-input:checked {
    background-color: var(--cor-accent);
    border-color: var(--cor-accent);
}

.form-section-title {
    font-size: .9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--cor-accent);
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--cor-accent-light);
    margin-bottom: .5rem;
}

.field-validation-error {
    width: 100%;
    margin-top: .25rem;
    font-size: .82em;
    color: #dc3545;
}

/* ===================== TABELA ===================== */
.table { font-size: .88rem; }
.table thead th {
    background: linear-gradient(180deg, #f8f9ff 0%, #f1f2fb 100%);
    color: #444;
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    border-bottom: 2px solid #e0e3f0;
    padding: .75rem 1rem;
    white-space: nowrap;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover td { background-color: rgba(55,55,153,.035); }
.table tbody td { padding: .65rem 1rem; vertical-align: middle; border-color: #f0f1f7; }

/* Badge de status */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .28rem .7rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3px;
}
.badge-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge-status.ativo   { background: rgba(60,181,33,.1);  color: #2d8f14; }
.badge-status.inativo { background: rgba(239,68,68,.1);  color: #c0392b; }
.badge-status.pendente{ background: rgba(245,158,11,.1); color: #b45309; }

/* ===================== ALERTS ===================== */
.alert {
    border: none;
    border-radius: 8px;
    border-left: 4px solid transparent;
    font-size: .9rem;
    padding: .85rem 1rem;
}
.alert-primary   { background: #eef0ff; border-left-color: var(--cor-accent); color: #2d2da0; }
.alert-success   { background: #edfbea; border-left-color: #3cb521; color: #1f6e0d; }
.alert-warning   { background: #fffbeb; border-left-color: #f59e0b; color: #92400e; }
.alert-danger    { background: #fff1f1; border-left-color: #ef4444; color: #991b1b; }
.alert-secondary { background: #f1f3f7; border-left-color: #64748b; color: #374151; }

/* ===================== FOOTER ===================== */
footer.footer-main {
    flex-shrink: 0;
    background: linear-gradient(135deg, #1d1d66 0%, #252580 100%);
    font-family: 'Barlow', Arial, sans-serif;
    color: rgba(255,255,255,.9);
}

.footer-bar {
    flex-shrink: 0;
    background: linear-gradient(90deg, #1a1a5a 0%, var(--cor-rodape) 100%);
    font-family: 'Barlow', Arial, sans-serif;
    font-size: .85rem;
    padding: .6rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255,255,255,.8);
}

footer.footer-bar { flex-shrink: 0; }

#enderecos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (min-width: 991px) {
    #enderecos {
        display: flex;
        flex-direction: row;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 2.5rem;
    }
}

footer .address { font-size: .75rem; color: rgba(255,255,255,.85); }
footer .address h6 {
    text-transform: uppercase;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .8px;
    color: #fff;
    margin-bottom: .6rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid rgba(255,255,255,.15);
}

footer .logo_rodape { margin-bottom: 2rem; }

footer .footer-help-btn {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.9);
    border-radius: 20px;
    padding: .25rem .8rem;
    font-size: .8rem;
    font-weight: 600;
    transition: background .18s;
}
footer .footer-help-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ===================== LOGIN ===================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d1d66 0%, var(--cor-fundo-topo) 50%, #4545b0 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 80%, rgba(255,255,255,.04) 0%, transparent 50%),
                      radial-gradient(circle at 80% 20%, rgba(255,255,255,.06) 0%, transparent 50%);
}

.login-card {
    width: 100%;
    max-width: 430px;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
    border: none;
    position: relative;
    z-index: 1;
    animation: fadeInUp .4s ease;
}

.login-card .card-header-login {
    background: linear-gradient(135deg, var(--cor-fundo-topo) 0%, #2525a0 100%);
    border-radius: 16px 16px 0 0;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card .card-header-login::after {
    content: '';
    position: absolute;
    bottom: -20px; left: 0; right: 0;
    height: 40px;
    background: #fff;
    border-radius: 50% 50% 0 0 / 20px;
}

.login-card .login-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    padding: 10px;
    margin-bottom: .75rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.3));
}

.login-card .card-body { padding: 2rem 1.75rem 1.5rem; }
.login-card .card-footer { background: #f8f9ff; border-radius: 0 0 16px 16px !important; padding: 1rem 1.75rem; }

/* ===================== PÁGINAS DE ERRO ===================== */
.page-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1rem;
    text-align: center;
}

.page-state .state-icon {
    width: 96px; height: 96px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.page-state.state-danger .state-icon  { background: rgba(239,68,68,.1); color: #ef4444; }
.page-state.state-warning .state-icon { background: rgba(245,158,11,.1); color: #f59e0b; }

.page-state h3 { font-weight: 700; margin-bottom: .5rem; }
.page-state p  { color: #666; max-width: 440px; line-height: 1.7; }

/* ===================== MOBILE ===================== */
@media only screen and (max-width: 991px) {
    .container { width: 100%; max-width: inherit !important; }
    .navbar-toggler { border: none; padding: .3rem; }
}

/* ===================== UTILITÁRIOS ===================== */
.section-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.5rem 0 1rem;
}
.section-divider .divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #e0e3f0 0%, transparent 100%);
}
.section-divider .divider-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--cor-accent);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* Skeleton / loading placeholder */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
@keyframes fadeInUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }

.fade-in { animation: fadeInUp .3s ease; }

/* Scrollbar sutil */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f0f1f7; }
::-webkit-scrollbar-thumb { background: #c5c8e0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cor-accent); }

/* ===================== ERROR PAGES ===================== */
.error-page-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem 2.5rem;
}

.error-code-display {
    font-size: clamp(5rem, 18vw, 9rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -4px;
    background: linear-gradient(135deg, var(--color-a, #ef4444) 0%, var(--color-b, #b91c1c) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: .25rem;
    position: relative;
    user-select: none;
}

.error-code-display.code-4xx {
    --color-a: #f59e0b;
    --color-b: #d97706;
}
.error-code-display.code-401 {
    --color-a: #8b5cf6;
    --color-b: #6d28d9;
}
.error-code-display.code-403 {
    --color-a: #ef4444;
    --color-b: #b91c1c;
}
.error-code-display.code-404 {
    --color-a: #3b82f6;
    --color-b: #1d4ed8;
}
.error-code-display.code-408, .error-code-display.code-504 {
    --color-a: #f59e0b;
    --color-b: #92400e;
}
.error-code-display.code-429 {
    --color-a: #f97316;
    --color-b: #c2410c;
}
.error-code-display.code-5xx {
    --color-a: #ef4444;
    --color-b: #991b1b;
}
.error-code-display.code-503 {
    --color-a: #6366f1;
    --color-b: #3730a3;
}

.error-icon-wrap {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 1.25rem;
    position: relative;
}

.error-icon-wrap::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed currentColor;
    opacity: .2;
    animation: spin 12s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-icon-wrap.icon-danger    { background: rgba(239,68,68,.1);    color: #ef4444; }
.error-icon-wrap.icon-warning   { background: rgba(245,158,11,.1);   color: #d97706; }
.error-icon-wrap.icon-purple    { background: rgba(139,92,246,.1);   color: #7c3aed; }
.error-icon-wrap.icon-blue      { background: rgba(59,130,246,.1);   color: #2563eb; }
.error-icon-wrap.icon-indigo    { background: rgba(99,102,241,.1);   color: #4338ca; }
.error-icon-wrap.icon-orange    { background: rgba(249,115,22,.1);   color: #c2410c; }
.error-icon-wrap.icon-secondary { background: rgba(100,116,139,.1);  color: #475569; }

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .5rem;
    color: var(--cor-padrao-letras);
}

.error-subtitle {
    font-size: .95rem;
    color: #777;
    max-width: 480px;
    line-height: 1.7;
    margin-bottom: 1.75rem;
}

.error-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .75rem;
    margin-bottom: 2rem;
}

.error-meta-item {
    padding: .5rem 1.1rem;
    border-radius: 8px;
    background: #f8f9ff;
    border: 1px solid #e8eaf0;
    text-align: center;
    min-width: 110px;
}

.error-meta-item .meta-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 700;
    color: #aaa;
    margin-bottom: 2px;
}

.error-meta-item code {
    font-size: .8rem;
    display: block;
}

/* Card para catálogo de erros */
.error-catalog-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1.1rem;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid #eef0f8;
    transition: var(--transition-base);
    background: #fff;
}

.error-catalog-item:hover {
    border-color: #d0d4ee;
    box-shadow: 0 4px 12px rgba(55,55,153,.08);
    transform: translateX(3px);
    background: #fafbff;
}

.error-catalog-item .cat-code,
.error-catalog-item .error-catalog-code {
    font-size: 1.1rem;
    font-weight: 800;
    min-width: 56px;
    width: 56px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    letter-spacing: -1px;
}

.error-catalog-item .cat-info,
.error-catalog-item .error-catalog-info { flex: 1; }

.error-catalog-item .cat-title,
.error-catalog-item .error-catalog-name { font-size: .88rem; font-weight: 700; color: var(--cor-padrao-letras); }

.error-catalog-item .cat-desc,
.error-catalog-item .error-catalog-desc { font-size: .76rem; color: #999; margin-top:2px; }

.error-catalog-item .cat-arrow,
.error-catalog-item .error-catalog-arrow { color: #ccc; transition: color .15s, transform .15s; }

.error-catalog-item:hover .cat-arrow,
.error-catalog-item:hover .error-catalog-arrow { color: var(--cor-accent); transform: translateX(3px); }

/* ===================== THEME TOGGLE BUTTON ===================== */
.theme-toggle {
    background: rgba(255,255,255,.13);
    border: 1px solid rgba(255,255,255,.22);
    color: rgba(255,255,255,.88);
    border-radius: 20px;
    padding: .22rem .65rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: background .18s, color .18s, border-color .18s;
    line-height: 1;
    font-family: inherit;
}
.theme-toggle:hover { background: rgba(255,255,255,.24); color: #fff; }
.theme-toggle .theme-icon { font-size: .82rem; }
.theme-toggle .theme-label { font-size: .73rem; font-weight: 600; letter-spacing: .2px; }

/* ===================== DARK THEME ===================== */
[data-theme="dark"] {
    --bs-body-bg:          #111827;
    --cor-fundo-card:      #1e2130;
    --cor-fundo-card-header: rgba(255,255,255,.04);
    --borda-card-header:   1px solid rgba(255,255,255,.08);
    --cor-padrao-letras:   #e2e8f0;
    --cor-padrao-letras-hover: #818cf8;
    --cor-menu-topo-bg:    #1a1d2e;
    --cor-rodape:          #0a0a30;
    --cor-accent-light:    rgba(129,140,248,.13);
    --shadow-card:         0 2px 10px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.28);
    --shadow-card-hover:   0 8px 28px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.32);
}

/* Body */
[data-theme="dark"] body { background-color: #111827; color: #e2e8f0; }

/* Header menu bar */
[data-theme="dark"] .menu {
    box-shadow: 0 2px 12px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.22);
    border-bottom-color: rgba(255,255,255,.05);
}
[data-theme="dark"] .menu .nav-item .nav-link { color: #cbd5e1; }
[data-theme="dark"] .menu .nav-item:hover .nav-link,
[data-theme="dark"] .menu .nav-item .nav-link.active { color: #818cf8; }

/* Cards */
[data-theme="dark"] .card { background-color: #1e2130; color: #e2e8f0; }
[data-theme="dark"] .card-stat { background: #1e2130; }
[data-theme="dark"] .card-stat .stat-label { color: #64748b; }
[data-theme="dark"] .card-botao { background: #1e2130; }
[data-theme="dark"] .card-botao .botao-label { color: #e2e8f0; }
[data-theme="dark"] .card-botao-desabilitado { background: #181c2a; }
[data-theme="dark"] .card.card-custom > .card-header { background: transparent; }

/* Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #252840;
    border-color: rgba(255,255,255,.13);
    color: #e2e8f0;
}
[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-select option { color: #4b5563; background: #252840; }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #2d3155;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129,140,248,.18);
}
[data-theme="dark"] .form-label { color: #94a3b8; }
[data-theme="dark"] .form-control-plaintext { border-bottom-color: rgba(255,255,255,.1); color: #94a3b8; }
[data-theme="dark"] .input-group-text {
    background-color: #252840;
    border-color: rgba(255,255,255,.13);
    color: #94a3b8;
}
[data-theme="dark"] .form-check-input:not(:checked) {
    background-color: #252840;
    border-color: rgba(255,255,255,.2);
}
[data-theme="dark"] .form-section-title { border-bottom-color: rgba(129,140,248,.2); }

/* Table */
[data-theme="dark"] .table { color: #e2e8f0; }
[data-theme="dark"] .table thead th {
    background: #252840;
    color: #94a3b8;
    border-bottom-color: rgba(255,255,255,.1);
}
[data-theme="dark"] .table tbody td { border-color: rgba(255,255,255,.05); }
[data-theme="dark"] .table tbody tr:hover td { background-color: rgba(129,140,248,.07); }

/* Badge status */
[data-theme="dark"] .badge-status.ativo    { background: rgba(74,222,128,.13); color: #4ade80; }
[data-theme="dark"] .badge-status.inativo  { background: rgba(248,113,113,.13); color: #f87171; }
[data-theme="dark"] .badge-status.pendente { background: rgba(251,191,36,.13);  color: #fbbf24; }

/* Alerts */
[data-theme="dark"] .alert-primary   { background: rgba(55,55,153,.22); color: #818cf8; border-left-color: #818cf8; }
[data-theme="dark"] .alert-success   { background: rgba(60,181,33,.15);  color: #4ade80; border-left-color: #4ade80; }
[data-theme="dark"] .alert-warning   { background: rgba(245,158,11,.15); color: #fbbf24; border-left-color: #fbbf24; }
[data-theme="dark"] .alert-danger    { background: rgba(239,68,68,.18);  color: #f87171; border-left-color: #f87171; }
[data-theme="dark"] .alert-secondary { background: rgba(100,116,139,.15);color: #94a3b8; border-left-color: #64748b; }

/* Buttons */
[data-theme="dark"] .btn-outline-secondary {
    border-color: rgba(255,255,255,.2);
    color: #94a3b8;
}
[data-theme="dark"] .btn-outline-secondary:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.3);
    color: #e2e8f0;
}
[data-theme="dark"] .btn-outline-primary {
    border-color: #818cf8;
    color: #818cf8;
}
[data-theme="dark"] .btn-outline-primary:hover {
    background: #818cf8;
    border-color: #818cf8;
}
[data-theme="dark"] .btn-warning { color: #111827; }

/* Breadcrumb */
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: #374151; }
[data-theme="dark"] .breadcrumb-item:not(.active) a { color: #64748b !important; }
[data-theme="dark"] .breadcrumb-item:not(.active) a:hover { color: #818cf8 !important; }
[data-theme="dark"] .breadcrumb-item.active { color: #818cf8; }

/* Título do sistema */
[data-theme="dark"] .titulo-sistema { color: #64748b; }

/* Section divider */
[data-theme="dark"] .section-divider .divider-line {
    background: linear-gradient(90deg, rgba(255,255,255,.1) 0%, transparent 100%);
}

/* Error pages */
[data-theme="dark"] .error-meta-item { background: #252840; border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .error-meta-item .meta-label { color: #4b5563; }
[data-theme="dark"] .error-subtitle { color: #94a3b8; }
[data-theme="dark"] .error-title { color: #e2e8f0; }
[data-theme="dark"] .page-state p { color: #94a3b8; }
[data-theme="dark"] .error-icon-wrap.icon-secondary { background: rgba(100,116,139,.15); color: #94a3b8; }

/* Error catalog */
[data-theme="dark"] .error-catalog-item { background: #1e2130; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .error-catalog-item:hover {
    background: #252840;
    border-color: rgba(129,140,248,.3);
    box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
[data-theme="dark"] .error-catalog-item .error-catalog-name { color: #e2e8f0; }
[data-theme="dark"] .error-catalog-item .error-catalog-desc { color: #4b5563; }
[data-theme="dark"] .error-catalog-item .error-catalog-arrow { color: #374151; }
[data-theme="dark"] .error-catalog-item:hover .error-catalog-arrow { color: #818cf8; }

/* Login */
[data-theme="dark"] .login-card { box-shadow: 0 24px 64px rgba(0,0,0,.65); }
[data-theme="dark"] .login-card .card-body { background: #1e2130; }
[data-theme="dark"] .login-card .card-footer { background: #181c2a !important; }
[data-theme="dark"] .login-card .card-header-login::after { background: #1e2130; }

/* Footer */
[data-theme="dark"] .footer-bar {
    background: linear-gradient(90deg, #07072a 0%, #0a0a30 100%);
}

/* Modal */
[data-theme="dark"] .modal-content { background: #1e2130; border-color: rgba(255,255,255,.1); color: #e2e8f0; }
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer { border-color: rgba(255,255,255,.08); }

/* Toast */
[data-theme="dark"] .toast { background: #252840; color: #e2e8f0; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .toast-header { background: #1e2130; color: #94a3b8; border-bottom-color: rgba(255,255,255,.08); }

/* DataTables */
[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background: #252840; color: #e2e8f0; border-color: rgba(255,255,255,.12);
}
[data-theme="dark"] .dataTables_wrapper .dataTables_info { color: #64748b; }
[data-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter label { color: #94a3b8; }
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button { color: #94a3b8 !important; }
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--cor-accent) !important; color: #fff !important; border-color: transparent !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(129,140,248,.15) !important; color: #818cf8 !important;
}

/* Bootstrap utility overrides */
[data-theme="dark"] .text-muted { color: #4b5563 !important; }
[data-theme="dark"] .bg-white   { background: #1e2130 !important; }
[data-theme="dark"] .bg-light   { background: #252840 !important; }
[data-theme="dark"] .border     { border-color: rgba(255,255,255,.1) !important; }
[data-theme="dark"] .text-dark  { color: #e2e8f0 !important; }
[data-theme="dark"] .bg-dark    { background: #0f1117 !important; }

/* Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track { background: #1a1d2e; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #374151; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #818cf8; }

/* Skeleton */
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1e2130 25%, #252840 50%, #1e2130 75%);
    background-size: 200% 100%;
}

/* Progress bar */
[data-theme="dark"] .progress { background: #252840; }

/* Collapse / details panel */
[data-theme="dark"] pre.bg-dark { background: #0a0c14 !important; }

/* Inline-style color patches for error/info panels (can't override inline without !important) */
[data-theme="dark"] [style*="background:#fff8f8"],
[data-theme="dark"] [style*="background:#f8f9ff"],
[data-theme="dark"] [style*="background:#f8f9fa"],
[data-theme="dark"] [style*="background:#fffbeb"],
[data-theme="dark"] [style*="background:#fffbf0"],
[data-theme="dark"] [style*="background:#fff5f5"],
[data-theme="dark"] [style*="background:#f0f4ff"],
[data-theme="dark"] [style*="background:#f1f3fb"] { background: #252840 !important; }
[data-theme="dark"] [style*="border:1px solid #fde8e8"],
[data-theme="dark"] [style*="border:1px solid #e8eaf0"],
[data-theme="dark"] [style*="border:1px solid #e0e3f0"],
[data-theme="dark"] [style*="border:1px solid #fde68a"],
[data-theme="dark"] [style*="border:1px solid #c7d2fe"] { border-color: rgba(255,255,255,.1) !important; }
[data-theme="dark"] [style*="color:#999"],
[data-theme="dark"] [style*="color:#888"],
[data-theme="dark"] [style*="color:#aaa"],
[data-theme="dark"] [style*="color:#666"],
[data-theme="dark"] [style*="color:#555"] { color: #94a3b8 !important; }
[data-theme="dark"] [style*="color:#333"],
[data-theme="dark"] [style*="color:#444"] { color: #e2e8f0 !important; }

/* Additional border overrides (2px variants used in 504.html) */
[data-theme="dark"] [style*="border:2px solid #c7d2fe"],
[data-theme="dark"] [style*="border:2px solid #fecaca"],
[data-theme="dark"] [style*="border:2px solid #fde68a"] { border-color: rgba(255,255,255,.12) !important; }

/* Inline text colors used in specific page panels */
[data-theme="dark"] [style*="color:#78350f"],
[data-theme="dark"] [style*="color:#92400e"] { color: #fbbf24 !important; }
[data-theme="dark"] [style*="color:#666"] { color: #94a3b8 !important; }

/* Stack trace / dev panel inside collapse */
[data-theme="dark"] [style*="background:#f1f3fb"] { background: #1a1d2e !important; }
[data-theme="dark"] [style*="border-color:#e0e3f0"] { border-color: rgba(255,255,255,.08) !important; }
[data-theme="dark"] [style*="color:#666;font-weight:600"] { color: #94a3b8 !important; }

/* ================================================================
   MULTI-MODULE APP LAYOUT
   topbar (fixed, 54px) + sidebar (fixed, 240px) + main-content
================================================================ */

/* App shell — applied to <body> on app pages */
body.app-layout {
    overflow-x: hidden;
    padding: 0;
    /* flex direction stays column; topbar/sidebar are position:fixed */
}

/* ===== TOPBAR ===== */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 54px;
    z-index: 1050;
    background: #373799;
    display: flex;
    align-items: center;
    padding: 0 .85rem;
    gap: .4rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.topbar-toggle {
    width: 36px; height: 36px;
    background: none; border: none; border-radius: 8px;
    color: rgba(255,255,255,.8); font-size: 1rem;
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.topbar-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }

.topbar-brand {
    display: flex; align-items: center; gap: .6rem;
    text-decoration: none; padding: .25rem .5rem;
    border-radius: 8px; transition: background .15s;
}
.topbar-brand:hover { background: rgba(255,255,255,.08); }
.topbar-brand img { height: 30px; filter: drop-shadow(0 2px 5px rgba(0,0,0,.4)); }
.topbar-brand .brand-name {
    font-weight: 800; font-size: .95rem; color: #fff;
    letter-spacing: 1.5px; text-transform: uppercase; line-height: 1.15;
}
.topbar-brand .brand-sub {
    font-size: .66rem; color: rgba(255,255,255,.58);
    letter-spacing: .2px; line-height: 1.15;
}

.topbar-spacer { flex: 1; min-width: 0; }

.topbar-actions { display: flex; align-items: center; gap: .1rem; }

.topbar-btn {
    width: 34px; height: 34px;
    background: none; border: none; border-radius: 8px;
    color: rgba(255,255,255,.78);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: .88rem;
    transition: background .15s, color .15s;
    position: relative; text-decoration: none;
}
.topbar-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

.topbar-badge {
    position: absolute; top: 7px; right: 7px;
    width: 7px; height: 7px; border-radius: 50%;
    background: #ef4444; border: 1.5px solid #373799;
}

.topbar-sep { width: 1px; height: 22px; background: rgba(255,255,255,.18); margin: 0 .3rem; }

.topbar-user {
    display: flex; align-items: center; gap: .5rem;
    padding: .2rem .65rem .2rem .4rem;
    border-radius: 20px; cursor: pointer;
    text-decoration: none; transition: background .15s;
}
.topbar-user:hover { background: rgba(255,255,255,.1); }
.topbar-user .tu-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,.22);
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.topbar-user .tu-name {
    font-size: .78rem; font-weight: 600;
    color: rgba(255,255,255,.9); line-height: 1;
}

/* Theme toggle inside topbar */
.topbar .theme-toggle {
    width: 34px; height: 34px; padding: 0;
    justify-content: center;
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.2);
    border-radius: 8px;
}
.topbar .theme-toggle .theme-label { display: none; }
.topbar .theme-toggle .theme-icon  { font-size: .82rem; }
.topbar .theme-toggle:hover { background: rgba(255,255,255,.2); }

/* ===== SIDEBAR ===== */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 1040;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

.sidebar {
    position: fixed;
    top: 54px; left: 0; bottom: 0;
    width: 240px;
    background: #1e1e5e;
    display: flex; flex-direction: column;
    z-index: 1045;
    transition: width .24s cubic-bezier(.4,0,.2,1),
                transform .24s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid rgba(255,255,255,.05);
    overflow: hidden;
}

/* --- Collapsed (desktop) --- */
body.sidebar-collapsed .sidebar { width: 64px; }
body.sidebar-collapsed .sidebar-group-label { opacity: 0; height: 0 !important; padding: 0 !important; overflow: hidden; }
body.sidebar-collapsed .sidebar-item > span,
body.sidebar-collapsed .sidebar-badge-pill { display: none; }
body.sidebar-collapsed .sidebar-item { justify-content: center; padding: .58rem; }
body.sidebar-collapsed .sidebar-sep { margin: .4rem .75rem; }
body.sidebar-collapsed .sb-user-info  { display: none; }
body.sidebar-collapsed .sidebar-footer { padding: .6rem .4rem; }

/* Tooltip on icon-only mode */
body.sidebar-collapsed .sidebar-item {
    position: relative; overflow: visible;
}
body.sidebar-collapsed .sidebar-item::after {
    content: attr(data-label);
    position: absolute; left: calc(100% + 10px); top: 50%;
    transform: translateY(-50%);
    background: #1e2442; color: #e2e8f0;
    padding: .3rem .75rem; border-radius: 6px;
    font-size: .78rem; font-weight: 600; white-space: nowrap;
    pointer-events: none; opacity: 0;
    transition: opacity .15s;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    z-index: 9999;
}
body.sidebar-collapsed .sidebar-item:hover::after { opacity: 1; }

/* Sidebar nav */
.sidebar-nav {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: .5rem 0 .5rem;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-group { margin-bottom: .1rem; }

.sidebar-group-label {
    font-size: .61rem; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: rgba(255,255,255,.28);
    padding: .85rem 1rem .3rem;
    white-space: nowrap; overflow: hidden;
    transition: opacity .2s, height .24s, padding .24s;
}

.sidebar-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .95rem;
    color: rgba(255,255,255,.65); text-decoration: none;
    font-size: .84rem; font-weight: 500;
    transition: background .15s, color .15s;
    position: relative; overflow: hidden; white-space: nowrap;
}
.sidebar-item i {
    font-size: .88rem; width: 18px; text-align: center;
    flex-shrink: 0; transition: color .15s;
}
.sidebar-item > span { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.sidebar-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.sidebar-item:hover i { color: rgba(255,255,255,.88); }

.sidebar-item.active { background: rgba(129,140,248,.2); color: #fff; }
.sidebar-item.active i { color: #818cf8; }
.sidebar-item.active::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: #818cf8; border-radius: 0 2px 2px 0;
}

.sidebar-badge-pill {
    background: rgba(239,68,68,.9); color: #fff;
    font-size: .6rem; font-weight: 700;
    border-radius: 10px; padding: .1rem .45rem;
    flex-shrink: 0; line-height: 1.4; margin-left: auto;
}

.sidebar-sep {
    height: 1px; background: rgba(255,255,255,.07);
    margin: .5rem 1rem;
}

/* Sidebar footer / user */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: .6rem; flex-shrink: 0;
}
.sidebar-user-btn {
    display: flex; align-items: center; gap: .6rem;
    padding: .45rem .5rem; border-radius: 8px;
    cursor: pointer; transition: background .15s;
    overflow: hidden;
    background: none; border: none; width: 100%;
    text-align: left;
}
.sidebar-user-btn:hover { background: rgba(255,255,255,.07); }
.sb-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.16);
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sb-user-info { overflow: hidden; min-width: 0; }
.sb-user-name {
    font-size: .8rem; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.sb-user-role {
    font-size: .68rem; color: rgba(255,255,255,.45);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 240px;
    padding-top: 54px;
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left .24s cubic-bezier(.4,0,.2,1);
}
body.sidebar-collapsed .main-content { margin-left: 64px; }

/* Page header (sticky sub-header) */
.page-header {
    background: var(--cor-fundo-card);
    border-bottom: var(--borda-card-header);
    padding: .6rem 1.5rem;
    display: flex; align-items: center;
    justify-content: space-between; flex-wrap: wrap; gap: .4rem;
    position: sticky; top: 54px; z-index: 100;
}
.page-header .ph-left { display: flex; flex-direction: column; gap: .1rem; }
.page-header .ph-breadcrumb {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .4px; margin: 0; padding: 0;
    list-style: none; display: flex; gap: .3rem; align-items: center;
    color: #999;
}
.page-header .ph-breadcrumb li + li::before { content: '/'; margin-right: .3rem; color: #ccc; }
.page-header .ph-breadcrumb li:last-child { color: var(--cor-accent); }
.page-header .ph-breadcrumb a { color: #888; text-decoration: none; }
.page-header .ph-breadcrumb a:hover { color: var(--cor-accent); }
.page-header .ph-title {
    font-size: .98rem; font-weight: 700;
    color: var(--cor-padrao-letras); margin: 0; line-height: 1.3;
}
.page-header .ph-actions { display: flex; gap: .4rem; align-items: center; }

/* Page body */
.page-body { flex: 1; padding: 1.25rem 1.5rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-240px) !important; width: 240px !important; }
    .sidebar.open { transform: translateX(0) !important; }
    .main-content { margin-left: 0 !important; }
    .page-body  { padding: 1rem; }
    .page-header { padding: .55rem 1rem; }
    .topbar-user .tu-name { display: none; }
}
@media (max-width: 400px) {
    .page-body { padding: .75rem; }
}

/* ===== DARK THEME — new layout ===== */
[data-theme="dark"] .topbar { background: #1c1c6e; }
[data-theme="dark"] .topbar-badge { border-color: #1c1c6e; }
[data-theme="light"] .topbar-badge { border-color: #373799; }
[data-theme="dark"] .sidebar { background: #12123e; border-right-color: rgba(255,255,255,.04); }
[data-theme="dark"] .page-header { background: var(--cor-fundo-card); border-bottom-color: rgba(255,255,255,.08); }
[data-theme="dark"] .topbar .theme-toggle { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }

/* ===== CHAT ===== */
.chat-wrap {
    display: flex;
    height: calc(100vh - 54px - 57px - 3rem);
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--cor-borda);
    background: var(--cor-fundo-card);
}
.chat-contacts {
    width: 280px; flex-shrink: 0;
    border-right: 1px solid var(--cor-borda);
    display: flex; flex-direction: column; overflow: hidden;
}
.chat-contacts-header {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--cor-borda);
    font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.chat-contacts > .px-2 { flex-shrink: 0; }
.chat-contact-list { overflow-y: auto; flex: 1; }
.chat-contact {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem .9rem; cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid var(--cor-borda);
}
.chat-contact:hover { background: rgba(55,55,153,.06); }
.chat-contact.active { background: rgba(55,55,153,.1); }
.chat-contact-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--cor-accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 700; flex-shrink: 0; position: relative;
}
.chat-contact-online::after {
    content: ''; position: absolute; bottom: 1px; right: 1px;
    width: 9px; height: 9px; border-radius: 50%;
    background: #10b981; border: 2px solid var(--cor-fundo-card);
}
.chat-contact-info { flex: 1; min-width: 0; }
.chat-contact-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-contact-preview { font-size: .73rem; color: var(--cor-texto-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-contact-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; flex-shrink: 0; }
.chat-contact-time { font-size: .68rem; color: var(--cor-texto-muted); }
.chat-unread {
    background: var(--cor-accent); color: #fff;
    border-radius: 10px; font-size: .64rem; font-weight: 700;
    padding: .1em .45em; min-width: 17px; text-align: center;
}

.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.chat-main-header {
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--cor-borda);
    display: flex; align-items: center; gap: .65rem; flex-shrink: 0;
}
.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 1rem; display: flex; flex-direction: column; gap: .7rem;
}
.chat-date-sep {
    text-align: center; font-size: .72rem;
    color: var(--cor-texto-muted); position: relative; margin: .25rem 0;
}
.chat-date-sep span {
    background: var(--cor-fundo-card); padding: 0 .75rem;
    position: relative; z-index: 1;
}
.chat-date-sep::before {
    content: ''; position: absolute; top: 50%; left: 0; right: 0;
    height: 1px; background: var(--cor-borda);
}
.chat-msg { display: flex; gap: .45rem; max-width: 75%; }
.chat-msg.sent { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.recv { align-self: flex-start; }
.chat-msg-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: #e0e3f0; display: flex; align-items: center;
    justify-content: center; font-size: .62rem; font-weight: 700;
    flex-shrink: 0; align-self: flex-end; color: #555;
}
.chat-msg.sent .chat-msg-avatar { background: var(--cor-accent); color: #fff; }
.chat-bubble {
    padding: .5rem .8rem; border-radius: 16px;
    font-size: .85rem; line-height: 1.5;
}
.chat-msg.recv .chat-bubble {
    background: var(--cor-fundo-card);
    border: 1px solid var(--cor-borda);
    border-bottom-left-radius: 4px;
}
.chat-msg.sent .chat-bubble {
    background: var(--cor-accent); color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg-time { font-size: .67rem; color: var(--cor-texto-muted); padding: .1rem .15rem; align-self: flex-end; }
.chat-input-area {
    border-top: 1px solid var(--cor-borda);
    padding: .55rem .8rem;
    display: flex; align-items: flex-end; gap: .4rem; flex-shrink: 0;
}
.chat-input {
    flex: 1; border: 1px solid var(--cor-borda); border-radius: 20px;
    padding: .45rem .9rem; font-size: .86rem;
    background: var(--cor-fundo-card); color: var(--cor-texto);
    resize: none; max-height: 100px; outline: none;
    font-family: inherit; line-height: 1.4;
}
.chat-input:focus { border-color: var(--cor-accent); box-shadow: 0 0 0 3px rgba(55,55,153,.12); }
.chat-send-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--cor-accent); color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: background .15s;
    font-size: .88rem;
}
.chat-send-btn:hover { background: #2d2d85; }

@media (max-width: 600px) {
    .chat-contacts { width: 100%; position: absolute; z-index: 10; height: 100%; display: none; }
    .chat-contacts.show { display: flex; }
}

/* Dark theme chat */
[data-theme="dark"] .chat-msg.recv .chat-bubble { background: rgba(255,255,255,.05); }
[data-theme="dark"] .chat-contact:hover { background: rgba(255,255,255,.04); }
[data-theme="dark"] .chat-contact.active { background: rgba(55,55,153,.25); }
[data-theme="dark"] .chat-msg-avatar { background: rgba(255,255,255,.1); color: #bbb; }

/* ================================================================
   ACESSIBILIDADE DIGITAL — WCAG 2.1 AA
================================================================ */

/* ── Link de saltar para o conteúdo ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 8px;
    z-index: 9999;
    padding: .55rem 1.2rem;
    background: #ffbf00;
    color: #1a1a1a;
    font-weight: 700;
    font-size: .9rem;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    transition: top .15s ease;
}
.skip-link:focus {
    top: 0;
    outline: 3px solid #1a1a1a;
    outline-offset: 2px;
}

/* ── Utilitário para leitores de tela ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.sr-only-focusable:focus { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }

/* ── Anel de foco visível (WCAG 2.4.7 / 2.4.11) ── */
:focus-visible {
    outline: 3px solid #ffbf00 !important;
    outline-offset: 2px !important;
    border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

.sidebar-item:focus-visible {
    outline: 3px solid #ffbf00 !important;
    outline-offset: -3px !important;
    border-radius: 8px;
}
.topbar-btn:focus-visible,
.topbar-toggle:focus-visible,
.topbar-brand:focus-visible,
.theme-toggle:focus-visible {
    outline: 3px solid #ffbf00 !important;
    outline-offset: 3px !important;
    border-radius: 6px;
}
.btn:focus-visible {
    outline: 3px solid var(--cor-accent) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(55,55,153,.25) !important;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--cor-accent) !important;
    box-shadow: 0 0 0 3px rgba(55,55,153,.25) !important;
    outline: 3px solid transparent !important;
}
.form-check-input:focus-visible {
    outline: 3px solid #ffbf00 !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}
a:focus-visible { border-radius: 3px; }

/* ── Contraste em tema escuro ── */
[data-theme="dark"] :focus-visible { outline-color: #ffd54f !important; }

/* ── Alto contraste (Windows / modo forçado) ── */
@media (forced-colors: active) {
    .skip-link           { forced-color-adjust: none; background: Highlight; color: HighlightText; }
    .sidebar-item.active { forced-color-adjust: none; border: 2px solid Highlight; }
    :focus-visible       { outline: 3px solid Highlight !important; }
    .topbar,
    .sidebar             { forced-color-adjust: none; border: 1px solid ButtonText; }
    .badge               { border: 1px solid currentColor; }
}

/* ── Redução de movimento (WCAG 2.3.3) ── */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/* ── aria-busy: indicador de carregamento ── */
[aria-busy="true"] { cursor: wait; opacity: .7; }

/* ── Elementos desabilitados acessíveis ── */
[aria-disabled="true"],
[disabled] { cursor: not-allowed; opacity: .55; }

/* ── Mensagens de status para leitores de tela ── */
[role="status"],
[role="alert"],
[aria-live] { min-height: 0; }

/* ── Tabelas: cabeçalho de escopo visível ── */
th[scope] { font-weight: 700; }

/* ── Breadcrumb: separador acessível ── */
.ph-breadcrumb li + li::before {
    content: '/';
    margin: 0 .3rem;
    color: #ccc;
    aria-hidden: true;
}
[data-theme="dark"] .chat-date-sep span { background: var(--cor-fundo-card); }

/* ================================================================
   ACESSIBILIDADE — TAMANHO DE FONTE
================================================================ */

/* Fonte grande (A+) */
html[data-fontsize="grande"] body {
    font-size: 17px !important;
}
html[data-fontsize="grande"] .sidebar-item         { font-size: .96rem !important; }
html[data-fontsize="grande"] .topbar-btn,
html[data-fontsize="grande"] .topbar-toggle        { font-size: 1.05rem !important; }
html[data-fontsize="grande"] .card-label           { font-size: 1rem   !important; }
html[data-fontsize="grande"] .ph-title             { font-size: 1.35rem !important; }
html[data-fontsize="grande"] .table td,
html[data-fontsize="grande"] .table th             { font-size: .93rem !important; }
html[data-fontsize="grande"] .form-control,
html[data-fontsize="grande"] .form-select,
html[data-fontsize="grande"] .form-label           { font-size: .95rem !important; }
html[data-fontsize="grande"] .btn                  { font-size: .9rem  !important; }
html[data-fontsize="grande"] .alert                { font-size: .9rem  !important; }
html[data-fontsize="grande"] .stat-value           { font-size: 1.7rem !important; }
html[data-fontsize="grande"] .stat-label           { font-size: .82rem !important; }

/* Fonte extra-grande (A++) */
html[data-fontsize="extragrande"] body {
    font-size: 20px !important;
}
html[data-fontsize="extragrande"] .sidebar-item    { font-size: 1.05rem !important; }
html[data-fontsize="extragrande"] .topbar-btn,
html[data-fontsize="extragrande"] .topbar-toggle   { font-size: 1.15rem !important; }
html[data-fontsize="extragrande"] .card-label      { font-size: 1.1rem  !important; }
html[data-fontsize="extragrande"] .ph-title        { font-size: 1.55rem !important; }
html[data-fontsize="extragrande"] .table td,
html[data-fontsize="extragrande"] .table th        { font-size: 1rem    !important; }
html[data-fontsize="extragrande"] .form-control,
html[data-fontsize="extragrande"] .form-select,
html[data-fontsize="extragrande"] .form-label      { font-size: 1.05rem !important; }
html[data-fontsize="extragrande"] .btn             { font-size: 1rem    !important; }
html[data-fontsize="extragrande"] .alert           { font-size: 1rem    !important; }
html[data-fontsize="extragrande"] .stat-value      { font-size: 2rem    !important; }
html[data-fontsize="extragrande"] .stat-label      { font-size: .9rem   !important; }

/* Botão ativo (estado salvo) */
.a11y-btn-active {
    background: #ffbf00 !important;
    color: #1a1a1a !important;
    border-radius: 6px;
}

/* ================================================================
   ACESSIBILIDADE — ALTO CONTRASTE
================================================================ */

html[data-contrast="alto"] {
    /* Variáveis de cor */
    --bs-body-bg:           #000000;
    --cor-fundo-card:       #0d0d0d;
    --cor-fundo-card-header:#000000;
    --cor-accent:           #ffff00;
    --cor-accent-light:     rgba(255,255,0,.15);
    --cor-padrao-letras:    #ffffff;
    --cor-padrao-letras-hover: #ffff00;
    --cor-rodape:           #000000;
    --shadow-card:          0 0 0 2px #ffffff;
    --shadow-card-hover:    0 0 0 3px #ffff00;
    --borda-card-header:    1px solid #ffffff;
    --cor-borda:            #ffffff;
    --cor-texto:            #ffffff;
    --cor-texto-muted:      #cccccc;
}

/* Base */
html[data-contrast="alto"] body {
    background: #000000 !important;
    color: #ffffff !important;
}

/* Topbar */
html[data-contrast="alto"] .topbar {
    background: #000000 !important;
    border-bottom: 3px solid #ffff00 !important;
    box-shadow: none !important;
}
html[data-contrast="alto"] .topbar-btn,
html[data-contrast="alto"] .topbar-toggle {
    color: #ffffff !important;
}
html[data-contrast="alto"] .topbar-btn:hover,
html[data-contrast="alto"] .topbar-toggle:hover {
    background: #ffff00 !important;
    color: #000000 !important;
}
html[data-contrast="alto"] .topbar-sep {
    background: #ffffff !important;
    opacity: 1 !important;
}
html[data-contrast="alto"] .brand-name,
html[data-contrast="alto"] .brand-sub {
    color: #ffffff !important;
}

/* Sidebar */
html[data-contrast="alto"] .sidebar {
    background: #0d0d0d !important;
    border-right: 3px solid #ffffff !important;
}
html[data-contrast="alto"] .sidebar-item {
    color: #ffffff !important;
}
html[data-contrast="alto"] .sidebar-item:hover {
    background: rgba(255,255,0,.15) !important;
    color: #ffff00 !important;
}
html[data-contrast="alto"] .sidebar-item.active {
    background: #ffff00 !important;
    color: #000000 !important;
}
html[data-contrast="alto"] .sidebar-item.active i {
    color: #000000 !important;
}
html[data-contrast="alto"] .sidebar-item.active::before {
    background: #000000 !important;
}
html[data-contrast="alto"] .sidebar-group-label {
    color: #aaaaaa !important;
}
html[data-contrast="alto"] .sidebar-sep {
    border-color: #444444 !important;
}
html[data-contrast="alto"] .sidebar-footer {
    border-top: 2px solid #444444 !important;
    background: #000000 !important;
}
html[data-contrast="alto"] .sb-user-name { color: #ffffff !important; }
html[data-contrast="alto"] .sb-user-role { color: #aaaaaa !important; }
html[data-contrast="alto"] .sb-avatar {
    background: #ffff00 !important;
    color: #000000 !important;
}

/* Conteúdo principal */
html[data-contrast="alto"] .main-content {
    background: #000000 !important;
}
html[data-contrast="alto"] .page-header {
    border-bottom: 2px solid #444444 !important;
}
html[data-contrast="alto"] .ph-title    { color: #ffffff !important; }
html[data-contrast="alto"] .ph-breadcrumb a { color: #ffff00 !important; }
html[data-contrast="alto"] .ph-breadcrumb li:last-child { color: #ffffff !important; }
html[data-contrast="alto"] .ph-breadcrumb li + li::before { color: #666666 !important; }

/* Cards */
html[data-contrast="alto"] .card-custom,
html[data-contrast="alto"] .card {
    background: #0d0d0d !important;
    border: 2px solid #ffffff !important;
    box-shadow: none !important;
}
html[data-contrast="alto"] .card-header {
    background: #000000 !important;
    border-bottom: 2px solid #ffffff !important;
}
html[data-contrast="alto"] .card-label  { color: #ffffff !important; }
html[data-contrast="alto"] .card-footer {
    background: #0d0d0d !important;
    border-top: 1px solid #444444 !important;
    color: #cccccc !important;
}
html[data-contrast="alto"] .card-icon {
    background: rgba(255,255,0,.1) !important;
    color: #ffff00 !important;
}
html[data-contrast="alto"] [class*="card-accent"]::before {
    background: #ffff00 !important;
}

/* KPIs */
html[data-contrast="alto"] .card-stat {
    background: #0d0d0d !important;
    border: 2px solid #ffffff !important;
    box-shadow: none !important;
}
html[data-contrast="alto"] .stat-value { color: #ffffff !important; }
html[data-contrast="alto"] .stat-label { color: #aaaaaa !important; }
html[data-contrast="alto"] .stat-icon  { background: rgba(255,255,0,.1) !important; color: #ffff00 !important; }

/* Tabelas */
html[data-contrast="alto"] .table {
    color: #ffffff !important;
    border-color: #555555 !important;
}
html[data-contrast="alto"] .table td,
html[data-contrast="alto"] .table th {
    border-color: #555555 !important;
    color: #ffffff !important;
    background: transparent !important;
}
html[data-contrast="alto"] .table-light,
html[data-contrast="alto"] thead.table-light tr {
    background: #1a1a1a !important;
    color: #ffffff !important;
}
html[data-contrast="alto"] .table-hover tbody tr:hover td {
    background: rgba(255,255,0,.08) !important;
}
html[data-contrast="alto"] .table-striped tbody tr:nth-of-type(odd) td {
    background: rgba(255,255,255,.04) !important;
}

/* Formulários */
html[data-contrast="alto"] .form-control,
html[data-contrast="alto"] .form-select {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}
html[data-contrast="alto"] .form-control::placeholder { color: #888888 !important; }
html[data-contrast="alto"] .form-label   { color: #cccccc !important; }
html[data-contrast="alto"] .form-text    { color: #aaaaaa !important; }
html[data-contrast="alto"] .form-check-input {
    background-color: #000000 !important;
    border: 2px solid #ffffff !important;
}
html[data-contrast="alto"] .form-check-input:checked {
    background-color: #ffff00 !important;
    border-color: #ffff00 !important;
}
html[data-contrast="alto"] .input-group-text {
    background: #1a1a1a !important;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
}

/* Botões */
html[data-contrast="alto"] .btn-primary {
    background: #ffff00 !important;
    color: #000000 !important;
    border-color: #ffff00 !important;
}
html[data-contrast="alto"] .btn-primary:hover {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
}
html[data-contrast="alto"] .btn-outline-primary {
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    background: transparent !important;
}
html[data-contrast="alto"] .btn-outline-primary:hover {
    background: #ffff00 !important;
    color: #000000 !important;
}
html[data-contrast="alto"] .btn-outline-secondary {
    color: #ffffff !important;
    border-color: #ffffff !important;
    background: transparent !important;
}
html[data-contrast="alto"] .btn-outline-secondary:hover {
    background: #ffffff !important;
    color: #000000 !important;
}
html[data-contrast="alto"] .btn-outline-danger {
    color: #ff6b6b !important;
    border-color: #ff6b6b !important;
}
html[data-contrast="alto"] .btn-outline-danger:hover {
    background: #ff6b6b !important;
    color: #000000 !important;
}
html[data-contrast="alto"] .btn-link { color: #ffff00 !important; }
html[data-contrast="alto"] .btn:disabled,
html[data-contrast="alto"] .btn[disabled] {
    opacity: .4 !important;
    border-color: #888 !important;
    color: #888 !important;
}

/* Badges */
html[data-contrast="alto"] .badge {
    border: 1px solid currentColor !important;
}
html[data-contrast="alto"] .badge.bg-success   { background: #004d00 !important; color: #00ff00 !important; }
html[data-contrast="alto"] .badge.bg-danger    { background: #4d0000 !important; color: #ff6b6b !important; }
html[data-contrast="alto"] .badge.bg-warning   { background: #4d3800 !important; color: #ffbf00 !important; }
html[data-contrast="alto"] .badge.bg-primary   { background: #00004d !important; color: #6699ff !important; }
html[data-contrast="alto"] .badge.bg-secondary { background: #1a1a1a !important; color: #aaaaaa !important; }

/* Alertas */
html[data-contrast="alto"] .alert {
    border: 2px solid currentColor !important;
    background: #000000 !important;
}
html[data-contrast="alto"] .alert-success { color: #00dd00 !important; }
html[data-contrast="alto"] .alert-warning { color: #ffbf00 !important; }
html[data-contrast="alto"] .alert-danger  { color: #ff6b6b !important; }
html[data-contrast="alto"] .alert-primary { color: #6699ff !important; }

/* Links */
html[data-contrast="alto"] a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}
html[data-contrast="alto"] a:hover {
    color: #ffffff !important;
}
html[data-contrast="alto"] a.btn,
html[data-contrast="alto"] a.sidebar-item,
html[data-contrast="alto"] a.topbar-brand,
html[data-contrast="alto"] a.topbar-btn,
html[data-contrast="alto"] a.card-botao,
html[data-contrast="alto"] a.footer-help-btn {
    text-decoration: none !important;
}

/* Rodapé */
html[data-contrast="alto"] .footer-bar {
    background: #000000 !important;
    color: #aaaaaa !important;
    border-top: 2px solid #444444 !important;
}
html[data-contrast="alto"] .footer-help-btn {
    color: #ffff00 !important;
    background: transparent !important;
    border-color: #555 !important;
}

/* Modais */
html[data-contrast="alto"] .modal-content {
    background: #0d0d0d !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}
html[data-contrast="alto"] .modal-header {
    background: #000000 !important;
    border-bottom: 2px solid #ffffff !important;
}
html[data-contrast="alto"] .modal-footer {
    border-top: 2px solid #444444 !important;
}
html[data-contrast="alto"] .btn-close { filter: invert(1) !important; }

/* Paginação */
html[data-contrast="alto"] .page-link {
    background: #000000 !important;
    border-color: #ffffff !important;
    color: #ffff00 !important;
}
html[data-contrast="alto"] .page-item.active .page-link {
    background: #ffff00 !important;
    color: #000000 !important;
    border-color: #ffff00 !important;
}
html[data-contrast="alto"] .page-item.disabled .page-link {
    background: #000000 !important;
    color: #555555 !important;
    border-color: #333333 !important;
}

/* Dropdowns */
html[data-contrast="alto"] .dropdown-menu {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
}
html[data-contrast="alto"] .dropdown-item {
    color: #ffffff !important;
}
html[data-contrast="alto"] .dropdown-item:hover {
    background: #ffff00 !important;
    color: #000000 !important;
}

/* Separadores */
html[data-contrast="alto"] hr,
html[data-contrast="alto"] .sidebar-sep { border-color: #444444 !important; }

/* Scrollbar */
html[data-contrast="alto"] ::-webkit-scrollbar       { background: #000000; }
html[data-contrast="alto"] ::-webkit-scrollbar-thumb { background: #555555; border-radius: 4px; }
html[data-contrast="alto"] ::-webkit-scrollbar-thumb:hover { background: #ffff00; }

/* Cards de botão rápido */
html[data-contrast="alto"] .card-botao {
    background: #0d0d0d !important;
    border: 2px solid #444444 !important;
    color: #ffffff !important;
}
html[data-contrast="alto"] .card-botao:hover {
    border-color: #ffff00 !important;
    background: rgba(255,255,0,.08) !important;
}
html[data-contrast="alto"] .botao-label { color: #ffffff !important; }

/* Inline styles overrides */
html[data-contrast="alto"] [style*="color:#999"],
html[data-contrast="alto"] [style*="color:#94a3b8"],
html[data-contrast="alto"] [style*="color:#64748b"] { color: #aaaaaa !important; }
html[data-contrast="alto"] [style*="background:#fff"],
html[data-contrast="alto"] [style*="background: #fff"] { background: #0d0d0d !important; }
html[data-contrast="alto"] [style*="background:rgba(55,55,153"] { background: rgba(255,255,0,.1) !important; }
html[data-contrast="alto"] [style*="color:#373799"],
html[data-contrast="alto"] [style*="color:var(--cor-accent)"] { color: #ffff00 !important; }

/* Skip link em alto contraste */
html[data-contrast="alto"] .skip-link {
    background: #ffff00 !important;
    color: #000000 !important;
    outline-color: #ffffff !important;
}

/* Foco em alto contraste */
html[data-contrast="alto"] :focus-visible {
    outline: 3px solid #ffff00 !important;
    outline-offset: 3px !important;
}
