/*
 * SIHAKI PATCH 06 — Statistik publik per unit
 * Hanya untuk blok statistik di halaman Beranda Guest.
 * Semua aturan dibatasi awalan ki-stat agar tidak memengaruhi modul lain.
 */

.ki-statistics-section {
    background: #f7faf8;
    border-top: 1px solid #edf1ee;
    border-bottom: 1px solid #edf1ee;
}

.ki-statistics-heading {
    align-items: center;
    margin-bottom: 23px;
}

.ki-statistics-heading h2 {
    font-size: clamp(1.65rem, 2.7vw, 2.05rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

.ki-statistics-heading p {
    margin-top: 8px;
    line-height: 1.65;
}

.ki-stat-filter-panel {
    padding: 19px 22px 20px;
    background: #ffffff;
    border: 1px solid #e2eae5;
    border-radius: 12px;
    margin-bottom: 18px;
}

.ki-stat-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.ki-stat-filter-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .91rem;
    font-weight: 650;
    color: #243c31;
}

.ki-stat-filter-title i {
    color: #0b6b4f;
}

.ki-stat-filter-caption {
    color: #71837a;
    font-size: .75rem;
}

.ki-stat-filter-controls {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px 15px;
}

.ki-stat-select-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 0 1 233px;
    min-width: 195px;
    font-size: .77rem;
    font-weight: 600;
    color: #50645a;
}

.ki-stat-select-group .form-select {
    min-height: 42px;
    font-size: .85rem;
    border: 1px solid #dce5df;
    border-radius: 7px;
    color: #26392f;
    background-color: #fff;
}

.ki-stat-select-group .form-select:focus {
    border-color: #409a7c;
    box-shadow: 0 0 0 3px rgb(25 119 86 / 10%);
}

.ki-stat-reset {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #dce5df;
    background: #fff;
    color: #2c5f49;
    padding: 0 13px;
    border-radius: 7px;
    font-size: .81rem;
    font-weight: 600;
}

.ki-stat-reset:hover {
    border-color: #94bca9;
    background: #f3f8f5;
}

.ki-stat-filter-panel.is-busy .ki-stat-filter-caption {
    color: #0b6b4f;
}

.ki-stat-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(200px, 1.5fr);
    gap: 0;
    padding: 14px 0;
    margin-bottom: 16px;
    background: #ecf5ef;
    border: 1px solid #dcebe1;
    border-radius: 11px;
}

.ki-stat-summary-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3px 21px;
    border-right: 1px solid #d4e4d9;
    gap: 2px;
}

.ki-stat-summary-item > span {
    font-size: .77rem;
    color: #587264;
    line-height: 1.45;
}

.ki-stat-summary-item strong {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.3;
    color: #0a5b44;
    font-variant-numeric: tabular-nums;
}

.ki-stat-summary-note {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    border-right: 0;
}

.ki-stat-summary-note i {
    color: #387c5f;
    font-size: 1.15rem;
    flex: none;
}

.ki-stat-summary-note span {
    line-height: 1.5;
}

.ki-stat-feedback {
    min-height: 24px;
    color: #64766b;
    font-size: .77rem;
    margin-bottom: 11px;
}

.ki-stat-feedback.is-warning,
.ki-stat-feedback.is-error,
.ki-stat-feedback.is-empty {
    border-radius: 8px;
    padding: 9px 13px;
    margin-bottom: 15px;
}

.ki-stat-feedback.is-warning {
    background: #fff8e7;
    color: #775919;
}

.ki-stat-feedback.is-error {
    background: #fff0f0;
    color: #b23838;
}

.ki-stat-feedback.is-empty {
    background: #edf3f0;
    color: #5d7066;
}

.ki-stat-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.ki-stat-card {
    --bar-color: #17876d;
    --bar-soft: #e6f4ed;
    background: #fff;
    border: 1px solid #e1e9e4;
    border-radius: 12px;
    padding: 21px 20px 18px;
    min-width: 0;
}

.ki-stat-card--amber {
    --bar-color: #ba903e;
    --bar-soft: #faf3e1;
}

.ki-stat-card--blue {
    --bar-color: #427aa6;
    --bar-soft: #ecf4fa;
}

