#bankMailForm { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
#bankMailForm label { min-width: 0; flex: 1 1 260px; margin: 0; }
#bankMailFile { width: 100%; min-width: 0; }
#accountingPage { min-width: 0; }
.bank-gmail { max-width: 720px; min-width: 0; }
.bank-gmail form { display: grid; gap: 14px; margin-bottom: 20px; }
.bank-gmail label { display: grid; gap: 6px; min-width: 0; }
.bank-gmail input { width: 100%; min-width: 0; }
.bank-gmail p { overflow-wrap: anywhere; }
.bank-gmail .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bank-mail-preview { padding: 16px 0; border-block: 1px solid var(--line); margin: 16px 0; }
.bank-mail-preview dl { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 10px 16px; }
.bank-mail-preview dt { color: var(--muted); }
.bank-mail-preview dd { margin: 0; }
.bank-mail-preview pre { white-space: pre-wrap; max-height: 360px; overflow: auto; font: inherit; }
.bank-mail-preview *, .bank-source { overflow-wrap: anywhere; }
.bank-import-status { font-weight: 700; }
.bank-source { border-bottom: 1px solid var(--line); padding: 16px 0; }
#accountingPage summary { padding: 12px 0; cursor: pointer; }
#bankImport { margin-bottom: 12px; }
.bank-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.bank-tabs [aria-pressed=true] { background: var(--accent, #087f78); color: white; }
.bank-query { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) minmax(180px,2fr) auto; gap: 12px; align-items: end; }
.bank-query label { min-width: 0; margin: 0; }
#bankLedgerPanel { min-width:0; max-width:100%; }
.bank-query input, .bank-query select { min-width:0; width:100%; max-width:100%; }
.bank-query label { display:flex; flex-direction:column; justify-content:flex-end; }
.bank-ledger-message, .bank-ledger-totals { overflow-wrap:anywhere; }
.bank-ledger-list { overflow-x: auto; }
.bank-ledger-table { width: 100%; min-width: 980px; table-layout: fixed; border-collapse: collapse; }
.bank-ledger-table th, .bank-ledger-table td { padding: 12px 10px; text-align: left; vertical-align: top; white-space: normal; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.bank-ledger-table th { background: #e9f1f0; font-size: 13px; }
.bank-ledger-table td { background: white; font-size: 14px; }
.bank-ledger-table small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.bank-ledger-table .bank-col-date { width: 13%; }
.bank-ledger-table .bank-col-party { width: 19%; }
.bank-ledger-table .bank-col-bank { width: 17%; }
.bank-ledger-table .bank-col-money { width: 14%; text-align: right; font-variant-numeric: tabular-nums; }
.bank-ledger-table .bank-col-reference { width: 20%; user-select: text; }
.bank-ledger-table .bank-col-status { width: 9%; }
.bank-ledger-table .bank-col-action { width: 8%; }
.bank-ledger-table .bank-party-link { border: 0; background: transparent; padding: 0; color: var(--accent, #087f78); text-align: left; white-space: normal; overflow-wrap: anywhere; font: inherit; font-weight: 600; max-width: 100%; }
.bank-ledger-table .bank-party-link:hover { text-decoration: underline; }
.bank-ledger-table .bank-state { color: #80591d; font-weight: 600; }
.bank-ledger-table [data-status=confirmed] .bank-state { color: #19804c; }
.bank-ledger-table .bank-conflict { color: #b42318; }
.bank-history { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #d4e1e0; min-width: 0; overflow-wrap: anywhere; }
.bank-history .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bank-history button { max-width: 100%; white-space: normal; }
.bank-sync [hidden] { display: none !important; }
.bank-sync-top, .sync-task, .sync-results-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bank-sync-top { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sync-state { display: inline-block; margin-left: 12px; color: var(--muted); font-size: 13px; }
.bank-sync .sync-range, .bank-sync .sync-updated { color: var(--muted); font-size: 13px; margin: 8px 0; }
.sync-task { margin: 20px 0 12px; }
.bank-sync h3 { margin: 0; font-size: 18px; }
.sync-progress { display: block; width: 100%; height: 10px; accent-color: var(--accent, #087f78); }
.sync-progress-text { font-size: 13px; }
.sync-metrics { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); padding: 16px 0; margin: 16px 0; border-block: 1px solid var(--line); gap: 16px; }
.sync-metrics dt { color: var(--muted); font-size: 13px; }
.sync-metrics dd { margin: 6px 0 0; font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sync-settings { margin: 16px 0; border-bottom: 1px solid var(--line); }
.sync-settings > summary { font-size: 14px; }
.sync-settings .bank-auto-history { padding-bottom: 12px; }
.sync-results-heading { margin-top: 20px; }
.sync-results-heading label { display: flex; align-items: center; gap: 8px; margin: 0; }
.sync-results-heading select { width: auto; min-width: 136px; }
.sync-links { display: flex; flex-wrap: wrap; gap: 20px; }
.history-results > details { border-bottom: 1px solid var(--line); }
.sync-record-id { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.sync-empty { padding: 24px 0; color: var(--muted); }
.history-message:empty, .sync-progress-text:empty { display: none; }
@media(max-width:600px) {
  .sync-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sync-task { align-items: flex-start; }
  .sync-task .actions { width: 100%; }
  .sync-task .actions button { flex: 1; }
}
.bank-auto-history label { display: flex; align-items: flex-start; gap: 8px; }
.bank-auto-history input { width: 18px; height: 18px; flex: 0 0 18px; }
.bank-review-body { padding: 16px; overflow-wrap: anywhere; }
.bank-batch-dialog { width: min(960px,calc(100vw - 24px)); }
.bank-batch-open { margin: 12px 0; }
.batch-table-wrap { overflow-x: auto; margin-top: 16px; }
.batch-table-wrap table { width: 100%; min-width: 620px; border-collapse: collapse; }
.batch-table-wrap th,.batch-table-wrap td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; white-space: normal; text-overflow: clip; max-width: none; }
.bank-review-body .batch-warning { display: flex; align-items: flex-start; gap: 8px; color: #9a3412; }
.batch-warning input { flex: 0 0 18px; width: 18px; height: 18px; }
.bank-review-dialog[open] { display: flex; flex-direction: column; max-height: 90dvh; overflow: hidden; }
.bank-review-dialog > header { flex: 0 0 auto; }
.bank-review-dialog .bank-review-body { overflow-y: auto; min-height: 0; }
.bank-review-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 16px; background: white; border-top: 1px solid var(--line); flex: 0 0 auto; }
.bank-review-footer [hidden] { display: none; }
.bank-review-body .identity { font-weight: 700; margin-top: 0; }
.bank-notice-time, .bank-review-body .confirmation { font-size: 13px; color: var(--muted); margin: 8px 0; }
.bank-matching .party-results { display: grid; max-height: 220px; overflow-y: auto; }
.bank-matching .party-results button { text-align: left; min-height: 44px; }
.match-message:empty, .review-message:empty { display: none; }
.bank-identity-details { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr); gap: 8px 16px; margin: 16px 0; }
.bank-identity-details dt { color: var(--muted); }
.bank-identity-details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; user-select: text; }
.bank-review-body form { display: grid; gap: 12px; }
.bank-review-body label { display: grid; gap: 6px; }
.bank-matching { display: grid; gap: 10px; min-width: 0; }
.bank-matching .bank-remember { display: flex; align-items: flex-start; gap: 8px; }
.bank-remember input { width: 18px; height: 18px; flex: 0 0 18px; margin: 3px 0 0; }
.party-results, .rule-suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.rule-suggestions p { flex-basis: 100%; margin: 0; }
.party-results button, .rule-suggestions button { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.bank-review-body [hidden] { display: none; }
.bank-review-body summary { padding: 12px 0; cursor: pointer; }
@media(max-width:900px) { .bank-query { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:600px) {
  .bank-identity-details { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .bank-identity-details dd { margin-bottom: 8px; }
  .bank-ledger-table { min-width: 0; }
  .bank-ledger-table .bank-col-bank, .bank-ledger-table .bank-col-reference, .bank-ledger-table .bank-col-action { display: none; }
  .bank-ledger-table .bank-col-date { width: 25%; }
  .bank-ledger-table .bank-col-party { width: 29%; }
  .bank-ledger-table .bank-col-money { width: 27%; }
  .bank-ledger-table .bank-col-status { width: 19%; }
  .bank-ledger-table th, .bank-ledger-table td { padding: 10px 4px; font-size: 12px; }
  .bank-mail-preview dl { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .bank-mail-preview dd { margin-bottom: 12px; }
  #accountingPage button { min-height: 44px; }
}
.batch-table-wrap input[type="checkbox"] {width:18px;height:18px;margin:4px;cursor:pointer;}
.batch-table-wrap th:first-child,.batch-table-wrap td:first-child {width:44px;min-width:44px;}
.bank-link-actions {display:flex;flex-wrap:wrap;gap:8px;}
.bank-link-actions .bank-batch-open {margin:0;}
.bank-batch-inline {min-width:0;border-top:1px solid var(--line);margin-top:16px;}
.bank-batch-inline > header {position:static;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;}
.bank-review-dialog:has(.bank-batch-inline) {width:min(960px,calc(100vw - 24px));}
.bank-review-dialog:has(.bank-batch-inline) > .bank-review-footer {display:none;}
.bank-batch-inline h2 {font-size:16px;}
.bank-batch-inline .bank-review-body {padding:0;overflow:visible;}
.bank-batch-inline .bank-review-footer {padding:12px 0;position:sticky;bottom:0;z-index:1;}
.bank-matching .party-custom {text-align:left;white-space:normal;overflow-wrap:anywhere;}
.bank-discard {padding:12px 16px;background:#fff4e5;flex:0 0 auto;}
.bank-discard button {margin:4px;}
.bank-dirty {flex-basis:100%;margin:0;color:#9a3412;font-size:13px;}
.bank-dirty:empty,.bank-result:empty {display:none;}
.bank-result {padding:10px 0;color:#00695c;overflow-wrap:anywhere;}
.bank-recommend-settings .bank-remember {display:flex;align-items:flex-start;gap:8px;}
.batch-current {display:block;color:#00695c;}
.batch-table-wrap {max-height:360px;overflow:auto;}
.batch-table-wrap thead th {position:sticky;top:0;background:#edf7f6;z-index:1;}
.batch-single-summary {font-weight:600;overflow-wrap:anywhere;}

/* Shared receipt/payment presentation; review and selection rules stay unchanged. */
.bank-ledger-message { color:var(--muted); font-size:13px; margin:10px 0; }
.bank-ledger-totals { padding:12px 0; margin:0 0 12px; border-bottom:1px solid var(--line); font-variant-numeric:tabular-nums; }
.bank-ledger-list { border:1px solid var(--line); border-radius:6px; }
.bank-ledger-table .bank-col-date { font-variant-numeric:tabular-nums; }
.bank-ledger-table .bank-company-label { color:var(--ink, #183332); line-height:1.5; }
.bank-ledger-table .bank-money { font-weight:600; overflow-wrap:normal; word-break:normal; }
.bank-ledger-table tbody tr:hover td { background:#f5faf9; }
.bank-ledger-table .bank-state { display:inline-block; padding:3px 6px; border-radius:4px; background:#fff3d8; font-size:12px; line-height:1.5; }
.bank-ledger-table [data-status=confirmed] .bank-state { background:#e5f4eb; }
.bank-ledger-table .bank-col-action button { min-height:44px; }
@media screen and (min-width:601px) {
  .bank-ledger-table .bank-col-action { position:sticky; right:0; z-index:1; box-shadow:-1px 0 var(--line); }
  .bank-ledger-table th.bank-col-action { z-index:2; }
  .bank-ledger-table .bank-col-bank { width:21%; }
  .bank-ledger-table .bank-col-reference { width:16%; }
  .bank-ledger-table .bank-col-bank small { overflow-wrap:break-word; word-break:normal; }
}
.bank-review-body .identity { display:grid; gap:8px; padding-bottom:12px; margin-bottom:10px; border-bottom:1px solid var(--line); }
.bank-review-amount { font-size:24px; line-height:1.3; font-variant-numeric:tabular-nums; }
.bank-review-body .identity > span { font-size:14px; font-weight:500; }
.bank-review-body .confirmation { padding:6px 10px; border-left:3px solid #ba861b; background:#fff8e9; color:#785617; line-height:1.6; }
.bank-review-body .confirmation[data-status=confirmed] { border-color:#26814b; background:#edf7f0; color:#24613a; }
.bank-company-summary { font-size:14px; line-height:1.6; margin:12px 0; }
.bank-review-body form input:not([type=checkbox]), .bank-review-body form select, .bank-review-body form textarea { width:100%; min-width:0; max-width:100%; }
.bank-review-body > details { border-top:1px solid var(--line); margin-top:12px; }
.bank-review-body > details > summary { font-size:14px; font-weight:600; }
.bank-review-footer button, .bank-link-actions button { min-height:44px; }
.bank-link-actions { padding:4px 0 12px; border-bottom:1px solid var(--line); }
.bank-review-dialog button:focus-visible, #bankLedgerPanel button:focus-visible, .batch-table-wrap input:focus-visible { outline:2px solid #087f78; outline-offset:3px; }
.batch-target { font-weight:600; line-height:1.6; margin:8px 0; }
.batch-count { color:var(--muted); font-size:13px; line-height:1.6; }
.batch-selection-count { font-weight:600; font-variant-numeric:tabular-nums; padding:8px 0; margin:8px 0; border-block:1px solid var(--line); }
.batch-table-wrap { border:1px solid var(--line); border-radius:6px; }
.batch-table-wrap tr.is-selected td { background:#e7f5f2; }
.batch-table-wrap tr.is-selected td:first-child { box-shadow:inset 3px 0 #087f78; }
.batch-table-wrap tr.is-protected td { background:#f3f4f5; color:#56616b; }
.batch-table-wrap .batch-money { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.batch-table-wrap th:nth-child(4) { text-align:right; }
.batch-table-wrap input:disabled { cursor:not-allowed; }
.bank-review-body .batch-warning { padding:10px; background:#fff5e9; border-radius:4px; font-size:14px; line-height:1.6; }
@media(max-width:600px) {
  .bank-review-dialog[open] { max-height:calc(100dvh - 16px); }
  .bank-review-dialog .bank-review-body { padding:12px; }
  .bank-review-dialog .bank-batch-inline .bank-review-body { padding:0; }
  .bank-review-footer { padding:10px 12px; padding-bottom:max(10px,env(safe-area-inset-bottom)); }
  .bank-review-footer > button { flex:1 1 auto; }
  .bank-review-amount { font-size:22px; }
  .bank-ledger-table .bank-col-money { width:28%; }
  .bank-ledger-table .bank-col-party { width:28%; }
  .bank-ledger-table .bank-state { padding:2px 4px; font-size:11px; }
}
.bank-auto-sync { border-top: 1px solid #d2dfe0; margin-top: 24px; padding-top: 20px; min-width: 0; }
.mail-sync-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.mail-sync-form label { display: grid; gap: 6px; min-width: 0; }
.mail-sync-form .mail-sync-toggle { display: flex; align-items: center; align-self: center; }
.mail-sync-toggle input { width: auto; }
.mail-sync-times { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.mail-sync-times dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.mail-sync-error { color: #a52a23; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .mail-sync-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mail-sync-form .mail-sync-toggle { grid-column: 1 / -1; }
  .mail-sync-form label:not(.mail-sync-toggle) { grid-column: 1 / -1; }
  .mail-sync-form button, .mail-sync-form select { min-width: 0; width: 100%; }
  .mail-sync-times { grid-template-columns: minmax(0,1fr); gap: 10px; }
}
/* Accounting-only spacing; no changes to form values or action handlers. */
.bank-gmail label, .bank-review-body label, .mail-sync-form label { margin-bottom:0; }
.mail-sync-form .mail-sync-toggle { align-self:end; min-height:44px; }
.mail-sync-form button, .mail-sync-form select { min-height:44px; }
.mail-sync-form { margin-bottom:12px; }
.bank-auto-sync { border-top:0; margin:0 0 20px; padding:0 0 16px; border-bottom:1px solid var(--line); }
.bank-auto-sync h3 { margin:0 0 16px; }
.mail-sync-times dt, .mail-sync-counts { color:var(--muted); font-size:13px; }
.mail-sync-error:empty { display:none; }
.bank-history { margin-bottom:0; padding-bottom:0; border-bottom:0; }
.bank-history .actions { margin-top:0; }
.sync-empty { padding:8px 0; }
.bank-gmail .connection { margin-top:0; }
.gmail-advanced { margin:20px 0; border-block:1px solid var(--line); }
.gmail-advanced > summary { cursor:pointer; padding:12px 0; }
.gmail-advanced form { margin-top:12px; }
.gmail-advanced form > button { justify-self:start; }
.gmail-disconnect { margin-top:24px; padding-top:16px; border-top:1px solid var(--line); }
.gmail-disconnect button { color:#a52a23; }
.bank-review-body form { gap:10px; }
.bank-review-body .bank-matching { gap:8px; }
.bank-review-body .party-results:empty, .bank-review-body .rule-suggestions:empty { display:none; }
.bank-review-body .bank-link-actions { padding:0 0 10px; }
.bank-review-body .bank-matching p { margin:4px 0; }
#accountingRulesPage > h3 { margin:24px 0 12px; }
#accountingRulesPage > select { max-width:240px; margin-bottom:12px; }
#accountingRulesPage article.bank-ledger-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:start; padding:16px 0; border-bottom:1px solid var(--line); }
#accountingRulesPage article p { margin:6px 0; color:var(--muted); overflow-wrap:anywhere; font-size:13px; }
#accountingRulesPage article summary { cursor:pointer; padding:6px 0; }
#accountingRulesPage article > button { min-height:44px; }
.bank-long-identity { font-size:13px; color:var(--muted); margin-top:5px; }
.bank-long-identity summary { cursor:pointer; font-size:13px; }
@media screen and (min-width:601px) and (max-width:1100px) {
  .bank-ledger-table { min-width:0; }
  .bank-ledger-table .bank-col-bank, .bank-ledger-table .bank-col-reference, .bank-ledger-table .bank-col-action { display:none; }
  .bank-ledger-table .bank-col-date { width:24%; }
  .bank-ledger-table .bank-col-party { width:30%; }
  .bank-ledger-table .bank-col-money { width:27%; }
  .bank-ledger-table .bank-col-status { width:19%; }
  .bank-ledger-table .bank-heading-full { display:none; }
  .bank-ledger-table .bank-heading-mobile { display:inline; }
}

/* Counterparty names stay visible at every viewport; identifiers have their own line. */
.bank-company-name, .bank-company-code, .bank-company-prefix {
  display:block; max-width:100%; white-space:normal; overflow:visible;
  text-overflow:clip; overflow-wrap:anywhere; word-break:normal;
}
.bank-company-code { margin-top:3px; color:var(--muted); font-weight:400; }
.bank-company-summary { min-width:0; padding:10px 12px; background:#f1f7f6; border-radius:6px; }
.bank-company-summary .bank-company-name { font-weight:600; }
.bank-ledger-table .bank-col-party, .bank-ledger-table .bank-company-label,
.bank-ledger-table .bank-party-link { white-space:normal; text-overflow:clip; overflow:visible; max-height:none; }
