:root {
    --bg-dark: #07090f;
    --surface-dark: #10131d;
    --surface-dark-2: #171b27;
    --border-dark: rgba(255,255,255,.08);
    --text-dark: #f5f7fa;
    --muted-dark: #9aa4b2;
    --accent: #ff3b3b;
    --accent-2: #7c3cff;
    --radius: 14px;
    --shadow: 0 18px 45px rgba(0,0,0,.35);
}

:root {
    --site-primary: #064d71;
    --site-secondary: #064d71;
    --site-primary-hover: #064d71;
    --site-secondary-hover: #064d71;
}

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    transition: background .25s ease, color .25s ease;
}

/* NAV / SIDEBAR */

.main-dashboard-row {
    margin-left: 0;
    margin-right: 0;
}

.sidebar-menu {
    box-sizing: border-box;
    padding: 0 !important;
    margin: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-nav {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
}

.navigation-link-css {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
    padding: .6rem .8rem !important;
    margin: 0 !important;
    border-radius: calc(var(--radius) - 4px);
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .015em;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

    .navigation-link-css:hover {
        transform: none;
    }

    .navigation-link-css.active-section {
        background: var(--site-secondary) !important;
        color: #ffffff !important;
        box-shadow: inset 3px 0 0 rgba(255,255,255,.35);
    }

.content-panel {
    min-width: 0;
    overflow: auto;
}

/* CARDS / LAYOUT */

.card,
.modal-content {
    border-radius: var(--radius) !important;
    border: 1px solid transparent;
    box-shadow: var(--shadow);
}

.container-fluid,
main {
    transition: background .25s ease;
}
/* TABLE */

table,
th,
td,
tr {
    font-family: Inter, Arial, sans-serif;
}

.table {
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: var(--radius);
}

    .table th {
        font-size: .78rem;
        text-transform: uppercase;
        letter-spacing: .06em;
        font-weight: 700;
    }

    .table td {
        vertical-align: middle;
    }

    .table tbody tr {
        transition: background .15s ease, transform .15s ease;
    }
/* CODE */

pre {
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
}
/* BUTTONS */

.btn {
    border-radius: 999px !important;
    font-weight: 700;
    letter-spacing: .02em;
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

    .btn:hover {
        transform: translateY(-1px);
    }

.btn-primary {
    border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.btn-secondary {
    border: 1px solid rgba(255,255,255,.12);
}
/* FORMS */

input,
select,
textarea,
.form-control,
.form-select {
    border-radius: 12px !important;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 .2rem rgba(124, 60, 255, .18) !important;
        border-color: var(--accent-2) !important;
    }
/* MODAL */

.dark-modal .modal-content {
    background: var(--surface-dark);
    color: var(--text-dark);
    border: 1px solid var(--border-dark);
}

.dark-modal .modal-header {
    border-bottom: 1px solid var(--border-dark);
}

[data-theme="light"] .dark-modal .btn-close {
    filter: none;
}

/* Tema escuro → inverter para ficar visível */
.dark-modal .btn-close {
    opacity: 1;
    filter: none;
    background-image: none !important;
    width: 32px;
    height: 32px;
    position: relative;
}

    .dark-modal .btn-close::before {
        content: "×";
        position: absolute;
        inset: 0;
        color: #9ca3af;
        font-size: 28px;
        line-height: 28px;
        text-align: center;
        font-weight: 400;
    }

    .dark-modal .btn-close:hover::before {
        color: #6b7280;
    }

#logDetailModal {
    pointer-events: none;
}

    #logDetailModal .modal-dialog,
    #logDetailModal .modal-content {
        pointer-events: auto;
    }
/* ANIMATIONS */


.page-fade-out {
    opacity: 0;
    transform: translateY(10px) scale(.995);
    transition: opacity 160ms ease, transform 160ms ease;
}

.page-fade-in {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 200ms ease, transform 200ms ease;
}
/* DARK THEME */

body.theme-dark {
    background: radial-gradient(circle at top left, rgba(124,60,255,.18), transparent 35%), radial-gradient(circle at top right, rgba(255,59,59,.12), transparent 32%), var(--bg-dark);
    color: var(--text-dark);
}

    body.theme-dark header,
    body.theme-dark .navbar,
    body.theme-dark .container-fluid,
    body.theme-dark main,
    body.theme-dark .row {
        background: transparent !important;
        color: var(--text-dark) !important;
    }

    body.theme-dark .navbar {
        background: #064d71 !important;
        background-color: #064d71 !important;
        border-bottom: 1px solid #064d71 !important;
    }

body.theme-light .navbar {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-bottom: 1px solid #064d71 !important;
}

body.theme-dark .sidebar-menu {
    background: linear-gradient(180deg, rgba(16,19,29,.96), rgba(7,9,15,.96)) !important;
    border-right: 1px solid var(--border-dark);
    box-shadow: 18px 0 45px rgba(0,0,0,.22);
}

    body.theme-dark .sidebar-menu a,
    body.theme-dark .navigation-link-css {
        color: var(--muted-dark);
    }

        body.theme-dark .sidebar-menu a:hover,
        body.theme-dark .navigation-link-css:hover {
            color: #fff !important;
            background: rgba(255,255,255,.06);
        }

    body.theme-dark .sidebar-menu h1,
    body.theme-dark .sidebar-menu h2,
    body.theme-dark .sidebar-menu h3,
    body.theme-dark .sidebar-menu h4 {
        color: #ffffff;
    }

body.theme-dark .card,
body.theme-dark .table,
body.theme-dark .modal-content {
    background: rgba(16, 19, 29, .92) !important;
    color: var(--text-dark) !important;
    border-color: var(--border-dark);
}

    body.theme-dark .table th {
        background: var(--site-secondary) !important;
        color: #ffffff !important;
    }

    body.theme-dark .table td {
        background: rgba(16,19,29,.75) !important;
        color: var(--text-dark) !important;
        border-color: var(--border-dark);
    }

    body.theme-dark .table tbody tr:hover td {
        background: rgba(124,60,255,.12) !important;
    }

body.theme-dark input:not([type="checkbox"]):not([type="radio"]),
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .form-control,
body.theme-dark .form-select {
    background: rgba(255,255,255,.06) !important;
    color: #fff !important;
    border-color: var(--border-dark) !important;
}

body.theme-dark pre {
    background: #090b12;
    color: #dbe4f0;
    border: 1px solid var(--border-dark);
}

body.theme-dark .text-muted {
    color: var(--muted-dark) !important;
}

body.theme-dark .card p {
    color: #d7dde8;
}
/* LIGHT THEME */

body.theme-light {
    background: radial-gradient(circle at top left, rgba(13,110,253,.08), transparent 34%), #f5f7fb;
    color: #1f2937;
}

    body.theme-light header,
    body.theme-light .navbar,
    body.theme-light .container-fluid,
    body.theme-light main,
    body.theme-light .row {
        background: transparent !important;
        color: #1f2937 !important;
    }

.navbar * {
    color: #ffffff !important;
}

body.theme-light .sidebar-menu {
    background: rgba(255,255,255,.88) !important;
    border-right: 1px solid rgba(15,23,42,.08);
    box-shadow: 18px 0 45px rgba(15,23,42,.06);
}

    body.theme-light .sidebar-menu a,
    body.theme-light .navigation-link-css {
        color: #475569 !important;
    }

        body.theme-light .sidebar-menu a:hover,
        body.theme-light .navigation-link-css:hover {
            color: #0d6efd !important;
            background: rgba(13,110,253,.08);
        }

/*body.theme-light .sidebar-menu h1,
        body.theme-light .sidebar-menu h2,
        body.theme-light .sidebar-menu h3,
        body.theme-light .sidebar-menu h4,
        body.theme-light .container-fluid h1,
        body.theme-light .container-fluid h2,
        body.theme-light .container-fluid h3,
        body.theme-light .container-fluid h4,
        body.theme-light .container-fluid h5,
        body.theme-light .container-fluid h6 {
            color: #111827 !important;
        }*/

body.theme-light .card,
body.theme-light .table,
body.theme-light .modal-content {
    background: rgba(255,255,255,.92) !important;
    color: #1f2937 !important;
    border: 1px solid rgba(15,23,42,.08);
}

    body.theme-light .table th {
        background: var(--site-secondary) !important;
        color: #ffffff !important;
    }

    body.theme-light .table td {
        background: rgba(255,255,255,.92) !important;
        color: #1f2937 !important;
        border-color: rgba(15,23,42,.08);
    }

    body.theme-light .table tbody tr:hover td {
        background: #f1f5f9 !important;
    }

body.theme-light input:not([type="checkbox"]):not([type="radio"]),
body.theme-light select,
body.theme-light textarea,
body.theme-light .form-control,
body.theme-light .form-select {
    background: #fff !important;
    color: #1f2937 !important;
    border-color: #cbd5e1 !important;
}

body.theme-light pre {
    background: #f1f5f9 !important;
    color: #1f2937 !important;
    border: 1px solid #cbd5e1 !important;
}

body.theme-light .text-muted {
    color: #64748b !important;
}

body.theme-light .navbar span,
body.theme-light .navbar strong {
    color: #1f2937 !important;
}

/* =========================
   FIX CONTENT / TABLE CLIPPING
========================= */

#content-area,
.content-panel {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: auto;
    padding: 1rem;
}

    #content-area > .row,
    #content-area > .container,
    #content-area > .container-fluid,
    .content-panel > .row,
    .content-panel > .container,
    .content-panel > .container-fluid {
        width: 100%;
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box;
    }

    #content-area .table-responsive,
    .content-panel .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius);
    }

    #content-area table,
    .content-panel table {
        width: 100%;
        max-width: 100%;
        margin-bottom: 0;
    }

    #content-area .table,
    .content-panel .table {
        overflow: visible;
    }

    #content-area th,
    #content-area td,
    .content-panel th,
    .content-panel td {
        white-space: nowrap;
    }

        #content-area td:first-child,
        #content-area th:first-child,
        .content-panel td:first-child,
        .content-panel th:first-child {
            padding-left: .9rem !important;
        }

        #content-area td:last-child,
        #content-area th:last-child,
        .content-panel td:last-child,
        .content-panel th:last-child {
            padding-right: .9rem !important;
        }

