* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Kanit', sans-serif; }
body { background-color: #f5f5f5; display: flex; justify-content: center; -webkit-tap-highlight-color: transparent; }
.app-container { width: 100%; max-width: 480px; background-color: #fcf8eb; min-height: 100vh; position: relative; padding-bottom: 70px; box-shadow: 0 0 10px rgba(0,0,0,0.1); overflow-x: hidden; }

/* Utility Classes */
.text-white { color: #fff !important; }
.text-red { color: #ea001b !important; }
.text-yellow { color: #ffdd00 !important; }
.text-gold { color: #b8860b !important; }
.text-green { color: #009900 !important; }
.text-gray { color: #999 !important; }
.bg-red { background-color: #ffeded; color: #ea001b; }
.bg-yellow { background-color: #fff9e6; color: #ffb300; }
.bg-blue { background-color: #e6f2ff; color: #0066cc; }
.bg-gray { background-color: #f0f0f0; color: #555; }
.float-right { float: right; }
.mb-2 { margin-bottom: 8px; }
.text-sm { font-size: 13px; }

/* Top Bar */
.top-bar-fixed { position: sticky; top: 0; background-color: #ea001b; color: white; display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; z-index: 100; }
.top-bar-fixed h2 { font-size: 18px; font-weight: 600; letter-spacing: 0.5px; margin: 0; display: flex; align-items: center; }
.top-icon { font-size: 20px; text-decoration: none; display: flex; align-items: center; justify-content: center; }

/* Pages */
.page { display: none; animation: fadeIn 0.2s ease-in-out; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Dashboard Header */
.dashboard-header { background-color: #ea001b; color: white; padding: 10px 20px 25px 20px; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; text-align: center; }
.dashboard-header p { font-size: 14px; opacity: 0.9; font-weight: 300; }
.dashboard-header h1 { font-size: 42px; margin: 5px 0 20px 0; font-weight: 700; letter-spacing: -1px; }
.summary-cards { display: flex; justify-content: space-between; gap: 12px; }
.card { flex: 1; background-color: rgba(255,255,255,0.15); padding: 15px; border-radius: 12px; text-align: center; }
.card p { font-size: 13px; margin-top: 5px; font-weight: 400; }
.card h3 { font-size: 18px; margin-top: 5px; font-weight: 600; }

/* Content Parsing */
.page-padding { padding: 20px; }
.section-heading { font-size: 16px; color: #222; margin-bottom: 15px; font-weight: 600; }
.red-header-simple { background-color: #ea001b; color: white; padding: 15px 20px; font-size: 18px; font-weight: 600; }

/* Info Cards (Home Tab) */
.info-card { background: white; border-radius: 16px; margin-bottom: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); overflow: hidden; }
.info-card .card-header { padding: 15px; font-weight: 600; font-size: 15px; border-bottom: 1px solid #f5f5f5; color: #333; }
.info-card .card-body { padding: 15px; }
.flex-between { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; color: #444; }
.flex-between:last-child { margin-bottom: 0; }

/* Transactions */
.transaction-item { background: white; padding: 16px; border-radius: 16px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,0.03); position:relative; }
.tx-left { display: flex; align-items: center; gap: 15px; flex:1; }
.tx-icon { width: 45px; height: 45px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 20px; flex-shrink:0; }
.tx-icon.expense { background-color: #ffeded; color: #ea001b; }
.tx-icon.income { background-color: #fff9e6; color: #ffb300; }
.tx-info { display: flex; flex-direction: column; justify-content: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tx-info h4 { font-size: 16px; color: #111; margin-bottom: 2px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.tx-info p { font-size: 13px; color: #777; font-weight: 300; }
.tx-amount-section { display: flex; align-items: center; gap:10px; }
.tx-amount { font-weight: 600; font-size: 18px; text-align:right;}
.tx-amount.expense { color: #ea001b; }
.tx-amount.income { color: #f3aa00; }
.tx-actions { font-size: 16px; color: #999; cursor: pointer; padding: 5px; }

/* Receipt Icon Indicator */
.receipt-badge { font-size: 12px; color: #0066cc; margin-left:5px; }

.empty-state { text-align: center; color: #999; padding: 40px 0; font-weight: 300; }
.empty-state-small { text-align: center; color: #999; padding: 10px 0; font-weight: 300; font-size: 14px; }

/* Segments (Summary Tab) */
.segment-wrapper { background: #fcf8eb; padding: 15px 20px 0 20px; }
.segment-control { display: flex; background: #e0e0e0; border-radius: 10px; overflow: hidden; padding: 3px; }
.seg-btn { flex: 1; padding: 8px 0; font-size: 13px; border: none; background: transparent; color: #666; font-weight: 500; cursor: pointer; border-radius: 8px; transition: 0.2s; }
.seg-btn.active { background: white; color: #ea001b; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
.summary-box { background: white; padding: 15px; border-radius: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.sb-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 22px; }
.sb-info p { font-size: 13px; color: #777; margin-bottom: 2px; }
.sb-info h3 { font-size: 18px; color: #111; font-weight: 600; }

/* Floating Action Button */
.fab { position: fixed; bottom: 85px; right: calc(50% - 220px); background-color: #ea001b; color: white; border: none; padding: 14px 22px; border-radius: 30px; font-size: 16px; font-weight: 500; box-shadow: 0 4px 15px rgba(234,0,27,0.3); cursor: pointer; z-index: 100; letter-spacing: 0.5px; }
@media(max-width: 480px) { .fab { right: 20px; } }

/* Bottom Navigation */
.bottom-nav { position: fixed; bottom: 0; width: 100%; max-width: 480px; background: white; display: flex; justify-content: space-around; padding: 12px 0 8px 0; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 100; border-top: 1px solid #f0f0f0; }
.nav-item { text-decoration: none; color: #888; text-align: center; font-size: 11px; flex: 1; font-weight: 400; }
.nav-item i { font-size: 22px; margin-bottom: 6px; }
.nav-item.active { color: #ea001b; font-weight: 500; }

/* Modal Styles */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 200; justify-content: center; align-items: flex-end; }
.modal-content { background: #fcf8eb; width: 100%; max-width: 480px; height: 90vh; border-top-left-radius: 20px; border-top-right-radius: 20px; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { background: #ea001b; color: white; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; border-top-left-radius: 20px; border-top-right-radius: 20px; }
.close-btn, .save-btn { cursor: pointer; font-size: 16px; padding: 5px; }
.modal-body { padding: 25px 20px; overflow-y: auto; }
.type-selector { display: flex; background: white; border-radius: 12px; margin-bottom: 25px; overflow: hidden; border: 1px solid #eaeaea; }
.type-btn { flex: 1; padding: 14px; border: none; background: transparent; font-size: 16px; cursor: pointer; font-weight: 500; color: #555; transition: 0.2s; }
.type-btn.active#btn-expense { background: #ea001b; color: white; }
.type-btn.active#btn-income { background: #ffcc00; color: #333; }
.input-group { margin-bottom: 18px; background: white; border-radius: 12px; border: 1px solid #555; padding: 6px 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.input-group label { display: block; font-size: 12px; color: #555; margin-top: 5px; font-weight: 400; }
.input-group input, .input-group select { width: 100%; border: none; padding: 8px 0 10px 0; font-size: 16px; outline: none; background: transparent; color: #222; font-weight: 500; }
