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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: white;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

header h1 {
    margin-bottom: 20px;
    color: #2563eb;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    background: #f3f4f6;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: #e5e7eb;
}

.nav-btn.active {
    background: #2563eb;
    color: white;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.username-display {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.btn-logout {
    background: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #b91c1c;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Cards */
.card {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 20px;
    color: #1f2937;
    font-size: 18px;
}

.card h4 {
    margin-top: 20px;
    margin-bottom: 15px;
    color: #4b5563;
    font-size: 16px;
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-cards .card {
    text-align: center;
}

.balance-amount {
    font-size: 36px;
    font-weight: bold;
    color: #2563eb;
    margin-top: 10px;
}

.amount {
    font-size: 28px;
    font-weight: bold;
    margin-top: 10px;
}

.income {
    color: #10b981;
}

.expense {
    color: #ef4444;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: #4b5563;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
}

/* Buttons */
.btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-primary {
    background: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Transactions */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.transaction-item:hover {
    background: #f9fafb;
}

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

.transaction-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.transaction-category {
    font-weight: 600;
    font-size: 14px;
}

.transaction-description {
    font-size: 13px;
    color: #6b7280;
}

.transaction-date {
    font-size: 12px;
    color: #9ca3af;
}

.transaction-source {
    font-size: 11px;
    color: #fff;
    background: #6366f1;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
    margin-top: 3px;
}

.transaction-amount {
    font-size: 18px;
    font-weight: bold;
    margin: 0 20px;
}

.transaction-actions {
    display: flex;
    gap: 8px;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters input {
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

/* Bulk Upload */
.info-text {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 15px;
}

.info-text a {
    color: #2563eb;
    text-decoration: none;
}

.info-text a:hover {
    text-decoration: underline;
}

.bulk-upload-section {
    margin-top: 15px;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f9fafb;
}

.upload-area:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.upload-area.drag-over {
    border-color: #2563eb;
    background: #dbeafe;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-area p {
    margin: 5px 0;
    color: #4b5563;
}

.upload-hint {
    font-size: 12px;
    color: #9ca3af;
}

.upload-results {
    margin-top: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 6px;
}

.result-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.result-stat {
    font-size: 16px;
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 6px;
}

.success-stat {
    background: #d1fae5;
    color: #065f46;
}

.error-stat {
    background: #fee2e2;
    color: #991b1b;
}

.warning-stat {
    background: #fef3c7;
    color: #92400e;
}

.upload-info {
    margin-top: 15px;
    padding: 12px;
    background: #dbeafe;
    border-left: 4px solid #2563eb;
    border-radius: 4px;
}

.upload-info p {
    margin: 5px 0;
    font-size: 13px;
    color: #1e40af;
}

.upload-info strong {
    color: #1e3a8a;
}

.error-details {
    margin-top: 15px;
}

.error-details h4 {
    color: #991b1b;
    margin-bottom: 10px;
    font-size: 14px;
}

.error-details ul {
    list-style: none;
    padding: 0;
}

.error-details li {
    padding: 5px 0;
    font-size: 13px;
    color: #6b7280;
}

.error-message {
    padding: 15px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    margin-top: 15px;
}

.loading {
    padding: 15px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* Categories */
.category-section {
    margin-bottom: 25px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

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

.category-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-color-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.category-name {
    font-weight: 500;
}

/* Budgets */
.budget-item {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 6px;
}

.budget-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.budget-category {
    font-weight: 600;
    font-size: 15px;
}

.budget-amounts {
    font-size: 14px;
    color: #6b7280;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s;
}

.progress-fill.ok {
    background: #10b981;
}

.progress-fill.warning {
    background: #f59e0b;
}

.progress-fill.over {
    background: #ef4444;
}

.budget-status {
    font-size: 13px;
    font-weight: 500;
}

.budget-status.ok {
    color: #10b981;
}

.budget-status.warning {
    color: #f59e0b;
}

.budget-status.over {
    color: #ef4444;
}

/* Reports */
.summary-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
}

.stat .label {
    font-weight: 500;
    color: #4b5563;
}

.stat .value {
    font-size: 20px;
    font-weight: bold;
}

.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-card canvas {
    height: 300px !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    color: #9ca3af;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #4b5563;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #1f2937;
}

.modal-content .form-group {
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 24px;
    }

    .nav-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .transaction-amount {
        margin: 0;
    }

    .chart-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}
