/* Match QuickBooks customers (Contacts, 2026-10-22). New UI standard: .inv-kind-switch tabs, wf-kpi-thin cards, Invoices-style rows.
   Everything is scoped to #qbm-view / #qbm-banner / #qbm-chip; Contacts is untouched while hidden. Theme tokens only (day + night). */
#qbm-view, #qbm-banner, #qbm-chip { --qbm-amber: #b7791f; --qbm-green: #1f8a4c; --qbm-grey: #7a8494; --qbm-blue: #2b63c4; }
html[data-remodel-mode="night"] #qbm-view, html[data-remodel-mode="night"] #qbm-banner, html[data-remodel-mode="night"] #qbm-chip { --qbm-amber: #e0a33a; --qbm-green: #4cc282; --qbm-grey: #9aa3b2; --qbm-blue: #82b2ff; }
#qbm-view[hidden], #qbm-banner[hidden], #qbm-chip[hidden], #qbm-open-btn[hidden] { display: none !important; } /* .btn would otherwise beat [hidden] */

/* while the QuickBooks view is open, the normal Contacts page steps aside (its own header below carries the way back) */
#page-contacts.qbm-on > .page-content > :not(#qbm-view) { display: none !important; }

#qbm-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 16px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 14px; color: var(--white); }
#qbm-banner .qbm-banner-ic { flex: 0 0 auto; display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 10px; background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); }
#qbm-banner .qbm-banner-ic svg { width: 18px; height: 18px; }
#qbm-banner .qbm-banner-t { flex: 1 1 auto; min-width: 0; font-size: 14.5px; font-weight: 500; }
#qbm-banner .btn { flex: 0 0 auto; min-height: 44px; }

#qbm-view { display: block; }
#qbm-view.is-busy { opacity: .6; pointer-events: none; }
.qbm-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 16px; margin: 0 0 22px; }
.qbm-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-raised); color: var(--white); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.qbm-back svg { width: 18px; height: 18px; }
.qbm-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); }
.qbm-title { margin: 2px 0 0; font-size: 22px; line-height: 28px; font-weight: 700; color: var(--white); }
.qbm-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.qbm-acts { display: flex; gap: 10px; align-items: center; }
.qbm-acts .btn { min-height: 44px; }
.qbm-acts .btn[disabled] { opacity: .5; }

.qbm-kpis { margin: 0 0 18px; }
html body #qbm-view .wf-kpi-rail.qbm-kpis { display: flex; margin: 0 0 18px; }
@media (min-width: 601px) {
  html body #qbm-view .wf-kpi-rail.qbm-kpis { --wf-kpi-cap: none; --wf-kpi-basis: 0px; }
  html body #qbm-view .wf-kpi-rail.qbm-kpis > .pay-kpi { flex: 1 1 0 !important; max-width: none !important; min-width: 0; }
  html body #qbm-view .wf-kpi-railwrap:has(> .qbm-kpis) .wf-kpi-progress { display: none; }
}
html body #qbm-view .qbm-kpis .pay-kpi { cursor: pointer; }
html body #qbm-view .qbm-kpis .pay-kpi.is-on { border-color: var(--gold); }
html body #qbm-view .wf-kpi-rail.qbm-kpis .pay-kpi-sub, html body #qbm-view .wf-kpi-rail.qbm-kpis .pay-kpi-footer { white-space: normal !important; overflow-wrap: anywhere; text-overflow: clip; display: block !important; }

.qbm-tabs { margin: 0 0 14px; }
.qbm-tabs .inv-kind-tab { min-height: 44px; }
.qbm-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.qbm-search { flex: 1 1 280px; min-width: 0; max-width: 520px; position: relative; }
.qbm-search .search-input { width: 100%; min-height: 44px; }
.qbm-bulk { display: flex; gap: 10px; flex-wrap: wrap; }
.qbm-bulk .btn { min-height: 44px; }
.qbm-bulk .btn.is-on { border-color: var(--gold); color: var(--gold); }

.qbm-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin: 0 0 16px; }
.qbm-row { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(190px, .8fr); column-gap: 18px; align-items: center; padding: 12px 18px; min-height: 64px; border-top: 1px solid var(--border); }
.qbm-row:first-child { border-top: 0; }
.qbm-row.has-diff { cursor: pointer; }
.qbm-row.has-diff:hover, .qbm-row.is-open { background: color-mix(in srgb, var(--gold) 6%, var(--bg-raised)); }
.qbm-row-pick { grid-template-columns: 44px minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(120px, auto); }
.qbm-row-rev { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.qbm-c { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qbm-c-st { align-items: flex-end; gap: 8px; }
.qbm-name { font-size: 15px; font-weight: 600; color: var(--white); overflow-wrap: anywhere; }
.qbm-name-qb { font-weight: 500; }
.qbm-link { background: none; border: 0; padding: 10px 0; margin: -10px 0; min-height: 44px; text-align: left; font: inherit; font-size: 15px; font-weight: 600; color: var(--white); cursor: pointer; }
.qbm-link:hover { text-decoration: underline; }
.qbm-meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.qbm-lbl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.qbm-dash { color: var(--muted); }
.qbm-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, currentColor 10%, transparent); vertical-align: middle; }
.qbm-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.35; white-space: nowrap; color: var(--qbm-tone, var(--qbm-grey)); background: color-mix(in srgb, var(--qbm-tone, var(--qbm-grey)) 12%, transparent); }
.qbm-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--qbm-tone, var(--qbm-grey)); }
.qbm-pill[data-tone="green"] { --qbm-tone: var(--qbm-green); }
.qbm-pill[data-tone="amber"] { --qbm-tone: var(--qbm-amber); }
.qbm-pill[data-tone="grey"] { --qbm-tone: var(--qbm-grey); }
.qbm-act { min-height: 44px; padding: 0 16px; white-space: nowrap; }

