/* The integration setup on one surface: the steps sit on the page head, every step is a stack of zones and one action
   bar ends the page. Everything new is prefixed wz-; the older rules at the end serve pages not converted yet. */

/* ---------- The pair being built, in the head: an empty slot until a system is picked ---------- */
.wz-side-slot { display: inline-flex; }

/* ---------- Rows of a step: a numbered label, with its control right under it ---------- */
.wz-rows { display: grid; counter-reset: wz-row; }
.wz-row { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.wz-rows > .wz-row:first-child, .wz-rows > :first-child > .wz-row:first-child { border-top: 0; padding-top: 4px; }
.wz-row-l { min-width: 0; }
.wz-row-l b { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: var(--fs-s); font-weight: 600; color: var(--ink); }
.wz-row-l b::before {
  counter-increment: wz-row; content: counter(wz-row);
  display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  font-size: var(--fs-2xs); font-weight: 700; background: var(--brand-soft); color: var(--brand-text);
}
.wz-row-l > span { display: block; margin: 2px 0 0 30px; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-4); }
.wz-row-c { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; max-width: 560px; margin-left: 30px; }
.wz-row-c > .input, .wz-row-c > .syspick, .wz-row-c > .wz-locked { flex: 1 1 100%; max-width: none; }
.wz-row-c > .pill { flex: none; }
.wz-row-c .checklist { margin-top: 0; }
.wz-more { padding: 0 0 16px; }
.wz-sub { display: flex; align-items: center; gap: 6px; margin: 0; padding: 18px 0 6px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4); }
.wz-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-4); }
.wz-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.wz-note.bad { color: var(--bad); }

/* The installed app's own side, already decided in a marketplace setup. */
.wz-locked { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--panel-2); }
.wz-locked .pill { margin-left: auto; }

/* ---------- A choice of one: as many columns as options ---------- */
.wz-opts-1 { --opts: 1; }
.wz-opts-2 { --opts: 2; }
.wz-opts-3 { --opts: 3; }
.wz-opts-4 { --opts: 4; }
.wz-opts-5 { --opts: 5; }
.optstrip.wz-opts-1 .opt { max-width: 640px; }
.zone > .optstrip + .zone-body { padding-top: 6px; }

/* ---------- Describe it in one sentence ---------- */
.wz-describe { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wz-describe .find-field { flex: 1 1 280px; height: 44px; }
.wz-describe .btn { height: 44px; }

/* ---------- Signing in, one zone per system ---------- */
.wz-side .zone-head .right { flex-wrap: wrap; justify-content: flex-end; }
.wz-side .zone-head .right .btn { min-width: 160px; }
.wz-side:not(:has(> .zone-body)) .zone-head { padding-bottom: 20px; }
.wz-side.is-done .zone-head h2 svg { width: 16px; height: 16px; color: var(--ok); }

/* ---------- Record types: a pick, the type, how well it matches, its direction and its fields ---------- */
.wz-types { --rl-cols: 26px minmax(0, 1fr) 180px 160px 128px; --rl-cols-md: 26px minmax(0, 1fr) 160px 128px; }
.wz-pick { display: grid; place-items: center; width: 22px; }
.wz-pick input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.wz-pick input[type="checkbox"]:disabled { cursor: not-allowed; }
.wz-pick svg { width: 15px; height: 15px; color: var(--ink-4); }
.wz-type label.rl-type { cursor: pointer; }
.wz-type .rl-name b { white-space: normal; }
.wz-type .rl-type > .pill, .wz-type .rl-type > .itip { flex: none; }
.wz-type.is-on, .wz-type:has(> .wz-pick input:checked) { background: color-mix(in srgb, var(--brand-text) 6%, var(--panel)); }
.wz-type.is-off .rl-name b { color: var(--ink-4); }
.wz-type.is-off label.rl-type { cursor: not-allowed; }
.wz-type .rl-do .btn { min-width: 120px; }
.wz-dir { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wz-fields { grid-column: 1 / -1; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.wz-fields[hidden] { display: none; }
.wz-fields > .wz-sub:first-child { padding-top: 0; }

/* ---------- The fields a record type carries ---------- */
.wz-fieldpanel { display: grid; gap: 4px; }
.wz-fieldpanel .table-wrap { background: none; }
.wz-fieldpanel > .wz-note { margin-top: 10px; }

/* ---------- Waiting for both sign ins: what the pair could sync ---------- */
.wz-pending { --rl-cols: minmax(0, 1fr) minmax(0, 1fr) 200px; --rl-cols-md: minmax(0, 1fr) minmax(0, 1fr) 170px; }
.wz-pending .rl-row.is-off { color: var(--ink-4); }

/* ---------- Review: one row per record type, which system leads right under a two way one ---------- */
.wz-review { --rl-cols: minmax(0, 1fr) 200px 150px 150px; --rl-cols-md: minmax(0, 1fr) 170px 140px; }
.wz-review .rl-name b { white-space: normal; }
.wz-review .rl-row:has(+ .wz-lead) { border-bottom: 0; }
.wz-lead {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 4px; padding-bottom: 16px;
  padding-left: calc(var(--zl, var(--pad-x)) + 46px); padding-right: var(--zr, var(--pad-x)); border-bottom: 1px solid var(--line-soft);
}
.wz-lead-q { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-s); font-weight: 600; color: var(--ink); }
.wz-lead-q > svg { width: 15px; height: 15px; color: var(--accent-gold); }
.wz-lead .lead-pick label:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.wz-lead .lead-pick b { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }

/* ---------- Choosing a stage, a tag or an extra option: a list of ticks ---------- */
.wz-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.wz-checks .checkbox { font-size: var(--fs-s); }

/* A switch row with what it opens under it: tax codes and accounts, or a summary of picked fields. */
.wz-more .table-wrap + .table-wrap { margin-top: 12px; }
table.data.wz-codes { table-layout: fixed; }
table.data.wz-codes th:first-child, table.data.wz-codes td:first-child { width: 50%; }
table.data.wz-codes select.input { width: 100%; max-width: 360px; }

/* ---------- Narrower pages ---------- */
@container page (max-width: 820px) {
  .wz-lead { padding-left: var(--zl, var(--pad-x)); }
}
@container page (max-width: 640px) {
  .wz-side .zone-head { flex-wrap: wrap; }
  .wz-side .zone-head .right { width: 100%; justify-content: flex-start; }
  .wz-types .rl-row.wz-type { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px 12px; }
  .wz-types .rl-row.wz-type > .wz-pick { grid-column: 1; grid-row: 1; }
  .wz-types .rl-row.wz-type > .rl-type { grid-column: 2; grid-row: 1; }
  .wz-types .rl-row.wz-type > .rl-do { grid-column: 3; grid-row: 1; }
  .wz-types .rl-row.wz-type > .wz-dir { grid-column: 2 / -1; }
  .wz-types .rl-row.wz-type > .wz-fields { grid-column: 1 / -1; }
  .wz-type .rl-do .btn { min-width: 0; }
  .optstrip.wz-opts-1 .opt { max-width: none; }
}

/* ---------- The record type page's field mapping, and the Sheet tab's save bar ---------- */
.fmpanel { display: flex; flex-direction: column; gap: 14px; }
.fmpanel > .small, .fmpanel > .xs { margin: 0; padding: 0 2px; }
.fmpanel .table-wrap { background: none; }

.flowbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel);
}
.flowbar .right { margin-left: auto; display: flex; gap: 8px; }

@media (max-width: 860px) {
  .flowbar .right { width: 100%; }
  .flowbar .right .btn { flex: 1; }
}