@media (max-width: 768px) {
    #content-area,
    .content-panel {
        padding: .75rem;
    }

        #content-area table,
        .content-panel table {
            min-width: 720px;
        }
}

/* FORÇA TOTAL - botões na tabela logs */
#logsTable button,
#logsTable .btn,
#logsTable input[type="button"],
#logsTable input[type="submit"] {
    background: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

    /* hover */
    #logsTable button:hover,
    #logsTable .btn:hover {
        background: #f1f3f5 !important;
        color: #000 !important;
    }

/* FIX SELECT no tema light */
body.theme-light select,
body.theme-light .form-select {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #ced4da !important;
}

    /* opções dentro do select */
    body.theme-light select option {
        color: #212529 !important;
        background-color: #ffffff !important;
    }

body.theme-light .form-control,
body.theme-light .form-select {
    color: #212529 !important;
}

body.theme-dark {
    --input-text: #fff;
}

body.theme-light {
    --input-text: #212529;
}

select,
.form-select {
    color: var(--input-text);
}

/* =========================
   SELECT FIX (DARK + LIGHT)
========================= */

/* ---------- DARK ---------- */

body.theme-dark select,
body.theme-dark .form-select {
    background-color: #1e1e1e !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

    body.theme-dark select option {
        background-color: #1e1e1e;
        color: #ffffff;
    }

/* ---------- LIGHT ---------- */

body.theme-light select,
body.theme-light .form-select {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #ced4da !important;
}

    body.theme-light select option {
        background-color: #ffffff;
        color: #212529;
    }

/* =========================
   MENU ACTIVE - LIGHT
========================= */

body.theme-light .navigation-link-css.active-section {
    background-color: transparent !important;
    color: #ffffff !important;
}

/* =========================
   LOG ROW COLORS FIX
========================= */

body.theme-dark .table tr.log-error td,
body.theme-dark .table tr[data-level="ERROR"] td {
    background: rgba(220, 53, 69, 0.22) !important;
    color: #fff !important;
}

body.theme-dark .table tr.log-warn td,
body.theme-dark .table tr[data-level="WARN"] td,
body.theme-dark .table tr[data-level="WARNING"] td {
    background: rgba(255, 193, 7, 0.22) !important;
    color: #fff !important;
}

body.theme-dark .table tr.log-info td,
body.theme-dark .table tr[data-level="INFO"] td {
    background: rgba(13, 202, 240, 0.16) !important;
    color: #fff !important;
}

body.theme-dark .table tr.log-debug td,
body.theme-dark .table tr[data-level="DEBUG"] td {
    background: rgba(108, 117, 125, 0.22) !important;
    color: #fff !important;
}

body.theme-dark .table tr.log-trace td,
body.theme-dark .table tr[data-level="TRACE"] td {
    background: rgba(124, 60, 255, 0.16) !important;
    color: #fff !important;
}

/* Light theme */
body.theme-light .table tr.log-error td,
body.theme-light .table tr[data-level="ERROR"] td {
    background: #f8d7da !important;
    color: #842029 !important;
}

body.theme-light .table tr.log-warn td,
body.theme-light .table tr[data-level="WARN"] td,
body.theme-light .table tr[data-level="WARNING"] td {
    background: #fff3cd !important;
    color: #664d03 !important;
}

body.theme-light .table tr.log-info td,
body.theme-light .table tr[data-level="INFO"] td {
    background: #cff4fc !important;
    color: #055160 !important;
}

body.theme-light .table tr.log-debug td,
body.theme-light .table tr[data-level="DEBUG"] td {
    background: #e2e3e5 !important;
    color: #41464b !important;
}

body.theme-light .table tr.log-trace td,
body.theme-light .table tr[data-level="TRACE"] td {
    background: #e7d9ff !important;
    color: #3d0a78 !important;
}

/* =========================
   LOGS DB HEADER FIX
========================= */

/* DARK */
body.theme-dark #logsTable thead th {
    color: #ffffff !important;
}

