* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f7f7f7;
    color: #222;
    line-height: 1.6;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e1e1e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
}

.beta-tag {
    background: #0066ff;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.user-email {
    margin-right: 12px;
    color: #666;
    font-size: 14px;
}

/* Buttons */
.btn-primary {
    background: #0066ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0052cc;
}

.btn-secondary {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 8px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Auth Forms */
.auth-forms {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    background: white;
    padding: 32px;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.auth-container h3 {
    margin-bottom: 24px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
}

.auth-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border 0.2s;
}

.auth-container input:focus {
    outline: none;
    border-color: #0066ff;
}

.auth-container button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: #0066ff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}

#switchAuth {
    width: 100%;
    background: transparent;
    color: #0066ff;
    border: none;
    margin-top: 16px;
    cursor: pointer;
    font-size: 14px;
}

/* Main App Layout */
.main-app {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid #e1e1e1;
    padding: 24px 0;
}

.sidebar-section {
    padding: 0 24px;
    margin-bottom: 32px;
}

.sidebar-section h4 {
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.nav-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item.active {
    background: #0066ff;
    color: white;
}

.nav-item:hover {
    background: #f0f0f0;
}

.nav-item.active:hover {
    background: #0052cc;
}

.content {
    flex: 1;
    padding: 24px;
    background: #f7f7f7;
    overflow-y: auto;
}

/* Boards */
.board {
    display: none;
}

.board.active {
    display: block;
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.board-header h2 {
    font-size: 24px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #0066ff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-amount {
    font-size: 24px;
    font-weight: 600;
    color: #222;
}

/* Issues Container */
.issues-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.issues-column h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #333;
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Issue Cards */
.issue-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e1e1e1;
    transition: all 0.2s;
    cursor: pointer;
}

.issue-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.issue-title {
    font-weight: 500;
    font-size: 14px;
}

.issue-amount {
    font-weight: 600;
    font-size: 14px;
}

.income .issue-amount {
    color: #10b981;
    font-weight: bold;
}

.expense .issue-amount {
    color: #ef4444;
    font-weight: bold;
}

.savings_goal .issue-amount {
    color: #f59e0b;
    font-weight: bold;
}

.bill .issue-amount {
    color: #8b5cf6;
    font-weight: bold;
}

.issue-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.issue-progress {
    margin-top: 8px;
}

.progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #0066ff;
    transition: width 0.3s;
}

/* Improved Priority System */
.priority-high {
    background: #ffebee;
    color: #c62828;
    border-left: 3px solid #c62828;
}

.priority-medium {
    background: #fff8e1;
    color: #ff8f00;
    border-left: 3px solid #ff8f00;
}

.priority-low {
    background: #f3e5f5;
    color: #7b1fa2;
    border-left: 3px solid #7b1fa2;
}

.issue-priority {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
}

.issue-recurring {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

/* Issue Actions */
.issue-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-small {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #e68900;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

/* Calendar */
.calendar {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border: 1px solid #e5e7eb;
}

.calendar-day {
    background: white;
    padding: 8px;
    min-height: 100px;
    font-size: 12px;
    position: relative;
}

.calendar-day.today {
    background: #fff8e1;
}

.calendar-day-header {
    background: #f8fafc;
    font-weight: 500;
    text-align: center;
    padding: 8px;
}

.day-number {
    font-weight: bold;
    margin-bottom: 4px;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-event {
    background: #0066ff;
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    margin-top: 2px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-event .event-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event .event-amount {
    font-weight: bold;
    margin-left: 4px;
}

.income-event {
    background: #10b981;
}

.expense-event {
    background: #ef4444;
}

.savings_goal-event {
    background: #f59e0b;
}

.bill-event {
    background: #8b5cf6;
}

/* Priority-based calendar events */
.calendar-event.priority-high {
    border-left: 3px solid #c62828;
}

.calendar-event.priority-medium {
    border-left: 3px solid #ff8f00;
}

.calendar-event.priority-low {
    border-left: 3px solid #7b1fa2;
}

.add-event-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: #0066ff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.calendar-day:hover .add-event-btn {
    opacity: 1;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 480px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 20px;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border 0.2s;
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: #0066ff;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Form Improvements */
#priorityGroup {
    transition: all 0.3s ease;
}

/* Pro Features */
.pro-features {
    margin: 20px 0;
}

.pro-feature {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pro-price {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0;
    color: #0066ff;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .issues-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 200px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 4px;
    }
    
    .calendar-event {
        font-size: 8px;
        padding: 1px 2px;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 160px;
    }
    
    .calendar-grid {
        font-size: 10px;
    }
    
    .calendar-day {
        min-height: 60px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 6px 12px;
        font-size: 12px;
    }
}