* { box-sizing: border-box; }
body, h1, h2, h3, p, ul { margin: 0; }
body { --aq-font: var(--font); --aq-font-sans: var(--font); --ledger-primary: #1B64DA; --ledger-action-h: 80px; }
body:not(.aq-dark) { --aq-fg-placeholder: var(--aq-fg-secondary); }
body.aq-dark { --aq-fg-placeholder: var(--aq-fg-muted); --aq-accent-fg: var(--aq-bg); }
.bg-bg { background: var(--aq-bg); }
.bg-surface { background: var(--aq-surface); }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.i, .icon-btn .i, .btn .i { width: 24px; height: 24px; stroke-width: 1.8; }
:focus-visible { outline-color: var(--aq-ring); border-radius: var(--aq-radius-el); }
.stage { display: grid; place-items: center; }
.device { width: min(100%, 390px); }
.shell-header { position: absolute; top: var(--safe-top); left: 0; right: 0; height: 52px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; background: var(--aq-bg); z-index: 20; }
.app-name { color: var(--aq-fg-secondary); font-weight: 650; font-size: 15px; letter-spacing: -.02em; }
.header-actions { display: flex; margin-right: -8px; }
.icon-btn { color: var(--aq-fg-secondary); }
.device-indicators { display: flex; align-items: center; gap: 5px; }
.device-indicators svg { width: 18px; height: 18px; }
.device-indicators svg:last-child { width: 25px; }
.scrollbody { position: absolute; inset: calc(var(--safe-top) + 52px) 0 calc(var(--ledger-action-h) + var(--tab-h) + var(--safe-bottom)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 0 20px 24px; }
.scrollbody::-webkit-scrollbar { display: none; }
.large-title { padding: 10px 0 24px; }
.screen-context { font-size: 13px; line-height: 20px; color: var(--aq-fg-secondary); }
.large-title h1 { margin-top: 2px; font-size: 34px; line-height: 42px; letter-spacing: -.04em; }
.spending-summary { border-radius: var(--aq-radius-card); padding: 24px; box-shadow: none; }
.summary-label { display: flex; align-items: center; justify-content: space-between; color: var(--aq-fg-secondary); font-size: 15px; line-height: 22px; font-weight: 500; }
.currency { font-size: 12px; font-weight: 600; }
.summary-value { margin: 8px 0 20px; font-size: 40px; line-height: 48px; font-weight: 750; letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--aq-fg-secondary); font-size: 12px; line-height: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 28px 2px 12px; }
.section-heading h2 { font-size: 17px; font-weight: 650; line-height: 24px; letter-spacing: -.025em; }
.section-heading > span { font-size: 12px; color: var(--aq-fg-secondary); }
.group { padding: 0; box-shadow: none; }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; }
.quick { min-height: 80px; padding: 16px 12px; display: flex; gap: 10px; align-items: center; text-align: left; }
.quick + .quick { box-shadow: inset 1px 0 var(--aq-border); }
.quick-copy { display: grid; gap: 3px; font-size: 14px; font-weight: 600; }
.quick-amt { color: var(--aq-fg-secondary); font-weight: 450; font-size: 13px; }
.quick-plus { margin-left: auto; color: var(--aq-fg-secondary); }
.category-icon { width: 40px; height: 40px; border-radius: var(--aq-radius-el); display: grid; place-items: center; flex: none; }
.quick .category-icon { width: 32px; height: 36px; border-radius: var(--aq-radius-sm); }
.cat-food { --category: var(--aq-cat-4); background: var(--aq-cat-4-light); color: var(--aq-cat-4-dark); }
.cat-transport { --category: var(--aq-cat-2); background: var(--aq-cat-2-light); color: var(--aq-cat-2-dark); }
.cat-home { --category: var(--aq-cat-1); background: var(--aq-cat-1-light); color: var(--aq-cat-1-dark); }
.cat-other { --category: var(--aq-cat-5); background: var(--aq-cat-5-light); color: var(--aq-cat-5-dark); }
.entry-list { list-style: none; padding: 0; }
.entry-group { margin-bottom: 16px; }
.entry-day { display: flex; justify-content: space-between; padding: 0 4px 8px; font-size: 12px; font-weight: 500; color: var(--aq-fg-secondary); }
.entry-day time { font-weight: 600; }
.day-entries { list-style: none; padding: 0; background: var(--aq-surface); border-radius: var(--aq-radius-card); overflow: hidden; }
.entry + .entry { box-shadow: inset 0 1px var(--aq-border); }
.expense-row { width: 100%; min-height: 76px; padding: 16px; display: flex; align-items: center; gap: 12px; text-align: left; border-radius: var(--aq-radius-el); }
.expense-row:active, .quick:active, .tool-row:active { background: var(--aq-surface-sunken); }
.entry-main { display: grid; flex: 1; min-width: 0; gap: 4px; }
.entry-note { font-size: 15px; font-weight: 600; line-height: 20px; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-cat { font-size: 12px; color: var(--aq-fg-secondary); }
.entry-amt { font-size: 15px; font-weight: 650; letter-spacing: -.025em; font-variant-numeric: tabular-nums; flex: none; }
.entry-chevron { color: var(--aq-fg-secondary); width: 24px; }
.shell-actions { position: absolute; bottom: calc(var(--tab-h) + var(--safe-bottom)); inset-inline: 0; height: var(--ledger-action-h); padding: 14px 16px; background: var(--aq-bg); z-index: 25; }

.primary, .primary:active { background: var(--ledger-primary); color: var(--aq-white); }
.shell-nav { position: absolute; bottom: 0; inset-inline: 0; display: grid; grid-template-columns: repeat(3, 1fr); height: calc(var(--tab-h) + var(--safe-bottom)); padding: 0 8px var(--safe-bottom); background: var(--aq-surface); box-shadow: 0 -1px var(--aq-border); z-index: 30; }
.shell-nav button { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 50px; border-radius: var(--aq-radius-el); color: var(--aq-fg-secondary); }
.shell-nav span { font-size: 11px; font-weight: 600; line-height: 14px; }
.shell-nav [aria-current="page"] { color: var(--accent-text); }
.period-control { display: flex; align-items: center; justify-content: space-between; background: var(--aq-surface); border-radius: var(--aq-radius-el); padding: 2px 4px; margin-bottom: 16px; }
.period-control input { width: 190px; text-align: center; color: var(--aq-fg); font-size: 15px; font-weight: 600; border: 0; background: transparent; min-height: 44px; }
.cat-row { padding: 16px; display: grid; grid-template-columns: 40px 1fr auto; gap: 8px 12px; align-items: center; }
.cat-row + .cat-row { box-shadow: inset 0 1px var(--aq-border); }
.cat-row .category-icon { grid-row: span 2; }
.cat-name { font-weight: 600; font-size: 15px; }
.cat-amt { text-align: right; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cat-track { grid-column: 2 / 4; height: 5px; background: var(--aq-surface-sunken); border-radius: var(--aq-radius-full); overflow: hidden; }
.cat-fill { height: 100%; display: block; background: var(--category); border-radius: inherit; }
.cat-row.cat-food, .cat-row.cat-home, .cat-row.cat-transport, .cat-row.cat-other { background: transparent; color: var(--aq-fg); }
.report-details { background: var(--aq-surface); border-radius: var(--aq-radius-el); margin-top: 12px; overflow: hidden; }
.report-details summary { cursor: pointer; min-height: 52px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; list-style: none; font-size: 15px; font-weight: 500; }
.report-details summary::-webkit-details-marker { display: none; }
.report-details[open] summary .i { transform: rotate(90deg); }
.summary-table { width: 100%; border-collapse: collapse; font-size: 11px; table-layout: fixed; }
.summary-table th, .summary-table td { padding: 10px 8px; text-align: left; box-shadow: inset 0 1px var(--aq-border); overflow-wrap: anywhere; }
.summary-table th { color: var(--aq-fg-secondary); font-weight: 500; }
.summary-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.print-only { display: none; }
.tool-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-align: left; color: var(--aq-fg); text-decoration: none; }
.tool-row + .tool-row { box-shadow: inset 0 1px var(--aq-border); }
.tool-row > .i:first-child { color: var(--aq-fg-secondary); }
.tool-row .trailing { margin-left: auto; color: var(--aq-fg-secondary); }
.tool-copy { display: grid; gap: 4px; font-size: 15px; font-weight: 600; }
.tool-copy small { font-size: 12px; font-weight: 400; color: var(--aq-fg-secondary); }
.group-foot { padding: 12px 4px 0; font-size: 13px; line-height: 20px; color: var(--aq-fg-secondary); }
.empty { margin: 8px 0 24px; padding: 32px 8px; gap: 12px; }
.empty h2 { font-size: 20px; font-weight: 650; letter-spacing: -.03em; }
.empty p { font-size: 14px; line-height: 22px; color: var(--aq-fg-secondary); }
.empty-icon { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--aq-surface); color: var(--aq-fg-secondary); margin-bottom: 4px; }
.empty-icon .i { width: 32px; height: 32px; }
.receipt-empty { margin-top: 16px; margin-bottom: 28px; }
.receipt-paper-wrap { margin-top: 24px; border-radius: var(--aq-radius-card); overflow: hidden; background: var(--aq-surface); padding: 16px; }
.receipt-paper canvas, .receipt-paper img { display: block; width: 100%; height: auto; }
.ocr-progress { padding: 16px; border-radius: var(--aq-radius-card); margin-top: 16px; }
.ocr-progress .skel { padding: 0; }
.s-lines i { height: 12px; width: 100%; }
.s-lines i:last-child { width: 65%; }
.ocr-bar { height: 5px; background: var(--aq-surface-sunken); overflow: hidden; border-radius: var(--aq-radius-full); margin: 12px 0; }
.ocr-bar span { display: block; height: 100%; background: var(--aq-accent); transform: scaleX(0); transform-origin: left; transition: transform .2s; }
#ocr-stage { font-size: 13px; line-height: 20px; color: var(--aq-fg-secondary); }
.status { font-size: 13px; line-height: 20px; color: var(--aq-fg-secondary); overflow-wrap: anywhere; }
.status:not(:empty) { margin: 16px 4px 0; }
.status[data-kind="error"], .error, .delete-expense { color: var(--danger-text); }
.sheet-backdrop { position: absolute; inset: 0; z-index: 50; background: color-mix(in srgb, var(--aq-black) 45%, transparent); animation: scrim-in .2s both; }
.sheet { transform: none; padding: 0; border-radius: 24px 24px 0 0; max-height: calc(100% - var(--safe-top) - 16px); overflow-y: auto; animation: sheet-in .35s var(--ease-sheet) both; }
.sheet-nav { margin: 0; padding: 0 12px 8px; grid-template-columns: 72px 1fr 72px; gap: 4px; position: sticky; top: 0; background: var(--aq-bg); z-index: 2; }
.sheet-nav h2 { text-align: center; font-size: 17px; line-height: 22px; }
.text-btn { font-size: 15px; min-width: 44px; min-height: 44px; color: var(--accent-text); }
.editor-body { padding: 0 20px 12px; }
.amount-field { padding: 24px 12px 28px; }
.amount-field label { display: flex; justify-content: space-between; font-size: 13px; color: var(--aq-fg-secondary); }
.amount-input { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 40px; line-height: 52px; font-weight: 700; letter-spacing: -.04em; }
.amount-input > span { color: var(--aq-fg-secondary); }
.amount-input input { width: 100%; min-width: 0; color: var(--aq-fg); font-weight: inherit; background: transparent; border: 0; padding: 4px 8px; border-radius: var(--aq-radius-el); }
input::placeholder { color: var(--aq-fg-placeholder); opacity: 1; }
.editor-fields { overflow: visible; }
.field { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; padding: 8px 16px; background: transparent; min-height: 60px; border-radius: 0; box-shadow: none; }
body.aq-dark .sheet .editor-fields .field { background: transparent; }
.field + .field { box-shadow: inset 0 1px var(--aq-border); }
.field label { font-size: 15px; font-weight: 500; }
.field input, .field select { width: 100%; min-width: 0; min-height: 44px; border: 0; border-radius: var(--aq-radius-sm); background: transparent; color: var(--aq-fg-secondary); padding: 4px; text-align: right; font-size: 15px; }
.field select { text-align-last: right; }
.field option { background: var(--aq-surface); color: var(--aq-fg); }
.error { grid-column: 1 / -1; font-size: 12px; line-height: 18px; padding-top: 4px; }
input[aria-invalid="true"], select[aria-invalid="true"] { outline: 2px solid var(--danger-text); outline-offset: 2px; }
.field input:focus-visible, .field select:focus-visible { border-radius: var(--aq-radius-sm); }
.delete-expense { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 52px; margin-top: 20px; border-radius: var(--aq-radius-el); }
.delete-expense:active { background: var(--aq-error-lt); }
.sheet-buttons { position: sticky; bottom: 0; padding: 12px 16px calc(var(--safe-bottom) + 16px); background: var(--aq-bg); }
.about-content { padding: 24px 24px calc(var(--safe-bottom) + 24px); }
.about-mark { display: grid; place-items: center; width: 56px; height: 56px; background: var(--aq-accent-subtle); color: var(--accent-text); border-radius: var(--aq-radius-el); margin-bottom: 20px; }
.about-content h3 { font-size: 24px; line-height: 32px; letter-spacing: -.04em; margin-bottom: 16px; }
.about-content > p { font-size: 15px; line-height: 24px; color: var(--aq-fg-secondary); margin-bottom: 24px; }
.about-local { font-size: 14px; line-height: 22px; padding: 16px; }
body.aq-dark .sheet-nav, body.aq-dark .sheet-buttons { background: var(--aq-surface-raised); }
.action-toast { position: absolute; z-index: 25; bottom: calc(var(--tab-h) + var(--safe-bottom) + 14px); left: 16px; right: 16px; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--aq-fg); background: var(--aq-surface-raised); border: 1px solid var(--aq-border); border-radius: var(--aq-radius-el); font-size: 13px; line-height: 20px; box-shadow: var(--aq-shadow-sm); animation: toast-in .25s var(--ease-out) both; }
.action-toast > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-toast .i { width: 18px; height: 18px; color: var(--aq-success); }
#action-undo { min-width: 44px; min-height: 44px; color: var(--accent-text); font-size: 13px; font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes sheet-in { from { transform: translateY(36px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) { .device { width: 412px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@page { size: A4; margin: 16mm; }
@media print {
:root, body, body.aq-dark { --aq-fg: var(--aq-black); --aq-fg-secondary: var(--aq-grey-700); --aq-bg: var(--aq-white); --aq-surface: var(--aq-white); --aq-border: var(--aq-grey-300); }
body, .stage, .device, .app, .scrollbody { display: block; position: static; width: auto; height: auto; min-height: 0; max-height: none; overflow: visible; padding: 0; background: var(--aq-white); border: 0; border-radius: 0; box-shadow: none; transform: none; }
.statusbar, .shell-header, .shell-nav, .shell-actions, .sheet, .sheet-backdrop, .action-toast, .device::after, .no-print, #panel-today, #panel-receipts, .period-control, .status, .cat-bars, .report .section-heading { display: none !important; }
#panel-month, #month-report { display: block !important; }
.print-only { display: table !important; }
.large-title { padding: 0 0 12px; }
.screen-context { display: none; }
.spending-summary { padding: 0 0 16px; }
.summary-value { font-size: 32px; margin-bottom: 8px; }
.report-details { overflow: visible; display: block; margin-top: 20px; break-inside: auto; }
.report-details > :not(summary) { display: table !important; content-visibility: visible; }
.report-details::details-content { display: block; content-visibility: visible; }
.report-details summary { display: block; padding: 0 0 8px; break-after: avoid; }
.report-details summary .i { display: none; }
.summary-table { font-size: 11px; }
.summary-table th, .summary-table td { padding: 8px; }
tr { break-inside: avoid; }
thead { display: table-header-group; }
caption { text-align: left; font-weight: 600; margin-bottom: 8px; }
}

