/* =============================================
   Tema Bradesco Seguros — Inventário de Automações
   ============================================= */

:root {
    --bs-primary: #CC0000;
    --bs-primary-dark: #990000;
    --bs-primary-light: #FF3333;
    --bs-white: #FFFFFF;
    --bs-gray-light: #F5F5F5;
    --bs-gray-mid: #E0E0E0;
    --bs-gray-dark: #333333;
    --bs-text-muted: #666666;
    --bs-success: #28A745;
    --bs-warning: #FFC107;
    --bs-danger: #CC0000;
    --font-family-base: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Reset de fonte global */
html, body {
    font-family: var(--font-family-base);
    color: var(--bs-gray-dark);
    background-color: var(--bs-gray-light);
    height: 100%;
    margin: 0;
    overflow: hidden;
}

/* =============================================
   Navbar / Topbar
   ============================================= */
.topbar {
    background-color: var(--bs-primary);
    color: var(--bs-white);
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--bs-white);
}

.topbar-brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--bs-white);
}

.topbar-brand-subtitle {
    font-size: 0.72rem;
    font-weight: 300;
    opacity: 0.85;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-white);
    display: block;
    line-height: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--bs-white);
}

.topbar-user-name {
    font-weight: 500;
    opacity: 0.95;
}

.topbar-logout {
    color: var(--bs-white);
    opacity: 0.85;
    font-size: 0.8rem;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.5);
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    transition: opacity 0.2s;
}

.topbar-logout:hover {
    opacity: 1;
    background-color: rgba(255,255,255,0.15);
    color: var(--bs-white);
}

/* =============================================
   Sidebar
   ============================================= */
.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    width: 220px;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: width 0.25s ease;
}

/* Estado colapsado — desktop: apenas ícones */
.sidebar--collapsed {
    width: 56px;
}

.sidebar--collapsed .nav-text {
    display: none;
}

.sidebar--collapsed .nav-link {
    justify-content: center;
    padding: 0.65rem 0;
    gap: 0;
}

.sidebar--collapsed .nav-icon {
    width: auto;
    font-size: 1.1rem;
    opacity: 1;
    margin: 0;
}

.sidebar .nav-item a {
    color: #d7d7d7;
    font-size: 0.9rem;
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-left: 3px solid transparent;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
}

.sidebar .nav-item a:hover,
.sidebar .nav-item a.active {
    background-color: rgba(255,255,255,0.15);
    border-left-color: rgba(255,255,255,0.8);
    color: #ffffff;
    font-weight: 500;
}

.sidebar .nav-item a.active {
    background-color: rgba(255,255,255,0.2);
    border-left: 3px solid #ffffff;
    color: #ffffff;
    font-weight: 600;
    position: relative;
}

.sidebar .nav-item a.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: rgba(255,255,255,0.5);
    border-radius: 2px 0 0 2px;
}

/* =============================================
   Layout principal
   ============================================= */
.page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.main-content {
    flex: 1;
    padding: 1.75rem 2rem;
    overflow-y: auto;
    overflow-x: hidden;
}

/* =============================================
   KPI Cards
   ============================================= */
.kpi-card {
    background-color: var(--bs-white);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-left: 4px solid var(--bs-primary);
    transition: box-shadow 0.2s;
}

.kpi-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.kpi-card.kpi-success {
    border-left-color: var(--bs-success);
}

.kpi-card.kpi-warning {
    border-left-color: var(--bs-warning);
}

.kpi-card.kpi-danger {
    border-left-color: var(--bs-danger);
}

.kpi-card.kpi-info {
    border-left-color: #1976D2;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-text-muted);
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bs-gray-dark);
    line-height: 1.1;
}

.kpi-icon {
    font-size: 1.6rem;
    opacity: 0.4;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.kpi-detail {
    font-size: 0.78rem;
    color: var(--bs-text-muted);
    margin-top: 0.2rem;
}

/* =============================================
   Seções / Cards de conteúdo
   ============================================= */
.content-card {
    background-color: var(--bs-white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.content-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-gray-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--bs-primary);
    display: block;
}

/* =============================================
   Page title
   ============================================= */
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--bs-gray-dark);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--bs-text-muted);
    margin-bottom: 1.5rem;
}