.ki-stat-card--violet {
    --bar-color: #7772a8;
    --bar-soft: #f0eff8;
}

.ki-stat-card-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 17px;
    margin-bottom: 14px;
    border-bottom: 1px solid #edf1ee;
}

.ki-stat-card-title {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.ki-stat-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--bar-soft);
    color: var(--bar-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    font-size: 1.15rem;
}

.ki-stat-card-title h3 {
    margin: 0 0 3px;
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.01em;
    color: #21372c;
}

.ki-stat-card-title p {
    margin: 0;
    font-size: .74rem;
    color: #7b8b81;
}

.ki-stat-card-total {
    display: flex;
    flex-direction: column;
    align-items: end;
    white-space: nowrap;
}

.ki-stat-card-total strong {
    color: var(--bar-color);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.ki-stat-card-total span {
    font-size: .65rem;
    color: #819086;
    margin-top: 4px;
}

.ki-stat-chart {
    position: relative;
    width: 100%;
    min-height: 160px;
}

.ki-stat-loading,
.ki-stat-empty {
    padding: 55px 0;
    text-align: center;
    color: #87988c;
    font-size: .83rem;
}

.ki-stat-chart-axis,
.ki-stat-chart-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 36px;
    gap: 10px;
    align-items: center;
}

.ki-stat-chart-axis {
    margin-bottom: 10px;
    font-size: .64rem;
    font-weight: 600;
    color: #899990;
}

.ki-stat-chart-axis > span:last-child {
    text-align: right;
}

.ki-stat-axis-ticks {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    width: 100%;
    font-variant-numeric: tabular-nums;
}

.ki-stat-chart-rows {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ki-stat-chart-row {
    min-height: 20px;
}

.ki-stat-unit-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #40544a;
    font-size: .74rem;
    font-weight: 600;
}

.ki-stat-bar-track {
    display: flex;
    align-items: center;
    width: 100%;
    height: 17px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f4f7f5 0%, #f0f4f1 100%);
    position: relative;
    overflow: hidden;
}

.ki-stat-bar-fill {
    height: 100%;
    background: var(--bar-color);
    border-radius: 4px;
    transition: width 260ms ease;
}

.ki-stat-chart-row:hover .ki-stat-bar-fill {
    filter: brightness(.9);
}

.ki-stat-count-label {
    color: #55665c;
    font-size: .74rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ki-stat-footnote {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    font-size: .78rem;
    line-height: 1.7;
    color: #78887e;
}

.ki-stat-footnote i {
    color: #5b9676;
    margin-top: 2px;
}

.ki-stat-footnote p {
    margin: 0;
}

.ki-stat-footnote strong {
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .ki-stat-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ki-stat-summary-note {
        grid-column: 1 / -1;
        padding-top: 13px;
        margin-top: 12px;
        border-top: 1px solid #d4e4d9;
    }

    .ki-stat-summary-item:nth-child(3) {
        border-right: 0;
    }

    .ki-stat-charts {
        gap: 13px;
    }

    .ki-stat-card {
        padding: 17px 15px;
    }
}

@media (max-width: 767.98px) {
    .ki-stat-charts {
        grid-template-columns: 1fr;
    }

    .ki-stat-filter-controls {
        align-items: stretch;
    }

    .ki-stat-select-group {
        flex: 1 1 100%;
        min-width: 0;
    }


    .ki-stat-summary-item {
        padding-left: 12px;
        padding-right: 12px;
    }

    .ki-stat-summary-item strong {
        font-size: 1.4rem;
    }

    .ki-stat-summary-item > span {
        font-size: .68rem;
    }

    .ki-stat-filter-caption {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ki-stat-bar-fill {
        transition: none;
    }
}

/* PATCH 19: kartu ringkasan diperluas dengan metrik keterlibatan. */
@media(min-width:1100px){.ki-stat-summary{grid-template-columns:repeat(4,minmax(0,1fr))}.ki-stat-summary-note{grid-column:1 / -1}}
@media(min-width:768px) and (max-width:1099px){.ki-stat-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.ki-stat-summary-note{grid-column:1 / -1}}