.spending-summary { background: var(--aq-surface); }
.editor-fields .field { border-radius: 0; box-shadow: none; }
.editor-fields .field + .field { box-shadow: inset 0 1px var(--aq-border); }
@media screen and (max-width: 599px) { .device { width: 100%; } }
@media screen and (min-width: 600px) { .device { width: 412px; } }

#period-label { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }

.screen-context, .section-heading > span { display: none; }
.shell-header { height: 60px; padding: 0 20px; background: transparent; pointer-events: none; }
.header-actions { margin-left: auto; pointer-events: auto; }
.app-name { opacity: 0; transition: opacity .15s; }
.shell-header.scrolled { background: color-mix(in srgb, var(--aq-bg) 92%, transparent); backdrop-filter: blur(20px); }
.shell-header.scrolled .app-name { opacity: 1; color: var(--aq-fg); }
.scrollbody { top: calc(var(--safe-top) + 10px); padding-bottom: 44px; }
.large-title { padding: 8px 96px 16px 0; }
.large-title h1 { margin: 0; }
.spending-summary { padding: 20px; }
.summary-value { margin: 6px 0 12px; font-size: 36px; line-height: 44px; }
.section-heading { padding-top: 22px; }
.shell-actions::before { content: ""; position: absolute; left: 0; right: 0; top: -24px; height: 24px; background: linear-gradient(transparent, var(--aq-bg)); pointer-events: none; }
.device:has([data-tab="month"][aria-current]):not(:has(.action-toast:not([hidden]))) .scrollbody { bottom: calc(var(--tab-h) + var(--safe-bottom)); }
#entries-empty { padding: 20px 8px; }
#entries-empty .empty-icon { width: 44px; height: 44px; margin-bottom: 8px; }
#entries-empty h2 { font-size: 17px; margin-bottom: 4px; }
#entries-empty p { font-size: 13px; line-height: 18px; }
.amount-input input:focus-visible { outline: none; border-radius: 0; box-shadow: none; }
.amount-input input[aria-invalid="true"] { color: var(--danger-text); border: 0; box-shadow: none; }
.amount-input:focus-within { border-bottom: 1px solid var(--aq-accent); }
.category-choices { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding-top: 8px; }
.category-choice { min-height: 64px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--aq-fg-secondary); }
.category-choice[aria-pressed="true"] { background: var(--aq-accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--aq-accent); }
.date-choice { min-height: 44px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--aq-fg-secondary); font-size: 15px; }
.date-choice .i { width: 18px; height: 18px; }
.date-picker { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; padding-top: 12px; gap: 8px; }
.date-picker label { grid-column: 1 / -1; }
.date-picker input { text-align: left; }
.receipt-paper-wrap { display: flex; justify-content: center; }
.receipt-paper-wrap img { max-height: 240px; width: auto; max-width: 100%; object-fit: contain; }
.ocr-progress { padding: 16px; }
#ocr-cancel { padding-left: 0; }
#ocr-stage { padding-left: 0; }