/* LIGHT */
body.theme-light #logsTable thead th {
    color: #ffffff !important;
    background: #334155 !important; /* fundo mais escuro para contraste */
}

/* =========================
   LOG LEVEL COLORS (FINAL FIX)
========================= */

/* DARK */
body.theme-dark #logsTable tr[data-level="ERROR"] td {
    background: rgba(220, 53, 69, 0.35) !important;
}

body.theme-dark #logsTable tr[data-level="WARN"] td,
body.theme-dark #logsTable tr[data-level="WARNING"] td {
    background: rgba(255, 193, 7, 0.30) !important;
}

body.theme-dark #logsTable tr[data-level="INFO"] td {
    background: rgba(13, 202, 240, 0.25) !important;
}

body.theme-dark #logsTable tr[data-level="DEBUG"] td {
    background: rgba(108, 117, 125, 0.30) !important;
}

body.theme-dark #logsTable tr[data-level="TRACE"] td {
    background: rgba(124, 60, 255, 0.25) !important;
}

/* LIGHT */
body.theme-light #logsTable tr[data-level="ERROR"] td {
    background: #f8d7da !important;
    color: #842029 !important;
}

body.theme-light #logsTable tr[data-level="WARN"] td,
body.theme-light #logsTable tr[data-level="WARNING"] td {
    background: #fff3cd !important;
    color: #664d03 !important;
}

