/* Requests, records, templates and the recipient page: small additions on top of Tabler + tokens.css. App-shell styling lives in app.css. */

.swap-prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.swap-break { overflow-wrap: anywhere; word-break: break-word; }
.min-w-0 { min-width: 0; }

/* Dashboard */
.swap-stat { text-decoration: none; color: inherit; display: block; }
.swap-stat .swap-stat-num { font-size: 1.75rem; font-weight: 700; line-height: 1.1; color: var(--swap-navy-900); }
.swap-stat .swap-stat-label { color: var(--swap-slate-600); font-size: 0.875rem; font-weight: 600; overflow-wrap: normal; }
@media (max-width: 399.98px) { .swap-stat .card-body { padding-left: 0.625rem !important; padding-right: 0.5rem !important; } .swap-stat .swap-stat-label { font-size: 0.8125rem; } }
.swap-stat:hover .card, .swap-stat:focus-visible .card { border-color: var(--swap-gold-400); box-shadow: var(--swap-shadow); }
.swap-request-row { padding-top: 0.875rem; padding-bottom: 0.875rem; }

/* Choosing a request type */
.swap-choice { text-decoration: none; color: inherit; height: 100%; }
.swap-choice:hover, .swap-choice:focus-visible { border-color: var(--swap-gold-400); box-shadow: var(--swap-shadow); }

/* Copyable link */
.swap-link-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; }