/* =============================================
   Badges de alerta
   ============================================= */
.badge-atencao {
    background-color: var(--bs-primary);
    color: white;
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
}

/* =============================================
   Botão primário (override Bootstrap)
   ============================================= */
.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    font-weight: 500;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--bs-primary-dark);
    border-color: var(--bs-primary-dark);
}

.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

/* Esconde o texto central do RadzenDonutSeries */
.donut-sem-centro .rz-donut-label,
.donut-sem-centro svg text.rz-donut-title,
.donut-sem-centro svg .rz-series-title {
    display: none;
    visibility: hidden;
}

/* =============================================
   Listagem — Filtros e Tabela
   ============================================= */
.filtro-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--bs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

/* Dropdown multi-select */
.filtro-ms {
    position: relative;
    z-index: 51;
}
.filtro-ms-open {
    z-index: 200;
}
.filtro-ms-btn {
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}
.filtro-ms-menu {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    padding: 4px 0;
    z-index: 52;
}
.filtro-ms-open .filtro-ms-menu {
    display: block;
}
.filtro-ms-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    white-space: nowrap;
    color: #333;
    user-select: none;
}
.filtro-ms-item:hover {
    background: #f8f9fa;
}
.filtro-ms-item input[type="checkbox"] {
    accent-color: #CC0000;
    cursor: pointer;
    flex-shrink: 0;
}

.badge-impacto {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 10px;
    white-space: nowrap;
}

