/* ==========================================================================
   BOME — cards de quantidade e tema escuro.
   Carregado depois de app.css (layout principal e telas de login).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Cards de quantidade (Chamados): uma cor por situação.
   Usam as cores "subtle" do Bootstrap, que já se adaptam ao tema claro/escuro.
   -------------------------------------------------------------------------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 1500px) { .kpi-row { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.kpi {
    --k-accent: var(--bs-primary); --k-bg: var(--bs-primary-bg-subtle); --k-border: var(--bs-primary-border-subtle); --k-text: var(--bs-primary-text-emphasis);
    position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n ico" "l ico"; align-items: center; column-gap: .5rem;
    padding: .8rem .75rem .8rem 1.05rem; border-radius: var(--app-radius);
    background: var(--k-bg); border: 1px solid var(--k-border); color: var(--k-text);
    text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.kpi::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--k-accent); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--app-shadow-lg); color: var(--k-text); }
.kpi.active { box-shadow: 0 0 0 2px var(--k-accent); }
.kpi .kpi-n { grid-area: n; font-size: 1.85rem; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; }
.kpi .kpi-l { grid-area: l; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .9; }
.kpi .kpi-ico { grid-area: ico; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; background: var(--k-accent); color: #fff; }
.kpi-info      { --k-accent: var(--bs-info);      --k-bg: var(--bs-info-bg-subtle);      --k-border: var(--bs-info-border-subtle);      --k-text: var(--bs-info-text-emphasis); }
.kpi-warning   { --k-accent: var(--bs-warning);   --k-bg: var(--bs-warning-bg-subtle);   --k-border: var(--bs-warning-border-subtle);   --k-text: var(--bs-warning-text-emphasis); }
.kpi-warning .kpi-ico { color: #422006; }
.kpi-success   { --k-accent: var(--bs-success);   --k-bg: var(--bs-success-bg-subtle);   --k-border: var(--bs-success-border-subtle);   --k-text: var(--bs-success-text-emphasis); }
.kpi-secondary { --k-accent: var(--bs-secondary); --k-bg: var(--bs-secondary-bg-subtle); --k-border: var(--bs-secondary-border-subtle); --k-text: var(--bs-secondary-text-emphasis); }
.kpi-dark      { --k-accent: #475569;             --k-bg: var(--bs-tertiary-bg);         --k-border: var(--app-line);                   --k-text: var(--app-text); }
.kpi-indigo    { --k-accent: #6366f1;             --k-bg: color-mix(in srgb, #6366f1 13%, var(--app-surface)); --k-border: color-mix(in srgb, #6366f1 35%, var(--app-surface)); --k-text: color-mix(in srgb, #4338ca 85%, var(--app-text)); }
@media (max-width: 575.98px) {
    .kpi-row { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .kpi { padding: .7rem .8rem .7rem 1rem; }
    .kpi .kpi-n { font-size: 1.5rem; }
    .kpi .kpi-ico { width: 2rem; height: 2rem; font-size: 1rem; }
}

/* --------------------------------------------------------------------------
   Tema escuro  ( <html data-bs-theme="dark"> )
   Troca as variáveis do sistema e corrige as cores fixas do tema claro.
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"] {
    --app-bg: #0b1220;
    --app-surface: #131c2e;
    --app-line: #26334d;
    --app-line-soft: #1b2740;
    --app-text: #e6eaf3;
    --app-muted: #94a3b8;
    --app-primary: #3b82f6;
    --app-primary-600: #2563eb;
    --app-primary-50: #172554;
    --app-sidebar: #070d19;
    --app-sidebar-2: #0d1526;
    --app-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .3);
    --app-shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    --bs-link-color: #6ea8fe; --bs-link-color-rgb: 110, 168, 254;
    --bs-link-hover-color: #9ec5fe; --bs-link-hover-color-rgb: 158, 197, 254;
    --bs-secondary-bg: #1c2740; --bs-tertiary-bg: #172036;
    --bs-secondary-color: rgba(230, 234, 243, .72);
    --bs-emphasis-color: #fff;
    --bs-card-bg: var(--app-surface);
}
[data-bs-theme="dark"] body { color: var(--app-text); }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #7db0ff; --bs-btn-border-color: #2d4a8a; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #c3cbda; --bs-btn-bg: transparent; --bs-btn-border-color: var(--app-line);
    --bs-btn-hover-bg: #1f2b44; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #3a4a69;
    --bs-btn-active-bg: #26334d; --bs-btn-active-color: #fff; --bs-btn-active-border-color: #3a4a69;
}
[data-bs-theme="dark"] .btn-secondary {
    --bs-btn-color: #dbe2ee; --bs-btn-bg: #26324b; --bs-btn-border-color: #26324b;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #31405f; --bs-btn-hover-border-color: #31405f;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #3a4b6e; --bs-btn-active-border-color: #3a4b6e;
}
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { border-color: #33425f; background-color: #0e1627; color: var(--app-text); }
[data-bs-theme="dark"] .form-control::placeholder { color: #6b7a93; }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-control[readonly] { background-color: #172036; }
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus { box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .3); }
[data-bs-theme="dark"] .form-label { color: #cbd5e1; }
[data-bs-theme="dark"] .form-text { color: var(--app-muted); }
[data-bs-theme="dark"] .alert-success { background: rgba(34, 197, 94, .14); color: #86efac; }
[data-bs-theme="dark"] .alert-danger { background: rgba(239, 68, 68, .15); color: #fca5a5; }
[data-bs-theme="dark"] .alert-warning { background: rgba(245, 158, 11, .15); color: #fcd34d; }
[data-bs-theme="dark"] .alert-info { background: rgba(59, 130, 246, .15); color: #93c5fd; }
[data-bs-theme="dark"] kbd { background: #26334d; color: #dbe2ee; }
[data-bs-theme="dark"] .dropdown-menu { background: var(--app-surface); }
[data-bs-theme="dark"] .modal-content { background: var(--app-surface); }
[data-bs-theme="dark"] .topbar { background: rgba(11, 18, 32, .85); }
[data-bs-theme="dark"] .topbar .user-btn:hover { background: #1c2740; }
[data-bs-theme="dark"] .table-card .table thead th { background: #172036; }
[data-bs-theme="dark"] .table-card .table tbody tr:hover { background: #172036; }
[data-bs-theme="dark"] .badge-ativo { background: rgba(34, 197, 94, .18); color: #86efac; }
[data-bs-theme="dark"] .badge-inativo { background: rgba(239, 68, 68, .2); color: #fca5a5; }
[data-bs-theme="dark"] .mon-atencao { background: rgba(245, 158, 11, .2); color: #fcd34d; }
[data-bs-theme="dark"] .mon-semdados { background: #26334d; color: #cbd5e1; }
[data-bs-theme="dark"] .mon-filtro { background: var(--app-surface); }
[data-bs-theme="dark"] [style*="background:#f1f5f9"] { background: #26334d !important; }
[data-bs-theme="dark"] [style*="background:#fee2e2"] { background: rgba(239, 68, 68, .2) !important; }
[data-bs-theme="dark"] .table-card .dataTables_filter input { background-color: #0e1627; border-color: #33425f; color: var(--app-text); }
[data-bs-theme="dark"] .dataTables_wrapper .pagination { --bs-pagination-bg: var(--app-surface); --bs-pagination-border-color: var(--app-line); --bs-pagination-color: var(--app-text); --bs-pagination-hover-bg: #1f2b44; --bs-pagination-disabled-bg: #0e1627; --bs-pagination-disabled-border-color: var(--app-line); }
[data-bs-theme="dark"] table.dataTable thead > tr > th.sorting::before, [data-bs-theme="dark"] table.dataTable thead > tr > th.sorting::after,
[data-bs-theme="dark"] table.dataTable thead > tr > th.sorting_asc::before, [data-bs-theme="dark"] table.dataTable thead > tr > th.sorting_asc::after,
[data-bs-theme="dark"] table.dataTable thead > tr > th.sorting_desc::before, [data-bs-theme="dark"] table.dataTable thead > tr > th.sorting_desc::after { color: #fff; }
[data-bs-theme="dark"] #btnAtalhos { background: var(--app-surface); }
[data-bs-theme="dark"] #btnAtalhos:hover { border-color: #2d4a8a; }
[data-bs-theme="dark"] .bottom-nav { background: rgba(13, 21, 38, .94); }
[data-bs-theme="dark"] .bottom-nav a, [data-bs-theme="dark"] .bottom-nav button { color: #94a3b8; }
[data-bs-theme="dark"] .bottom-nav .active { color: #6ea8fe; }
[data-bs-theme="dark"] .auth-card .input-icon > i, [data-bs-theme="dark"] .auth-card .toggle-pass { color: #6b7a93; }
@media (max-width: 991.98px) {
    [data-bs-theme="dark"] form > .d-flex:has(> button[type="submit"]) { background: rgba(11, 18, 32, .95); }
}
/* Dashboard e telas com blocos de ícone em cores pastel fixas */
[data-bs-theme="dark"] [style*="background:#dbeafe"] { background: rgba(59, 130, 246, .2) !important; }
[data-bs-theme="dark"] [style*="background:#dcfce7"] { background: rgba(34, 197, 94, .2) !important; }
[data-bs-theme="dark"] [style*="background:#fef9c3"], [data-bs-theme="dark"] [style*="background:#fef3c7"] { background: rgba(245, 158, 11, .22) !important; color: #fcd34d !important; }
[data-bs-theme="dark"] [style*="background:#ede9fe"] { background: rgba(139, 92, 246, .22) !important; }
[data-bs-theme="dark"] [style*="color:#7c3aed"] { color: #c4b5fd !important; }
[data-bs-theme="dark"] .strength-bar[style*="#e2e8f0"] { background: #26334d !important; }
[data-bs-theme="dark"] [style*="background:#f8fafc"], [data-bs-theme="dark"] [style*="background: #f8fafc"] { background: #172036 !important; border-color: var(--app-line) !important; }
/* Relatórios (blocos com estilo próprio na tela) */
[data-bs-theme="dark"] .rel-type-card { border-color: var(--app-line); background: var(--app-surface); color: #c3cbda; }
[data-bs-theme="dark"] .rel-type-card:hover, [data-bs-theme="dark"] .rel-type-card.active { border-color: #3b82f6; background: rgba(59, 130, 246, .16); color: #93c5fd; }
[data-bs-theme="dark"] .campo-required-badge { background: #26334d; color: #94a3b8; }
[data-bs-theme="dark"] .result-group-header { background: #1e3a8a; color: #dbeafe; border-top-color: #1d4ed8; }
[data-bs-theme="dark"] .result-subtotal td { background: #1b2740 !important; color: #cbd5e1; }
[data-bs-theme="dark"] .result-table th { background: #172036; color: #94a3b8; border-bottom-color: var(--app-line); }
[data-bs-theme="dark"] .result-table td { border-bottom-color: var(--app-line-soft); }
[data-bs-theme="dark"] .result-table tbody tr:hover td { background: #172036; }
[data-bs-theme="dark"] .btn-check-all { color: #94a3b8; }
/* Ficha PUMA: continua como "folha de papel" branca (é um documento para impressão) */
[data-bs-theme="dark"] .ficha-wrapper { color: #1e293b; }