/* Repeatable rows (question builder, links) */
.swap-row { border: 1px solid var(--tblr-border-color, #e6e7e9); border-radius: 0.5rem; padding: 0.75rem; margin-bottom: 0.75rem; background: var(--swap-white); }
.swap-row[hidden] { display: none; }
.js-only[hidden] { display: none !important; }
.swap-row-tools .btn { min-width: 44px; min-height: 44px; }

/* Current vs Proposed */
.swap-compare { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 576px) { .swap-compare { grid-template-columns: 1fr 1fr; } }
.swap-compare-col { border: 1px solid var(--tblr-border-color, #e6e7e9); border-radius: 0.5rem; padding: 0.875rem; background: var(--swap-white); }
.swap-compare-col h3, .swap-compare-col .swap-compare-label { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--swap-slate-600); margin-bottom: 0.375rem; }
.swap-compare-col.is-proposed { border-color: var(--swap-navy-900); box-shadow: inset 4px 0 0 var(--swap-gold-400); }

/* Recipient page */
.swap-biz { color: var(--swap-navy-900); font-weight: 700; font-size: 1.5rem; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.swap-biz-eyebrow { color: var(--swap-slate-600); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 0.25rem; }
.swap-recipient .container-tight { max-width: 32rem; }
.swap-decisions .btn { min-height: 52px; font-size: 1.0625rem; }
.swap-recipient .form-control, .swap-recipient .form-select { min-height: 44px; font-size: 1rem; }
.swap-recipient .form-check-input { width: 1.5rem; height: 1.5rem; margin-top: 0; }
.swap-recipient .swap-check-row { display: flex; gap: 0.75rem; align-items: flex-start; min-height: 44px; }
.swap-footer { color: var(--swap-slate-600); font-size: 0.8125rem; text-align: center; padding: 1rem 0 1.5rem; }
.swap-done-mark { width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--swap-green-700); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.75rem; margin-bottom: 0.75rem; }
.swap-ref-img { max-width: 100%; height: auto; border-radius: 0.375rem; border: 1px solid var(--tblr-border-color, #e6e7e9); display: block; margin-top: 0.375rem; }

/* Timeline */
.swap-timeline { list-style: none; margin: 0; padding: 0; }
.swap-timeline li { position: relative; padding: 0 0 1rem 1.25rem; border-left: 2px solid var(--tblr-border-color, #e6e7e9); margin-left: 0.4rem; }
.swap-timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.swap-timeline li::before { content: ''; position: absolute; left: -0.4rem; top: 0.3rem; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--swap-navy-900); box-shadow: 0 0 0 3px var(--swap-ivory-50); }

/* Requests list: draft rows (select + delete) */
.swap-request-row-wrap { padding: 0; }
.swap-row-flex { display: flex; align-items: stretch; }
.swap-row-link { flex: 1 1 auto; min-width: 0; display: block; padding: 0.875rem 1rem; color: var(--swap-navy-900); text-decoration: none; }
.swap-row-link:hover, .swap-row-link:focus-visible { background: var(--swap-ivory-50); color: var(--swap-navy-900); }
/* A11Y-1: Home's "Records due" and "Waiting more than 3 days" rows became row links (a named link inside each list item) but keep the
   size they had as list rows: the list item padding, which lines the text up with the card title, and the 44px minimum. */
.swap-row-link--list { padding: 1rem 1.25rem; min-height: 44px; }
.swap-pick { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 44px; min-height: 44px; padding-left: 0.5rem; margin: 0; cursor: pointer; }
.swap-pick[hidden] { display: none; }
.swap-pick .form-check-input { width: 1.25rem; height: 1.25rem; margin: 0; }
.swap-row-actions, .swap-recorddraft { display: flex; justify-content: flex-end; padding: 0 1rem 0.75rem; }
.swap-pick-spacer { flex: 0 0 44px; }
.swap-draft-delete .btn, .swap-bulk .btn { min-height: 44px; min-width: 44px; }
.swap-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; padding: 0.25rem 1rem; border-bottom: 1px solid var(--tblr-border-color, #e6e7e9); }
.swap-bulk[hidden] { display: none; }
.swap-bulk-label { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; margin: 0; padding-left: 0; cursor: pointer; }
.swap-bulk-label .form-check-input { width: 1.25rem; height: 1.25rem; margin: 0; }
.swap-bulk .btn[hidden] { display: none; }
.swap-bulk-right { margin-left: auto; }

@media (max-width: 575.98px) {
  .swap-bulk-right { margin-left: 0; width: 100%; padding-bottom: 0.5rem; }
  .swap-bulk-right .btn { width: 100%; }
  /* A long recipient address in "Send to ..." wraps instead of pushing the button past the card. */
  .swap-actions .btn { width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .swap-actions form { width: 100%; }
}

/* Photos or files (REQ-UPLOAD) and files the business shows (REQ-SHARE) */
.swap-files { border: 1px solid var(--swap-border); border-radius: var(--swap-radius); padding: 0.875rem; background: var(--swap-white); }
.swap-file-list { margin: 0; padding: 0; }
.swap-file { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; justify-content: space-between; padding: 0.5rem 0; border-top: 1px solid var(--swap-border); }
.swap-file:first-child { border-top: 0; }
.swap-file-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; min-width: 0; flex: 1 1 12rem; }
.swap-file-name { font-weight: 600; min-width: 0; }
.swap-file-state { font-size: 0.875rem; font-weight: 600; }
.swap-file.is-refused .swap-file-name { text-decoration: line-through; }
.swap-file-progress { width: 100%; }
.swap-file-remove, .swap-shared-open { min-height: 44px; min-width: 44px; }
.swap-file-add { position: relative; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; }
.swap-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.swap-file-add:focus-within { outline: 3px solid var(--swap-focus); outline-offset: 2px; }
.swap-file-add[hidden] { display: none; }
.swap-shared-file { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; padding: 0.375rem 0; }
.swap-file-from { font-size: 0.8125rem; }
@media (prefers-reduced-motion: reduce) { .swap-file-progress { transition: none; } }

/* "Files to show" picker on the business form (S7): one file per row, 44 px targets. */
.swap-pick-row { display: flex; gap: 0.75rem; align-items: center; min-height: 44px; padding: 0.25rem 0; cursor: pointer; }
.swap-pick-row .form-check-input { width: 1.5rem; height: 1.5rem; margin: 0; }

/* OPTIONS-PHOTOS (D-071): the customer's option cards, the sender's option rows. */
.swap-compare.is-single { grid-template-columns: 1fr; }
.swap-options { border: 0; padding: 0; margin: 0; min-width: 0; }
.swap-options-legend { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--swap-slate-600); margin: 0 0 0.5rem; padding: 0; float: none; width: auto; }
.swap-options-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .swap-options-grid { grid-template-columns: 1fr 1fr; } }
.swap-option-card { position: relative; display: flex; flex-direction: column; border: 2px solid var(--tblr-border-color, #d5d9de); border-radius: 0.75rem; background: var(--swap-white); cursor: pointer; overflow: hidden; min-height: 64px; margin: 0; }
.swap-option-card:hover { border-color: var(--swap-slate-600); }
.swap-option-card:has(.swap-option-radio:checked) { border-color: var(--swap-navy-900); box-shadow: 0 0 0 2px var(--swap-gold-400); }
.swap-option-card:has(.swap-option-radio:focus-visible) { outline: 3px solid var(--swap-navy-900); outline-offset: 2px; }
.swap-option-radio { position: absolute; top: 0.75rem; left: 0.75rem; width: 1.5rem; height: 1.5rem; margin: 0; z-index: 1; accent-color: var(--swap-navy-900); background: var(--swap-white); }
.swap-option-photo { display: block; aspect-ratio: 4 / 3; background: var(--swap-slate-100, #eef0f3); }
.swap-option-photo img { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--swap-slate-100, #eef0f3); }
.swap-option-photo.is-gone { display: flex; align-items: center; justify-content: center; }
.swap-option-gone { color: var(--swap-slate-600); font-size: 0.9375rem; padding: 0.5rem; text-align: center; }
.swap-option-body { display: flex; flex-direction: column; gap: 0.125rem; padding: 0.875rem 0.875rem 0.875rem 3rem; }
.swap-option-card:has(.swap-option-photo) .swap-option-body { padding-left: 0.875rem; }
.swap-option-label { font-size: 1.0625rem; font-weight: 600; }
.swap-option-price { color: var(--swap-slate-600); font-size: 0.9375rem; }
.swap-option-card.is-none { justify-content: center; border-style: dashed; }
.swap-option-row { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-top: 1px solid var(--tblr-border-color, #e6e7e9); }
.swap-option-num { flex: 0 0 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--swap-navy-900); color: #fff; font-weight: 700; font-size: 0.875rem; display: flex; align-items: center; justify-content: center; margin-top: 1.9rem; }
.swap-option-fields { flex: 1 1 auto; min-width: 0; }
.swap-option-summary { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.swap-option-summary li { display: flex; gap: 0.75rem; align-items: center; }
.swap-option-summary img { width: 72px; height: 54px; object-fit: cover; border-radius: 0.375rem; border: 1px solid var(--tblr-border-color, #e6e7e9); flex: 0 0 auto; }
.swap-option-summary .is-chosen { font-weight: 700; }
@media (prefers-reduced-motion: no-preference) { .swap-option-card { transition: border-color 0.12s ease, box-shadow 0.12s ease; } }

/* Batch Ready: a button that names a long template wraps instead of being cut off. */
.swap-btn-wrap { white-space: normal; overflow-wrap: anywhere; text-align: center; }
/* FAIR-ASK (D-078): the "Fair ask check" card on a draft. A mark and words, never colour alone. */
.swap-fair-item { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem 0; border-top: 1px solid var(--tblr-border-color, #e6e7e9); }
.swap-fair-item:first-child { border-top: 0; }
.swap-fair-mark { flex: 0 0 1.5rem; text-align: center; font-weight: 700; line-height: 1.5; }
.swap-fair-item.is-ok .swap-fair-mark { color: #2b7a3d; }
.swap-fair-text { min-width: 0; overflow-wrap: anywhere; }
.swap-fair-edit { display: inline-block; margin-top: .25rem; min-width: 44px; min-height: 44px; line-height: 44px; font-weight: 600; }

/* QR-APPROVE (D-080): the "QR code" action beside the other waiting-request actions. */
.swap-actions .btn { min-height: 44px; }
/* UX-1: the draft's own row only (show.ejs). A long email in "Send to <email>" wraps inside its button and the row wraps, so no width
   can push the page sideways. Every other .swap-actions row (the reply and waiting actions, the builder, the AI card, edit forms) keeps
   its layout: wrapping them all moved "Cancel request" under the reply buttons on an iPad. */
.swap-actions--wrap { flex-wrap: wrap; }
.swap-actions--wrap form { max-width: 100%; }
.swap-actions--wrap .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.swap-qr-action { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.swap-qr-icon { flex: none; }

/* P2-1: "Show only when..." in the question builder, and the hint under a conditional question when JavaScript is off. */
.swap-cond { border-top: 1px dashed var(--swap-border, #e6e7e9); padding-top: 0.625rem; }
.swap-cond .form-select { min-height: 44px; }
.swap-cond-hint { font-style: italic; }
/* A customer page whose questions appear and disappear starts at the top instead of being centred on a tall screen (iPad, desktop):
   centring would move the whole page, and the tick box under the finger, by half of every question that appears or goes. */
.swap-recipient > .page-center:has([data-show-if]) { justify-content: flex-start; }

/* Draft with AI card (new-request page) */
.swap-ai-card { border-color: var(--swap-navy-900); box-shadow: inset 4px 0 0 var(--swap-gold-400); }
.swap-ai-card textarea { min-height: 7rem; }
/* POLISH-6: a shorter card on phones. Below 576 px the box shows three lines instead of four and the card has less padding; the privacy
   line stays in view (its second sentence shows from 576 px). 576 px and up are unchanged. */
@media (max-width: 575.98px) {
  .swap-ai-card .card-body { padding: 1rem; }
  /* More specific than `.page-body textarea.form-control` (app.css, min-height 6rem), which would otherwise keep the box at four lines. */
  .swap-ai-card .card-body textarea.form-control { min-height: 0; height: 5rem; }
}
.swap-ai-card .btn { min-height: 44px; }

/* The Change builder's options card is a disclosure: closed until the person asks for options (UX-2, finding 14). */
.swap-options-summary { display: list-item; list-style-position: inside; min-height: 44px; padding: 0.75rem 1rem; cursor: pointer; color: var(--tblr-body-color, inherit); }
.swap-options-card[open] > .swap-options-summary { border-bottom: 1px solid var(--tblr-border-color, #e6e7e9); }
/* Closed, the summary is the whole card: Tabler's card-header keeps a square bottom border, which showed as a line poking out past the
   card's rounded corners. Drop it and round the summary like the card. */
.swap-options-card:not([open]) > .swap-options-summary { border-bottom: 0; border-radius: inherit; }
.swap-options-summary:focus-visible { outline: 2px solid var(--swap-navy-900, #1d273b); outline-offset: -2px; }

/* POLISH-7: the "can send a reminder after ..." reason follows the greyed button directly on a phone and wraps below the row from 576 px up. */
@media (min-width: 576px) { .swap-actions--hint { flex-wrap: wrap; } .swap-actions--hint .swap-remind-wait { order: 1; flex: 0 0 100%; } }
/* POLISH-7: "Question 1" never wraps, and it shares one row with its tools from 320 px up. The tools are 44 px targets and never shrink.
   From 360 px up the row is exactly as before. Below 360 px the card's side padding, the gaps and Remove's side padding are smaller, so
   the row fits a 320 px phone with room to spare. If a larger text size still leaves too little room, the tools move under "Question 1"
   instead of spilling out of the card (review of POLISH-7: at 320 px Remove used to stick out past the card's right edge). */
.swap-row-head { flex-wrap: wrap; gap: 0.25rem 0.5rem; }
.swap-row-head > strong { white-space: nowrap; }
.swap-row-head .swap-row-tools { flex-shrink: 0; flex-wrap: nowrap; margin-left: auto; }
@media (max-width: 359.98px) {
  .swap-row { padding-left: 0.5rem; padding-right: 0.5rem; }
  .swap-row-head { column-gap: 0.25rem; }
  .swap-row-head .swap-row-tools { gap: 0.25rem; }
  .swap-row-head .swap-row-tools [data-row-remove] { padding-left: 0.5rem; padding-right: 0.5rem; }
}
