:root {
    --app-bg: #f8fafc;
    --app-text: #1f2937;
    --app-muted: #6c757d;
    --app-surface: #ffffff;
    --app-surface-2: #f8f9fb;
    --app-border: #e2e8f0;
    --app-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    --app-link: #005ca9;
    --app-link-hover: #0b3d6e;
    --app-brand: #005ca9;
    --app-title: #0b3d6e;
    --app-accent: #ffc107;
    --app-info: #17a2b8;
    --app-success: #28a745;
    --app-warning: #ffc107;
    --app-danger: #dc3545;
    --app-nav-hover-bg: #f0f6fa;
    --app-footer-bg: #f8f9fa;
}

[data-theme="dark"] {
    --app-bg: #0f1725;
    --app-text: #e6edf3;
    --app-muted: #9ca9b8;
    --app-surface: #182437;
    --app-surface-2: #121e30;
    --app-border: #2b3a53;
    --app-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    --app-link: #8ec9ff;
    --app-link-hover: #b8dcff;
    --app-brand: #8ec9ff;
    --app-title: #dbeafe;
    --app-accent: #ffd45c;
    --app-info: #70d5e3;
    --app-success: #6ee7a2;
    --app-warning: #ffd45c;
    --app-danger: #ff9b9b;
    --app-nav-hover-bg: rgba(142, 201, 255, 0.12);
    --app-footer-bg: #101a2b;
}

body {
    background-color: var(--app-bg);
    color: var(--app-text);
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: var(--app-link);
}

a:hover,
a:focus {
    color: var(--app-link-hover);
}

.text-muted {
    color: var(--app-muted) !important;
}

.card,
.modal-content,
.dropdown-menu {
    background-color: var(--app-surface);
    border-color: var(--app-border);
}

[data-theme="dark"] .bg-white {
    background-color: var(--app-surface) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--app-surface-2) !important;
}

[data-theme="dark"] .border,
[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .list-group-item {
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--app-text);
    --bs-table-border-color: var(--app-border);
    --bs-table-striped-bg: rgba(142, 201, 255, 0.05);
    --bs-table-hover-bg: rgba(142, 201, 255, 0.08);
}

[data-theme="dark"] .dropdown-item {
    color: var(--app-text);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    color: var(--app-text);
    background-color: var(--app-nav-hover-bg);
}

[data-theme="dark"] .error-summary {
    color: #fecaca;
    background: #3f1d24;
    border-left-color: #ef4444;
}

.theme-card-panel {
    border-left: 4px solid var(--theme-panel-color, var(--app-brand));
}

.theme-card-panel > .card-header {
    border-bottom: 2px solid var(--theme-panel-color, var(--app-brand));
    color: var(--theme-panel-color, var(--app-brand));
    font-weight: 600;
    background-color: var(--app-surface-2) !important;
}

.theme-card-panel--brand {
    --theme-panel-color: var(--app-brand);
}

.theme-card-panel--info {
    --theme-panel-color: var(--app-info);
}

.theme-card-panel--success {
    --theme-panel-color: var(--app-success);
}

.theme-card-panel--warning {
    --theme-panel-color: var(--app-warning);
}

.theme-card-panel--danger {
    --theme-panel-color: var(--app-danger);
}

.theme-label {
    font-weight: 600;
    color: var(--app-muted);
}

.theme-th-label {
    font-weight: 600;
    color: var(--app-muted);
}

.theme-text-success {
    color: var(--app-success) !important;
}

.theme-text-danger {
    color: var(--app-danger) !important;
}

.theme-prewrap {
    white-space: pre-wrap;
    word-break: break-word;
}

.theme-card-hover-lift {
    transition: transform 0.2s ease;
}

.theme-card-hover-lift:hover {
    transform: translateY(-2px);
}

.theme-col-occurrences {
    width: 100px;
}

.theme-table-hover tbody tr:hover {
    background-color: rgba(11, 61, 110, 0.05);
}

[data-theme="dark"] .theme-table-hover tbody tr:hover {
    background-color: rgba(142, 201, 255, 0.1);
}

.theme-max-w-60 {
    max-width: 60%;
    min-width: 0;
}

@media (max-width: 991.98px) {
    .theme-max-w-60 {
        max-width: 100%;
    }
}

.theme-font-95 {
    font-size: 0.95rem;
}

.theme-indent-2em {
    margin-left: 2em;
}

.theme-note-box {
    padding: 15px;
    background: rgba(0, 113, 194, 0.09);
    border-left: 4px solid var(--app-brand);
    border-radius: 4px;
}

[data-theme="dark"] .theme-note-box {
    background: rgba(142, 201, 255, 0.12);
}

.theme-table-bordered-soft {
    border: 1px solid var(--app-border);
}

.theme-summary-card {
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
}

.theme-summary-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.theme-help-icon {
    cursor: pointer;
    color: var(--app-link);
}

.theme-modal-wide {
    max-width: 95vw;
}

