/* Money stuff (setup-money.js, currency-picker.js). The budget question, the small "select currency" link under
   the amount, the budget app cards, and the receipt hero that sits outside the form's card on pale blue. */
/* taste-gate: allow T12 because "select currency" is the owner's requested small underlined text control; its hit area is 44px tall and the 13px lines here are text, not controls. */
.money-step .setup-form { gap: 30px; }
.money-art { display: grid; place-items: center; overflow: hidden; }
.setup-hero .money-art { order: 1; flex: none; box-sizing: border-box; width: 96px; height: 96px; padding: 8px 12px 4px; border-radius: 12px; background: var(--wheat); }
.money-art .frank-mascot { width: 100%; height: 100%; }
#app .money-ask, .money-step legend.money-ask { margin: 0 0 12px; padding: 0; font: normal 26px/1.2 Georgia, serif; letter-spacing: -.2px; color: var(--green); }
.money-budget { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
.money-period { display: grid; grid-template-columns: 1fr 1fr; max-width: min(100%, 20em); }
.money-period .segment span { overflow-wrap: normal; word-break: normal; }
.money-amount { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 0; width: 100%; max-width: 340px; min-width: 0; box-sizing: border-box; }
.money-amount-box { box-sizing: border-box; min-width: 0; max-width: 100%; }
.money-amount-box { position: relative; display: flex; align-items: center; width: 100%; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--white); }
.money-amount-box:focus-within { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.money-symbol { flex: none; display: grid; place-items: center; min-width: 30px; padding-left: 14px; color: var(--muted); font: normal 24px/1 Georgia, serif; }
.money-symbol .coin { width: 26px; height: 26px; }
#app .money-amount-box input { flex: 1; min-width: 0; width: auto; min-height: 56px; padding: 8px 6px 8px 8px; border: 0; background: transparent; box-shadow: none; outline: none; color: var(--ink); font: normal 28px/1.1 Georgia, serif; }
/* A refused amount marks the whole box once, in brick, instead of a second box inside the first. */
#app .money-amount-box input[aria-invalid="true"] { border: 0; box-shadow: none; outline: none; }
.money-amount-box:has(input[aria-invalid="true"]) { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.money-unit { flex: none; padding-right: 14px; color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: .04em; }
#app .currency-link { min-height: 44px; margin: 0; padding: 4px 2px; border: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
#app .currency-link:hover { color: var(--red); }
#app .currency-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.money-fx { display: grid; gap: 6px; margin: 0; max-width: 60ch; padding: 10px 12px; border-left: 4px solid var(--wheat-line); background: var(--wheat); color: var(--ink); font-size: 15px; line-height: 1.45; }
.money-fx[hidden] { display: none; }
#app .money-legacy { display: grid; gap: 6px; max-width: 340px; margin: 0; font-weight: 700; }
.money-flex { max-width: 420px; }
.money-apps { display: grid; gap: 4px; min-width: 0; }
.money-app-groups { display: grid; gap: 18px; }
/* Text enlargement needs room for the app name and action as well as the mark. */
.money-apps .shop-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 20em), 1fr)); }
.app-card .app-mark { width: 76px; height: 44px; }
.app-card .app-mark img { max-height: 40px; max-width: 76px; width: auto; height: auto; border-radius: 8px; }
.app-card[data-app="lunch_money"] .app-mark img { width: 32px; height: 32px; image-rendering: auto; }
.connect-mark .app-mark img { border-radius: 8px; max-height: 40px; }
.connect-field { display: grid; gap: 6px; font-weight: 700; }
.connect-field input { min-height: 44px; box-sizing: border-box; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--white); color: var(--ink); font: inherit; font-size: 16px; }
.connect-categories { display: grid; gap: 14px; }
.connect-category-group { margin: 0; padding: 0; border: 0; display: grid; gap: 2px; }
.connect-category-group legend { padding: 0; margin: 0 0 4px; font-weight: 700; }
.connect-check { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: 0; cursor: pointer; }
.connect-dialog .connect-check input { flex: none; width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--green); }