body.theme-light #logsTable tr[data-level="INFO"] td {
    background: #cff4fc !important;
    color: #055160 !important;
}

body.theme-light #logsTable tr[data-level="DEBUG"] td {
    background: #e2e3e5 !important;
    color: #41464b !important;
}

body.theme-light #logsTable tr[data-level="TRACE"] td {
    background: #e7d9ff !important;
    color: #3d0a78 !important;
}

/* =========================
   LOG ROW COLOR SWITCH
========================= */

/* Default: sem cores por nível */
#logsTable:not(.log-colors-enabled) tr.log-row-error td,
#logsTable:not(.log-colors-enabled) tr.log-row-warn td,
#logsTable:not(.log-colors-enabled) tr.log-row-info td,
#logsTable:not(.log-colors-enabled) tr.log-row-debug td,
#logsTable:not(.log-colors-enabled) tr.log-row-trace td {
    background: var(--bs-table-bg) !important;
    color: var(--bs-table-color) !important;
}

/* Cores ligadas - Dark */
body.theme-dark #logsTable.log-colors-enabled tr.log-row-error td {
    background: rgba(220, 53, 69, 0.35) !important;
    color: #fff !important;
}

body.theme-dark #logsTable.log-colors-enabled tr.log-row-warn td {
    background: rgba(255, 193, 7, 0.30) !important;
    color: #fff !important;
}

body.theme-dark #logsTable.log-colors-enabled tr.log-row-info td {
    background: rgba(13, 202, 240, 0.25) !important;
    color: #fff !important;
}

body.theme-dark #logsTable.log-colors-enabled tr.log-row-debug td {
    background: rgba(108, 117, 125, 0.30) !important;
    color: #fff !important;
}

body.theme-dark #logsTable.log-colors-enabled tr.log-row-trace td {
    background: rgba(124, 60, 255, 0.25) !important;
    color: #fff !important;
}

/* Cores ligadas - Light */
body.theme-light #logsTable.log-colors-enabled tr.log-row-error td {
    background: #f8d7da !important;
    color: #842029 !important;
}

body.theme-light #logsTable.log-colors-enabled tr.log-row-warn td {
    background: #fff3cd !important;
    color: #664d03 !important;
}

body.theme-light #logsTable.log-colors-enabled tr.log-row-info td {
    background: #cff4fc !important;
    color: #055160 !important;
}