.theme-modal-scroll-body {
    max-height: 75vh;
    overflow-y: auto;
}

/* ──────────────────────────────────────────────────────────────
   KPI Cards — componente reutilizável para painéis e dashboards
   ────────────────────────────────────────────────────────────── */
.kpi-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-shadow);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kpi-icon.blue   { background: rgba(13, 110, 253, .1);  color: #0d6efd; }
.kpi-icon.green  { background: rgba(25, 135,  84, .1);  color: #198754; }
.kpi-icon.orange { background: rgba(255, 193,  7, .12); color: #cc9a06; }
.kpi-icon.red    { background: rgba(220,  53, 69, .1);  color: #dc3545; }
.kpi-icon.purple { background: rgba(111,  66,193, .1);  color: #6f42c1; }
.kpi-icon.cyan   { background: rgba(13, 202, 240, .1);  color: #0dcaf0; }

.kpi-body { flex: 1; min-width: 0; }

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--app-title);
}

.kpi-label {
    font-size: .78rem;
    color: var(--app-muted);
    margin-top: 2px;
}

.kpi-extra { font-size: .72rem; margin-top: 4px; }

.kpi-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-weight: 600;
    font-size: .7rem;
}

.kpi-badge.danger  { background: rgba(220,  53, 69, .1);  color: #dc3545; }
.kpi-badge.warning { background: rgba(255, 193,  7, .12); color: #cc9a06; }
.kpi-badge.success { background: rgba(25,  135, 84, .1);  color: #198754; }
.kpi-badge.info    { background: rgba(13,  110,253, .1);  color: #0d6efd; }

/* ──────────────────────────────────────────────────────────────
   Dashboard Panel — superfície de card interna
   ────────────────────────────────────────────────────────────── */
.dash-panel {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 20px;
    height: 100%;
}

/* ──────────────────────────────────────────────────────────────
   Alert Strip — faixa de alerta/notificação inline
   ────────────────────────────────────────────────────────────── */
.alert-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: .85rem;
    text-decoration: none;
    transition: opacity .15s;
}

.alert-strip:hover { opacity: .85; }

.alert-strip.danger  { background: rgba(220,  53, 69, .08); color: #dc3545;  border: 1px solid rgba(220,  53, 69, .15); }
.alert-strip.warning { background: rgba(255, 193,  7, .08); color: #997404;  border: 1px solid rgba(255, 193,  7, .20); }
.alert-strip.info    { background: rgba(13,  110,253, .06); color: #0d6efd;  border: 1px solid rgba(13,  110,253, .12); }

.alert-strip i        { font-size: 1.1rem; flex-shrink: 0; }
.alert-strip .alert-text { flex: 1; }
.alert-strip .alert-go   { font-size: .75rem; opacity: .6; }

/* ──────────────────────────────────────────────────────────────
   Status Dot — indicador de estado colorido
   ────────────────────────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.status-dot.green  { background: #198754; }
.status-dot.yellow { background: #ffc107; }
.status-dot.red    { background: #dc3545; }
.status-dot.blue   { background: #0d6efd; }

main > .container {
    padding: 70px 15px 20px;
}

.footer {
    background-color: var(--app-footer-bg);
    font-size: .9em;
    height: 60px;
}

.footer > .container {
    padding-right: 15px;
    padding-left: 15px;
}

.not-set {
    color: #c55;
    font-style: italic;
}

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
    content: '';
    left: 3px;
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 4px 4px 2px 4px;
    background: transparent;
}

a.asc:after {
    border-bottom: solid 7px var(--app-text);
    border-top-width: 0;
}

a.desc:after {
    border-top: solid 7px var(--app-text);
    border-bottom-width: 0;
}

.grid-view th {
    white-space: nowrap;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: var(--app-muted);
}

.error-summary {
    color: #a94442;
    background: #fdf7f7;
    border-left: 3px solid #eed3d7;
    padding: 10px 20px;
    margin: 0 0 15px 0;
}

/* align the logout "link" (button in form) of the navbar */
.nav li > form > button.logout {
    padding-top: 7px;
    color: rgba(255, 255, 255, 0.5);
}

@media(max-width:767px) {
    .nav li > form > button.logout {
        display:block;
        text-align: left;
        width: 100%;
        padding: 10px 0;
    }
}

.nav > li > form > button.logout:focus,
.nav > li > form > button.logout:hover {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.75);
}

.nav > li > form > button.logout:focus {
    outline: none;
}

.form-group {
    margin-bottom: 1rem;
}

/* Títulos principais */
h1, .h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--app-brand);
    margin-bottom: 1.2rem;
    letter-spacing: -1px;
}

h2, .h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--app-title);
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

/* Para títulos em cards ou seções especiais */
.section-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--app-title);
    margin-bottom: 1.5rem;
    text-align: center;
}

.page-header .section-title {
    text-align: left;
    line-height: 1.15;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-wrap: balance;
}

.page-header .section-title::after {
    margin-left: 0;
    margin-right: 0;
}