-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
494 lines (486 loc) · 28.5 KB
/
index.html
File metadata and controls
494 lines (486 loc) · 28.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TSV Expenses</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nouislider@15.8.1/dist/nouislider.min.css">
<link rel="stylesheet" href="css/shell.css">
<link rel="stylesheet" href="css/app.css">
<link rel="stylesheet" href="css/payment-methods.css">
<script src="https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/nouislider@15.8.1/dist/nouislider.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<!-- App modules (loaded before Alpine initialization) -->
<script src="js/app-getters.js"></script>
<script src="js/app-settings.js"></script>
</head>
<body x-data="expenseApp()">
<!-- App Shell: Header -->
<header role="banner" class="app-header">
<button data-testid="menu-toggle" class="menu-toggle" @click="menuOpen=!menuOpen" aria-label="Menu">☰</button>
<h1 data-testid="logo">📊 TSV</h1>
<span data-testid="identity-badge" class="outline secondary"
style="font-size:0.875rem;padding:0.25rem 0.6rem;border-radius:999px" x-text="identityBadgeLabel"></span>
<span data-testid="auth-button" class="auth-btn"
@click="auth.authenticated ? showUserMenu=!showUserMenu : showAuthModal=true">
<template x-if="auth.authenticated && auth.user?.image"><img :src="auth.user.image" alt=""
class="avatar"></template>
<span x-text="auth.authenticated ? (auth.user?.name || 'Profile') : 'Sign In'"></span>
</span>
<div x-show="showUserMenu" x-cloak class="user-dropdown" @click.outside="showUserMenu=false">
<button data-testid="logout-button" @click="logout()">Sign Out</button>
</div>
</header>
<!-- App Shell: Navigation (hidden during onboarding - ADR-025) -->
<aside x-show="showNav" x-cloak data-testid="main-nav" class="app-nav" :class="{'open':menuOpen}"
@click.outside="menuOpen=false">
<nav><a href="#/" data-nav="dashboard" :class="{'active':route==='dashboard'}"
@click="route='dashboard';menuOpen=false">📊 Dashboard</a>
<a href="#/expenses" data-nav="expenses" :class="{'active':route==='expenses'}"
@click="route='expenses';menuOpen=false">💰 Expenses</a>
<a href="#/import" data-nav="import" :class="{'active':route==='import'}" @click.prevent="navigateToImport()">📁
Import</a>
<a href="#/settings" data-nav="settings" :class="{'active':route==='settings'}"
@click="route='settings';menuOpen=false">⚙️ Settings</a>
</nav>
</aside>
<!-- App Shell: Main -->
<main role="main" class="app-main">
<aside x-show="dataAuthority === 'none' && storageIntent === 'cloud'" x-cloak
data-testid="cloud-auth-required-banner" class="cloud-auth-banner" role="alert">
🔒 <strong>Cloud Access Locked</strong> — Sign in to access your cloud data.
<button @click="showAuthModal=true" class="outline contrast"
style="padding:0.25rem 0.5rem;font-size:0.875rem">Sign In</button>
<button data-testid="start-fresh-local" @click="resetToOnboarding()" class="outline secondary"
style="padding:0.25rem 0.5rem;font-size:0.875rem">Start Fresh Locally</button>
</aside>
<aside x-show="storageIntent === 'local' && localDataLocked" x-cloak data-testid="local-locked-banner"
class="cloud-auth-banner" role="alert">
🔐 <strong>Local Access Paused</strong> — Data on this device is hidden until you resume local access.
<button data-testid="resume-local-access" @click="resumeLocalAccess()" class="outline contrast"
style="padding:0.25rem 0.5rem;font-size:0.875rem">Resume Local Access</button>
</aside>
<!-- Local Mode Warning Banner (shown when in local storage mode) -->
<aside x-show="dataAuthority === 'local' && expenses.length > 0" x-cloak class="guest-warning-banner" role="alert">
⚠️ <strong>Local Mode</strong> — Data for <span x-text="localProfile?.alias || 'Local User'"></span> stays on this
device only.
<button @click="showAuthModal=true" class="outline contrast"
style="padding:0.25rem 0.5rem;font-size:0.875rem">Sign in to sync to cloud</button>
</aside>
<!-- Welcome Wizard (ADR-025) - Replaces scattered empty states -->
<section x-show="!showNav" x-cloak data-testid="welcome-wizard" class="welcome-wizard">
<!-- Step Indicator -->
<div data-testid="step-indicator" class="step-indicator">
<span :data-step="1" :data-active="onboardingStep === 1" class="step-dot">●</span>
<span :data-step="2" :data-active="onboardingStep === 2" class="step-dot">●</span>
<span :data-step="3" :data-active="onboardingStep === 3" class="step-dot">●</span>
</div>
<!-- Step 1: Welcome -->
<div x-show="onboardingStep === 1" class="wizard-step">
<h2>📊 TSV Expenses</h2>
<p>Track Amazon orders & bank statements.<br>Allocate expenses between Business and Personal with visual
sliders.</p>
<label
style="display:flex;gap:0.5rem;align-items:flex-start;justify-content:center;margin:1rem 0;text-align:left">
<input data-testid="accept-terms-checkbox" type="checkbox" x-model="termsAccepted"
@change="setTermsAccepted()" style="margin-top:0.2rem">
<span style="font-size:0.875rem">I agree to the <a href="docs/TERMS_OF_SERVICE.md" target="_blank">Terms of
Service</a>
and understand this tool is not tax advice.</span>
</label>
<button data-testid="get-started-btn" @click="onboardingStep = 2" class="primary" :disabled="!termsAccepted">Get
Started →</button>
</div>
<!-- Step 2: Storage Choice -->
<div x-show="onboardingStep === 2" data-testid="storage-choice-step" class="wizard-step">
<h3>Where should your data live?</h3>
<div class="storage-options">
<button data-testid="choose-cloud" @click="selectStorageMode('cloud')" class="outline">
<strong>☁️ Cloud Sync</strong><br>
<small>Access from any device • Automatic backups • Requires sign-in</small>
</button>
<button data-testid="choose-local" @click="selectStorageMode('local')" class="outline secondary">
<strong>💻 Local Only</strong><br>
<small>No account needed • Data stays on this device • You manage backups</small>
</button>
</div>
</div>
<!-- Step 3: Import -->
<div x-show="onboardingStep === 3" data-testid="import-step" class="wizard-step">
<h3>Import your first file</h3>
<div class="drag-area" data-testid="drop-zone" @dragover.prevent="dragover=true" @dragleave="dragover=false"
@drop.prevent="handleDrop($event)" :class="{dragover}">
<p>Drop CSV/DAT/ZIP or <input type="file" accept=".csv,.dat,.zip" @change="handleFileSelect($event)"></p>
</div>
<small>Supported: Amazon Order History, Bank of America statements</small>
<div x-show="importStatus" :data-import-status="importComplete?'complete':'processing'">
<p x-text="importStatus" :class="importError?'error':'success'"></p>
<button x-show="importComplete" data-testid="view-dashboard-btn" @click="completeOnboarding()"
class="primary">View Dashboard →</button>
</div>
</div>
</section>
<!-- Auth Modal -->
<dialog :open="showAuthModal" data-testid="auth-modal">
<article>
<button data-testid="auth-modal-close" @click="showAuthModal=false" aria-label="Close" class="close">×</button>
<h3>Sign In</h3>
<button data-testid="auth-google" @click="authWith('google')" class="outline">🔵 Google</button>
<button data-testid="auth-github" @click="authWith('github')" class="outline">⚫ GitHub</button>
<hr><button data-testid="auth-passkey" @click="authWith('passkey')" class="secondary">🔐 Passkey</button>
</article>
</dialog>
<!-- Dashboard -->
<section x-show="showNav && route==='dashboard'">
<div class="split-view">
<article class="summary-card category-supplies">
<h3>🏢 Business Supplies</h3>
<p class="amount" x-text="formatCurrency(totals.supplies)"></p><small
x-text="`${counts.supplies} items`"></small>
</article>
<article class="summary-card category-benefits">
<h3>👥 Board Member Benefits</h3>
<p class="amount" x-text="formatCurrency(totals.benefits)"></p><small
x-text="`${counts.benefits} items`"></small>
</article>
</div>
<div x-show="counts.uncategorized > 0" style="margin-top:1rem">
<article class="summary-card category-uncategorized" style="background:#fff3cd;border-left:4px solid #ffc107">
<h3>⚠️ Needs Review</h3>
<p class="amount" x-text="counts.uncategorized"></p><small>uncategorized items</small><br><a href="#/expenses"
@click="route='expenses'">Review & Categorize →</a>
</article>
</div>
<div class="expense-grid">
<template x-for="e in expenses.slice(0,20)" :key="e.id">
<article class="expense-card" data-expense-card>
<header><strong x-text="e.description"></strong><small x-text="formatDate(e.date)"></small></header>
<p><span class="badge" x-text="e.category"></span></p>
<footer><strong x-text="formatCurrency(e.amount)"></strong></footer>
</article>
</template>
</div>
<p x-show="!expenses.length">No expenses yet. Import data to get started.</p>
</section>
<!-- Expenses -->
<section x-show="showNav && route==='expenses'">
<div style="display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem;">
<h2 style="margin: 0;">💰 Expenses Allocation</h2>
<input type="search" placeholder="Search expenses..." x-model="allocationSearchQuery"
style="flex: 0 1 300px; margin: 0;">
</div>
<div class="allocation-board">
<!-- Business Supplies Column -->
<div class="allocation-column business-supplies">
<div class="column-header">
<h3>🏢 Business Supplies</h3>
<p class="column-total" x-text="formatCurrency(totalSupplies)" data-testid="total-supplies"></p>
<small x-text="businessCards.length + ' items'"></small>
</div>
<div class="cards-container">
<template x-for="e in businessCardsVisible" :key="'bus-' + e.id">
<article class="allocation-card card-enter"
:class="{'split-item': (100 - (e.businessPercent ?? 100)) > 0 && (100 - (e.businessPercent ?? 100)) < 100, 'reviewed': e.adjusted}"
data-testid="allocation-card">
<header>
<strong x-text="e.description" :title="e.description"></strong>
<small x-text="formatDate(e.date)"></small>
</header>
<div class="card-meta-row">
<span class="card-id"><span x-text="'#' + String(e.id).slice(-8)"></span><span
x-show="e.itemTotal > 1" class="item-position"
x-text="' (' + e.itemIndex + '/' + e.itemTotal + ')'"></span></span>
<span class="card-payment-method" x-show="e.paymentMethod"
x-text="getPaymentMethodLabel(e.paymentMethod)"></span>
</div>
<div class="card-amount-row">
<span class="card-amount" x-text="formatCurrency(e.amount * (e.businessPercent ?? 100) / 100)"
data-testid="supplies-amount"></span>
<span class="allocation-percentage">
<span class="percentage-badge" x-text="(e.businessPercent ?? 100) + '%'"></span>
<span>of <span x-text="formatCurrency(e.amount)"></span></span>
</span>
<button class="expand-toggle" @click="toggleAdjusted(e)" data-testid="expand-toggle"
:title="e.adjusted ? 'Expand controls' : 'Collapse controls'"
x-text="e.adjusted ? '▶' : '▼'"></button>
</div>
<div class="slider-with-arrows" x-show="!e.adjusted">
<button class="slider-arrow" @click="setAllocation(e, 0)" title="0% Business (100% Benefits)"
aria-label="Allocate 0% to Business">○</button>
<div class="allocation-slider" data-testid="allocation-slider" :data-expense-id="e.id"
x-init="initSlider($el, e)"></div>
<button class="slider-arrow" @click="setAllocation(e, 100)" title="100% Business"
aria-label="Allocate 100% to Business">●</button>
</div>
<div class="preset-buttons" x-show="!e.adjusted">
<button @click="setAllocation(e, 100)" :class="{'active': e.businessPercent === 100}"
title="100% Business">100</button>
<button @click="setAllocation(e, 75)" :class="{'active': e.businessPercent === 75}"
title="75% Business">75</button>
<button @click="setAllocation(e, 50)" :class="{'active': e.businessPercent === 50}"
title="50/50 Split">50</button>
<button @click="setAllocation(e, 25)" :class="{'active': e.businessPercent === 25}"
title="25% Business">25</button>
<button @click="setAllocation(e, 0)" :class="{'active': e.businessPercent === 0}"
title="0% Business">0</button>
</div>
</article>
</template>
<button x-show="hasMoreBusinessCards" @click="loadMoreBusiness()" class="outline">
Load More (<span x-text="businessCards.length - businessCardsVisible.length"></span> remaining)
</button>
<p x-show="businessCards.length === 0" class="empty-column">No items allocated to Business Supplies</p>
</div>
</div>
<!-- Board Member Benefits Column -->
<div class="allocation-column benefits">
<div class="column-header">
<h3>👥 Board Member Benefits</h3>
<p class="column-total" x-text="formatCurrency(totalBenefits)" data-testid="total-benefits"></p>
<small x-text="benefitsCards.length + ' items'"></small>
<p x-show="entityTypeWarning" data-testid="entity-benefit-warning" x-text="entityTypeWarning"
style="color:#e67e22;font-size:.8rem;margin:.25rem 0 0"></p>
</div>
<div class="cards-container">
<template x-for="e in benefitsCardsVisible" :key="'ben-' + e.id">
<article class="allocation-card card-enter"
:class="{'split-item': (e.businessPercent ?? 100) > 0 && (e.businessPercent ?? 100) < 100, 'reviewed': e.adjusted}"
data-testid="allocation-card">
<header>
<strong x-text="e.description" :title="e.description"></strong>
<small x-text="formatDate(e.date)"></small>
</header>
<div class="card-meta-row">
<span class="card-id"><span x-text="'#' + String(e.id).slice(-8)"></span><span
x-show="e.itemTotal > 1" class="item-position"
x-text="' (' + e.itemIndex + '/' + e.itemTotal + ')'"></span></span>
<span class="card-payment-method" x-show="e.paymentMethod"
x-text="getPaymentMethodLabel(e.paymentMethod)"></span>
</div>
<div class="card-amount-row">
<span class="card-amount" x-text="formatCurrency(e.amount * (100 - (e.businessPercent ?? 100)) / 100)"
data-testid="benefits-amount"></span>
<span class="allocation-percentage">
<span class="percentage-badge" x-text="(100 - (e.businessPercent ?? 100)) + '%'"></span>
<span>of <span x-text="formatCurrency(e.amount)"></span></span>
</span>
<button class="expand-toggle" @click="toggleAdjusted(e)" data-testid="expand-toggle"
:title="e.adjusted ? 'Expand controls' : 'Collapse controls'"
x-text="e.adjusted ? '▶' : '▼'"></button>
</div>
<div x-show="(100 - (e.businessPercent ?? 100)) > 0" style="margin:.4rem 0"><select data-testid="benefit-subcategory-select" :value="e.benefitSubcategory || 'Requires Review'" @change="setBenefitSubcategory(e, $event.target.value)" style="margin:0;padding:.25rem .5rem;font-size:.75rem"><option>Requires Review</option><option>Taxable Compensation</option><option>De Minimis Benefits</option><option>Working Condition Fringe</option><option>IRC §119 Meals/Lodging</option></select></div>
<div class="slider-with-arrows" x-show="!e.adjusted">
<button class="slider-arrow" @click="setAllocation(e, 100)" title="0% Benefits (100% Business)"
aria-label="Allocate 0% to Benefits">○</button>
<div class="allocation-slider" data-testid="allocation-slider" :data-expense-id="e.id"
x-init="initSlider($el, e)"></div>
<button class="slider-arrow" @click="setAllocation(e, 0)" title="100% Benefits"
aria-label="Allocate 100% to Benefits">●</button>
</div>
</article>
</template>
<button x-show="hasMoreBenefitsCards" @click="loadMoreBenefits()" class="outline">
Load More (<span x-text="benefitsCards.length - benefitsCardsVisible.length"></span> remaining)
</button>
<p x-show="benefitsCards.length === 0" class="empty-column">No items allocated to Benefits</p>
</div>
</div>
</div>
<p x-show="!expenses.length" class="empty-state">No expenses yet. Import data to get started.</p>
</section>
<!-- Import -->
<section x-show="showNav && route==='import'">
<h2>📁 Import</h2>
<div class="drag-area" @dragover.prevent="dragover=true" @dragleave="dragover=false"
@drop.prevent="handleDrop($event)" :class="{dragover}">
<p>Drop CSV/DAT/ZIP or <input type="file" accept=".csv,.dat,.zip" @change="handleFileSelect($event)"></p>
</div>
<div x-show="importStatus" :data-import-status="importComplete?'complete':'processing'">
<p x-text="importStatus" :class="importError?'error':'success'"></p>
</div>
<details>
<summary>➕ Add Manually</summary>
<form @submit.prevent="addExpense()" class="grid"><input type="date" x-model="newExpense.date" required>
<input type="text" x-model="newExpense.description" placeholder="Description" required><select
x-model="newExpense.category" required>
<option value="">Category</option>
<option>Business Supplies</option>
<option>Board Member Benefits</option>
<option>Uncategorized</option>
</select>
<input type="number" x-model.number="newExpense.amount" placeholder="Amount" step="0.01" required><button
type="submit">Add</button>
</form>
</details>
<h3 style="margin-top:2rem">📜 Import History</h3>
<div x-show="!importHistory.length" class="empty-state">
<p>No imports yet.</p>
</div>
<div class="import-timeline"><template x-for="imp in importHistory" :key="imp.id">
<article class="import-card" data-testid="import-card"
:class="{success:imp.success,partial:imp.duplicatesCount>0}">
<header><strong x-text="imp.filename"></strong>
<small x-text="new Date(imp.timestamp).toLocaleDateString()"></small>
</header>
<p><span class="badge" x-text="imp.type"></span></p>
<div class="import-stats"><span x-text="`${imp.recordsCount} new`"></span>
<span x-show="imp.duplicatesCount>0" x-text="`${imp.duplicatesCount} duplicates`"></span>
<span x-show="imp.skipped>0" x-text="`${imp.skipped} skipped`"></span>
</div>
<small x-show="imp.dateRange"
x-text="imp.dateRange ? formatDateRange(imp.dateRange.earliest,imp.dateRange.latest) : ''"></small>
</article>
</template></div>
</section>
<!-- Settings -->
<section x-show="showNav && route==='settings'">
<h2>⚙️ Settings</h2>
<article style="margin-bottom:1.5rem">
<h3>🪪 Identity & Storage</h3>
<p><strong>Current identity:</strong> <span x-text="identityBadgeLabel"></span></p>
<p><strong>Storage intent:</strong> <span x-text="storageIntent || 'Not selected'"></span></p>
<div x-show="storageIntent === 'local'" x-cloak>
<label for="local-alias-input">Local alias</label>
<input id="local-alias-input" data-testid="local-alias-input" type="text" x-model="localAliasDraft"
placeholder="Local User">
<button data-testid="save-local-alias" class="outline" @click="saveLocalAlias()">Save Alias</button>
<button data-testid="local-signout-button" class="outline secondary" @click="openLocalSignOut()">Local Sign
Out</button>
<p style="color:var(--muted-color);margin-top:0.5rem">Local lock is a device privacy control, not encryption.</p>
</div>
</article>
<article data-testid="entity-type-section" style="margin-bottom:1.5rem">
<h3>🏢 Entity Type</h3>
<select data-testid="entity-type-select" x-model="entityType" @change="setEntityType($event.target.value)">
<option value="">Select entity type...</option>
<option value="c-corp">C Corporation</option><option value="s-corp">S Corporation</option>
<option value="llc">LLC</option><option value="partnership">Partnership</option><option value="sole-prop">Sole Proprietorship</option>
</select>
<p x-show="entityTypeWarning" data-testid="entity-warning" x-text="entityTypeWarning" style="color:#e67e22;margin-top:.5rem"></p>
</article>
<p data-testid="export-disclaimer" class="legal-disclaimer"><strong>Not Tax Advice:</strong> This tool provides expense allocation assistance only. Verify all allocations with a qualified tax professional.</p>
<button class="outline" @click="exportCSV()">📤 Export CSV</button><button class="outline secondary"
@click="clearAll()">🗑️ Clear All</button>
<section data-testid="payment-methods-section" style="margin-top:2rem" x-show="paymentMethods.length > 0">
<h3>💳 Payment Methods</h3>
<p style="color:var(--muted-color);margin-bottom:1rem">Remove expenses by payment method to filter out personal purchases.</p>
<div class="payment-methods-list">
<template x-for="pm in paymentMethods" :key="pm.method">
<div class="payment-method-row" data-testid="payment-method-row" :data-payment="pm.method">
<span class="pm-label" x-text="getPaymentMethodLabel(pm.method)"></span>
<span class="pm-stats"><span data-testid="item-count" x-text="pm.count"></span> items</span>
<span class="pm-total" data-testid="total-amount" x-text="formatCurrency(pm.total)"></span>
<button class="outline secondary" data-testid="remove-btn"
@click="openPurgeModal(pm.method)">Remove</button>
</div>
</template>
</div>
</section>
</section>
</main>
<!-- Payment Method Purge Confirmation Modal -->
<dialog :open="showPurgeModal" data-testid="purge-confirm-dialog" @click.self="closePurgeModal()">
<article>
<header>
<h3>⚠️ Remove Expenses?</h3><button @click="closePurgeModal()" aria-label="Close" class="close">×</button>
</header>
<p>This will permanently delete all expenses paid with:</p>
<p><strong x-text="getPaymentMethodLabel(purgeTarget)"></strong></p>
<template x-if="purgeTarget">
<p
x-text="(() => { const pm = paymentMethods.find(p => p.method === purgeTarget); return pm ? pm.count + ' expenses totaling ' + formatCurrency(pm.total) : ''; })()">
</p>
</template>
<p style="color:var(--muted-color)">This action cannot be undone.</p>
<footer>
<button class="secondary outline" data-testid="purge-cancel-btn" @click="closePurgeModal()">Cancel</button>
<button class="contrast" data-testid="purge-confirm-btn" @click="confirmPurge()">Remove Expenses</button>
</footer>
</article>
</dialog>
<dialog :open="showLocalSignOutModal" data-testid="local-signout-modal" @click.self="closeLocalSignOut()">
<article>
<header>
<h3>🔒 Local Sign Out</h3>
<button @click="closeLocalSignOut()" aria-label="Close" class="close">×</button>
</header>
<p>Choose what should happen to data for <strong x-text="localProfile?.alias || 'Local User'"></strong>.</p>
<footer style="display:grid;gap:0.75rem">
<button data-testid="local-signout-migrate" class="outline" @click="moveLocalDataToCloud()">Move to
Cloud</button>
<button data-testid="local-signout-lock" class="outline secondary" @click="lockLocalData()">Lock on This
Device</button>
<button data-testid="local-signout-delete" class="contrast" @click="deleteLocalData()">Delete Local
Data</button>
</footer>
</article>
</dialog>
<!-- Bulk Allocation Modal -->
<dialog :open="showBulkApplyModal" class="bulk-apply-modal" @click.self="closeBulkApplyModal()">
<article>
<header>
<h3>✨ Apply to Matching Items?</h3>
<button @click="closeBulkApplyModal()" aria-label="Close" class="close">×</button>
</header>
<div class="modal-content">
<p>Found <strong x-text="bulkApplyMatches.length"></strong> matching item<span
x-show="bulkApplyMatches.length !== 1">s</span> with the same description:</p>
<p class="allocation-preview" x-show="bulkApplySource">
<strong x-text="bulkApplySource?.description"></strong><br>
<span class="business-badge">Business: <span
x-text="(bulkApplySource?.businessPercent ?? 100) + '%'"></span></span>
<span class="benefits-badge">Benefits: <span
x-text="(100 - (bulkApplySource?.businessPercent ?? 100)) + '%'"></span></span>
</p>
<div class="matches-list">
<h4>Items to update:</h4>
<template x-for="match in bulkApplyMatches" :key="match.id">
<div class="match-item">
<div class="match-info">
<strong x-text="match.description"></strong>
<small x-text="formatDate(match.date)"></small>
<small x-text="formatCurrency(match.amount)"></small>
</div>
<div class="match-change">
<span class="current" x-text="(match.businessPercent ?? 100) + '% → '"></span>
<span class="new" x-text="(bulkApplySource?.businessPercent ?? 100) + '%'"></span>
</div>
</div>
</template>
</div>
</div>
<footer>
<button class="secondary outline" @click="closeBulkApplyModal()">Cancel</button>
<button @click="applyBulkAllocation()">Apply to All</button>
</footer>
</article>
</dialog>
<!-- App Shell: Footer -->
<footer role="contentinfo" class="app-footer"><small>TSV Ledger v3.5 • <a href="docs/TERMS_OF_SERVICE.md"
style="color:inherit">Not Tax Advice</a> • <a href="docs/PRIVACY_POLICY.md"
style="color:inherit">Privacy</a></small></footer>
<script src="js/storage.js"></script>
<script src="js/utils.js"></script>
<script src="js/csv.js"></script>
<script src="js/amazon-parser.js"></script>
<script src="js/boa-parser.js"></script>
<script src="js/zip-handler.js"></script>
<script src="js/categorizer.js"></script>
<script src="js/import-history.js"></script>
<script src="js/payment-methods.js"></script>
<script src="js/cloud-sync.js"></script>
<!-- App modules - split by ADR-026 for 100-line constraint -->
<script src="js/app-auth.js"></script>
<script src="js/app-crud.js"></script>
<script src="js/app-import.js"></script>
<script src="js/app-storage.js"></script>
<script src="js/app-onboarding.js"></script>
<script src="js/app-allocation.js"></script>
<script src="js/app-allocation-ui.js"></script>
<script src="js/app-payment.js"></script>
<script src="js/app-identity.js"></script>
<script src="js/app.js"></script>
</body>
</html>