body.theme-light #logsTable.log-colors-enabled tr.log-row-debug td {
    background: #e2e3e5 !important;
    color: #41464b !important;
}

body.theme-light #logsTable.log-colors-enabled tr.log-row-trace td {
    background: #e7d9ff !important;
    color: #3d0a78 !important;
}

.section-transition-out {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
    transition: opacity 160ms ease, transform 160ms ease;
}

.section-transition-in {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 220ms ease, transform 220ms ease;
}

.navbar {
    padding: 0 !important;
}

    .navbar img {
        margin: 0px;
        padding: 0px;
        display: block;
    }

.header-logo-area {
    width: 16.66666667%;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
}

    .header-logo-area img {
        width: 100%;
        height: 56px;
        object-fit: cover;
        display: block;
    }

.header-user-area {
    width: 83.33333333%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 1rem;
}

#content-area {
    opacity: 1;
    transform: translateY(0);
}

.section-transition-out {
    opacity: 0 !important;
    transform: translateY(10px) scale(0.995) !important;
    transition: opacity 170ms ease, transform 170ms ease;
}

.section-transition-in {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    transition: opacity 220ms ease, transform 220ms ease;
}

#logDetailModal .modal-content {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.dark-modal .btn-close:hover::before {
    color: #e5e7eb; /* mais claro no hover */
}

.log-json-box {
    background: #111;
    color: white;
    border: 1px solid #333;
    padding: 10px;
    overflow: visible;
    max-height: none;
}

    .log-json-box pre {
        margin: 0;
        white-space: pre-wrap;
        word-break: break-word;
    }

/* garante que o backdrop fica atrás */
.modal-backdrop {
    z-index: 1040 !important;
}

/* garante que o modal fica por cima */
.modal {
    z-index: 1055 !important;
}

body.theme-light .form-check-input,
body.theme-dark .form-check-input {
    width: 1em;
    height: 1em;
    margin-top: .25em;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    appearance: none;
    print-color-adjust: exact;
    cursor: pointer;
}

body.theme-light .form-check-input {
    background-color: #fff !important;
    border: 1px solid #6b7280 !important;
}

body.theme-dark .form-check-input {
    background-color: rgba(255,255,255,.08) !important;
    border: 1px solid #9ca3af !important;
}

    body.theme-light .form-check-input:checked,
    body.theme-dark .form-check-input:checked {
        background-color: #0d6efd !important;
        border-color: #0d6efd !important;
        background-image: var(--bs-form-check-bg-image) !important;
    }

#userSearch::placeholder {
    color: #b5b5b5;
    opacity: 1;
}



/* =========================
   HEADERS
========================= */

.card-header,
.modal-header,
.table thead th,
.table-dark th {
    background-color: var(--site-secondary) !important;
    color: #ffffff !important;
    border-color: var(--site-secondary) !important;
}

/* =========================
   SIDEBAR
========================= */

.sidebar,
.offcanvas,
.menu-container {
    background-color: var(--site-primary) !important;
}

/* =========================
   BOTÕES PRIMÁRIOS
========================= */

.btn-primary {
    background-color: var(--site-primary) !important;
    border-color: var(--site-primary) !important;
    color: #fff !important;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: var(--site-primary-hover) !important;
        border-color: var(--site-primary-hover) !important;
    }

/* =========================
   BOTÕES SECUNDÁRIOS
========================= */

.btn-secondary {
    background-color: var(--site-secondary) !important;
    border-color: var(--site-secondary) !important;
    color: #fff !important;
}

    .btn-secondary:hover,
    .btn-secondary:focus {
        background-color: var(--site-secondary-hover) !important;
        border-color: var(--site-secondary-hover) !important;
    }

.text-primary {
    color: var(--site-secondary) !important;
}

/* =========================
   TABLE HEADERS
========================= */

.table thead th {
    background-color: var(--site-secondary) !important;
    color: white !important;
}

/* =========================
   ACTIVE MENU ITEMS
========================= */

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background-color: var(--site-secondary) !important;
    color: #fff !important;
}

/* =========================
   MODAL FOOTER / HEADER
========================= */

.modal-content {
    border-color: var(--site-secondary) !important;
}

/* =========================
   PLACEHOLDERS
========================= */

input::placeholder,
textarea::placeholder {
    color: #b7c4cc !important;
    opacity: 1;
}

/* =========================
   TABLE HEADERS
========================= */

.table thead th,
.table-dark th,
#logsTable thead th {
    background: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
}