/* Round 3: one inset, compact receipt states, transient feedback. */
.scrollbody { padding-left:16px; padding-right:16px; }
.shell-header { padding-left:16px; padding-right:16px; }
.section-heading,.entry-section-heading,.entry-group-header,.group-foot { padding-left:0; padding-right:0; margin-left:0; margin-right:0; }
.editor-body { padding-left:16px; padding-right:16px; }
.amount-field { padding-left:0; padding-right:0; }
.spending-summary,.quick,.entry-row,.field { padding-left:16px; padding-right:16px; }
.editor-fields .field + .field,body.aq-dark .sheet .editor-fields .field + .field { box-shadow:inset 0 1px var(--aq-border); }
.amount-input:has([aria-invalid="true"]) { border-bottom:1px solid var(--danger-text); }
.primary:disabled { background:var(--aq-surface-sunken); color:var(--aq-fg-secondary); opacity:1; }
input::placeholder { color:var(--aq-fg-secondary); }
.about-content { text-align:center; padding:20px 16px 24px; }
.about-mark { margin:0 auto 12px; }
.about-content h3 { font-size:24px; margin-bottom:8px; }
.about-local { padding:0; color:var(--aq-fg-secondary); margin-top:16px; font-size:13px; line-height:20px; }
.about-content .tool-row { text-align:left; }
.appearance-heading { text-align:left; padding-top:24px; }
.appearance-mode { margin-left:auto; color:var(--aq-fg-secondary); font-size:14px; }
.receipt-result { border-radius:20px; overflow:hidden; }
.receipt-result:has(#receipt-preview:not([hidden])) { background:var(--aq-surface); padding:16px; }
#panel-receipts:has(#receipt-preview:not([hidden])) .sample-group,#panel-receipts:has(#receipt-preview:not([hidden])) > .group-foot { display:none; }
.receipt-paper-wrap { padding:0; margin:0 0 12px; }
.receipt-paper-wrap img { max-height:170px; }
.ocr-progress { padding:0; margin:0; box-shadow:none; }
#ocr-cancel { min-height:44px; padding:0 16px; border:1px solid var(--aq-border); border-radius:12px; margin-top:8px; }
#ocr-status:not(:empty) { margin:8px 0; }
#ocr-stage { margin:8px 0; }
#ocr-retry { display:block; width:100%; background:var(--ledger-primary); color:var(--aq-white); border-radius:12px; margin-top:12px; font-weight:600; }
#receipt-dismiss { display:block; width:100%; padding:0; }
.device:has(#ocr-progress:not([hidden])) .shell-actions,.device:has(#ocr-retry:not([hidden])) .shell-actions { display:none; }
.device:has(#ocr-progress:not([hidden])):not(:has(.action-toast:not([hidden]))) .scrollbody,.device:has(#ocr-retry:not([hidden])):not(:has(.action-toast:not([hidden]))) .scrollbody { bottom:calc(var(--tab-h) + var(--safe-bottom)); }

.entry-list { background:var(--aq-surface); border-radius:20px; overflow:hidden; }
.entry-group { margin:0; }
.entry-day { padding:12px 16px 0; font-size:11px; }
.day-entries { border-radius:0; background:transparent; }
.entry-group + .entry-group { border-top:1px solid var(--aq-border); }
.expense-row { min-height:66px; padding:12px 16px; }
#panel-receipts:has(#ocr-progress:not([hidden])) #ocr-status { display:none; }
#ocr-cancel { width:100%; text-align:center; margin-top:12px; }
.category-choice[aria-pressed="true"] { background:var(--ledger-primary); color:var(--aq-white); box-shadow:none; }
body.aq-dark .sheet .editor-fields .field + .field { border-top:1px solid var(--aq-grey-600); box-shadow:none; }
body.aq-dark .primary:disabled { background:var(--aq-grey-700); color:var(--aq-grey-200); opacity:1; }
.export-label { display:flex; align-items:center; gap:4px; min-height:44px; min-width:56px; color:var(--accent-text); font-size:12px; font-weight:600; }
.export-label .i { width:18px; height:18px; }
.csv-preview { display:flex; align-items:center; gap:12px; padding:16px; margin:12px 0; }
.csv-preview strong { font-size:13px; }.csv-preview p { font-size:12px; color:var(--aq-fg-secondary); margin-top:4px; }
@media print { .csv-preview { display:none !important; } }

.appearance-mode + .trailing { margin-left:0; }
#panel-receipts > .group-foot { text-align:center; }
.month-details { background:var(--aq-surface); border-radius:var(--aq-radius-card); overflow:hidden; margin-top:16px; }
.month-details .report-details { margin:0; border-radius:0; }
.month-details .report-details + .report-details { border-top:1px solid var(--aq-border); }
@media print { .month-details { overflow:visible; } }

.action-toast { bottom:calc(var(--tab-h) + var(--safe-bottom) + 88px); }
#expense-sheet-context { margin:0; padding:0 0 12px; }
.amount-input:focus-within { outline:2px solid var(--aq-ring); outline-offset:4px; border:0; border-radius:var(--aq-radius-el); }
#theme-toggle .appearance-mode { margin-left:auto; } #theme-toggle .trailing { margin-left:0; }
.receipt-result:has(#receipt-preview:not([hidden])) { background:var(--aq-surface-sunken); }
.receipt-paper-wrap { border:1px solid var(--aq-border); border-radius:12px; }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .scrollbody { bottom:calc(var(--tab-h) + var(--safe-bottom) + 164px); }
.shell-nav button:not([aria-current]) span { font-weight:400; }
.shell-actions .sample-group { display:none; }
.device:has([data-tab="receipts"][aria-current]) .shell-actions { height:164px; }
.device:has([data-tab="receipts"][aria-current]) .shell-actions .sample-group { display:block; margin-bottom:12px; }
.device:has([data-tab="receipts"][aria-current]):has(#receipt-preview:not([hidden])) .shell-actions .sample-group { display:none; }
.device:has([data-tab="receipts"][aria-current]):has(#receipt-preview:not([hidden])) .shell-actions { height:80px; }
.shell-nav::before { content:""; position:absolute; bottom:100%; left:0; right:0; height:16px; background:linear-gradient(transparent,var(--aq-bg)); pointer-events:none; }
.amount-input:focus-within { outline:0; box-shadow:inset 0 0 0 2px var(--aq-ring); padding:8px 16px; border-radius:12px; }
.amount-input { padding:8px 16px; border-radius:12px; }
.action-toast { background:var(--aq-surface-raised); border:1px solid var(--aq-border); border-radius:16px; box-shadow:var(--aq-shadow-sm); }
.receipt-result:has(#receipt-preview:not([hidden])) { background:transparent; padding:0; }
.ocr-progress { padding:16px; background:var(--aq-surface); border-radius:16px; margin-top:16px; }
#ocr-cancel { border:0; margin-top:8px; background:transparent; }
.receipt-empty .receipt-privacy { font-size:13px; margin-top:12px; line-height:20px; }
.device:has([data-tab="month"][aria-current]) .scrollbody { padding-bottom:80px; }

.large-title { padding-bottom:12px; }
.spending-summary { padding:16px; }
.summary-value { margin-bottom:8px; }
.quick { min-height:72px; padding-top:12px; padding-bottom:12px; }
.section-heading { padding-top:18px; }
.action-toast { top:calc(var(--safe-top) + 76px); bottom:auto; }

#today-status[data-kind="info"], #month-status[data-kind="info"] { display:none; }
.shell-header.scrolled { background:color-mix(in srgb,var(--aq-bg) 96%,transparent); border-bottom:1px solid var(--aq-border); }
.shell-header.scrolled .app-name { position:absolute; left:50%; transform:translateX(-50%); }
body.aq-dark .category-icon { background:color-mix(in srgb,var(--category) 18%,var(--aq-surface)); color:var(--category); }

/* r9: compact hierarchy, real amount pad, content-stable feedback. */
#panel-today .spending-summary { padding:12px 16px; }
#panel-today .summary-value { font-size:32px; line-height:38px; margin:2px 0 4px; }
.quick { min-height:60px; padding-top:8px; padding-bottom:8px; }
.section-heading { padding-top:16px; padding-bottom:8px; }
.entry-list { background:transparent; border-radius:0; overflow:visible; }
.entry-group { margin-bottom:12px; border:0 !important; }
.entry-day { padding:0 12px 6px; font-size:12px; }
.day-entries { background:var(--aq-surface); border-radius:16px; }
.expense-row { min-height:58px; padding:10px 12px; }
.entry-note { font-size:14px; }
.entry-chevron,.report-details summary > .i:last-child { color:var(--aq-fg-secondary); width:18px; height:18px; stroke-width:1.8; }
.action-toast { top:auto; bottom:calc(var(--tab-h) + var(--safe-bottom) + 84px); height:44px; left:24px; right:24px; border-radius:24px; }
.device:has([data-tab="today"][aria-current]) .scrollbody { padding-bottom:100px; }
.amount-field { padding-top:0; }
.amount-field > label { justify-content:center; }
.amount-input,.amount-input:focus-within { justify-content:center; padding:8px 0; border:0; box-shadow:none; outline:0; background:transparent; }
.amount-input input { flex:0 1 150px; width:150px; font-size:40px; text-align:left; caret-color:var(--ledger-primary); }
.amount-input > span { font-size:40px; }
.number-pad { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; padding:8px 0 0; }
.number-pad button { min-height:44px; border-radius:8px; background:var(--aq-surface); font-size:22px; color:var(--aq-fg); }
.number-pad button:active { background:var(--aq-surface-sunken); }
.report-details summary { gap:12px; }
.report-details summary > span { flex:1; }
.ocr-next { display:flex; align-items:center; gap:12px; padding-top:12px; color:var(--aq-fg-secondary); font-size:13px; }
.ocr-next .skeleton-line { height:14px; width:90px; border-radius:8px; background:var(--aq-surface-sunken); }

.entry-group { margin-bottom:8px; }
.entry-day { line-height:16px; padding-bottom:4px; }
.expense-row { padding-top:8px; padding-bottom:8px; }
.amount-field > label { gap:6px; }

/* r11: one ledger list and stable header confirmation. */
.entry-list { background:var(--aq-surface); border-radius:16px; overflow:hidden; }
.entry + .entry { box-shadow:none; }
.entry + .entry .expense-row { position:relative; }
.entry + .entry .expense-row::before { content:""; position:absolute; top:0; left:64px; right:12px; height:1px; background:var(--aq-border); }
.action-toast { top:calc(var(--safe-top) + 10px); bottom:auto; left:16px; right:64px; height:52px; background:var(--aq-surface-raised); border-radius:16px; }
.device:has(.action-toast:not([hidden])) .large-title h1 { visibility:hidden; }
.device:has([data-tab="today"][aria-current]) .scrollbody { padding-bottom:44px; }
.receipt-empty { min-height:400px; margin:0; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px 8px; }
.receipt-empty .empty-icon { width:88px; height:88px; border-radius:24px; }
.receipt-empty .empty-icon .i { width:44px; height:44px; }
.tool-group { margin-top:16px; }

/* r12: distinct confirmation lane, cohesive settings data tools. */
.action-toast { top:auto; bottom:calc(var(--tab-h) + var(--safe-bottom) + 84px); left:16px; right:16px; height:44px; border-radius:16px; }
.device:has(.action-toast:not([hidden])) .large-title h1 { visibility:visible; }
.device:has([data-tab="today"][aria-current]):has(.action-toast:not([hidden])) .scrollbody { bottom:calc(var(--tab-h) + var(--safe-bottom) + 140px); }
.action-toast::before { content:""; position:absolute; z-index:-1; inset:-8px -16px; background:var(--aq-bg); }
.shell-header.scrolled { background:var(--aq-bg); }
.shell-header.scrolled::after { content:""; position:absolute; top:100%; left:0; right:0; height:16px; background:linear-gradient(var(--aq-bg),transparent); pointer-events:none; }
.editor-fields .field + .field,body.aq-dark .sheet .editor-fields .field + .field { border:0; box-shadow:none; position:relative; }
.editor-fields .field + .field::before { content:""; position:absolute; top:0; left:16px; right:16px; height:1px; background:var(--aq-border); }
.field:has(#exp-note) { grid-template-columns:76px minmax(0,1fr) 18px; gap:4px; }
.note-edit { width:18px; height:18px; color:var(--aq-fg-secondary); }
.about-content { text-align:left; }
.about-content .about-mark { display:none; }
.about-content h3 { font-size:18px; }
.about-content > p:first-of-type { font-size:13px; }
.about-content .tool-group { margin-top:0; }
.about-local { text-align:center; }
.quick-plus { width:28px; height:28px; padding:4px; border-radius:50%; background:var(--aq-surface-sunken); flex:none; }

.device:has([data-tab="month"][aria-current]):has(.action-toast:not([hidden])) .scrollbody { bottom:calc(var(--tab-h) + var(--safe-bottom) + 60px); }
.device:has([data-tab="month"][aria-current]) .action-toast { bottom:calc(var(--tab-h) + var(--safe-bottom) + 8px); }

/* r13: compact header threshold, feedback surface, legible narrow presets. */
.action-toast::before { display:none; }
.device:has([data-tab="today"][aria-current]):has(.action-toast:not([hidden])) .shell-actions::before { top:-84px; height:24px; }
.amount-input input { flex:none; width:4.25ch; padding-inline:0; font-variant-numeric:tabular-nums; }
.amount-input > span { font-size:28px; align-self:center; }
.quick { padding-left:10px; padding-right:10px; gap:10px; }
.quick .category-icon { width:28px; height:32px; }
.quick-copy { font-size:13px; }
.quick-plus { width:24px; height:24px; padding:3px; }
.tool-group .tool-row + .tool-row { border-top:1px solid var(--aq-border); }
.about-details { margin-top:16px; }
.about-details .group-foot { padding:12px 16px; }
.about-details .section-heading { padding:8px 16px; }

/* r15: native key proportions and a focused receipt entry screen. */
.number-pad { gap:8px; padding-top:16px; }
.number-pad button { min-height:52px; border-radius:12px; background:var(--aq-surface); }
.quick:active { background:var(--aq-surface-sunken); transform:scale(.98); }
.settings-identity { display:flex; gap:12px; align-items:center; margin-bottom:8px; }
.about-content .settings-identity .about-mark { display:grid; width:44px; height:44px; margin:0; border-radius:12px; }
.settings-identity h3 { margin-bottom:4px; }
.settings-identity p { font-size:13px; color:var(--aq-fg-secondary); }
.about-content .section-heading h2 { font-size:13px; line-height:18px; font-weight:500; color:var(--aq-fg-secondary); }
.tool-group .tool-row + .tool-row { border:0; box-shadow:none; position:relative; }
.tool-group .tool-row + .tool-row::before { content:""; position:absolute; top:0; left:16px; right:16px; height:1px; background:var(--aq-border); }
#panel-receipts { min-height:100%; display:flex; flex-direction:column; }
.receipt-empty { flex:1; min-height:0; }
.shell-header.scrolled { border-bottom:1px solid var(--aq-grey-300); }
.shell-header.scrolled::after { height:24px; }
body.aq-dark .shell-header.scrolled { border-color:var(--aq-grey-700); }

/* r16: keypad stays fully visible in the phone frame; sample is actionable context. */
.amount-field { padding-bottom:12px; }
.amount-input { margin-top:4px; line-height:44px; }
.settings-identity h3 { letter-spacing:0; white-space:pre; }
.receipt-demo-paper { width:240px; max-width:100%; padding:24px; border-radius:12px; background:var(--aq-surface); box-shadow:var(--aq-shadow-sm); display:grid; gap:16px; text-align:left; }
.receipt-demo-paper strong { text-align:center; font-size:16px; letter-spacing:.03em; }
.receipt-demo-paper > div:not(.receipt-demo-rule) { display:flex; justify-content:space-between; gap:16px; font-size:13px; color:var(--aq-fg-secondary); }
.receipt-demo-paper .receipt-demo-total { font-size:20px !important; font-weight:700; color:var(--aq-fg) !important; }
.receipt-demo-rule { border-top:1px dashed var(--aq-border); }
.receipt-demo-label,.receipt-demo-thanks { font-size:12px; text-align:center; color:var(--aq-fg-secondary); }
.receipt-empty > p { font-size:14px; margin-top:8px; }
.receipt-action-note { display:none; font-size:11px; line-height:16px; text-align:center; color:var(--aq-fg-secondary); padding-top:8px; }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .receipt-action-note { display:block; }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .shell-actions { height:180px; }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .scrollbody { bottom:calc(var(--tab-h) + var(--safe-bottom) + 180px); }

/* The same local sample paper is both a try target and the OCR preview. */
.receipt-empty { margin-top:0; padding:16px 0 0; gap:12px; }
.receipt-sample-card { width:100%; display:grid; justify-items:center; gap:16px; padding:20px; border:0; border-radius:20px; background:var(--aq-surface); color:var(--aq-fg); box-shadow:var(--aq-shadow-sm); }
.receipt-sample-card:active { background:var(--aq-surface-sunken); }
#sample-paper { display:block; width:100%; }
#sample-paper canvas { display:block; height:300px; max-width:100%; width:auto; margin:auto; border-radius:12px; box-shadow:var(--aq-shadow-sm); }
.sample-caption { width:100%; display:flex; justify-content:space-between; align-items:center; font-size:15px; font-weight:600; }
.receipt-paper-wrap { border:0; border-radius:16px; background:transparent; }
.receipt-paper canvas,.receipt-paper img { max-height:300px; width:auto; max-width:100%; object-fit:contain; border-radius:12px; box-shadow:var(--aq-shadow-sm); }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .shell-actions { height:104px; }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .scrollbody { bottom:calc(var(--tab-h) + var(--safe-bottom) + 104px); }
.quick-trailing { width:16px; height:16px; margin-left:auto; color:var(--aq-fg-secondary); }
.summary-label .currency,.amount-field label span { display:none; }
body.aq-dark .sheet-backdrop { background:rgba(0,0,0,.62); }

/* Native scan entry and genuine per-day chart, using current ledger totals. */
.receipt-empty { justify-content:flex-start; align-items:stretch; flex:1; padding-top:16px; gap:0; }
.receipt-sample-card { display:flex; align-items:center; text-align:left; gap:16px; padding:16px; border-radius:16px; }
#sample-paper { width:56px; flex:none; }
#sample-paper canvas { height:66px; width:56px; border-radius:4px; }
.sample-caption { display:grid; flex:1; gap:4px; }
.sample-caption strong { font-size:16px; }
.sample-caption small { font-size:13px; font-weight:400; color:var(--aq-fg-secondary); }
.receipt-start { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:12px; min-height:260px; }
.receipt-start > .i { width:48px; height:48px; color:var(--aq-fg-secondary); }
.receipt-start h2 { font-size:22px; letter-spacing:-.02em; }
.receipt-start p { color:var(--aq-fg-secondary); font-size:15px; line-height:22px; }
.receipt-paper-wrap { padding:16px; background:var(--aq-surface); }
.shell-actions::before { display:none; }
.shell-actions { border-top:1px solid var(--aq-border); }
.quick:active { transform:scale(.97); background:var(--aq-surface-sunken); }
.daily-chart { padding:16px; margin-top:16px; }
.daily-chart-heading { display:flex; justify-content:space-between; align-items:center; }
.daily-chart-heading h2 { font-size:15px; }
.daily-chart-heading span,.daily-chart p { font-size:12px; color:var(--aq-fg-secondary); }
.spending-chart { display:flex; align-items:flex-end; gap:4px; height:48px; margin:16px 0 8px; }
.spending-chart span { flex:1; border-radius:3px 3px 0 0; background:var(--aq-accent); }
.spending-chart .unspent { background:var(--aq-border); }
@media print { .daily-chart { display:none !important; } }

/* One inset scan group, with explicit guidance and a secondary sample row. */
.receipt-empty { flex:none; background:var(--aq-surface); border-radius:16px; padding:20px 16px 0; margin-top:16px; }
.receipt-start { order:-1; min-height:0; flex:none; align-items:flex-start; justify-content:flex-start; text-align:left; gap:12px; padding:0 0 20px; }
.receipt-start > .i { width:32px; height:32px; color:var(--aq-accent-strong); }
.receipt-start h2 { font-size:20px; }
.receipt-start p { font-size:15px; line-height:22px; }
.receipt-sample-card { border-top:1px solid var(--aq-border); box-shadow:none; border-radius:0 0 16px 16px; padding:16px 0; }
#sample-paper { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:var(--aq-surface-sunken); color:var(--aq-fg-secondary); }
#sample-paper .i { width:24px; height:24px; }
.sample-caption strong { font-weight:600; }
.chart-axis { display:flex; justify-content:space-between; font-size:11px; color:var(--aq-fg-secondary); margin:4px 0 8px; }
.spending-chart { margin-bottom:0; }
.spending-chart .peak { background:var(--aq-accent-strong); }
.quick:active { transform:scale(.96); box-shadow:inset 0 0 0 2px var(--aq-accent); }
.quick:active .quick-copy > span:first-child { color:var(--aq-accent-strong); }

/* The scan tab is an input workflow; no receipt archive is implied. */
.quick-row { background:transparent; box-shadow:none; gap:12px; overflow:visible; }
.quick { background:var(--aq-surface); border-radius:16px; }
.quick + .quick { box-shadow:none; }
.quick:active { border-radius:16px; background:var(--aq-accent-subtle); transform:scale(.97); box-shadow:inset 0 0 0 2px var(--aq-accent); }
.shell-header.scrolled { backdrop-filter:blur(20px) saturate(180%); background:color-mix(in srgb,var(--aq-bg) 88%,transparent); border-bottom:1px solid var(--aq-border); }
.shell-header.scrolled::after { display:none; }
.summary-footer,.daily-chart-heading span,.daily-chart p,.chart-axis,.receipt-action-note { font-size:13px; line-height:18px; }
.sample-caption + .i,.tool-row .trailing,.report-details summary > .i:last-child,.report-details summary > svg:last-child { width:18px; height:18px; color:var(--aq-fg-secondary); stroke-width:1.8; }
.about-content { padding-bottom:calc(32px + var(--safe-bottom)); }
.receipt-start h2 { font-size:20px; line-height:26px; max-width:280px; }

/* Photo selection has a viewfinder-shaped empty canvas, never fake camera data. */
.receipt-empty { background:transparent; padding:0; margin-top:16px; }
.receipt-start { min-height:370px; align-items:center; justify-content:center; text-align:center; position:relative; background:var(--aq-surface); border-radius:20px; padding:32px 16px; }
.receipt-start .viewfinder { position:absolute; width:260px; height:300px; top:35px; max-width:100%; fill:none; stroke:var(--aq-fg-secondary); stroke-width:2; }
.receipt-start > .i { width:48px; height:48px; color:var(--aq-fg-secondary); }
.receipt-start h2,.receipt-start p { position:relative; z-index:1; }
.receipt-start p { font-size:13px; line-height:20px; }
.receipt-sample-card { background:var(--aq-surface); border:0; margin-top:16px; padding:16px; border-radius:16px; }
.receipt-action-note { display:none; }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .shell-actions { height:80px; }
.device:has([data-tab="receipts"][aria-current]):not(:has(#receipt-preview:not([hidden]))) .scrollbody { bottom:calc(var(--tab-h) + var(--safe-bottom) + 80px); }
.spending-chart { height:68px; }
.spending-chart > span { position:relative; }
.peak-label { position:absolute; top:-22px; left:50%; transform:translateX(-50%); font-size:13px; font-weight:600; color:var(--aq-fg); white-space:nowrap; }
.spending-chart > span:first-child .peak-label { left:0; transform:none; }
.spending-chart > span:last-child .peak-label { left:auto; right:0; transform:none; }
body.aq-dark .tool-group .tool-row + .tool-row::before { background:var(--aq-grey-600); }

.peak-label { background:var(--aq-surface); padding:2px 4px; border-radius:4px; line-height:18px; }
