:root {
    --navbar-height: 56px;
    --sidebar-width: 260px;
    --sidebar-bg: #1f2937;
    --sidebar-hover: #374151;
    --body-bg: #f3f4f6;
    --card-border: #e5e7eb;
    --text-muted: #6b7280;
}

body {
    background-color: var(--body-bg);
    color: #111827;
}

.navbar {
    min-height: var(--navbar-height);
}

.layout-shell {
    display: flex;
}

.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 1.5rem 1rem;
    background: var(--sidebar-bg);
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1030;
}

.sidebar-brand {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    color: #d1d5db;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-link.active {
    box-shadow: inset 3px 0 0 #f8fafc;
    font-weight: 600;
}

.main-content {
    width: 100%;
    min-height: 100vh;
    padding: calc(var(--navbar-height) + 1.5rem) 1.5rem 1.5rem;
    margin-left: var(--sidebar-width);
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.page-subtitle {
    margin-top: 0.35rem;
    color: var(--text-muted);
}

.dashboard-card {
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.06);
}

.dashboard-card .card-body {
    padding: 1.5rem;
}

.admin-filters-card .card-body {
    padding: 1.5rem;
}

.admin-filters-form .form-control,
.admin-filters-form .form-select {
    min-height: 44px;
}

.admin-table {
    margin-bottom: 0;
}

.admin-table th {
    white-space: nowrap;
    font-size: 0.88rem;
    color: #4b5563;
}

.admin-table td {
    vertical-align: middle;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.empty-state {
    padding: 1.75rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-cell {
    padding: 0;
    border-bottom: 0;
}

.ui-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 160px;
    padding: 1.5rem 1rem;
    text-align: center;
}

.ui-state-icon {
    font-size: 1.75rem;
    color: #9ca3af;
}

.ui-state.error .ui-state-icon {
    color: #dc3545;
}

.ui-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.ui-state-message {
    max-width: 480px;
    color: var(--text-muted);
}

.status-badge {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.status-badge.success-soft {
    background: #d1e7dd;
    color: #0f5132;
}

.status-badge.error-soft {
    background: #f8d7da;
    color: #842029;
}

.status-badge.warning-soft {
    background: #fff3cd;
    color: #664d03;
}

.status-badge.info-soft {
    background: #cff4fc;
    color: #055160;
}

.btn-action-primary,
.btn-action-secondary,
.btn-action-save,
.btn-action-back {
    min-height: 44px;
}

.metric-label {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.metric-value {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.detail-label {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    word-break: break-word;
}

.detail-code-block {
    margin: 0;
    padding: 1rem;
    border-radius: 0.75rem;
    background: #111827;
    color: #f9fafb;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.comparacao-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comparison-section {
    margin-top: 1rem;
}

.comparison-column {
    height: 100%;
}

.comparison-scroll-area {
    max-height: 520px;
    overflow: auto;
}

.comparison-status-badge.ok {
    background-color: #d1e7dd;
    color: #0f5132;
}

.comparison-status-badge.nao_processado {
    background-color: #f8d7da;
    color: #842029;
}

.comparacao-item.ok .dashboard-card {
    border-color: #c7e7d4;
}

.comparacao-item.nao_processado .dashboard-card {
    border-color: #f1c3c9;
}

.global-loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(243, 244, 246, 0.78);
    backdrop-filter: blur(2px);
    z-index: 2000;
}

.global-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.08);
}

.global-loading-text {
    font-size: 0.95rem;
    color: #374151;
}

.toast-container {
    z-index: 2010;
}

.toast.toast-success {
    background: #d1e7dd;
    color: #0f5132;
}

.toast.toast-error {
    background: #f8d7da;
    color: #842029;
}

.toast.toast-warning {
    background: #fff3cd;
    color: #664d03;
}

.toast.toast-info {
    background: #cff4fc;
    color: #055160;
}

.execution-log-panel {
    min-height: 220px;
    max-height: 220px;
    overflow-y: auto;
    padding: 1rem;
    border-radius: 0.85rem;
    background: #111827;
    color: #e5e7eb;
    font-family: "Courier New", monospace;
    font-size: 0.92rem;
    line-height: 1.5;
}

.execution-log-entry + .execution-log-entry {
    margin-top: 0.5rem;
}

.execution-log-entry.success {
    color: #86efac;
}

.execution-log-entry.error {
    color: #fca5a5;
}

.execution-log-entry.warning {
    color: #fde68a;
}

.execution-log-entry.info {
    color: #93c5fd;
}

.execution-log-entry.muted {
    color: #9ca3af;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: var(--navbar-height) 0 0 0;
        background: rgba(17, 24, 39, 0.45);
        z-index: 1025;
    }

    .sidebar-backdrop.is-open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: calc(var(--navbar-height) + 1rem) 1rem 1rem;
    }

    .admin-actions {
        justify-content: stretch;
    }
}
