/* The integration wizard: pick rows, choice cards, record type rows, authorization blocks, the review.
   Manage reuses the choice cards, record type rows and review blocks. */

.setup { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.setup.even { align-items: stretch; }
.setup.even > .card > .card-body { padding-top: 6px; padding-bottom: 14px; }

/* Numbered pick rows on the systems step. */
.pickrow { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; align-items: start; padding: 22px 0; border-bottom: 1px solid var(--line-soft); }
.pickrow:last-of-type { border-bottom: 0; }
.setup.even .pickrow { padding: 16px 0; }
.setup.even .pickrow:first-of-type { padding-top: 8px; }
.setup.even .pickrow:last-of-type { padding-bottom: 12px; }
.pickrow .step-n {
  display: grid; place-items: center; width: 28px; height: 28px; margin-top: 2px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--panel); color: var(--ink-4);
  font-size: var(--fs-xs); font-weight: 700;
}
.pickrow.done .step-n { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pickrow .pk-l { margin-bottom: 10px; font-size: var(--fs-m); font-weight: 600; }
.pickrow .pk-c { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pickrow select.input { max-width: 480px; }
.setup.even .syspick, .setup.even .onb-locked-system { max-width: none; }

/* ---------- Choice cards ----------
   Direction, trigger and similar either/or choices; the chosen one is tinted with a brand ring. */
.dirpick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.dircard {
  position: relative; padding: 18px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); color: inherit; font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.dircard:hover { border-color: var(--line-strong); }
.dircard.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand-text) 5%, var(--panel)); box-shadow: var(--focus-ring); }
.dircard.off { cursor: not-allowed; border-style: dashed; background: var(--panel-2); }
.dircard.off .dt, .dircard.off .dd { color: var(--ink-4); }
.dircard.off:hover { border-color: var(--line); }
.dircard input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.dircard .dtop { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dircard .dar { font-size: 20px; line-height: 1; color: var(--brand-text); }
.dircard .dt { font-size: var(--fs-l); font-weight: 600; letter-spacing: var(--tr-snug); }
.dircard .tick {
  display: grid; place-items: center; width: 20px; height: 20px; margin-left: auto; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--panel); font-size: 11px; color: transparent;
}
.dircard.on .tick { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.dircard .dd { margin: 0; font-size: var(--fs-s); line-height: 1.55; color: var(--ink-3); }
a.dircard, a.dircard:hover { display: block; color: inherit; }
.dircard .dar svg { width: 20px; height: 20px; }

.trigpick { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); margin-bottom: 20px; }
.trigpick .dircard { padding: 13px 14px; }
.trigpick .dircard .dtop { margin-bottom: 6px; }
.trigpick .dircard .dt { font-size: var(--fs-s); }
.trigpick .dircard .dd { font-size: var(--fs-xs); line-height: 1.5; }
.trighead { flex-wrap: wrap; }
.trignote {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 2px; padding: 4px 11px;
  border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand-text);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.4;
}
.trignote svg { width: 13px; height: 13px; flex: none; }
.tagfield { margin-top: 14px; margin-bottom: 8px; }

/* ---------- Record type rows ---------- */
.rt { margin-bottom: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); transition: border-color .15s ease, box-shadow .15s ease; }
label.rt, span.rt { display: block; }
.rt.on { border-color: var(--brand); box-shadow: var(--focus-ring); }
.rt.off { border-style: dashed; background: var(--panel-2); }
.rt.off .rt-h { cursor: not-allowed; }
.rt.off .tx b, .rt.off .tx span { color: var(--ink-4); }
.rt.on.rt-locked { box-shadow: none; }
.rt.rt-locked .rt-h { cursor: default; }
.rt input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.rt-h { display: flex; align-items: center; gap: 13px; padding: 13px 15px; cursor: pointer; }
.rt-h .ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: var(--r-m); background: var(--panel-3); font-size: var(--fs-l); }
.rt-h .tx, .rt .tx { flex: 1; min-width: 0; }
.rt-h .tx b { display: block; font-size: var(--fs-s); font-weight: 600; }
.rt-h .tx span { font-size: var(--fs-xs); color: var(--ink-4); }
.rt-h .tx .rt-title { display: flex; align-items: center; font-size: inherit; color: inherit; }
.rt-h .tx .rt-title b { display: inline; }
.rt .rt-pill { flex: none; margin-left: auto; }
.rt-b { padding: 4px 15px 15px; border-top: 1px solid var(--line-soft); }

