.kpi-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.kpi-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.kpi-header {
    background: linear-gradient(135deg, #6c5ce7 0%, #574bd2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.kpi-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.kpi-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.kpi-content {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.kpi-section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.kpi-section:last-child {
    border-bottom: none;
}

.kpi-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.kpi-settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kpi-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kpi-row label {
    flex: 1;
    color: #2c3e50;
    font-size: 0.9rem;
}

.kpi-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.kpi-input {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100px;
    transition: all 0.3s ease;
}

.kpi-unit {
    position: absolute;
    right: 10px;
    color: #7f8c8d;
    font-size: 0.9rem;
    pointer-events: none;
}

.kpi-select {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 200px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kpi-input:focus,
.kpi-select:focus {
    outline: none;
    border-color: #6c5ce7;
}

.kpi-save-btn {
    background: #6c5ce7;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.kpi-save-btn:hover {
    background: #574bd2;
    transform: translateY(-2px);
}

.warning-message {
    padding: 0.5rem 1rem;
    background: #fff3cd;
    color: #856404;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-message.error {
    background: #f8d7da;
    color: #721c24;
}

.warning-message.success {
    background: #d4edda;
    color: #155724;
}

.kpi-enable-section {
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.kpi-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #6c5ce7;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 600;
}

.kpi-settings-container {
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.3s ease;
}

.kpi-settings-container.enabled {
    opacity: 1;
    pointer-events: all;
}