/* The receipt hero: its own band, never a card inside the form's card. Art left on desktop, above on a phone. */
.receipt-hero { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); align-items: center; gap: 28px; margin: 28px 0 0; padding: 30px 32px; border-radius: var(--panel-radius); background: var(--blue); color: var(--ink); }
.receipt-hero-visual { display: grid; place-items: center; }
.receipt-hero-art { width: 100%; max-width: 190px; height: auto; }
.receipt-hero-copy { display: grid; gap: 12px; min-width: 0; }
#app .receipt-hero h2 { margin: 0; font: normal clamp(28px, 3.6vw, 38px)/1.1 Georgia, serif; letter-spacing: -.4px; color: var(--green); text-wrap: balance; }
.receipt-hero p { margin: 0; max-width: 54ch; font-size: 17px; line-height: 1.5; }
.receipt-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 4px; }
#app .receipt-hero-cta, #app .receipt-hero-link { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; box-sizing: border-box; padding: 10px 22px; border-radius: var(--button-radius); font-weight: 700; font-size: 17px; text-decoration: none; }
#app .receipt-hero-cta { background: var(--green); color: #fff; }
#app .receipt-hero-cta:hover { background: var(--green-hover); }
#app .receipt-hero-link { border: 1px solid var(--line); background: var(--white); color: var(--ink); }
#app .receipt-hero-cta:focus-visible, #app .receipt-hero-link:focus-visible, #app .receipt-hero-other:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
#app .provider-button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 18px; background: var(--white); }
.provider-mark { display: grid; place-items: center; width: 20px; height: 20px; }
.provider-mark svg { width: 20px; height: 20px; }
#app .receipt-hero-other { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 15px; }
.receipt-hero-problem { flex-basis: 100%; color: var(--red); font-weight: 600; }
.receipt-hero-problem[hidden] { display: none; }
.receipt-hero-off { color: var(--muted); }
.receipt-linked { display: grid; gap: 8px; flex-basis: 100%; margin: 0; padding: 0; list-style: none; }
.receipt-linked li { display: flex; align-items: center; gap: 12px; }
.receipt-linked li > span:last-child { display: grid; }
.receipt-linked small { color: var(--muted); font-size: 14px; }
.receipt-linked-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--white); }
.receipt-linked-mark svg { width: 20px; height: 20px; }
.setup-actions-after { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Currency picker */
dialog.currency-dialog { width: min(440px, calc(100% - 24px)); }
.currency-search { display: grid; gap: 6px; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.currency-search label { font-weight: 700; font-size: 14px; }
.currency-search input { min-height: 44px; box-sizing: border-box; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--white); color: var(--ink); font: inherit; font-size: 16px; }
.currency-search input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.currency-list { overflow: auto; overscroll-behavior: contain; padding: 6px 8px 12px; min-height: 120px; }
.currency-group-title { margin: 12px 10px 4px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.currency-option { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-radius: var(--button-radius); background: transparent; color: var(--ink); font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.currency-option:hover { background: var(--sage); }
.currency-option:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; background: var(--sage); }
.currency-option[aria-selected="true"] { background: var(--sage); box-shadow: inset 3px 0 0 var(--green); font-weight: 700; }
.currency-symbol { justify-self: center; color: var(--muted); font: normal 17px/1 Georgia, serif; }
.currency-option .coin { width: 26px; height: 26px; justify-self: center; }
.currency-code { color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.currency-none { margin: 18px 10px; color: var(--muted); }

@media (max-width: 700px) {
  .receipt-hero { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-left: -16px; margin-right: -16px; padding: 24px 16px; border-radius: 0; }
  .receipt-hero-visual { justify-self: start; }
  .receipt-hero-art { max-width: 124px; }
  .receipt-hero-actions > .receipt-hero-cta, .receipt-hero-actions > .provider-button { flex: 1 1 100%; }
  .setup-hero .money-art { width: 80px; height: 80px; }
}
/* The store cards narrow their mark column to 64px on small phones; the budget marks follow, so a wide wordmark never runs under the name. */
@media (max-width: 420px) {
  .app-card .app-mark { width: 64px; }
  .app-card .app-mark img { max-width: 64px; }
}
@media (max-width: 560px) { dialog.currency-dialog { width: 100%; } }
@media (forced-colors: active) {
  .currency-option[aria-selected="true"] { outline: 2px solid Highlight; }
  .receipt-hero, .money-fx { border: 1px solid CanvasText; }
}

/* The explicit source choice is a full-size native radio row, including on phones. */
.money-source-choice { min-width: 0; }
.money-source-choice .connect-check { padding: 8px 0; }
.money-source-choice input[type=radio] { flex: none; width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--green); }
.money-source-choice .connect-check span { min-width: 0; overflow-wrap: anywhere; }
.money-source-choice .connect-check:has(:checked) { font-weight: 700; }
.money-source-choice .connect-check:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

.money-source-choice .connect-problem:empty { display: none; }

/* The saved plan's allowance is a short ruled note alongside the colourful meal pages. */
.saved-allowance { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 0 0 20px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
#app .saved-allowance h2 { flex-basis: 100%; margin: 0; font: normal 20px/1.25 Georgia, serif; color: var(--green); }
.saved-allowance p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.saved-allowance .allowance-coverage { flex-basis: 100%; color: var(--muted); }
.saved-allowance a { display: inline-flex; align-items: center; min-height: 44px; color: var(--green); }

dialog.connect-dialog:has(.ynab-approval-guide) { width: min(900px, calc(100% - 24px)); max-width: 900px; }
.ynab-approval-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.ynab-approval-guide { min-width: 0; margin: 0; }
.ynab-approval-screen { padding: 16px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--white); color: #19233e; font-size: 14px; }
.ynab-approval-title { display: block; font-size: 22px; }
.ynab-approval-screen dt { margin-top: 14px; font-weight: 700; }
.ynab-approval-screen dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.ynab-approval-plan { padding: 8px; border: 1px solid var(--line); border-radius: 4px; }
.ynab-approval-authorize { display: inline-block; margin-top: 18px; padding: 8px 12px; border-radius: 6px; background: #3e59df; color: #fff; }
.ynab-approval-guide figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.45; }
@media (max-width: 700px) { .ynab-approval-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; } }
@media (max-width: 560px) { dialog.connect-dialog:has(.ynab-approval-guide) { width: 100%; } }
@media (forced-colors: active) { .ynab-approval-authorize { border: 1px solid CanvasText; } }
