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

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

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

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-card h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 8px;
    color: #333;
}

.login-card .subtitle {
    text-align: center;
    color: #999;
    margin-bottom: 32px;
    font-size: 14px;
}

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

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

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: white;
}

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

.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
    transform: translateY(-1px);
}

.btn-danger {
    background: #ff4757;
    color: white;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    width: auto;
    display: inline-block;
}

.error-msg {
    color: #ff4757;
    font-size: 14px;
    text-align: center;
    margin-bottom: 16px;
    display: none;
}

/* Dashboard Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.header h1 {
    font-size: 20px;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.header .logout-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #666;
}

.header .logout-btn:hover {
    background: #f0f0f0;
}

/* Month Picker */
.month-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.month-picker button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-picker button:hover {
    background: #f0f0f0;
}

.month-picker .month-label {
    font-size: 18px;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

/* Summary Card */
.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    margin-bottom: 20px;
}

.summary-card .summary-title {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.summary-card .summary-balance {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
}

.summary-card .summary-detail {
    display: flex;
    justify-content: space-between;
}

.summary-card .summary-item {
    text-align: center;
    flex: 1;
}

.summary-card .summary-item .label {
    font-size: 12px;
    opacity: 0.7;
}

.summary-card .summary-item .amount {
    font-size: 18px;
    font-weight: 600;
}

.summary-card .summary-item .amount.expense {
    color: #ff6b6b;
}

.summary-card .summary-item .amount.income {
    color: #51cf66;
}

/* Add Transaction */
.add-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.add-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.add-section .type-toggle {
    display: flex;
    margin-bottom: 16px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.add-section .type-toggle button {
    flex: 1;
    padding: 10px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.add-section .type-toggle button.active.expense {
    background: #ff4757;
    color: white;
}

.add-section .type-toggle button.active.income {
    background: #2ed573;
    color: white;
}

.add-section .type-toggle button:not(.active) {
    background: #f8f8f8;
    color: #999;
}

.add-section .category-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.add-section .category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.add-section .category-item:hover {
    background: #f0f0f0;
}

.add-section .category-item.selected {
    border-color: #667eea;
    background: #f0f3ff;
}

.add-section .category-item .cat-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.add-section .category-item .cat-name {
    font-size: 11px;
    color: #666;
}

.add-section .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.add-section .form-row input {
    flex: 1;
}

.add-section .form-row .btn {
    flex: 0 0 auto;
}

/* Transaction List */
.transaction-list {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.transaction-list h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.transaction-list .tx-empty {
    text-align: center;
    color: #ccc;
    padding: 32px 0;
    font-size: 14px;
}

.tx-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.tx-item .tx-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.tx-item .tx-info {
    flex: 1;
}

.tx-item .tx-info .tx-category {
    font-size: 14px;
    font-weight: 500;
}

.tx-item .tx-info .tx-note {
    font-size: 12px;
    color: #999;
}

.tx-item .tx-amount {
    font-size: 16px;
    font-weight: 600;
}

.tx-item .tx-amount.expense {
    color: #ff4757;
}

.tx-item .tx-amount.income {
    color: #2ed573;
}

.tx-item .tx-delete {
    margin-left: 8px;
    background: none;
    border: none;
    color: #ddd;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.tx-item .tx-delete:hover {
    color: #ff4757;
}

/* Stats Section */
.stats-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stats-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.stats-section .chart-container {
    max-width: 300px;
    margin: 0 auto;
}

/* Category Breakdown List */
.cat-breakdown {
    margin-top: 12px;
}

.cat-breakdown .cat-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.cat-breakdown .cat-row .cat-icon {
    font-size: 18px;
    margin-right: 8px;
}

.cat-breakdown .cat-row .cat-name {
    font-size: 14px;
    flex: 1;
}

.cat-breakdown .cat-row .cat-bar-wrap {
    flex: 2;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin: 0 12px;
    overflow: hidden;
}

.cat-breakdown .cat-row .cat-bar {
    height: 100%;
    background: #667eea;
    border-radius: 4px;
    transition: width 0.3s;
}

.cat-breakdown .cat-row .cat-amount {
    font-size: 14px;
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

@media (max-width: 400px) {
    .add-section .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
