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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-size: 28px;
}

.balance-section {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
}

.balance-section label {
    font-weight: 600;
    color: #2c3e50;
}

.balance-section input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

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

.currency {
    font-weight: 600;
    color: #27ae60;
}

.remaining-balance {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 20px;
    text-align: center;
    color: white;
}

.remaining-balance h2 {
    color: white;
    margin: 0;
    font-weight: 600;
}

#remainingAmount {
    color: white;
    font-weight: 700;
    font-size: 1.2em;
}

#remainingAmount.negative {
    color: #ffeb3b;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.categories-section {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.add-category-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

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

.category {
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 12px;
    background: #fafafa;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.category-name {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    border: none;
    background: transparent;
    padding: 5px;
    border-radius: 3px;
}

.category-name:focus {
    outline: none;
    background: white;
    border: 2px solid #3498db;
}

.category-controls {
    display: flex;
    gap: 10px;
}

.category-total {
    font-weight: 600;
    color: #e74c3c;
    font-size: 16px;
}

.delete-category-btn {
    background: #bdc3c7;
    color: #2c3e50;
    border: none;
    padding: 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-category-btn:hover {
    background: #95a5a6;
}

.items-list {
    margin-bottom: 12px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.items-table th {
    background: #f8f9fa;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    border-bottom: 2px solid #e9ecef;
}

.items-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.items-table tr:last-child td {
    border-bottom: none;
}

.items-table tr:hover {
    background: #f8f9fa;
}

.item-name {
    font-weight: 500;
    color: #2c3e50;
}

.item-value {
    font-weight: 600;
    color: #e74c3c;
    text-align: right;
}

.item-actions {
    text-align: center;
    width: 80px;
}

.delete-item-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.delete-item-btn:hover {
    background: #c0392b;
}

.add-item-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.add-item-form input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.add-item-form input[type="text"] {
    flex: 2;
}

.add-item-form input[type="number"] {
    flex: 1;
}

.add-item-btn {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(86, 171, 47, 0.3);
}

.add-item-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(86, 171, 47, 0.4);
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    .balance-section {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }
    
    .add-item-form {
        flex-direction: column;
    }
    
    .categories-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .category {
        padding: 12px;
    }
    
    .remaining-balance {
        padding: 15px;
    }
    
    .categories-section {
        padding: 15px;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .balance-section {
        padding: 12px;
    }
    
    .balance-section label {
        font-size: 14px;
    }
    
    .balance-section input {
        font-size: 16px;
        padding: 8px;
    }
    
    .remaining-balance {
        padding: 12px;
    }
    
    .remaining-balance h2 {
        font-size: 20px;
    }
    
    .categories-section {
        padding: 12px;
    }
    
    .category {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .category-name {
        font-size: 16px;
    }
    
    .items-table {
        font-size: 13px;
    }
    
    .items-table th,
    .items-table td {
        padding: 6px 8px;
    }
    
    .items-table th:last-child,
    .items-table td:last-child {
        width: 60px;
    }
    
    .delete-item-btn {
        padding: 3px 6px;
        font-size: 11px;
    }
    
    .add-item-form {
        padding: 6px;
        gap: 6px;
    }
    
    .add-item-form input {
        padding: 8px;
        font-size: 16px;
    }
    
    .add-item-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .add-category-btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
}