.qbm-diffs { grid-column: 1 / -1; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 10px; }
.qbm-diff { display: grid; grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1fr); column-gap: 18px; align-items: start; font-size: 14px; color: var(--white); }
.qbm-diff-f { font-weight: 600; }
.qbm-diff-v { overflow-wrap: anywhere; }

.qbm-cands { display: flex; flex-direction: column; }
.qbm-cand { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; column-gap: 16px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.qbm-cand:first-child { border-top: 0; padding-top: 0; }
/* P3.6: merge offer under the candidates (key qbContactsAuto) */
.qbm-merge { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; }
.qbm-merge-t { flex: 1 1 220px; min-width: 0; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.qbm-why { display: flex; flex-wrap: wrap; gap: 6px; }
.qbm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--qbm-amber); background: color-mix(in srgb, var(--qbm-amber) 12%, transparent); }
.qbm-btns { display: flex; gap: 8px; justify-content: flex-end; }

.qbm-pick { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
.qbm-pick input { position: absolute; opacity: 0; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.qbm-pick-box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-light, var(--border)); background: var(--bg-base, transparent); display: inline-block; }
.qbm-pick input:checked + .qbm-pick-box { background: var(--gold); border-color: var(--gold); box-shadow: inset 0 0 0 3px var(--bg-raised); }
.qbm-pick input:focus-visible + .qbm-pick-box { outline: 2px solid var(--gold); outline-offset: 2px; }

.qbm-empty { padding: 36px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qbm-empty-t { font-size: 16px; font-weight: 600; color: var(--white); }
.qbm-empty-s { font-size: 14px; color: var(--muted); max-width: 46ch; }
.qbm-more { display: flex; justify-content: center; padding: 0; }
.qbm-more:not(:empty) { padding: 14px; border-top: 1px solid var(--border); }
.qbm-more .btn { min-height: 44px; }
.qbm-end { font-size: 13px; color: var(--muted); }

/* the small "QuickBooks" chip on a linked contact's page */
#qbm-chip { margin-top: 8px; }
.qbm-chip-qb { color: var(--qbm-green); background: color-mix(in srgb, var(--qbm-green) 12%, transparent); }
.qbm-chip-qb svg { width: 14px; height: 14px; }

/* vendors (key qbVendorsMatch): the status block carries a long "QuickBooks says" line and the person's card tags, so it wraps instead of squeezing the name */
.qbm-cards { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.qbm-cards .qbm-tag { margin-left: 0; font-size: 12.5px; padding: 3px 10px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.qbm-mode { margin: 0 0 14px; }
.qbm-mode .inv-kind-tab { min-height: 44px; }
@media (max-width: 900px) {
  .qbm-row.qbm-row-v { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
  .qbm-row.qbm-row-v .qbm-c-qb, .qbm-row.qbm-row-v .qbm-c-st { grid-column: 1; grid-row: auto; align-items: flex-start; justify-content: flex-start; }
  .qbm-row.qbm-row-v .qbm-cards { justify-content: flex-start; }
  .qbm-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .qbm-row .qbm-c-qb { grid-column: 1 / 2; grid-row: 2; }
  .qbm-row .qbm-c-st { grid-column: 2; grid-row: 1 / span 2; justify-content: center; }
  .qbm-row-pick { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .qbm-row-pick .qbm-c-qb { grid-column: 2; grid-row: 2; }
  .qbm-row-pick .qbm-c-st { grid-column: 3; grid-row: 1 / span 2; }
  .qbm-row-rev { grid-template-columns: minmax(0, 1fr); }
  .qbm-cand { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
  .qbm-btns { justify-content: flex-start; }
  .qbm-diff { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
}
@media (max-width: 640px) {
  /* the three vendor tabs stay ONE row that slides sideways */
  .qbm-tabs.qbm-tabs-v { display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .qbm-tabs.qbm-tabs-v::-webkit-scrollbar { display: none; }
  .qbm-tabs.qbm-tabs-v .inv-kind-tab { flex: 0 0 auto; white-space: nowrap; }
  .qbm-mode { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 22px; overflow: visible; }
  .qbm-mode .inv-kind-tab { justify-content: center; min-width: 0; }
  .qbm-head { grid-template-columns: auto minmax(0, 1fr); row-gap: 12px; }
  .qbm-back { grid-column: 1; justify-self: start; }
  .qbm-titles { grid-column: 1 / -1; grid-row: 2; }
  .qbm-acts { grid-column: 2; grid-row: 1; min-width: 0; flex-wrap: wrap; justify-content: flex-end; } /* large text: the buttons wrap instead of sliding under Contacts */
  .qbm-title { font-size: 20px; line-height: 26px; }
  .qbm-tabs { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 22px; overflow: visible; }
  .qbm-tabs .inv-kind-tab { justify-content: center; padding: 10px 12px; min-width: 0; white-space: normal; text-align: center; line-height: 1.2; }
  .qbm-tools { flex-direction: column; align-items: stretch; }
  .qbm-search { max-width: none; flex-basis: auto; }
  .qbm-bulk .btn { flex: 1 1 auto; }
  .qbm-card { border-radius: 14px; }
  .qbm-row { padding: 14px 16px; }
  #qbm-banner { flex-wrap: wrap; }
  #qbm-banner .qbm-banner-t { flex-basis: calc(100% - 52px); }
}
