/* Forge Money foundation: warm paper, crisp hierarchy, exact financial text. */
:root {
  color-scheme: light;
  --paper: #f7f5ef; --surface: #fffefa; --ink: #292d28; --muted: #62665d;
  --line: #dcded3; --accent: #4b6250; --accent-soft: #e8ede3;
  --warning: #765020; --warning-paper: #f7efd9; --danger: #91412d;
  --radius: .55rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--paper); font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 64rem; margin: auto; padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .6rem; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12; letter-spacing: -.045em; font-weight: 600; }
h2 { font-size: 1.15rem; line-height: 1.4; letter-spacing: -.02em; font-weight: 600; }
h3 { font-size: 1rem; }
p { line-height: 1.6; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
#page-content:focus { outline: none; }
input, select, textarea, button { font: inherit; max-width: 100%; }
input:not([type=checkbox]):not([type=radio]):not([type=submit]), select, textarea { border: 1px solid #999f91; background: var(--surface); color: var(--ink); border-radius: .35rem; padding: .65rem .75rem; min-height: 44px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
button, input[type=submit], .button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--accent); border-radius: .35rem; padding: .65rem 1rem; background: var(--accent); color: white; text-decoration: none; font-weight: 550; line-height: 1.3; cursor: pointer; }
button:hover, input[type=submit]:hover, .button:hover { background: #384b3c; color: white; }
.button--secondary, input[type=submit].button--secondary { background: var(--surface); color: var(--ink); border-color: #a8ae9e; }
label { display: inline-block; font-size: .85rem; font-weight: 550; line-height: 1.5; margin: .35rem .3rem .35rem 0; }
section { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
article { border-bottom: 1px solid var(--line); padding: 1.25rem 0; overflow-wrap: anywhere; }
summary { cursor: pointer; color: var(--accent); padding-block: .45rem; line-height: 1.5; }
details p:last-child { margin-bottom: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 650; color: var(--muted); margin-bottom: .8rem; }
.muted, .field-hint, .attribution { color: var(--muted); }
.field-hint { font-size: .8rem; line-height: 1.5; margin: .5rem 0 0; }
.attribution { font-size: .75rem; line-height: 1.6; overflow-wrap: anywhere; margin: .5rem 0; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header__inner { max-width: 80rem; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: .8rem clamp(1rem, 3vw, 2rem); }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); font-weight: 650; letter-spacing: -.025em; white-space: nowrap; }
.brand-mark { font-family: Georgia, serif; background: var(--accent-soft); color: var(--accent); width: 2.2rem; height: 2.2rem; display: inline-grid; place-items: center; border-radius: .5rem; font-size: 1.6rem; font-style: italic; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.site-header nav a { padding: .7rem .85rem; font-size: .85rem; color: var(--muted); text-decoration: none; border-radius: .35rem; }
.site-header nav a[aria-current=page] { color: var(--ink); background: var(--accent-soft); font-weight: 600; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 2; background: var(--surface); padding: .75rem; }
.skip-link:focus { top: 1rem; }
.page-heading, .position-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.page-heading { margin-bottom: 2rem; }
.page-heading p:last-child { margin-bottom: 0; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1.2rem; }
.quiet-link { font-size: .85rem; white-space: nowrap; }
.month-filter { display: flex; gap: 1rem; align-items: end; padding: 1rem 1.25rem; background: #efeee6; border-radius: var(--radius); }
.month-filter label { display: block; margin-top: 0; }
.month-filter input[type=text] { width: 10rem; }
.month-context { display: flex; justify-content: space-between; gap: 1rem; margin: .8rem 0 1rem; color: var(--muted); font-size: .75rem; }
.empty-state { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.5rem, 5vw, 3.5rem); background: var(--surface); text-align: center; margin-block: 2rem; }
.empty-state p { max-width: 31rem; margin: 0 auto 1rem; }
.empty-state h2 { font-family: Georgia, serif; font-weight: 400; font-size: 1.8rem; letter-spacing: -.035em; }
.empty-mark { display: inline-block; color: var(--accent); margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: 50%; padding: .3rem .8rem; }
.currency-section { margin-top: 2.5rem; padding-top: 2rem; }
.position-amount { font-size: clamp(1.7rem, 5vw, 2.8rem); font-weight: 550; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-bottom: .5rem; overflow-wrap: anywhere; }
.position-note { color: var(--muted); text-align: right; font-size: .8rem; white-space: nowrap; }
.position-heading .muted { font-size: .8rem; }
.message { padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); line-height: 1.6; margin-block: 1.5rem; }
.message--warning { background: var(--warning-paper); border-color: #d9c79c; color: var(--warning); }
.message--warning summary { color: var(--warning); }
.message--error { background: #f8eae2; border-color: #d5ab9b; color: #793826; }
.message h2 { margin-bottom: .5rem; }
.message ul { margin-bottom: 0; padding-left: 1.25rem; }
.trajectory { margin: 1.5rem 0 2rem; padding: 1.5rem; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.trajectory h2 { margin-bottom: .2rem; }
.trajectory figcaption p { font-size: .75rem; }
.trajectory-chart { width: 100%; height: auto; display: block; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-endpoint, .comparison-actual { fill: var(--accent); }
.chart-baseline { stroke: #9caa97; stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; gap: 1rem; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart-data { margin-top: 1rem; font-size: .8rem; }
.section-heading h2 { margin-bottom: 1rem; }
.comparison-legend { display: flex; align-items: center; gap: .5rem; font-size: .7rem; color: var(--muted); }
.legend-actual { width: 1rem; height: .45rem; background: var(--accent); }
.legend-target { width: 2px; height: .85rem; background: var(--ink); margin-left: .5rem; }
.comparison-chart { display: block; width: 12rem; height: 1.5rem; margin-top: .5rem; }
.comparison-target { stroke: var(--ink); stroke-width: 2; }
.mobile-table-hint { display: none; }
.table-scroll { max-width: 100%; overflow-x: auto; padding-bottom: .4rem; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; text-align: left; }
caption { text-align: left; padding: .75rem 0; color: var(--muted); }
th, td { padding: 1rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 550; }
thead th { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.budget-table { min-width: 44rem; }
.budget-table thead th:not(:first-child) { text-align: right; }
.category-name { display: block; overflow-wrap: anywhere; max-width: 16rem; }
.over-target { color: var(--danger); font-weight: 600; }
.edit-history { text-align: left; font-size: .7rem; white-space: normal; }
.edit-history summary { color: var(--muted); }
.edit-history .attribution { max-width: 14rem; }
.review-links { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 2rem 0; font-size: .85rem; }
.accounting-notes { border-top: 1px solid var(--line); padding-top: 1rem; font-size: .8rem; color: var(--muted); }
.form-page { max-width: 40rem; }
.back-link { display: inline-block; padding: .5rem 0; margin-bottom: 2rem; font-size: .85rem; }
.stacked-form { margin-top: 2rem; display: grid; gap: 1.25rem; }
.stacked-form label { display: block; }
.stacked-form input:not([type=submit]), .stacked-form select { width: 100%; }
.stacked-form .actions { margin-top: .5rem; }
.form-context { font-size: 1.3rem; overflow-wrap: anywhere; }
.management-list { list-style: none; padding: 0; }
.management-list li { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.management-list li > div { min-width: 0; }
.management-list h2 { overflow-wrap: anywhere; margin-bottom: .25rem; }
.management-list a { padding: .6rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
  .site-header__inner { flex-direction: column; align-items: start; gap: .5rem; }
  .site-header nav { width: 100%; gap: 0; }
  .site-header nav a { padding: .7rem .6rem; font-size: .75rem; }
  .page-heading { align-items: start; flex-direction: column; }
  .month-filter { flex-wrap: wrap; gap: .75rem; padding: 1rem; }
  .month-filter > div { flex: 1 1 8rem; min-width: 0; }
  .month-filter input[type=text], .month-filter select { width: 100%; }
  .month-context { display: block; }
  .month-context p { margin-bottom: .3rem; }
  .position-heading { align-items: start; }
  .position-note { display: none; }
  .trajectory { padding: 1rem; }
  .section-heading { align-items: start; flex-direction: column; gap: 0; }
  .section-heading h2 { margin-bottom: .3rem; }
  .mobile-table-hint { display: block; margin: 0 0 .75rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

/* Compatible polish for evolving product screens; no per-screen financial logic. */
.workspace-page > a { display: inline-block; margin: 0 1rem 1.5rem 0; font-size: .85rem; }
.workspace-page > p:not(.eyebrow), .workspace-page section > p { max-width: 65ch; }
.workspace-page .stacked-form p { margin: 0; }
.workspace-page .stacked-form p > label { display: block; }
.workspace-page .stacked-form p > input:not([type=checkbox]), .workspace-page .stacked-form p > select { width: 100%; }
.workspace-page .stacked-form p:has(input[type=checkbox]) { display: flex; align-items: center; gap: .5rem; }
.workspace-page .stacked-form p:has(input[type=checkbox]) label { margin: 0; }
.workspace-page fieldset { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; display: grid; gap: 1rem; }
.workspace-page legend { padding: 0 .5rem; font-weight: 600; }
.workspace-page article { padding: 1.5rem 0; }
.workspace-page article p { font-size: .85rem; color: var(--muted); margin-bottom: .65rem; }
.workspace-page article > a { font-weight: 600; }
.workspace-page article .button_to { display: inline-block; margin: .6rem .5rem 0 0; }
.workspace-page article .button_to button { background: var(--surface); color: var(--ink); border-color: #a8ae9e; }
.inline-empty { padding: 1.25rem 0; color: var(--muted); }
.inline-empty p { margin-bottom: .5rem; }
.utility-links { font-size: .85rem; }
.setup-panel { padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 1.5rem 0 2rem; }
.setup-panel > summary { font-weight: 600; }
.setup-panel .stacked-form { max-width: 35rem; margin: 1.25rem 0 .5rem; }
.setup-panel .stacked-form > label { margin-bottom: -.9rem; }
.household-links { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.5rem; margin: 2rem 0; }
.household-links a { padding: 1.5rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.household-links strong, .household-links span { display: block; }
.household-links span { font-size: .85rem; color: var(--muted); line-height: 1.6; margin-top: .4rem; }
.welcome-page { padding-top: clamp(4rem, 12vh, 8rem); }
.welcome-page h1 { max-width: 12ch; font-size: clamp(3rem, 8vw, 5.5rem); }
.welcome-intro { max-width: 36rem; font-size: 1.15rem; color: var(--muted); margin: 1.5rem 0 2rem; }
.connection-status:empty { display: none; }
@media (max-width: 760px) { .household-links { grid-template-columns: 1fr; } .workspace-page .stacked-form { gap: 1rem; } }

/* Keep receipt metadata and explicit attachment actions readable when scrolling. */
.receipt-history-table { min-width: 44rem; }
.receipt-attachment-table { min-width: 48rem; }
.receipt-attachment-table td:last-child { min-width: 15rem; }

/* Manual receipt observations remain individually labeled at every width. */
.receipt-draft-page { max-width: 54rem; }
.draft-field-grid, .workspace-page .draft-item { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.workspace-page .draft-item > p:first-of-type, .workspace-page .draft-item > .draft-remove { grid-column: 1 / -1; }
.receipt-draft-page .stacked-form input[type=checkbox] { width: 1.1rem; flex-shrink: 0; }
@media (max-width: 540px) { .draft-field-grid, .workspace-page .draft-item { grid-template-columns: minmax(0, 1fr); } }