/* =========================
   PRIMARY BUTTONS
========================= */

.btn-primary {
    background: #064d71 !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background: #064d71 !important;
        background-color: #064d71 !important;
        border-color: #064d71 !important;
    }

/* =========================
   BADGES
========================= */

.badge {
    color: #ffffff !important;
}

/* =========================
   FINAL COLOR OVERRIDE
   Primary: #064d71
   Secondary: #064d71
========================= */

/* Table headers - todas as tabelas */
table thead,
table thead tr,
table thead th,
.table thead,
.table thead tr,
.table thead th,
.table-dark,
.table-dark tr,
.table-dark th,
#logsTable thead th {
    background-color: #064d71 !important;
    background: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
}

/* Card headers */
.card-header {
    background-color: #064d71 !important;
    background: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
}

/* Modal headers */
.modal-header {
    background-color: #064d71 !important;
    background: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
}

    .modal-header h5 {
        color: #ffffff !important;
    }

/* Botões primários */
.btn-primary {
    background-color: #064d71 !important;
    background: #064d71 !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background: #064d71 !important;
        background-color: #064d71 !important;
        border-color: #064d71 !important;
        color: #ffffff !important;
    }

/* Badges com fundo azul escuro */
.badge,
.bg-secondary,
.bg-primary {
    color: #ffffff !important;
}

/* =========================
   SIDEBAR ACTIVE SECTION
========================= */

.navigation-link-css.active-section,
.sidebar-menu .navigation-link-css.active-section,
body.theme-dark .navigation-link-css.active-section,
body.theme-light .navigation-link-css.active-section {
    background: #064d71 !important;
    background-color: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
    box-shadow: inset 3px 0 0 rgba(255,255,255,.35);
}

/* =========================
   SIDEBAR HOVER TEXT
========================= */

body.theme-dark .sidebar-menu .navigation-link-css:hover,
body.theme-light .sidebar-menu .navigation-link-css:hover {
    color: #8f9aa5 !important;
}

/* =========================
   USERS PAGE FINAL COLORS
========================= */

/* Botão pesquisar users */
#userSearchBtn,
button[type="submit"],
.btn-search-user {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
}

    #userSearchBtn:hover,
    .btn-search-user:hover {
        background: #064d71 !important;
        border-color: #064d71 !important;
        color: #ffffff !important;
    }

/* Títulos Users / Criar User */
.card-header,
.users-title,
.create-user-title {
    color: #ffffff !important;
}

/* =========================
   DANGER BUTTONS
========================= */

