* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.form-card {
    background: white;
    border-radius: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    border: none;
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0;
    min-height: auto;
}

.title {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
    font-weight: 700;
}

.title i {
    color: #667eea;
    margin-right: 8px;
}

.section {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 12px;
    border: 1px solid #e8ecf7;
}

.section-title {
    color: #333;
    font-size: 1.2em;
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.section-title i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 0.7em;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
    font-size: 0.9em;
}

.input-group input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.kg-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.kg-suffix {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
    z-index: 2;
    pointer-events: none;
    background: white;
    padding: 0 5px;
}

.input-group input[type="number"] {
    text-align: left;
    padding-right: 40px;
}

.input-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 45px;
}

.input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-group select option {
    padding: 10px;
    background: white;
    color: #333;
}

.rupiah-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.rupiah-prefix {
    position: absolute;
    left: 15px;
    top: 45%;
    transform: translateY(-50%);
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
    z-index: 2;
    pointer-events: none;
}

.input-group input.rupiah-input {
    text-align: left;
    font-weight: 500;
    color: #333;
    padding-left: 35px;
    width: 100%;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.input-group input.rupiah-input::placeholder {
    color: #a0a0a0;
    font-style: normal;
    margin-left: 0;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-group input::placeholder {
    color: #a0a0a0;
    font-style: normal;
}

.btn-add {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 8px;
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-add i {
    margin-right: 6px;
    font-size: 0.8em;
}

.date-section {
    margin: 15px 0;
    padding: 15px;
    background: #f0f4ff;
    border-radius: 12px;
    border: 1px solid #d6e0ff;
}

.date-section label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 1em;
}

.date-section input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

.date-section input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.summary-section {
    background: linear-gradient(135deg, #f8f9ff, #e8ecf7);
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    border: 1px solid #d6e0ff;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e1e5e9;
    font-size: 1em;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item.total {
    font-weight: 700;
    font-size: 1.1em;
    color: #333;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid #667eea;
}

.btn-save {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 20px auto 0;
    width: 100%;
    max-width: 250px;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(102, 126, 234, 0.4);
}

.btn-save i {
    margin-right: 8px;
}

.data-section {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 12px;
    border: 1px solid #e8ecf7;
}

.data-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    border-left: 3px solid #667eea;
    position: relative;
}

.data-item h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.data-item p {
    color: #666;
    margin: 3px 0;
    font-size: 0.9em;
}

/* Row style for saved data: label left, value right */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.data-row .label {
    color: #333;
    font-weight: 400;
}
.data-row .value {
    color: #666;
    text-align: right;
}

.data-row.separator {
    border-top: 1px solid #e1e5e9;
    margin-top: 6px;
    padding-top: 8px;
}
.data-row.separator .label {
    font-weight: 700;
}

/* Emphasis rows */
.data-row.total .label {
    font-weight: 700;
}
.data-row.total.income {
    margin-bottom: 10px;
}
.data-row.final .label,
.data-row.final .value {
    font-weight: 800;
    font-size: 1.05em;
    font-style: italic;
}

.data-item .amount {
    font-weight: 600;
    color: #667eea;
}

.data-item .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff5f5;
    color: #dc3545;
    border: 1px solid #ffd6d6;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}
.data-item .delete-btn:hover {
    background: #ffe9e9;
}

/* Modern modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.15s ease-out;
}

.modal-card {
    width: 95%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    overflow: hidden;
}

.modal-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-weight: 700;
}

.modal-body {
    padding: 16px;
    color: #333;
}

.modal-body p { margin: 0 0 10px 0; }

.modal-input {
    width: 100%;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px 16px 16px;
}

.btn-cancel {
    background: #f1f1f1;
    color: #333;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
}

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

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #c3e6cb;
    display: none;
    font-size: 0.9em;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
    display: none;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-card {
        padding: 15px;
    }
    
    .title {
        font-size: 1.5em;
        margin-bottom: 12px;
    }
    
    .section {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .btn-save {
        padding: 12px 25px;
        font-size: 14px;
        max-width: 200px;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-card {
    animation: fadeInUp 0.4s ease-out;
}

.section {
    animation: fadeInUp 0.6s ease-out;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ripple effect */
.btn-add, .btn-save {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.amount.positive {
    color: #28a745 !important;
}

.amount.negative {
    color: #dc3545 !important;
}