@charset "UTF-8";

:root {
  --canvas: #f3f6fc;
  --paper: #ffffff;
  --ink: #12213d;
  --muted: #5d6b82;
  --teal: #087f6b;
  --teal-dark: #066756;
  --teal-soft: #e4f5ef;
  --line: #dde4ef;
  --surface-soft: #edf2f9;
  --positive: #007953;
  --positive-soft: #e6f6ef;
  --danger: #c12c4c;
  --danger-soft: #fceaf0;
  --indigo: #5b50bd;
  --indigo-soft: #eeecfc;
  --warning: #855515;
  --warning-soft: #fff4db;
  --focus: #315cdd;
  --shadow: 0 6px 22px rgb(18 33 61 / 4%);
  --radius: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--teal); text-underline-offset: 3px; }
svg { display: block; flex-shrink: 0; width: 24px; height: 24px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.8rem, 7vw, 2.5rem); line-height: 1.13; letter-spacing: -.04em; font-weight: 680; }
h2 { font-size: 1.15rem; line-height: 1.35; letter-spacing: -.025em; font-weight: 680; }
h3 { font-size: 1rem; line-height: 1.4; }
p { line-height: 1.6; }
small { font-size: .78rem; line-height: 1.5; }

.app-shell { max-width: 560px; min-height: 100svh; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px calc(116px + env(safe-area-inset-bottom)); }
.app-shell:focus { outline: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; margin-bottom: 27px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: .97rem; font-weight: 750; letter-spacing: -.025em; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 15px; background: var(--teal); color: white; font-size: 25px; font-weight: 500; }
.brand svg { width: 27px; height: 27px; color: var(--teal); }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); color: var(--ink); font-weight: 700; object-fit: cover; overflow: hidden; box-shadow: 0 3px 10px rgb(18 33 61 / 4%); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow { margin-bottom: 10px; font-size: .67rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.positive { color: var(--positive); }
.negative { color: var(--danger); }
.hero { position: relative; padding: 26px 24px; margin-bottom: 20px; overflow: hidden; border-radius: 28px; color: var(--paper); background: var(--ink); box-shadow: 0 12px 28px rgb(18 33 61 / 12%); }
.hero .eyebrow, .hero .muted { color: #cbd9eb; }
.hero p:last-child { margin-bottom: 0; }
.hero-value { margin: 8px 0 14px; font-size: clamp(2.25rem, 9.4vw, 3.1rem); line-height: 1.12; letter-spacing: -.055em; font-weight: 630; font-variant-numeric: tabular-nums; }
.hero .badge { color: #d8f7eb; border-color: #425671; background: #233755; }
.card { padding: 21px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.card-grid > .card { margin-bottom: 0; padding: 18px; min-width: 0; }
.metric { min-width: 0; }
.metric .eyebrow { letter-spacing: .07em; font-size: .63rem; }
.metric strong { display: block; font-size: clamp(1.12rem, 4.5vw, 1.5rem); letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric small { display: block; margin-top: 7px; color: var(--muted); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 27px 0 13px; }
.section-heading h2 { margin: 0; }
.section-heading .button { min-height: 44px; padding: 8px 11px; font-size: .8rem; }
.list { list-style: none; padding: 0; margin: 0; }
.card.list { padding: 21px; }
.list-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--line); }
button.list-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.list-row:first-child { padding-top: 1px; }
.list-row:last-child { border: 0; padding-bottom: 1px; }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-size: .9rem; line-height: 1.4; overflow-wrap: anywhere; }
.row-main small, .row-main p { display: block; margin: 4px 0 0; color: var(--muted); font-size: .77rem; line-height: 1.45; overflow-wrap: anywhere; }
.row-value { margin-left: auto; text-align: right; font-size: .95rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-value small { display: block; margin-top: 4px; color: var(--muted); font-size: .7rem; font-weight: 450; }
.row-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 13px; background: var(--teal-soft); color: var(--teal); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid #c8e8dd; border-radius: 100px; background: var(--teal-soft); color: var(--teal-dark); font-size: .68rem; line-height: 1.3; font-weight: 650; }
.notice, .warning, .demo-banner { padding: 14px 16px; margin: 14px 0; border-radius: 16px; font-size: .82rem; line-height: 1.55; }
.notice { background: var(--teal-soft); color: var(--teal-dark); border: 1px solid #c8e8dd; }
.warning { color: var(--warning); background: var(--warning-soft); border: 1px solid #edd9aa; }
.demo-banner { background: var(--indigo-soft); border: 1px solid #dad5f6; color: var(--indigo); }
.notice p:last-child, .warning p:last-child, .demo-banner p:last-child { margin-bottom: 0; }
.empty-state { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty-state h2, .empty-state h3 { color: var(--ink); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 16px; color: var(--teal); }
.empty-state p { font-size: .87rem; max-width: 32ch; margin-left: auto; margin-right: auto; }

.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; padding: 13px 20px; border: 1px solid transparent; border-radius: 15px; text-decoration: none; font-size: .88rem; line-height: 1.3; font-weight: 650; text-align: center; background: var(--teal-soft); color: var(--teal); transition: background-color .15s, transform .15s; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button.primary { background: var(--teal); color: white; }
.button.primary:hover:not(:disabled) { background: var(--teal-dark); }
.button.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.button.secondary:hover:not(:disabled) { background: var(--surface-soft); border-color: #bdcce0; }
.button.ghost { background: transparent; color: var(--teal); }
.button.ghost:hover:not(:disabled) { background: var(--teal-soft); }
.button.danger { color: var(--danger); background: var(--danger-soft); border-color: #efc9d2; }
.movement-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.movement-title h1 { margin-bottom: 0; }
.transaction-delete-action { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px; }
.transaction-action-summary { overflow-wrap: anywhere; }
.transaction-action-summary p { margin: 8px 0 16px; }
.transaction-action-amount { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.transaction-action-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.transaction-action-buttons .button { flex: 1 1 160px; }
.button svg { width: 20px; height: 20px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; }
.button-row > .button { flex: 1; }
.button-row > .button.ghost { flex-grow: 0; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 12px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > span { font-size: .8rem; font-weight: 650; line-height: 1.4; }
.field small { color: var(--muted); font-size: .74rem; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 49px; padding: 12px; border: 1px solid #8492a8; border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.4; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); }
.field textarea { min-height: 95px; resize: vertical; }
.field input[type="checkbox"] { width: 22px; height: 22px; min-height: 22px; accent-color: var(--teal); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); }
.full-width { grid-column: 1 / -1; width: 100%; }
.initial-lots-editor { min-width: 0; padding: 17px 0 0; border-top: 1px solid var(--line); }
.initial-lots-editor > .footer-note { margin: 10px 0 18px; text-align: left; }
.initial-lot-row { padding: 16px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 17px; background: var(--canvas); }
.initial-lot-row:nth-child(even) { background: var(--teal-soft); }
.initial-lot-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.initial-lot-heading > strong { min-width: 0; font-size: .86rem; line-height: 1.4; }
.initial-lot-heading > .button { flex-shrink: 0; padding: 9px 10px; min-height: 44px; font-size: .78rem; }
.initial-lot-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.initial-lot-fields > :last-child { grid-column: 1 / -1; }
.initial-lots-summary { padding: 13px 0 0; margin-bottom: 0; font-size: .85rem; line-height: 1.5; font-weight: 600; }
.field input[readonly] { background: var(--surface-soft); border-style: dashed; color: var(--ink); }
.initial-lots-history { margin-top: 14px; }
.initial-lots-history .footer-note { margin: 10px 0 14px; text-align: left; }
.bottom-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-around; align-items: stretch; max-width: 560px; margin: 0 auto; padding: 9px 10px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgb(255 255 255 / 97%); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 -4px 22px rgb(18 33 61 / 3%); }
.bottom-nav button, .bottom-nav a { display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 54px; padding: 6px 3px; border: 0; border-radius: 15px; background: none; color: var(--muted); font-size: .63rem; font-weight: 600; line-height: 1.3; text-decoration: none; }
.bottom-nav svg { width: 22px; height: 22px; }
.bottom-nav .active { color: var(--teal-dark); background: var(--teal-soft); }
.fab { position: fixed; z-index: 21; right: max(22px, calc((100vw - 520px) / 2)); bottom: calc(90px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 55px; min-width: 55px; padding: 15px 19px; border: 0; border-radius: 19px; background: var(--teal); color: white; font-weight: 680; font-size: .9rem; box-shadow: 0 8px 22px rgb(8 127 107 / 24%); }
.chart { position: relative; width: 100%; min-height: 140px; margin: 18px 0 8px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart svg > path { stroke: var(--line); }
.chart svg > polyline { stroke: var(--teal); }
.chart svg > polyline[stroke-dasharray] { stroke: var(--indigo); }
.chart svg > circle { fill: var(--teal); }
.chart svg > text { fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 0 0; color: var(--muted); font-size: .72rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend > span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.legend > span:nth-child(2)::before { background: var(--indigo); }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.chart-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .65rem; }
.analysis-entry { margin: 0 0 20px; }
.analysis-period { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: end; gap: 10px; margin: 24px 0 12px; }
.analysis-period .icon-button { margin-bottom: 2px; font-size: 20px; }
.analysis-coverage { color: var(--muted); font-size: .8rem; line-height: 1.5; margin-bottom: 22px; }
.section-heading.analysis-heading { margin: 0 0 18px; }
.analysis-bar { display: block; width: 100%; min-width: 0; margin: 0; padding: 13px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.analysis-bar:last-of-type { border-bottom: 0; }
.analysis-bar-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: .87rem; line-height: 1.45; }
.analysis-bar-heading > span { min-width: 0; overflow-wrap: anywhere; }
.analysis-bar-heading strong { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.analysis-bar-track { display: block; height: 9px; margin-top: 9px; border-radius: 5px; background: var(--surface-soft); overflow: hidden; }
.analysis-bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--teal); }
.analysis-bar-fill.gold { background: var(--indigo); }
.analysis-bar-fill.refund { background: var(--positive); }
.analysis-bar-fill.refund { margin-left: auto; }
.analysis-bar > small { display: block; margin-top: 7px; color: var(--warning); }
.category-bar { border-radius: 0; min-height: 75px; }
.category-bar:hover { background: var(--canvas); }
.category-detail-hint { display: block; margin-top: 7px; color: var(--teal); font-size: .75rem; }
.analysis-margin { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 19px; padding-top: 17px; border-top: 1px solid var(--line); font-size: .85rem; }
.analysis-margin strong { flex-shrink: 0; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.analysis-chart { width: 100%; min-width: 0; }
.analysis-chart-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 18px; font-size: .8rem; line-height: 1.4; }
.analysis-chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.analysis-chart-legend > span::before { content: ""; flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.analysis-chart-legend > .series-1::before { background: var(--indigo); }
.analysis-chart-range, .analysis-chart-dates { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: .78rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
.analysis-chart-range { margin-bottom: 8px; }
.analysis-chart-dates { margin-top: 8px; }
.analysis-chart .analysis-plot { display: block; width: 100%; height: 180px; overflow: visible; }
.analysis-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.analysis-line { fill: none; stroke: var(--teal); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.analysis-dot { fill: var(--paper); stroke: var(--teal); stroke-width: 2; }
.analysis-line.series-1, .analysis-dot.series-1 { stroke: var(--indigo); }
.analysis-line.series-1 { stroke-dasharray: 5 3; }
.analysis-chart details { margin-top: 8px; padding-bottom: 0; }
.analysis-chart summary { font-size: .8rem; color: var(--teal); }
.analysis-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .75rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.analysis-table th, .analysis-table td { padding: 10px 5px; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; text-align: right; }
.analysis-table th:first-child { text-align: left; }
.analysis-table th { font-weight: 600; }
.analysis-table thead { background: var(--surface-soft); }
.analysis-table tbody tr:nth-child(even) { background: var(--canvas); }
.analysis-view .footer-note, .forecast-card .footer-note { text-align: left; }
.forecast-card { margin-top: 22px; }
.forecast-card .card-grid { margin-bottom: 24px; }
.forecast-card details ul { padding-left: 20px; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.tabs { display: flex; gap: 5px; padding: 5px; margin: 15px 0 22px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }
.tabs button { flex: 1; min-height: 44px; padding: 9px 10px; border: 0; border-radius: 11px; background: none; color: var(--muted); font-size: .79rem; font-weight: 650; }
.tabs .active, .tabs [aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 2px 8px rgb(18 33 61 / 6%); }
.signin, .onboarding { padding: 32px 4px; }
.signin { display: flex; flex-direction: column; align-items: flex-start; min-height: calc(100svh - 160px); justify-content: center; }
.signin.app-shell { padding: max(32px, env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom)); min-height: 100svh; }
.signin .brand { margin-bottom: 32px; }
.signin .brand-mark { width: 66px; height: 66px; border-radius: 22px; font-size: 38px; margin-bottom: 42px; }
.signin h1 { max-width: 16ch; margin-bottom: 18px; }
.signin > p { max-width: 36ch; }
.signin .button { width: 100%; }
.signin .button-row { width: 100%; }
.signin .eyebrow { font-size: .67rem; }
.signin .notice, .signin .warning { width: 100%; }
.onboarding h1 { font-size: 2rem; }
.footer-note { margin: 25px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.6; text-align: center; }
.skeleton { width: 100%; height: 48px; margin: 10px 0; border-radius: 14px; background: linear-gradient(90deg, #e3eaf5 25%, #f3f6fc 50%, #e3eaf5 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; }
.toast { position: fixed; z-index: 80; bottom: calc(94px + env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: min(90vw, 500px); padding: 14px 18px; border: 1px solid #425671; border-radius: 15px; background: var(--ink); box-shadow: 0 8px 22px rgb(18 33 61 / 20%); color: white; font-size: .82rem; line-height: 1.5; transform: translateX(-50%); }
.toast.error { background: #8d213a; border-color: var(--danger); }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 12px 15px; background: white; border: 2px solid var(--teal); border-radius: 10px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
dialog { position: fixed; inset: auto 0 0; width: 100%; max-width: 560px; max-height: calc(100dvh - max(25px, env(safe-area-inset-top))); margin: 0 auto; padding: 27px 22px max(25px, env(safe-area-inset-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 27px 27px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 50px rgb(18 33 61 / 12%); overflow-y: auto; overscroll-behavior: contain; }
dialog::backdrop { background: rgb(18 33 61 / 42%); backdrop-filter: blur(3px); }
dialog h2 { font-size: 1.4rem; margin-bottom: 9px; }
dialog .section-heading { margin-top: 0; }
dialog .button-row { margin-top: 24px; }
dialog p, dialog dd, dialog li { overflow-wrap: anywhere; }
dialog dd { margin: 3px 0 12px; }
dialog::before { content: ""; display: block; width: 38px; height: 4px; margin: -13px auto 22px; border-radius: 3px; background: #c3cede; }
details { padding: 13px 0; }
summary { min-height: 44px; padding: 12px 0; font-weight: 650; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
pre { max-width: 100%; padding: 14px; border-radius: 12px; background: var(--surface-soft); font-size: .73rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; }

/* Movement search, filters and direction cues share the same color semantics. */
.movement-view { min-width: 0; }
.movement-view > .section-heading { margin-top: 0; }
.movement-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 10px; margin: 18px 0 14px; }
.movement-search { grid-column: 1; grid-row: 1; min-width: 0; margin: 0; }
.movement-search input { min-height: 48px; border-radius: 15px; box-shadow: 0 3px 10px rgb(18 33 61 / 3%); }
.movement-search input:focus { border-color: var(--focus); }
.movement-filter-toggle { display: inline-flex; grid-column: 2; grid-row: 1; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); color: var(--ink); font-size: .84rem; font-weight: 650; }
.movement-filter-toggle[aria-expanded="true"] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.movement-filter-toggle svg { width: 18px; height: 18px; }
.movement-directions { display: flex; flex-wrap: wrap; grid-column: 1 / -1; grid-row: 2; gap: 8px; margin: 0 0 2px; }
.direction-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; max-width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--muted); font-size: .8rem; font-weight: 650; line-height: 1.35; transition: background-color .15s, border-color .15s; }
.direction-chip:hover:not(:disabled) { border-color: #aab9d0; }
.direction-chip.active, .direction-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: white; }
.direction-chip.direction-in { color: var(--positive); }
.direction-chip.direction-out { color: var(--danger); }
.direction-chip.direction-transfer { color: var(--indigo); }
.direction-chip.direction-in:is(.active, [aria-pressed="true"]) { border-color: var(--positive); background: var(--positive-soft); box-shadow: inset 0 0 0 1px var(--positive); }
.direction-chip.direction-out:is(.active, [aria-pressed="true"]) { border-color: var(--danger); background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }
.direction-chip.direction-transfer:is(.active, [aria-pressed="true"]) { border-color: var(--indigo); background: var(--indigo-soft); box-shadow: inset 0 0 0 1px var(--indigo); }
.movement-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; margin: 16px 0 20px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.movement-filters .field > span { color: var(--muted); font-size: .75rem; }
.movement-filters .button-row { grid-column: 1 / -1; margin: 0; }
.movement-results-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin: 21px 0 12px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.movement-results-meta > :is(p, span) { margin: 0; }
.movement-results-meta strong { color: var(--ink); font-weight: 650; }
.movement-results-meta .button { min-height: 44px; padding: 8px 11px; font-size: .77rem; }
.movement-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0 20px; }
.movement-summary > * { min-width: 0; margin: 0; padding: 17px; border: 1px solid transparent; border-radius: 19px; box-shadow: none; }
.movement-summary .movement-summary-in { background: var(--positive-soft); border-color: #c8e8dd; }
.movement-summary .movement-summary-out { background: var(--danger-soft); border-color: #f1d1da; }
.movement-summary-in strong, .movement-summary-in .eyebrow { color: var(--positive); }
.movement-summary-out strong, .movement-summary-out .eyebrow { color: var(--danger); }
.movement-summary strong { display: block; margin: 7px 0 0; font-size: clamp(1.2rem, 4.8vw, 1.65rem); line-height: 1.2; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.movement-summary > * > span { font-size: .76rem; font-weight: 650; line-height: 1.45; }
.movement-summary p { margin: 0; font-size: .76rem; line-height: 1.45; }
.movement-summary small { display: block; margin-top: 8px; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.movement-summary-note { margin: -7px 0 18px; text-align: left; font-size: .7rem; }
.movement-list { min-width: 0; }
.movement-list.card { padding: 6px 17px; }
.movement-list .empty-state { padding: 30px 10px; }
button.list-row.movement-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 41%); align-items: center; gap: 11px; min-height: 82px; padding: 17px 0; }
.movement-row .row-icon { width: 40px; height: 40px; border-radius: 14px; font-size: 1.15rem; font-weight: 700; }
.movement-row .row-value { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; max-width: 100%; margin: 0; font-size: .95rem; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
.movement-row .row-main strong { font-size: .87rem; }
.movement-row .row-main small { font-size: .72rem; }
.movement-row .row-value small { font-size: .68rem; font-weight: 500; }
.movement-type { display: inline-flex; align-items: center; width: fit-content; max-width: 100%; margin-top: 5px; padding: 3px 7px; border: 0; border-radius: 7px; font-size: .65rem; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.movement-row .row-value .movement-type { display: inline-flex; margin-left: auto; font-size: .65rem; font-weight: 650; }
.movement-in .row-icon, .movement-in .movement-type { background: var(--positive-soft); color: var(--positive); }
.movement-out .row-icon, .movement-out .movement-type { background: var(--danger-soft); color: var(--danger); }
.movement-transfer .row-icon, .movement-transfer .movement-type { background: var(--indigo-soft); color: var(--indigo); }
.movement-in .row-value { color: var(--positive); }
.movement-out .row-value { color: var(--danger); }
.movement-transfer .row-value { color: var(--indigo); }
.movement-in .row-value .movement-type { color: var(--positive); }
.movement-out .row-value .movement-type { color: var(--danger); }
.movement-transfer .row-value .movement-type { color: var(--indigo); }
.movement-row:hover { background: var(--canvas); }
.movement-date-heading { margin: 0 -17px; padding: 14px 17px 8px; background: var(--canvas); color: var(--muted); font-size: .71rem; font-weight: 650; line-height: 1.4; }
.movement-list .empty-state .button, .movement-empty-reset { min-height: 44px; margin-top: 8px; }

@keyframes shimmer { to { background-position: -200% 0; } }
@media (min-width: 600px) {
  body { background: #e7edf7; }
  .app-shell { background: var(--canvas); box-shadow: 0 0 60px rgb(18 33 61 / 5%); padding-left: 26px; padding-right: 26px; }
  dialog { bottom: 25px; max-height: calc(100dvh - 50px); border-bottom: 1px solid var(--line); border-radius: 27px; }
}
@media (max-width: 350px) {
  .app-shell { padding-left: 15px; padding-right: 15px; }
  .card { padding: 16px; }
  .card-grid { gap: 9px; }
  .card-grid > .card { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .initial-lot-fields { grid-template-columns: 1fr; }
  .row-value { font-size: .85rem; }
  .movement-summary { gap: 9px; }
  .movement-summary > * { padding: 14px; }
  .movement-toolbar { gap: 10px 8px; }
  .movement-filter-toggle { padding-left: 11px; padding-right: 11px; }
  .movement-filters { grid-template-columns: 1fr; padding: 15px; }
  .movement-directions { gap: 7px; }
  .direction-chip { padding-left: 12px; padding-right: 12px; }
  .movement-list.card { padding-left: 13px; padding-right: 13px; }
  button.list-row.movement-row { grid-template-columns: 34px minmax(0, 1fr) minmax(0, 41%); gap: 9px; }
  .movement-row .row-icon { width: 34px; height: 38px; border-radius: 12px; }
  .movement-row .row-value { font-size: .86rem; }
  .movement-date-heading { margin-left: -13px; margin-right: -13px; padding-left: 13px; padding-right: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Optional transaction detail: keep the main entry short. */
.category-choice { min-width: 0; }
.category-choice-row { display: flex; gap: 8px; align-items: flex-end; }
.category-choice-row .field { flex: 1; min-width: 0; }
.category-add { flex: 0 0 46px; height: 46px; margin-bottom: 0; padding: 0; font-size: 1.35rem; }
.transaction-details { border: 1px solid var(--line); border-radius: 17px; background: var(--canvas); overflow: hidden; }
.transaction-details > summary { padding: 16px; font-size: .86rem; font-weight: 650; cursor: pointer; line-height: 1.5; }
.transaction-details > summary span { display: block; color: var(--muted); font-size: .72rem; font-weight: 450; margin-left: 17px; }
.transaction-details-body { padding: 0 16px 16px; }
.transaction-details-body h3 { font-size: .96rem; margin: 18px 0 8px; }
.receipt-picker { position: relative; display: flex; justify-content: center; overflow: hidden; cursor: pointer; }
.receipt-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.receipt-picker:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.receipt-list { display: grid; gap: 10px; margin-top: 12px; }
.receipt-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); min-width: 0; }
.receipt-card a { display: block; color: var(--teal); font-size: .8rem; text-align: center; }
.receipt-card img { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 8px; background: var(--canvas); margin-bottom: 8px; }
.receipt-card small { display: block; color: var(--muted); font-size: .72rem; margin-top: 8px; }
.receipt-item { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 13px; margin: 12px 0; }
.receipt-item .field { margin-bottom: 12px; }
.receipt-item .category-add { margin-bottom: 12px; }
.receipt-item > .button { min-height: 44px; padding: 8px; }
.receipt-totals { font-size: .78rem; font-weight: 650; line-height: 1.6; }
.receipt-indicator { color: var(--teal) !important; font-weight: 600; }