.btn-danger {
    background: #dc3545 !important;
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

    .btn-danger:hover,
    .btn-danger:focus {
        background: #bb2d3b !important;
        border-color: #bb2d3b !important;
        color: #ffffff !important;
    }

/* =========================
   HEADER / NAVBAR
========================= */

.navbar,
header,
.header-user-area,
.header-logo-area {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-color: #064d71 !important;
}

    /* texto do header */
    .navbar *,
    header * {
        color: #ffffff !important;
    }

/* =========================
   DATABASE LOGS BUTTONS
========================= */

/* FILTRAR -> azul claro */
#btnFilterLogs,
button[data-action="filter-logs"],
.btn-filter-logs {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

    #btnFilterLogs:hover,
    button[data-action="filter-logs"]:hover,
    .btn-filter-logs:hover {
        background: #064d71 !important;
        border-color: #064d71 !important;
    }

/* LIMPAR -> azul escuro */
#btnClearLogs,
button[data-action="clear-logs"],
.btn-clear-logs {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

    #btnClearLogs:hover,
    button[data-action="clear-logs"]:hover,
    .btn-clear-logs:hover {
        background: #064d71 !important;
        border-color: #064d71 !important;
    }

/* =========================
   BOTÃO TEMA ESCURO
========================= */

#themeToggle,
.btn-theme-dark,
button[data-theme-toggle] {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

    #themeToggle:hover,
    .btn-theme-dark:hover,
    button[data-theme-toggle]:hover {
        background: #1a1a1a !important;
        border-color: #1a1a1a !important;
        color: #ffffff !important;
    }

/* =========================
   DARK THEME TOGGLE BUTTON FINAL FIX
========================= */

body.theme-dark #themeToggle,
body.theme-dark .btn-theme-dark,
body.theme-dark button[data-theme-toggle],
body.theme-light #themeToggle,
body.theme-light .btn-theme-dark,
body.theme-light button[data-theme-toggle] {
    background: #000000 !important;
    background-color: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
}

    body.theme-dark #themeToggle:hover,
    body.theme-dark .btn-theme-dark:hover,
    body.theme-dark button[data-theme-toggle]:hover,
    body.theme-light #themeToggle:hover,
    body.theme-light .btn-theme-dark:hover,
    body.theme-light button[data-theme-toggle]:hover {
        background: #1f1f1f !important;
        background-color: #1f1f1f !important;
        border-color: #1f1f1f !important;
        color: #ffffff !important;
    }

/* =========================
   USER SEARCH INPUT
========================= */

#userSearch,
#userSearch.form-control,
input[name="UserSearch"],
#userSearch:focus,
input[name="UserSearch"]:focus {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #ced4da !important;
    color: #000000 !important;
    box-shadow: none !important;
}

    /* placeholder */
    #userSearch::placeholder,
    input[name="UserSearch"]::placeholder {
        color: #ffffff !important;
        opacity: 1 !important;
    }

    /* focus */
    #userSearch:focus,
    input[name="UserSearch"]:focus {
        background: #ffffff !important;
        background-color: #ffffff !important;
        border-color: #064d71 !important;
        color: #ffffff !important;
        box-shadow: none !important;
    }

/* =========================
   USERS TABLE - ISADMIN BADGE
========================= */

#usersTable .badge,
#usersTable td .badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 90px;
    padding: 0.45rem 0.9rem !important;
    text-align: center !important;
    border-radius: 999px !important;
    font-weight: 600;
}

.user-role-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 90px !important;
    padding: 0.45rem 1rem !important;
    text-align: center !important;
    border-radius: 999px !important;
}

/* =========================
   TOP HEADER AREA
========================= */

.navbar,
.header-user-area,
.header-logo-area {
    background: #064d71 !important;
    background-color: #064d71 !important;
}

    /* texto */
    .header-user-area,
    .header-user-area *,
    .navbar,
    .navbar * {
        color: #ffffff !important;
    }

/* =========================
   FOOTER
========================= */

.site-footer {
    background: #064d71;
    background-color: #064d71;
    color: #ffffff;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: auto;
}

    .site-footer span {
        color: #ffffff !important;
        font-weight: 500;
        letter-spacing: .03em;
    }

body.theme-light header,
body.theme-light .navbar,
body.theme-light .header-user-area,
body.theme-light .header-logo-area {
    background: #064d71 !important;
    background-color: #064d71 !important;
    color: #ffffff !important;
}

    body.theme-light header *,
    body.theme-light .navbar *,
    body.theme-light .header-user-area *,
    body.theme-light .header-logo-area * {
        color: #ffffff !important;
    }

html,
body {
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
}

main,
.container-fluid {
    flex: 1 0 auto;
}

.site-footer {
    margin-top: auto !important;
    flex-shrink: 0;
}

body.theme-light .header-user-area,
body.theme-light .header-user-area *,
body.theme-light .navbar span,
body.theme-light .navbar strong,
body.theme-light .navbar a {
    color: #ffffff !important;
}

/* =========================
   FINAL GLOBAL BLUE FIX
   Azul claro: #064d71
========================= */

:root {
    --site-primary: #064d71;
    --site-secondary: #064d71;
    --site-primary-hover: #064d71;
    --site-secondary-hover: #064d71;
}

/* Topo / imagem / bem-vindo user */
header,
.navbar,
.header-logo-area,
.header-user-area,
body.theme-dark header,
body.theme-dark .navbar,
body.theme-dark .header-logo-area,
body.theme-dark .header-user-area,
body.theme-light header,
body.theme-light .navbar,
body.theme-light .header-logo-area,
body.theme-light .header-user-area {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-color: #064d71 !important;
}

    /* Texto do topo */
    header *,
    .navbar *,
    .header-logo-area *,
    .header-user-area * {
        color: #ffffff !important;
    }

/* Headers de tabelas */
table thead,
table thead tr,
table thead th,
.table thead,
.table thead tr,
.table thead th,
.table-dark,
.table-dark tr,
.table-dark th,
#logsTable thead,
#logsTable thead tr,
#logsTable thead th,
body.theme-dark .table th,
body.theme-light .table th,
body.theme-light #logsTable thead th {
    background: #064d71 !important;
    background-color: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
}

/* Card e modal headers */
.card-header,
.modal-header,
.modal-header h5,
.modal-header .modal-title {
    background: #064d71 !important;
    background-color: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
}

/* Botões principais/secundários */
.btn-primary,
.btn-secondary,
#btnFilterLogs,
#btnClearLogs,
.btn-filter-logs,
.btn-clear-logs,
#userSearchBtn,
.btn-search-user {
    background: #064d71 !important;
    background-color: #064d71 !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

    .btn-primary:hover,
    .btn-primary:focus,
    .btn-secondary:hover,
    .btn-secondary:focus,
    #btnFilterLogs:hover,
    #btnClearLogs:hover,
    .btn-filter-logs:hover,
    .btn-clear-logs:hover,
    #userSearchBtn:hover,
    .btn-search-user:hover {
        background: #064d71 !important;
        background-color: #064d71 !important;
        border-color: #064d71 !important;
        color: #ffffff !important;
        box-shadow: none !important;
    }

/* Input pesquisa users */
#userSearch,
#userSearch.form-control,
input[name="UserSearch"],
#userSearch:focus,
input[name="UserSearch"]:focus {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #064d71 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

/* Menu ativo */
.navigation-link-css.active-section,
.sidebar-menu .navigation-link-css.active-section,
body.theme-dark .navigation-link-css.active-section,
body.theme-light .navigation-link-css.active-section {
    background: #064d71 !important;
    background-color: #064d71 !important;
    color: #ffffff !important;
    border-color: #064d71 !important;
}

/* Footer */
.site-footer {
    background: #064d71 !important;
    background-color: #064d71 !important;
    color: #ffffff !important;
}

.category-custom-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1040 !important;
}

#editCategoryModal {
    z-index: 1055 !important;
}


.app-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-toast {
    min-width: 280px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 12px 35px rgba(0,0,0,.25);
    opacity: 0;
    transform: translateX(30px);
    transition: opacity .25s ease, transform .25s ease;
}

    .app-toast.show {
        opacity: 1;
        transform: translateX(0);
    }

.app-toast-create {
    background: #198754;
}

.app-toast-edit {
    background: #ffc107;
    color: #212529;
}

.app-toast-delete {
    background: #dc3545;
}

.settings-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}

