[hidden] { display: none !important; }
button, input, select, textarea, summary { touch-action: manipulation; }
button, input, select, textarea { max-width: 100%; }
button { font-family: inherit; }
p + p { margin-top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 6px; left: 6px; z-index: 10000; padding: 12px; background: var(--cream); color: var(--ink); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid var(--denim); outline-offset: 3px; }
h2[tabindex]:focus, h1[tabindex]:focus { outline: none; }
.site-header h1.site-header-title { display: block; }
.part-tab { background: none; border-top: 0; border-left: 0; border-right: 0; border-radius: 0; color: var(--espresso); }
.part-tab.active { color: var(--espresso); }
.part-tab.done { color: var(--espresso); }
.part-tab.active .tab-num { color: var(--ink); }
.part-panel { scroll-margin-top: 85px; }
.btn-primary, .gate-submit { color: var(--ink); }
.gate-title { margin-bottom: 10px; }
.gate-card { max-height: calc(100dvh - 32px); overflow: auto; }
.gate-sub { margin-bottom: 20px; }
.save-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 4px 22px; font-size: .75rem; }
.check-label { display: flex; align-items: flex-start; gap: 10px; font-size: .82rem; line-height: 1.6; cursor: pointer; }
.check-label input { width: 19px; height: 19px; flex: 0 0 19px; margin-top: 3px; accent-color: var(--denim); }
.save-status { color: var(--mid); font-size: .73rem; }
.file-tools { width: 100%; }
summary { cursor: pointer; color: var(--denim); font-weight: 600; font-size: .82rem; padding: 8px 0; }
.file-tools-inner { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 0 0; }
.file-tools-inner p { width: 100%; color: var(--mid); line-height: 1.7; }
.small { font-size: .75rem; padding: 9px 14px; }
label.btn { margin: 0; cursor: pointer; }
.text-button { color: var(--denim); background: transparent; border: 0; text-decoration: underline; font-size: .8rem; padding: 10px 0; text-align: left; cursor: pointer; }
.file-message { margin-bottom: 16px; padding: 12px 16px; background: var(--bubblegum-lt); border-radius: 10px; font-size: .82rem; }
select, input[type="month"], input[type="date"] { width: 100%; min-width: 0; padding: 10px 12px; border: 2px solid var(--border); border-radius: 10px; background: var(--white); color: var(--ink); font: inherit; font-size: .86rem; min-height: 44px; }
.month-field { max-width: 300px; }
.model-notes { margin: 10px 0 22px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.model-notes p { font-size: .82rem; line-height: 1.7; color: var(--mid); }
.field-help { font-size: .79rem; line-height: 1.7; color: var(--mid); margin: 4px 0 12px; }
.offset-field { margin-top: 22px; }
.expense-section { margin: 22px 0; }
.expense-heading { font-family: var(--font-body); font-size: .88rem; line-height: 1.5; margin-bottom: 3px; }
.expense-hint { display: block; color: var(--mid); font-size: .73rem; line-height: 1.6; margin: 0 0 10px; }
.expense-row { display: grid; grid-template-columns: minmax(0, 1fr) 116px 145px 36px; gap: 8px; margin-bottom: 12px; align-items: start; }
.expense-row input, .expense-row select { font-size: .8rem; min-height: 44px; padding: 9px 10px; }
.expense-row .input-prefix input { padding-left: 24px; }
.expense-monthly { grid-column: 1 / -1; font-size: .69rem; color: var(--mid); margin-top: -5px; }
.expense-row .del-btn { min-height: 44px; width: 36px; margin: 0; }
.row-error { grid-column: 1 / -1; color: #A32E1B; font-size: .73rem; line-height: 1.5; }
.expense-row .field-error { grid-column: 1 / -1; }
#confirm-dialog { margin: auto; width: min(520px,calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 26px; border: 2px solid var(--peach); border-radius: 18px; background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
#confirm-dialog::backdrop { background: rgba(36,24,10,.55); }
#confirm-message { font-size: .88rem; line-height: 1.7; margin-top: 16px; }
.inline-error { color: #A32E1B; font-size: .8rem; line-height: 1.6; margin: 8px 0; }
[aria-invalid="true"] { border-color: #A32E1B !important; }
.review-check { margin-top: 20px; padding: 14px; background: var(--bubblegum-lt); border-radius: 12px; }
.section-heading { margin-top: 28px; }
.target-card { padding: 22px; border: 2px solid var(--denim); border-radius: 14px; margin-top: 18px; background: var(--bubblegum-lt); }
.target-card p { font-size: .78rem; line-height: 1.7; }
.target-value { color: var(--denim); font-size: 1.8rem; font-weight: 700; font-family: var(--font-head); margin: 5px 0 10px; overflow-wrap: anywhere; }
.target-card .chip-label { color: var(--espresso); }
.chip-val, .t-val { overflow-wrap: anywhere; }
.pp-category { min-width: 0; padding: 18px; }
.pp-cat-header { display: grid; grid-template-columns: minmax(0, 1fr) auto 36px; gap: 10px; align-items: start; }
.pp-cat-name input[type="text"] { width: 100%; min-width: 0; font-size: .9rem; padding: 8px; border: 1px solid var(--border); background: var(--white); min-height: 44px; }
.pp-pct-wrap { align-items: center; flex-wrap: wrap; }
.pp-pct-input { width: 80px !important; min-height: 44px; }
.pp-dollar { min-width: 0; padding: 6px 0; font-size: 1rem; overflow-wrap: anywhere; }
.pp-remove { min-width: 36px; min-height: 44px; }
.category-bottom { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; margin-top: 12px; }
.category-bottom label { font-size: .73rem; }
.category-bottom .check-label { font-size: .73rem; align-self: end; }
.category-bottom input[type="text"] { font-size: .8rem; min-height: 44px; padding: 8px; }
input[type="range"] { height: 24px; margin: 8px 0; background: linear-gradient(var(--border),var(--border)) center / 100% 5px no-repeat; }
input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
.balance-wrap { --balance-colour: var(--green); }
.balance-wrap:has(.under) { --balance-colour: var(--peach); }
.balance-wrap:has(.over) { --balance-colour: var(--poppy); }
.balance-fill { background: var(--balance-colour); height: 100%; }
.balance-row.ok .balance-pct, .balance-row.under .balance-pct, .balance-row.over .balance-pct { color: var(--espresso); }
.balance-msg { white-space: nowrap; }
.validation-summary { padding: 18px; background: var(--tangerine-lt); border: 2px solid var(--peach); border-radius: 12px; margin-bottom: 20px; font-size: .84rem; line-height: 1.7; }
.validation-summary ul { padding-left: 20px; margin-top: 8px; }
.validation-summary a { color: var(--denim); }
.budget-list { margin: 16px 0 22px; }
.budget-line { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); padding: 10px 0; font-size: .83rem; }
.budget-line span:last-child { text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.budget-line.total { font-weight: 700; border-bottom: 2px solid var(--espresso); padding-top: 15px; }
.shortfall-text { color: #A32E1B; }
.allocation-cards { display: grid; gap: 10px; margin: 14px 0 22px; }
.allocation-card { padding: 14px; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; }
.allocation-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: .83rem; }
.allocation-card-top strong { overflow-wrap: anywhere; min-width: 0; }
.allocation-card-top span { font-weight: 700; white-space: nowrap; color: var(--denim); }
.allocation-card p { font-size: .75rem; line-height: 1.6; margin-top: 5px; overflow-wrap: anywhere; }
.action-card { padding: 18px; border: 2px dashed var(--poppy); border-radius: 14px; margin: 18px 0; background: var(--raspberry-lt); }
.action-card p { font-size: .82rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.action-card h3 { font-size: .86rem; margin-bottom: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.ps-detail-group { margin: 12px 0; }
.ps-detail-group h3 { font-size: 11px; margin-bottom: 5px; }
.ps-detail-group p { font-size: 10px; }
.ps-journal { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10px; }
.ps-state { padding: 12px; border: 2px solid var(--denim); border-radius: 8px; margin-bottom: 12px; font-weight: 700; font-size: 12px; }
.ps-notes { font-size: 10px; line-height: 1.6; margin: 14px 0; }
@media (max-width: 640px) {
  .expense-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 36px; }
  .expense-description { grid-column: 1 / -1; }
  .expense-monthly { margin-top: 0; }
  .expense-row .del-btn { grid-column: 3; }
  .pp-cat-header { grid-template-columns: minmax(0,1fr) 36px; }
  .pp-cat-name { grid-column: 1; }
  .pp-remove { grid-column: 2; grid-row: 1; }
  .pp-pct-wrap { grid-column: 1 / -1; justify-content: space-between; }
  .pp-pct-wrap .percent-pair { display: flex; align-items: center; gap: 8px; }
  .category-bottom { grid-template-columns: 1fr; }
  .balance-row { align-items: flex-start; gap: 14px; flex-wrap: wrap; }
  .balance-right { width: 100%; justify-content: space-between; }
  .profit-allocate-card { padding: 18px; }
  .profit-allocate-amount { font-size: 1.8rem; white-space: normal; overflow-wrap: anywhere; }
  .sum-tile { padding: 14px 10px; min-width: 0; }
  .sum-tile .t-val { font-size: 1.15rem; }
  .field-2 { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .part-nav { padding: 0 4px; }
  .part-tab { font-size: .63rem; padding: 14px 4px; }
  .card-title { font-size: 1.25rem; }
  .btn { font-size: .8rem; padding: 12px 18px; }
  .budget-line { font-size: .76rem; gap: 10px; }
  .gate-card { padding: 24px 18px; }
  .sum-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@media print {
  #print-summary { display: block !important; }
  .ps-body { padding: 18px 20px; }
  .ps-header { break-inside: avoid; }
  .budget-line, .allocation-card, .ps-detail-group, .action-card, .ps-state, .ps-tile { break-inside: avoid; }
  .ps-section-title { break-after: avoid; }
  .allocation-card-top { font-size: 12px; }
  .allocation-card p, .budget-line, .action-card p, .ps-notes { font-size: 11px; }
  .allocation-card { padding: 8px 10px; }
  .budget-line { padding: 5px 0; }
  .ps-footer { display: block; }
  .ps-header h1 { font-size: 20px; }
  .ps-header-inner { padding: 18px 20px; }
  .ps-row-grid, .ps-goals-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
