/* ==========================================================================
   KPF Components
   Componentes visuais compartilhados para migração gradual das telas modernas.
   Use sempre com prefixo .kpf-component-* para evitar conflito com Backpack.
   ========================================================================== */

.kpf-component-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.kpf-component-section-head h2,
.kpf-component-section-title {
    margin: 0;
    color: var(--tblr-body-color);
    font-size: 1.35rem;
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.2;
}

.kpf-component-section-head p,
.kpf-component-section-subtitle {
    margin: .25rem 0 0;
    color: var(--tblr-secondary-color);
    font-size: .92rem;
    line-height: 1.45;
}

.kpf-component-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .9rem;
}

.kpf-component-kpi-card {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    min-width: 0;
    min-height: 116px;
    padding: 1rem;
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--kpf-radius-card, 12px);
    background: var(--tblr-bg-surface);
    box-shadow: var(--kpf-shadow-card, 0 8px 24px rgba(15, 23, 42, .06));
}

.kpf-component-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 14px;
    color: var(--kpf-component-tone-color, var(--tblr-primary));
    background: rgba(var(--kpf-component-tone-rgb, var(--tblr-primary-rgb)), .1);
    font-size: 1.25rem;
}

.kpf-component-kpi-body {
    min-width: 0;
}

.kpf-component-kpi-value {
    display: block;
    margin-bottom: .15rem;
    color: var(--tblr-body-color);
    font-size: 1.65rem;
    font-weight: 900;
    line-height: 1;
}

.kpf-component-kpi-label {
    margin: 0;
    color: var(--tblr-body-color);
    font-size: .86rem;
    font-weight: 850;
    line-height: 1.25;
}

.kpf-component-kpi-hint {
    display: block;
    margin-top: .28rem;
    color: var(--tblr-secondary-color);
    font-size: .78rem;
    font-style: normal;
    line-height: 1.35;
}

.kpf-component-tone-primary {
    --kpf-component-tone-color: var(--tblr-primary);
    --kpf-component-tone-rgb: var(--tblr-primary-rgb);
}

.kpf-component-tone-success {
    --kpf-component-tone-color: var(--kpf-risk-very-low, #27AE60);
    --kpf-component-tone-rgb: var(--kpf-risk-very-low-rgb, 39, 174, 96);
}

.kpf-component-tone-warning {
    --kpf-component-tone-color: var(--kpf-risk-moderate, #F2C94C);
    --kpf-component-tone-rgb: var(--kpf-risk-moderate-rgb, 242, 201, 76);
}

.kpf-component-tone-danger {
    --kpf-component-tone-color: var(--kpf-risk-critical, #EB5757);
    --kpf-component-tone-rgb: var(--kpf-risk-critical-rgb, 235, 87, 87);
}

.kpf-component-tone-muted {
    --kpf-component-tone-color: var(--tblr-secondary-color);
    --kpf-component-tone-rgb: 148, 163, 184;
}

.kpf-component-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 28px;
    padding: .32rem .62rem;
    border: 1px solid rgba(var(--kpf-component-risk-rgb, 148, 163, 184), .24);
    border-radius: 999px;
    color: var(--kpf-component-risk-color, var(--tblr-secondary-color));
    background: rgba(var(--kpf-component-risk-rgb, 148, 163, 184), .1);
    font-size: .76rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}

.kpf-component-risk-badge.is-very-low {
    --kpf-component-risk-color: var(--kpf-risk-very-low, #27AE60);
    --kpf-component-risk-rgb: var(--kpf-risk-very-low-rgb, 39, 174, 96);
}

.kpf-component-risk-badge.is-low {
    --kpf-component-risk-color: var(--kpf-risk-low, #6FCF97);
    --kpf-component-risk-rgb: var(--kpf-risk-low-rgb, 111, 207, 151);
}

.kpf-component-risk-badge.is-moderate {
    --kpf-component-risk-color: var(--kpf-risk-moderate, #F2C94C);
    --kpf-component-risk-rgb: var(--kpf-risk-moderate-rgb, 242, 201, 76);
}

.kpf-component-risk-badge.is-high {
    --kpf-component-risk-color: var(--kpf-risk-high, #F2994A);
    --kpf-component-risk-rgb: var(--kpf-risk-high-rgb, 242, 153, 74);
}

.kpf-component-risk-badge.is-critical {
    --kpf-component-risk-color: var(--kpf-risk-critical, #EB5757);
    --kpf-component-risk-rgb: var(--kpf-risk-critical-rgb, 235, 87, 87);
}

.kpf-component-risk-badge.is-neutral {
    --kpf-component-risk-color: var(--tblr-secondary-color);
    --kpf-component-risk-rgb: 148, 163, 184;
}

.kpf-component-progress-card,
.kpf-component-chart-panel,
.kpf-component-empty-state {
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--kpf-radius-card, 12px);
    background: var(--tblr-bg-surface);
    box-shadow: var(--kpf-shadow-card, 0 8px 24px rgba(15, 23, 42, .06));
}

.kpf-component-progress-card {
    padding: 1rem;
}

.kpf-component-progress-head,
.kpf-component-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .85rem;
    margin-bottom: .85rem;
}

.kpf-component-progress-head strong,
.kpf-component-chart-head strong {
    display: block;
    color: var(--tblr-body-color);
    font-size: .96rem;
    font-weight: 850;
    line-height: 1.25;
}

.kpf-component-progress-head span,
.kpf-component-chart-head span {
    color: var(--tblr-secondary-color);
    font-size: .78rem;
    font-weight: 750;
}

.kpf-component-progress-track {
    width: 100%;
    height: 9px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .16);
    overflow: hidden;
}

.kpf-component-progress-bar {
    display: block;
    height: 100%;
    width: var(--kpf-component-progress, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--tblr-primary), var(--kpf-color-primary-hover, #2F80ED));
}

.kpf-component-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .55rem;
    color: var(--tblr-secondary-color);
    font-size: .78rem;
    font-weight: 750;
}

.kpf-component-chart-panel {
    padding: 1rem;
}

.kpf-component-chart-body {
    min-height: var(--kpf-component-chart-height, 280px);
}

.kpf-component-empty-state {
    display: grid;
    justify-items: center;
    gap: .55rem;
    padding: 2.25rem 1.25rem;
    color: var(--tblr-secondary-color);
    text-align: center;
}

.kpf-component-empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: var(--tblr-primary);
    background: rgba(var(--tblr-primary-rgb), .1);
    font-size: 1.45rem;
}

.kpf-component-empty-state strong {
    color: var(--tblr-body-color);
    font-size: 1rem;
    font-weight: 850;
}

.kpf-component-empty-state p {
    max-width: 420px;
    margin: 0;
    color: var(--tblr-secondary-color);
    font-size: .88rem;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .kpf-component-section-head,
    .kpf-component-progress-head,
    .kpf-component-chart-head {
        flex-direction: column;
    }

    .kpf-component-kpi-card {
        min-height: auto;
    }
}
