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

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

.container {
    max-width: 480px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-nav {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-nav:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Resumo Financeiro */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.summary-item {
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.summary-income {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
}

.summary-expense {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #dc3545;
}

.summary-label {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.summary-income .summary-value {
    color: #28a745;
}

.summary-expense .summary-value {
    color: #dc3545;
}

.balance-section {
    padding: 20px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #dee2e6;
}

.balance-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: #555;
}

.balance-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.balance-positive {
    color: #007bff !important;
}

.balance-negative {
    color: #dc3545 !important;
}

.expense-amount {
    color: #dc3545 !important;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 1.25rem;
    color: #667eea;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.message {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

.sales-list {
    max-height: 400px;
    overflow-y: auto;
}

.sale-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    gap: 12px;
}

.sale-item:hover {
    background-color: #f8f9fa;
}

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

.sale-info {
    flex: 1;
    min-width: 0;
}

.sale-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sale-date {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.sale-description {
    color: #777;
    font-size: 0.85rem;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sale-amount {
    font-weight: 600;
    color: #667eea;
    font-size: 1.1rem;
    white-space: nowrap;
}

.sale-actions {
    display: flex;
    gap: 6px;
}

.btn-edit,
.btn-delete {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-edit:hover {
    background-color: #e3f2fd;
}

.btn-delete:hover {
    background-color: #ffebee;
}

.btn-edit-mode {
    background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%) !important;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state p {
    font-size: 0.95rem;
}

.total-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
}

.total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

/* Scrollbar personalizada */
.sales-list::-webkit-scrollbar {
    width: 8px;
}

.sales-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sales-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.sales-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Responsividade */
@media (max-width: 520px) {
    .container {
        padding: 0;
    }
    
    .card {
        border-radius: 8px;
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .nav-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .balance-section {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}