/* A record type row with its field and direction controls next to it. */
.rtwrap { display: flex; align-items: stretch; gap: 8px; }
.rtwrap .rt { flex: 1; margin-bottom: 0; }
.rt-eye { flex: none; align-self: center; white-space: nowrap; }
.rt-dir { flex: none; align-self: center; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 6px; width: 176px; box-sizing: border-box; }
.rt-dir .itip { margin-left: 0; }
/* a converted record type only travels one way: the arrow sits where the switch sits on the other rows */
.rt-oneway { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 20px; border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand-text); }
.rt-oneway svg { width: 13px; height: 13px; }
.rt-dir-row { display: flex; align-items: center; gap: 9px; }
.rt-dir-l { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.rt-dir.soon { cursor: help; }
.rt-dir.soon .switch, .rt-dir.soon .rt-dir-l { opacity: .55; }
.rt-lead { display: flex; align-items: center; gap: 8px; }
.rt-lead-l { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-4); }

/* ---------- Field mapping panel ---------- */
.fieldpanel { padding: 18px 20px 16px; border: 1px solid var(--line); border-radius: var(--r-l); }
.fmpanel { display: flex; flex-direction: column; gap: 14px; }
.fmpanel .sect { padding-bottom: 0; }
.fmpanel .sect.sep { margin-top: 4px; padding-top: 16px; }
.fmpanel > .small, .fmpanel > .xs { margin: 0; padding: 0 2px; }
.fieldpanel .table-wrap, .fmpanel .table-wrap { background: none; }

/* ---------- Authorization blocks ---------- */
.authblock { margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); }
.authblock.done { border-color: var(--ok-line); }
.authblock .ab-h { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.authblock .ab-h .brandmark { width: 120px; height: 32px; }
.authblock .ab-h .ab-t { flex: 1; min-width: 0; }
.authblock .ab-h .ab-t b { display: block; font-size: var(--fs-m); font-weight: 600; }
.authblock .ab-h .ab-t span { font-size: var(--fs-xs); color: var(--ink-4); }
.authblock .ab-h .ab-side { display: flex; align-items: center; gap: 10px; flex: none; }
.authblock .ab-b { padding: 6px 16px 16px; border-top: 1px solid var(--line-soft); }

/* ---------- Live summary sidebar ---------- */
.sumflow { display: flex; flex-direction: column; }
.sumflow .sf-n { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel-2); }
.sumflow .sf-n.unset { border-style: dashed; background: transparent; color: var(--ink-4); font-size: var(--fs-xs); }
.sumflow .sf-n b { font-size: var(--fs-s); font-weight: 600; }
.sumflow .sf-a { padding: 5px 0; text-align: center; font-size: var(--fs-l); line-height: 1; color: var(--brand-text); }

/* ---------- Review ---------- */
.reviewlist { display: grid; margin: 0; }
.reviewlist > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.reviewlist > div:last-child { border-bottom: 0; }
.reviewlist dt { margin: 0; font-size: var(--fs-s); color: var(--ink-4); }
.reviewlist dd { margin: 0; font-size: var(--fs-s); font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.reviewtypes { display: grid; gap: 8px; }
.reviewtype { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel-2); }
.reviewtype.rt-dir { flex-direction: row; align-self: auto; width: auto; }
.reviewtype .rv-ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--r-m); background: var(--brand-soft); color: var(--brand-text); }
.reviewtype .rv-ic svg { width: 15px; height: 15px; }
.reviewtype .rv-t { display: flex; flex-direction: column; gap: 1px; }
.reviewtype .rv-t b { font-size: var(--fs-s); font-weight: 600; }
.reviewtype .rv-t span { font-size: var(--fs-xs); color: var(--ink-4); }
.reviewtype .rv-lead { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.reviewtype .rv-lead-l { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-4); }
.reviewtype .rv-lead .rt-dir-row { margin-left: 6px; padding-left: 14px; border-left: 1px solid var(--line); }
.settingsgrid { gap: 16px 12px; }
.settingsgrid .field, .settingsgrid .mt16 { margin-top: 0; }