.badge-impacto-altíssimo { background: #B71C1C; color: #FFFFFF; }
.badge-impacto-alto       { background: #FDECEA; color: #CC0000; }
.badge-impacto-médio      { background: #FFF8E1; color: #856404; }
.badge-impacto-baixo      { background: #E8F5E9; color: #1B5E20; }
.badge-impacto-n\/a       { background: #F5F5F5; color: #666; }
.badge-impacto-não-informado { background: #F5F5F5; color: #666; }

/* Faixas de risco coloridas */
.risk-altissimo { border-left: 4px solid #B71C1C; background: #FFEBEE; }
.risk-alto      { border-left: 4px solid #CC0000; background: #FFF5F5; }
.risk-medio     { border-left: 4px solid #FFC107; background: #FFFBF0; }
.risk-baixo     { border-left: 4px solid #28A745; background: #F1F8E9; }

/* =============================================
   Classificação de Risco — badges e cards
   ============================================= */

/* Badges para a coluna de classificação */
.badge-risco {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    color: #fff;
}
.badge-risco-critico    { background: #7B0000; }
.badge-risco-alto-risco { background: #CC0000; }
.badge-risco-medio-risco { background: #E65100; }
.badge-risco-baixo-risco { background: #1B5E20; }

/* Cards de resumo por faixa */
.card-risco {
    border-radius: 10px;
    border-left: 5px solid;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    padding: 1rem 1.1rem;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    transition: box-shadow 0.15s;
    user-select: none;
}
.card-risco:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.13); }
.card-risco-critico    { border-color: #7B0000; }
.card-risco-alto-risco { border-color: #CC0000; }
.card-risco-medio-risco { border-color: #E65100; }
.card-risco-baixo-risco { border-color: #1B5E20; }
.card-risco-icon { font-size: 1.8rem; padding-top: 0.1rem; }
.card-risco-body { flex: 1; }
.card-risco-count {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}
.card-risco-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #333;
    margin-top: 0.1rem;
}
.card-risco-rec {
    font-size: 0.72rem;
    color: #666;
    margin-top: 0.25rem;
    line-height: 1.3;
}

/* Score de governança */
.score-bar-track {
    height: 10px;
    border-radius: 6px;
    background: #E0E0E0;
    overflow: hidden;
}
.score-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #CC0000, #28A745);
    transition: width 0.6s ease;
}

.status-ok  { color: #28A745; font-weight: 700; }
.status-nok { color: #CC0000; font-weight: 700; }

.btn-xs {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}

/* =============================================
   Paginação — override Bootstrap (cor Bradesco)
   ============================================= */
.page-link {
    color: var(--bs-primary);
    border-color: var(--bs-gray-mid);
}

.page-link:hover {
    color: var(--bs-primary-dark);
    background-color: #fdecea;
    border-color: var(--bs-primary);
}

.page-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(204, 0, 0, 0.2);
}

.page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

.page-item.disabled .page-link {
    color: #aaa;
    border-color: var(--bs-gray-mid);
}


.detalhe-dl {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.45rem 1rem;
    font-size: 0.875rem;
    margin: 0;
}

.detalhe-dl-full {
    grid-template-columns: 200px 1fr;
}

.detalhe-dl dt {
    font-weight: 600;
    color: var(--bs-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    align-self: start;
    padding-top: 2px;
}

.detalhe-dl dd {
    margin: 0;
    color: var(--bs-gray-dark);
    word-break: break-word;
}

.detalhe-alerta {
    background: #FDECEA;
    color: #CC0000;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
}

/* =============================================
   Páginas de Erro (404 / 500)
   ============================================= */
.error-wrapper {
    min-height: 100vh;
    background-color: #F0F2F5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-base);
}

.error-card {
    background-color: var(--bs-white);
    border-radius: 12px;
    padding: 3rem 3rem 2.5rem;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--bs-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
    letter-spacing: -2px;
}

.error-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--bs-gray-dark);
    margin-bottom: 0.75rem;
}

.error-description {
    font-size: 0.9rem;
    color: var(--bs-text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-divider {
    border: none;
    border-top: 1px solid var(--bs-gray-mid);
    margin: 0 auto 2rem;
    width: 60px;
}

.error-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.error-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    background-color: var(--bs-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s;
    cursor: pointer;
}

.error-btn-primary:hover {
    background-color: var(--bs-primary-dark);
    color: white;
}

.error-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    background-color: transparent;
    color: var(--bs-primary);
    border: 1.5px solid var(--bs-primary);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}

.error-btn-secondary:hover {
    background-color: var(--bs-primary);
    color: white;
}

.error-request-id {
    font-size: 0.72rem;
    color: var(--bs-text-muted);
    margin-top: 1.5rem;
    font-family: 'Courier New', monospace;
}

/* =============================================
   Login Page
   ============================================= */
.login-wrapper {
    min-height: 100vh;
    background-color: #F0F2F5;
    background-image: radial-gradient(circle at 20% 50%, rgba(204,0,0,0.06) 0%, transparent 50%),
                      radial-gradient(circle at 80% 20%, rgba(204,0,0,0.04) 0%, transparent 40%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background-color: var(--bs-white);
    border-radius: 12px;
    padding: 2.5rem 2.5rem 2rem;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    margin-bottom: 1.25rem;
}

.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bs-gray-dark);
    margin-bottom: 0.35rem;
}

.login-subtitle {
    font-size: 0.82rem;
    color: var(--bs-text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bs-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s;
    cursor: pointer;
}

.login-btn:hover {
    background-color: var(--bs-primary-dark);
    color: white;
}

.login-footer {
    margin-top: 1.75rem;
    font-size: 0.72rem;
    color: var(--bs-text-muted);
}

/* =============================================
   Botão toggle da sidebar
   ============================================= */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem 0.55rem;
    border-radius: 4px;
    transition: background 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* =============================================
   Responsividade
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        z-index: 1030;
        width: 220px !important;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        padding-top: 0.5rem;
        overflow-y: auto;
    }

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

    /* No collapsed narrow on mobile */
    .sidebar--collapsed {
        width: 220px !important;
    }
    .sidebar--collapsed .nav-text { display: inline; }
    .sidebar--collapsed .nav-link { justify-content: flex-start; padding: 0.6rem 1.25rem; gap: 0.6rem; }
    .sidebar--collapsed .nav-icon { width: 18px; font-size: 0.9rem; opacity: 0.85; }

    .sidebar-backdrop {
        position: fixed;
        inset: 64px 0 0 0;
        background: rgba(0, 0, 0, 0.38);
        z-index: 1029;
    }

    .main-content {
        padding: 1rem;
    }
}

/* =============================================
   Painel de Filtros (Overlay Direito)
   ============================================= */
.filtro-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 1045;
    animation: filtroFadeIn 0.18s ease;
}

@keyframes filtroFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.filtro-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    background: #fff;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 18px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.filtro-panel.aberto {
    transform: translateX(0);
}

.filtro-panel-header {
    background: var(--bs-primary);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.filtro-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.filtro-label-group {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-primary);
    border-bottom: 1px solid rgba(204,0,0,0.18);
    padding-bottom: 0.25rem;
    margin-bottom: -0.25rem;
}

.filtro-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 0.4rem;
}

.filtro-panel-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

/* Grupos de checkboxes (legado, mantido por segurança) */
.filtro-check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.845rem;
    cursor: pointer;
    color: var(--bs-gray-dark);
    user-select: none;
    padding: 0.15rem 0;
}

.filtro-check-item input[type="checkbox"] {
    accent-color: var(--bs-primary);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

/* =============================================
   Tom Select — tema Bradesco
   ============================================= */
.filtro-panel-body .ts-wrapper {
    font-size: 0.845rem;
}

/* Input / controle */
.filtro-panel-body .ts-control {
    border-color: #ced4da;
    border-radius: 0.375rem;
    min-height: 32px;
    padding: 3px 6px;
    font-size: 0.845rem;
}

.filtro-panel-body .ts-wrapper.focus .ts-control {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(204, 0, 0, 0.18);
}

/* Tags selecionadas */
.filtro-panel-body .ts-control .item {
    background: var(--bs-primary);
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 0.78rem;
    padding: 1px 6px;
}

.filtro-panel-body .ts-control .item .remove {
    color: rgba(255, 255, 255, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    padding-left: 4px;
    margin-left: 4px;
}

/* Botão clear (×) no input */
.filtro-panel-body .plugin-clear_button .clear-button {
    color: #999;
    font-size: 0.9rem;
}

/* Dropdown */
.filtro-panel-body .ts-dropdown {
    border-color: #ced4da;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    font-size: 0.845rem;
    z-index: 2000;
}

/* Opção no dropdown */
.filtro-panel-body .ts-dropdown .option {
    padding: 0.35rem 0.75rem;
    color: var(--bs-gray-dark);
}

.filtro-panel-body .ts-dropdown .option:hover,
.filtro-panel-body .ts-dropdown .option.active {
    background: rgba(204, 0, 0, 0.08);
    color: var(--bs-gray-dark);
}

/* Checkbox dentro da opção */
.filtro-panel-body .ts-dropdown .option input[type=checkbox] {
    accent-color: var(--bs-primary);
    margin-right: 0.5rem;
}

/* Placeholder */
.filtro-panel-body .ts-control input::placeholder {
    color: #bbb;
    font-style: italic;
}


/* FAB — botão flutuante */
.filtro-fab {
    position: fixed;
    bottom: 2rem;
    right: 1.75rem;
    z-index: 1040;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    border: none;
    font-size: 1.15rem;
    box-shadow: 0 4px 14px rgba(204, 0, 0, 0.38);
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filtro-fab:hover {
    background: var(--bs-primary-dark);
    box-shadow: 0 6px 20px rgba(204, 0, 0, 0.48);
    transform: scale(1.06);
}

/* Badge de contagem */
.filtro-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    background: #052767;
    color: #fff;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* =============================================
   Página Automações — Listagem e Detalhes
   ============================================= */

/* Truncamento de célula */
.cell-truncate {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pills de tecnologia */
.tag-pill {
    display: inline-block;
    background: #e9ecef;
    color: #444;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 1px 8px;
    margin: 1px 2px 1px 0;
    white-space: nowrap;
}

.tag-pill-more {
    background: #dee2e6;
    color: #555;
    cursor: default;
}

/* Ícones booleanos */
.icon-ok {
    color: #28A745;
    font-size: 1rem;
}

.icon-nok {
    color: #CC0000;
    font-size: 1rem;
}

/* Cor primária Bradesco para ícones inline */
.text-primary-bradesco {
    color: #CC0000;
}

/* Linha da tabela de automações */
.automacoes-table tbody tr.automacoes-row:hover td {
    background-color: #fff5f5;
}

/* Cabeçalho da página de detalhe */
.detalhe-page-header {
    border-left: 4px solid var(--bs-primary);
}

/* Badges por empresa */
.badge-empresa {
    display: inline-block;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 9px;
    white-space: nowrap;
}

.badge-empresa-saúde,
.badge-empresa-saude {
    background: #E3F2FD;
    color: #1565C0;
}

.badge-empresa-bare {
    background: #F3E5F5;
    color: #6A1B9A;
}

.badge-empresa-cap {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-empresa-bvp {
    background: #FFF3E0;
    color: #E65100;
}

.badge-empresa-holding {
    background: #FCE4EC;
    color: #880E4F;
}

/* =============================================
   Página Exportar PDF
   ============================================= */
.export-section {
    margin-bottom: 2.5rem;
}

.export-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #CC0000;
    border-bottom: 2px solid #CC0000;
    padding-bottom: 0.4rem;
    margin-bottom: 1.25rem;
}

/* =============================================
   Impressão / Exportar PDF
   ============================================= */
@page {
    size: auto;
    margin: 1cm 1.5cm;
}

@media print {
    /* Sem limite de altura — o PDF assume o tamanho do conteúdo */
    html, body {
        height: auto !important;
        overflow: visible !important;
    }

    /* Oculta elementos de navegação e interação */
    .topbar,
    .sidebar,
    .sidebar-backdrop,
    .filtro-fab,
    .filtro-panel,
    .filtro-backdrop,
    .btn-exportar-pdf,
    .page-wrapper > .content-wrapper > aside {
        display: none !important;
    }

    /* Layout ocupa a folha toda */
    body {
        background: #fff !important;
        font-size: 11pt;
    }

    .page-wrapper {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .content-wrapper {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0.5cm 1cm !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Cabeçalho de impressão — mostra logo e título */
    .print-header {
        display: flex !important;
        align-items: center;
        gap: 0.75rem;
        border-bottom: 2px solid #cc0000;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }

    /* Cards e gráficos sem sombra */
    .content-card {
        box-shadow: none !important;
        border: 1px solid #e0e0e0 !important;
        break-inside: avoid;
    }

    .kpi-card {
        box-shadow: none !important;
        break-inside: avoid;
    }

    /* Sem quebras de página forçadas — conteúdo contínuo */
    .print-page-break {
        break-before: auto;
        page-break-before: auto;
        margin-top: 2rem;
    }

    /* Garante que canvas (Chart.js) não seja cortado */
    canvas {
        max-width: 100% !important;
    }

    /* Remove backgrounds coloridos que mancham impressão em P&B */
    .topbar-brand-title,
    .topbar-brand-subtitle {
        color: #000 !important;
    }

    /* Esconde paginação e barra de busca da listagem */
    .pagination,
    .input-group,
    input[type=text],
    input[type=search] {
        display: none !important;
    }

    /* Tabela da listagem — mostra tudo sem scroll */
    .table-responsive {
        overflow: visible !important;
    }

    /* Garante que as colunas do Bootstrap imprimam lado a lado */
    .col-md-3, .col-md-4, .col-md-6, .col-md-8,
    .col-lg-3, .col-lg-4, .col-lg-6, .col-lg-8, .col-lg-12 {
        float: left;
    }

    /* Larguras explícitas para as colunas de gráficos */
    .col-lg-4  { width: 33.3333% !important; }
    .col-lg-6  { width: 50%      !important; }
    .col-lg-8  { width: 66.6666% !important; }
    .col-lg-12 { width: 100%     !important; }
}
