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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
}

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 3rem; }

/* Header */
header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 1.25rem 1rem 0;
    border-radius: 0 0 1.5rem 1.5rem;
    position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: 1rem; }

/* Tabs */
.tabs { display: flex; gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1; min-width: max-content; padding: 0.75rem 0.5rem; background: transparent;
    color: rgba(255,255,255,0.6); border: none; font-size: 0.8rem;
    font-weight: 600; cursor: pointer; white-space: nowrap;
    border-bottom: 3px solid transparent; transition: all 0.2s;
    text-align: center;
}
.tab.active { color: white; border-bottom-color: #4cc9f0; }
.tab:hover { color: rgba(255,255,255,0.9); }

/* Main */
main { padding: 1rem; }
.tab-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem;
}
.tab-header h2 { font-size: 1.15rem; }
.tab-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Buttons */
.btn-add {
    background: #1a1a2e; color: white; border: none; padding: 0.5rem 1rem;
    border-radius: 10px; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.btn-add:hover { opacity: 0.9; }
.btn-icon {
    background: none; border: 1.5px solid #ddd; border-radius: 10px;
    padding: 0.4rem 0.55rem; font-size: 1.1rem; cursor: pointer;
    line-height: 1;
}
.btn-icon:hover { border-color: #4cc9f0; background: #f0f4ff; }
.btn-back {
    background: none; border: 1.5px solid #ddd; border-radius: 10px;
    padding: 0.65rem 1.5rem; font-size: 0.9rem; cursor: pointer; color: #666;
}
.btn-back:hover { border-color: #4cc9f0; color: #1a1a2e; }

/* Data List */
.data-list { display: flex; flex-direction: column; gap: 0.5rem; }
.loading { text-align: center; color: #999; padding: 2rem; font-size: 0.9rem; }
.indicator { text-align: center; color: #888; padding: 0.5rem; font-size: 0.85rem; }
.indicator.hidden { display: none; }
.empty-state { text-align: center; color: #aaa; padding: 2rem; font-size: 0.9rem; }

/* List Item */
.list-item {
    background: white; border-radius: 12px; padding: 0.85rem 1rem;
    display: flex; align-items: center; gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: pointer;
    transition: all 0.15s; border: 2px solid transparent;
}
.list-item:hover, .list-item:active { border-color: #4cc9f0; }
.list-item-icon {
    font-size: 1.2rem; width: 2.2rem; height: 2.2rem;
    display: flex; align-items: center; justify-content: center;
    background: #f0f4ff; border-radius: 10px; flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 0.9rem; font-weight: 600; }
.list-item-desc { font-size: 0.78rem; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-amt { font-size: 0.95rem; font-weight: 700; text-align: right; white-space: nowrap; }
.list-item-date { font-size: 0.75rem; color: #aaa; }

/* Form */
.form-card {
    background: white; border-radius: 16px; padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.form-card h3 { font-size: 1.05rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid #eee; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #555; margin-bottom: 0.3rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.65rem 0.8rem; border: 1.5px solid #ddd;
    border-radius: 10px; font-size: 0.95rem; transition: border-color 0.2s;
    background: #fafafa; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #4cc9f0; background: white;
}
.form-group textarea { resize: vertical; min-height: 2.5rem; }
.form-group .field-note { font-size: 0.75rem; color: #999; margin-top: 0.2rem; }

/* Pagination */
.pagination {
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    margin-top: 1rem; padding: 0.5rem 0;
}
.page-btn {
    background: white; border: 1.5px solid #ddd; border-radius: 10px;
    padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 600; cursor: pointer;
    color: #1a1a2e; text-decoration: none; transition: all 0.15s;
}
.page-btn:hover { border-color: #4cc9f0; background: #f0f4ff; }
.page-info { font-size: 0.85rem; color: #888; }

/* Form Buttons */
.form-actions { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.btn-submit {
    width: 100%; padding: 0.8rem; background: #1a1a2e; color: white;
    border: none; border-radius: 10px; font-size: 0.95rem; font-weight: 600;
    cursor: pointer; transition: opacity 0.2s;
}
.btn-submit:hover { opacity: 0.9; }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Detail */
.detail-card {
    background: white; border-radius: 16px; padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.detail-card h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.detail-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid #f5f5f5; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 0.82rem; color: #888; }
.detail-value { font-size: 0.9rem; font-weight: 600; text-align: right; }
.detail-amount { font-size: 1.3rem; font-weight: 700; color: #059669; }
.detail-actions { margin-top: 1.25rem; display: flex; gap: 0.5rem; }
.detail-actions .btn-submit { flex: 1; }
.btn-danger {
    flex: 1; padding: 0.8rem; background: #dc2626; color: white;
    border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover { opacity: 0.9; }
.btn-edit {
    flex: 1; padding: 0.8rem; background: #2563eb; color: white;
    border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
    cursor: pointer;
}
.btn-edit:hover { opacity: 0.9; }

/* Picker */
.picker-grid { display: flex; flex-direction: column; gap: 0.6rem; }
.picker-item {
    background: white; border-radius: 12px; padding: 0.9rem 1rem;
    display: flex; align-items: center; gap: 0.75rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06); cursor: pointer;
    border: 2px solid transparent; transition: all 0.15s;
}
.picker-item:hover, .picker-item:active { border-color: #4cc9f0; }
.picker-icon { font-size: 1.2rem; }
.picker-text strong { display: block; font-size: 0.9rem; }
.picker-text small { color: #888; font-size: 0.8rem; }

/* Toast */
.toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
    background: #1a1a2e; color: white; padding: 0.75rem 1.25rem;
    border-radius: 12px; font-weight: 600; font-size: 0.85rem;
    z-index: 200; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: opacity 0.3s; white-space: nowrap;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }

/* Backdrop click for cancel */
.picker-backdrop {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3); z-index: 5;
}
@media (min-width: 640px) {
    .picker-grid { flex-direction: row; flex-wrap: wrap; }
    .picker-item { flex: 1; min-width: 200px; }
}
