/* ========================================
   GODEN FINANCE - Modern Mobile First CSS
   Updated with: Wallets, Recurring, Debts, Search, OCR
   ======================================== */

/* CSS Variables */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --income-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --expense-gradient: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%);
    --dark-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    
    --primary: #667eea;
    --primary-dark: #764ba2;
    --income: #11998e;
    --expense: #fc4a1a;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --nav-height: 70px;
    --header-height: 60px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--bg-color);
    padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 20px);
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
}

.logo h1 {
    font-size: 18px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-notification {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-color);
    color: var(--text-primary);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-notification:hover {
    background: var(--border-color);
}

/* Main Content */
.main-content {
    padding: 16px;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Balance Card */
.balance-card {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xl);
}

.balance-bg {
    position: absolute;
    inset: 0;
    background: var(--dark-gradient);
}

.balance-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, transparent 70%);
}

.balance-bg::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.3) 0%, transparent 70%);
}

.balance-content {
    position: relative;
    padding: 24px 20px;
    z-index: 1;
}

.balance-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.balance-amount {
    color: white;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.balance-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.stat-item.income .stat-icon {
    background: var(--income-gradient);
    color: white;
}

.stat-item.expense .stat-icon {
    background: var(--expense-gradient);
    color: white;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.stat-amount {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

/* Section Card */
.section-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.section-header h3 i {
    color: var(--primary);
}

.badge-count {
    background: var(--expense);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.month-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
}

/* Monthly Summary */
.monthly-summary {
    padding: 8px 0;
}

.summary-bar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.progress-ring {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3;
}

.progress-ring-expense {
    fill: none;
    stroke: url(#expenseGradient);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-text span {
    font-size: 18px;
    font-weight: 700;
    color: var(--expense);
}

.summary-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.detail-item .dot.income {
    background: var(--income);
}

.detail-item .dot.expense {
    background: var(--expense);
}

.detail-item.balance {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-weight: 500;
    color: var(--text-primary);
}

.detail-item b {
    color: var(--text-primary);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-btn:active {
    transform: scale(0.98);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.action-icon.income {
    background: var(--income-gradient);
}

.action-icon.expense {
    background: var(--expense-gradient);
}

.action-icon.stats {
    background: var(--primary-gradient);
}

.action-btn span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==========================================
   WALLETS
   ========================================== */

.wallet-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wallet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.wallet-item:hover {
    background: var(--border-color);
}

.wallet-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.wallet-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wallet-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.wallet-balance {
    font-size: 13px;
    font-weight: 600;
}

.wallet-balance.positive {
    color: var(--income);
}

.wallet-balance.negative {
    color: var(--expense);
}

.empty-mini {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px;
}

/* Wallet Selector in Modal */
.wallet-selector {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.wallet-selector::-webkit-scrollbar {
    display: none;
}

.wallet-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 80px;
}

.wallet-option:hover {
    background: var(--border-color);
}

.wallet-option.selected {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.wallet-option-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.wallet-option-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==========================================
   RECURRING
   ========================================== */

.recurring-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recurring-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.recurring-info {
    flex: 1;
    min-width: 0;
}

.recurring-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.recurring-freq {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    font-weight: 500;
}

.recurring-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.recurring-amount {
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
}

.recurring-amount.income {
    color: var(--income);
}

.recurring-amount.expense {
    color: var(--expense);
}

.btn-recurring-action {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--card-bg);
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-recurring-action:hover {
    background: var(--primary);
    color: white;
}

.btn-recurring-action.delete {
    color: var(--text-muted);
}

.btn-recurring-action.delete:hover {
    background: var(--expense);
    color: white;
}

/* Frequency Selector */
.frequency-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.freq-btn {
    padding: 10px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.freq-btn.active {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    font-weight: 500;
}

/* ==========================================
   DEBTS
   ========================================== */

.debt-summary {
    margin-bottom: 8px;
}

.debt-summary-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.debt-sum-box {
    padding: 16px 12px;
    border-radius: var(--radius-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debt-sum-box.owe {
    background: rgba(252, 74, 26, 0.1);
}

.debt-sum-box.owed {
    background: rgba(17, 153, 142, 0.1);
}

.debt-sum-box .label {
    font-size: 11px;
    color: var(--text-secondary);
}

.debt-sum-box .amount {
    font-size: 16px;
    font-weight: 700;
}

.debt-sum-box.owe .amount {
    color: var(--expense);
}

.debt-sum-box.owed .amount {
    color: var(--income);
}

/* Debt Tabs */
.debt-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.debt-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.debt-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 500;
}

.btn-add-debt {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
    border: 2px dashed var(--border-color);
    background: transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-add-debt:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.debt-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.debt-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.debt-item.paid {
    opacity: 0.7;
    background: rgba(17, 153, 142, 0.05);
}

.debt-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.debt-icon.owe {
    background: rgba(252, 74, 26, 0.1);
    color: var(--expense);
}

.debt-icon.owed {
    background: rgba(17, 153, 142, 0.1);
    color: var(--income);
}

.debt-info {
    flex: 1;
    min-width: 0;
}

.debt-person {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.debt-amount {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.debt-amount.expense {
    color: var(--expense);
}

.debt-amount.income {
    color: var(--income);
}

.debt-meta {
    font-size: 11px;
    margin-bottom: 4px;
}

.badge-due {
    color: var(--expense);
    font-weight: 500;
}

.badge-paid {
    color: var(--income);
    font-weight: 500;
}

.debt-desc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-pay-debt {
    padding: 8px 16px;
    border: none;
    background: var(--income);
    color: white;
    border-radius: 20px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pay-debt:hover {
    background: #0d7a6e;
}

.text-danger { color: var(--expense); }
.text-warning { color: #f59e0b; }
.text-info { color: var(--primary); }

/* ==========================================
   SEARCH
   ========================================== */

.search-bar {
    position: relative;
    margin-bottom: 12px;
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.search-bar input {
    width: 100%;
    padding: 14px 40px 14px 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.btn-clear:hover {
    background: var(--border-color);
}

/* ==========================================
   RECEIPT UPLOAD & OCR
   ========================================== */

.receipt-upload {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-receipt-scan {
    padding: 16px;
    border: 2px dashed var(--border-color);
    background: var(--bg-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-receipt-scan:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.btn-receipt-scan.secondary {
    border-style: solid;
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.btn-receipt-scan.secondary:hover {
    background: var(--primary);
    color: white;
}

.receipt-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.receipt-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
}

.btn-remove-receipt {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-remove-receipt:hover {
    background: var(--expense);
}

/* ==========================================
   OCR MODAL
   ========================================== */

.ocr-steps {
    min-height: 400px;
}

.ocr-step {
    display: none;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.ocr-step.active {
    display: block;
}

.ocr-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ocr-step h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.ocr-step p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-ocr-action {
    width: 100%;
    padding: 16px;
    margin-bottom: 12px;
    border: 2px solid var(--primary);
    background: var(--primary);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-ocr-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-ocr-action.secondary {
    background: transparent;
    color: var(--primary);
}

.btn-ocr-action.secondary:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* OCR Preview */
.ocr-preview {
    margin: 20px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.ocr-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    background: var(--bg-color);
}

.ocr-result-preview {
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.ocr-result-preview img {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
}

/* OCR Progress */
.ocr-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    min-width: 40px;
}

.ocr-status {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* OCR Extracted Data */
.ocr-extracted {
    text-align: left;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.extracted-item {
    margin-bottom: 12px;
}

.extracted-item:last-child {
    margin-bottom: 0;
}

.extracted-item label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.extracted-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.extracted-item textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--card-bg);
    resize: none;
    height: 80px;
}

/* OCR Actions */
.ocr-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-ocr-apply {
    padding: 16px;
    border: none;
    background: var(--income-gradient);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-ocr-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-ocr-retry {
    padding: 14px;
    border: 2px solid var(--border-color);
    background: transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-ocr-retry:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ==========================================
   TRANSACTION LIST
   ========================================== */

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transaction-list.full {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.transaction-item:hover {
    background: var(--border-color);
}

.transaction-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.transaction-item.income .transaction-icon {
    background: rgba(17, 153, 142, 0.1);
}

.transaction-item.expense .transaction-icon {
    background: rgba(252, 74, 26, 0.1);
}

.transaction-info {
    flex: 1;
    min-width: 0;
}

.transaction-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.transaction-meta .dot {
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
}

.transaction-amount {
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.transaction-item.income .transaction-amount {
    color: var(--income);
}

.transaction-item.expense .transaction-amount {
    color: var(--expense);
}

.transaction-actions {
    display: flex;
    gap: 4px;
}

.btn-action {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: var(--card-bg);
    color: var(--primary);
}

.btn-action.delete:hover {
    color: var(--expense);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
}

/* View Header */
.view-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-top: 8px;
}

.view-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.btn-back {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--card-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: var(--border-color);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* Top Expense List */
.top-expense-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-expense-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-expense-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.top-expense-rank.top-1 {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: white;
}

.top-expense-rank.top-2 {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: white;
}

.top-expense-rank.top-3 {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: white;
}

.top-expense-info {
    flex: 1;
}

.top-expense-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.top-expense-bar {
    height: 6px;
    background: var(--bg-color);
    border-radius: 3px;
    overflow: hidden;
}

.top-expense-progress {
    height: 100%;
    background: var(--expense-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.top-expense-amount {
    font-size: 13px;
    font-weight: 600;
    color: var(--expense);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 250px;
    margin-top: 16px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: calc(var(--nav-height) + var(--safe-area-bottom));
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: var(--safe-area-bottom);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 20px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.center {
    position: relative;
    top: -20px;
}

.nav-center-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.nav-center-btn i {
    color: white;
    font-size: 24px;
}

.nav-center-btn:active {
    transform: scale(0.95);
}

/* ==========================================
   MODALS
   ========================================== */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal.active {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-small .modal-content {
    max-height: 70vh;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: var(--border-color);
}

.modal-body {
    padding: 20px;
}

/* ==========================================
   FORMS
   ========================================== */

.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.type-option {
    cursor: pointer;
}

.type-option input {
    display: none;
}

.type-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.type-label.income {
    color: var(--income);
}

.type-label.expense {
    color: var(--expense);
}

.type-option input:checked + .type-label.income {
    background: rgba(17, 153, 142, 0.1);
    border-color: var(--income);
}

.type-option input:checked + .type-label.expense {
    background: rgba(252, 74, 26, 0.1);
    border-color: var(--expense);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Plain Amount Input (No Rp prefix) */
.amount-input-plain {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-color);
    text-align: center;
    transition: all 0.3s ease;
}

.amount-input-plain:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.category-item.selected {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.category-icon {
    font-size: 24px;
}

.category-name {
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Icon & Color Selectors */
.icon-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: var(--radius-md);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    border-color: var(--primary);
}

.icon-btn.selected {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.color-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-btn {
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--primary);
}

.btn-submit {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-submit:active {
    transform: scale(0.98);
}

/* ==========================================
   TOAST NOTIFICATION
   ========================================== */

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--dark-gradient);
    color: white;
    padding: 14px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-xl);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    font-size: 18px;
    color: #38ef7d;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================
   SCROLLBAR
   ========================================== */

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 380px) {
    .balance-amount {
        font-size: 28px;
    }
    
    .stat-amount {
        font-size: 12px;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .quick-actions {
        gap: 8px;
    }
    
    .action-icon {
        width: 40px;
        height: 40px;
    }
    
    .amount-input-plain {
        font-size: 20px;
    }
    
    .wallet-option {
        min-width: 70px;
        padding: 10px 12px;
    }
    
    .frequency-selector {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f0f1a;
        --card-bg: #1a1a2e;
        --text-primary: #f1f1f1;
        --text-secondary: #a0a0b0;
        --text-muted: #6b6b7b;
        --border-color: #2a2a3e;
    }
}

/* Print styles */
@media print {
    .bottom-nav,
    .btn-notification,
    .quick-actions,
    .btn-text,
    .btn-back {
        display: none !important;
    }
    
    .section-card {
        break-inside: avoid;
    }
}
