﻿.kpi-master-page {
    min-height: 100vh;
    padding: 24px;
    background: #f6f8fc;
    color: #172033;
    font-family: Inter, Arial, sans-serif;
}

.kpi-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}

    .kpi-page-header h1 {
        margin: 0 0 6px;
        font-size: 27px;
        font-weight: 750;
    }

    .kpi-page-header p {
        margin: 0;
        color: #758097;
        font-size: 14px;
    }

.kpi-primary-btn,
.kpi-secondary-btn {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    border: none;
    font-weight: 650;
    cursor: pointer;
}

.kpi-primary-btn {
    background: #3158e6;
    color: #fff;
    box-shadow: 0 7px 18px rgba(49, 88, 230, .19);
}

    .kpi-primary-btn:hover {
        background: #284bc8;
    }

.kpi-secondary-btn {
    background: #eef2f8;
    color: #3e485c;
}

.kpi-alert {
    margin-bottom: 18px;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: 14px;
}

    .kpi-alert.success {
        background: #eaf8f0;
        color: #23734a;
    }

    .kpi-alert.error {
        background: #fff0f0;
        color: #c53b3b;
    }

.kpi-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.kpi-summary-card {
    min-height: 126px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e8ecf4;
    border-radius: 15px;
    box-shadow: 0 5px 18px rgba(28, 42, 76, .045);
}

    .kpi-summary-card span {
        display: block;
        margin-bottom: 13px;
        color: #78839a;
        font-size: 13px;
        font-weight: 600;
    }

    .kpi-summary-card strong {
        display: block;
        margin-bottom: 7px;
        font-size: 29px;
        line-height: 1;
    }

    .kpi-summary-card small {
        color: #9aa3b4;
    }

.kpi-panel {
    background: #fff;
    border: 1px solid #e7ebf3;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(28, 42, 76, .045);
    overflow: hidden;
}

.kpi-filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 14px;
    padding: 20px;
    border-bottom: 1px solid #edf0f5;
}

.kpi-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

    .kpi-field.full {
        grid-column: 1 / -1;
    }

    .kpi-field label {
        font-size: 13px;
        color: #5d687d;
        font-weight: 650;
    }

    .kpi-field input,
    .kpi-field select,
    .kpi-field textarea {
        width: 100%;
        min-height: 42px;
        padding: 9px 12px;
        background: #fff;
        border: 1px solid #dfe4ed;
        border-radius: 9px;
        outline: none;
        box-sizing: border-box;
    }

    .kpi-field textarea {
        resize: vertical;
    }

        .kpi-field input:focus,
        .kpi-field select:focus,
        .kpi-field textarea:focus {
            border-color: #6f88ef;
            box-shadow: 0 0 0 3px rgba(49, 88, 230, .09);
        }

.kpi-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.kpi-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
}

    .kpi-table th {
        padding: 14px 16px;
        background: #f8f9fc;
        color: #657087;
        text-align: left;
        font-size: 12px;
        font-weight: 700;
        border-bottom: 1px solid #e9edf4;
    }

    .kpi-table td {
        padding: 15px 16px;
        border-bottom: 1px solid #eef1f6;
        font-size: 13px;
        vertical-align: middle;
    }

    .kpi-table tbody tr:hover {
        background: #fafbfe;
    }

.kpi-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .kpi-name strong {
        color: #263148;
        font-size: 14px;
    }

    .kpi-name span {
        max-width: 290px;
        color: #8a94a7;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.kpi-table code {
    padding: 5px 8px;
    border-radius: 6px;
    background: #f0f3fa;
    color: #4b5e91;
    font-size: 11px;
}

.kpi-status {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

    .kpi-status.active {
        background: #e9f8ef;
        color: #278052;
    }

    .kpi-status.inactive {
        background: #f0f1f4;
        color: #7c8493;
    }

.kpi-actions {
    display: flex;
    gap: 7px;
}

    .kpi-actions button {
        width: 34px;
        height: 34px;
        border: 1px solid #e1e5ed;
        border-radius: 8px;
        background: #fff;
        color: #5f6c84;
        cursor: pointer;
    }

        .kpi-actions button:hover {
            background: #eef2ff;
            color: #3158e6;
        }

.kpi-empty {
    padding: 45px !important;
    text-align: center;
    color: #929bad;
}

.kpi-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    color: #747f93;
    font-size: 13px;
}

    .kpi-pagination > div {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .kpi-pagination button {
        min-height: 35px;
        padding: 0 12px;
        border: 1px solid #dfe4ec;
        border-radius: 8px;
        background: #fff;
        cursor: pointer;
    }

        .kpi-pagination button:disabled {
            opacity: .45;
            cursor: default;
        }

.kpi-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(24, 31, 48, .48);
}

.kpi-modal {
    width: 760px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .27);
}

.kpi-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 22px;
    border-bottom: 1px solid #e9edf3;
}

    .kpi-modal-header h3 {
        margin: 0 0 5px;
        font-size: 20px;
    }

    .kpi-modal-header p {
        margin: 0;
        color: #8690a2;
        font-size: 13px;
    }

    .kpi-modal-header > button {
        width: 34px;
        height: 34px;
        border: none;
        border-radius: 8px;
        background: #f1f3f7;
        cursor: pointer;
    }

.kpi-modal-body {
    max-height: calc(100vh - 210px);
    padding: 22px;
    overflow-y: auto;
}

.kpi-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.toggle-field {
    justify-content: center;
}

    .toggle-field input {
        width: 18px;
        min-height: 18px;
    }

.kpi-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid #e9edf3;
}

@media (max-width: 1000px) {
    .kpi-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .kpi-master-page {
        padding: 15px;
    }

    .kpi-page-header {
        flex-direction: column;
    }

        .kpi-page-header .kpi-primary-btn {
            width: 100%;
        }

    .kpi-summary-grid {
        grid-template-columns: 1fr;
    }

    .kpi-filter-grid,
    .kpi-form-grid {
        grid-template-columns: 1fr;
    }

    .kpi-field.full {
        grid-column: auto;
    }

    .kpi-pagination {
        flex-direction: column;
        align-items: stretch;
    }

        .kpi-pagination > div {
            justify-content: space-between;
        }
}