/* ---------- The bar with Back and Continue ---------- */
.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; }
.onb-wrap .flowbar { background: var(--panel-2); }

/* A per route switch: control, label and info icon in one row, the same shape as "Both ways". */
.mark-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.mark-row:last-child { border-bottom: 0; }
.mark-row .itip { margin-left: -4px; }
.mark-label { font-size: var(--fs-s); font-weight: 600; color: var(--ink); }
.mark-select.mark-select { width: auto; min-width: 200px; max-width: 320px; }

@media (max-width: 1080px) {
  .setup { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .dirpick { grid-template-columns: 1fr; }
  .authblock .ab-h { flex-wrap: wrap; }
  .authblock .ab-h .ab-side { margin-left: auto; }
  .flowbar .right { width: 100%; }
  .flowbar .right .btn { flex: 1; }
  .rtwrap { flex-wrap: wrap; }
  .rtwrap .rt { flex-basis: 100%; }
}

@media (max-width: 700px) {
  .pickrow select.input, .pickrow input.input { max-width: 100%; }
  .rt-h { flex-wrap: wrap; }
  .rt-h .tx { flex-basis: 100%; order: 3; }
  .reviewtype { flex-wrap: wrap; }
  .reviewtype .rv-lead { margin-left: 44px; }
}

/* Describe it, we set it up: one sentence in, a prefilled wizard out. */
.aiset {
  padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-l);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 9%, var(--panel)) 0, var(--panel) 62%);
  box-shadow: var(--sh-card);
}
.aiset-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.aiset-head h3 { margin: 0; font-size: var(--fs-m); font-weight: 650; color: var(--ink); }
.aiset-head p { margin: 3px 0 0; font-size: var(--fs-s); color: var(--ink-3); }
.aiset-ic { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: var(--r-m); background: var(--brand-soft); color: var(--brand-text); }
.aiset-ic svg { width: 17px; height: 17px; }
.aiset-field { display: flex; align-items: center; gap: 8px; }
.aiset-field .input { flex: 1 1 auto; min-width: 0; }
.aiset-field .btn { flex: none; }
.aiset-field .btn svg { width: 14px; height: 14px; }
.aiset-result { --tone: var(--ok); margin-top: 12px; padding: 12px 14px; border-radius: var(--r-m); border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); background: color-mix(in srgb, var(--tone) 8%, transparent); font-size: var(--fs-s); color: var(--ink-2); }
.aiset-result.warn { --tone: var(--warn); }
.aiset-result p { margin: 0 0 6px; }
.aiset-result p:last-child { margin-bottom: 0; }
.aiset-result ul { margin: 0; padding-left: 18px; }
.aiset-result li + li { margin-top: 3px; }
.aiset-result a { color: var(--brand-text); font-weight: 600; }

@media (max-width: 560px) {
  .aiset { padding: 16px; }
  .aiset-field { flex-wrap: wrap; }
  .aiset-field .input { flex-basis: 100%; }
  .aiset-field .btn { width: 100%; justify-content: center; }
}


.linecodes { padding: 4px 0 12px; border-bottom: 1px solid var(--line-soft); }
.linecodes:last-child { border-bottom: 0; }
.linecodes-table td:first-child { width: 50%; color: var(--ink); font-weight: 500; }
.linecodes-table .mark-select.mark-select { width: 100%; max-width: 360px; }

/* A filter's scope (both systems on a two way pair) sits next to its label or record type. */
.field > label .pill, .trighead .pill { margin-left: 6px; vertical-align: middle; }
.sect-t b .pill { display: inline-flex; margin: 0 0 0 6px; vertical-align: middle; font-size: var(--fs-2xs); line-height: 1.35; color: var(--tone); }
.trighead .itip { margin-left: 2px; }