.settings-box {
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: calc(50% - .75rem);
}

.settings-box-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .settings-box-header h5 {
        margin: 0;
        font-weight: 800;
    }

    .settings-box-header small {
        color: var(--muted-dark);
    }

.settings-box-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-grid {
    column-count: 2;
    column-gap: 1.8rem;
    margin-top: 1.5rem;
    align-items: start;
}

.settings-box {
    display: inline-block;
    width: 100%;
    margin-bottom: 1.8rem;
    break-inside: avoid;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

    .settings-box:hover {
        transform: translateY(-2px);
        box-shadow: 0 20px 45px rgba(0,0,0,.22);
    }

.settings-box-header {
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .settings-box-header h5 {
        margin: 0;
        font-weight: 800;
        font-size: 1rem;
    }

    .settings-box-header small {
        color: var(--muted-dark);
    }

.settings-box-body {
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.setting-field {
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

    .setting-field:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

.setting-label {
    font-weight: 700;
    margin-bottom: .55rem;
    display: block;
    font-size: .92rem;
}

.setting-code {
    display: block;
    margin-top: .45rem;
    color: var(--muted-dark);
    font-size: .72rem;
    opacity: .8;
}

.settings-actions {
    margin-top: 2rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
}

.settings-box .form-control,
.settings-box .form-select {
    min-height: 46px;
}

.settings-box .form-check {
    padding-top: .4rem;
}

[data-theme="light"] .settings-box {
    background: #ffffff;
    border-color: rgba(0,0,0,.08);
}

[data-theme="light"] .settings-box-header {
    border-bottom-color: rgba(0,0,0,.08);
}

[data-theme="light"] .setting-field {
    border-bottom-color: rgba(0,0,0,.08);
}

[data-theme="light"] .settings-box-header small,
[data-theme="light"] .setting-code {
    color: #6c757d;
}

@media (max-width: 1200px) {
    .settings-grid {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .settings-grid {
        column-count: 1;
    }

    .settings-box {
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 992px) {
    .settings-box {
        width: 100%;
    }
}

#userSearch::placeholder,
input[name="UserSearch"]::placeholder {
    color: #555555 !important;
    opacity: 1 !important;
}

input[readonly] {
    background-color: #f8f9fa;
}

.hangfire-panel-wrapper {
    height: 100%;
    padding: 1rem;
}

.hangfire-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

    .hangfire-card .card-body {
        flex: 1;
        min-height: 0;
    }

.hangfire-dashboard-frame {
    width: 100%;
    height: 100%;
    min-height: 760px;
    border: 0;
    display: block;
}