:root {
    --sigma-navy-950: #0b1f38;
    --sigma-navy-900: #102a4c;
    --sigma-navy-800: #163a66;
    --sigma-blue-700: #1d4ed8;
    --sigma-blue-600: #2563eb;
    --sigma-blue-500: #3b82f6;
    --sigma-blue-100: #dbeafe;
    --sigma-blue-50: #eff6ff;
    --sigma-slate-900: #0f172a;
    --sigma-slate-700: #334155;
    --sigma-slate-500: #64748b;
    --sigma-border: #e2e8f0;
    --sigma-bg: #f4f7fb;
    --sigma-sidebar-width: 260px;
}

body {
    background-color: var(--sigma-bg);
    color: var(--sigma-slate-900);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 0.925rem;
}

/* ===== Layout Shell ===== */
.sigma-wrapper {
    display: flex;
    min-height: 100vh;
}

.sigma-sidebar {
    width: var(--sigma-sidebar-width);
    min-width: var(--sigma-sidebar-width);
    background: linear-gradient(180deg, var(--sigma-navy-950) 0%, var(--sigma-navy-900) 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
    z-index: 1020;
}

.sigma-sidebar.collapsed {
    margin-left: calc(var(--sigma-sidebar-width) * -1);
}

.sigma-brand {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.sigma-brand:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sigma-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--sigma-blue-600);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.sigma-nav-section {
    padding: 0.9rem 1.25rem 0.35rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 600;
}

.sigma-dynamic-menu,
.sigma-submenu {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.sigma-sidebar .nav-item {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.sigma-sidebar .nav-link {
    color: #cbd5e1;
    padding: 0.58rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-left: 3px solid transparent;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
    font-weight: 500;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.sigma-sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}

.sigma-sidebar .nav-link.active {
    color: #ffffff;
    background-color: rgba(37, 99, 235, 0.22);
    border-left-color: var(--sigma-blue-500);
}

.sigma-menu-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.sigma-fa-icon {
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    opacity: 0.9;
}

.sigma-chevron {
    font-size: 0.72rem;
    transition: transform 0.2s ease;
    opacity: 0.75;
    flex-shrink: 0;
    margin-left: 0.35rem;
}

.sigma-menu-parent:not(.collapsed) .sigma-chevron {
    transform: rotate(180deg);
}

.sigma-submenu {
    background-color: rgba(0, 0, 0, 0.18);
    padding: 0.25rem 0;
}

.sigma-submenu-link {
    padding: 0.45rem 1.1rem 0.45rem 2.4rem !important;
    font-size: 0.85rem;
    color: #cbd5e1;
}

.sigma-submenu-link > span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sigma-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sigma-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--sigma-border);
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1010;
}

.sigma-content {
    padding: 1.5rem;
    flex: 1;
}

/* ===== Cards & Panels ===== */
.sigma-card {
    background: #ffffff;
    border: 1px solid var(--sigma-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.sigma-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--sigma-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sigma-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sigma-navy-900);
    margin: 0;
}

.sigma-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.sigma-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--sigma-navy-900);
    margin: 0;
}

.sigma-page-subtitle {
    font-size: 0.85rem;
    color: var(--sigma-slate-500);
    margin: 0.15rem 0 0;
}

/* ===== Buttons & Badges (Tema Azul Corporativo) ===== */
.btn-primary {
    background-color: var(--sigma-blue-700);
    border-color: var(--sigma-blue-700);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--sigma-navy-800);
    border-color: var(--sigma-navy-800);
}

.btn-outline-primary {
    color: var(--sigma-blue-700);
    border-color: var(--sigma-blue-700);
}

.btn-outline-primary:hover {
    background-color: var(--sigma-blue-700);
    border-color: var(--sigma-blue-700);
}

.badge-sigma-db {
    background-color: var(--sigma-blue-50);
    color: var(--sigma-blue-700);
    border: 1px solid var(--sigma-blue-100);
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
}

/* ===== Tables & DataTables ===== */
.table.sigma-table thead th {
    background-color: #f8fafc;
    color: var(--sigma-slate-700);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--sigma-border);
    white-space: nowrap;
}

.table.sigma-table tbody td {
    vertical-align: middle;
    border-color: #f1f5f9;
}

/* ===== Modals (Suporte visual para pilha de modais aninhados) ===== */
.modal-header.sigma-modal-header {
    background-color: var(--sigma-navy-900);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header.sigma-modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal.sigma-modal-stacked .modal-content {
    box-shadow: 0 20px 50px rgba(11, 31, 56, 0.35);
    border: 1px solid rgba(29, 78, 216, 0.25);
}

.sigma-modal-depth-badge {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* ===== Select2 Bootstrap 5 Alignment ===== */
.select2-container--bootstrap-5 .select2-selection {
    border-color: #cbd5e1;
    min-height: 38px;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--sigma-blue-600);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
}

/* ===== Auth Page ===== */
.sigma-auth-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sigma-navy-950) 0%, var(--sigma-navy-800) 55%, var(--sigma-blue-700) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.sigma-auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.sigma-auth-split-card {
    width: 100%;
    max-width: 960px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
    overflow: hidden;
}

.sigma-auth-visual {
    min-height: 520px;
    background: var(--sigma-navy-950);
}

.sigma-hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ===== Rich Text (Summernote & Comunicados) ===== */
.sigma-rich-content {
    line-height: 1.6;
    color: var(--sigma-slate-900);
    word-break: break-word;
}

.sigma-rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
}

.sigma-rich-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.sigma-rich-content table th,
.sigma-rich-content table td {
    border: 1px solid var(--sigma-border);
    padding: 0.45rem 0.65rem;
}

.note-editor.note-frame {
    border-color: #cbd5e1 !important;
    border-radius: 8px;
    overflow: visible;
}

.note-editor .note-toolbar {
    background-color: #f8fafc !important;
    border-bottom: 1px solid var(--sigma-border) !important;
    border-radius: 8px 8px 0 0;
}

.note-modal-backdrop {
    z-index: 1090 !important;
}

.note-modal {
    z-index: 1095 !important;
}

.sigma-auth-header {
    background: var(--sigma-navy-900);
    color: #ffffff;
    padding: 1.75rem 2rem;
    text-align: center;
}

@media (max-width: 991.98px) {
    .sigma-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        margin-left: calc(var(--sigma-sidebar-width) * -1);
    }
    .sigma-sidebar.mobile-open {
        margin-left: 0;
    }
}
