/* Connect with Stream guide, in the merchant portal's look: Inter, the portal's neutral grays,
   near-black primary buttons, brand gold only for progress and focus, radius 8.
   Tokens follow stream_website/src/_stream/assets/sass/core/components/_variables.scss. */
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --gray-25: #fafafa;
  --gray-50: #f0f0f0;
  --gray-100: #e8e8e8;
  --gray-200: #d1d1d1;
  --gray-300: #b9b9b9;
  --gray-500: #8b8b8b;
  --gray-600: #747474;
  --gray-700: #5d5d5d;
  --gray-800: #464646;
  --gray-900: #2e2e2e;
  --gray-950: #171717;
  --brand-100: #fffbf2;
  --brand-500: #fdc14b;
  --positive-100: #def8e9;
  --positive-800: #1b7441;
  --negative-100: #fdefed;
  --negative-800: #a52214;
  --warning-100: #fef7eb;
  --warning-200: #fbdaa7;
  --warning-800: #8e5a07;
  --info-100: #e7f3fd;
  --info-800: #0059af;
  --shadow-sm: 0 1px 3px rgba(93, 93, 93, 0.08);
  --shadow-card: 0 3px 4px rgba(0, 0, 0, 0.03);
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --bar-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/20px var(--sans); color: var(--gray-950); background: #fff; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; }
:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--brand-500); border-radius: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--bar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: #fff; border-bottom: 1px solid var(--gray-100);
}
.topbar .logo { display: flex; align-items: center; width: 232px; flex: none; }
.topbar .logo img { height: 22px; width: auto; display: block; }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--gray-600); font-size: 14px; min-width: 0; white-space: nowrap; }
.crumb b { font-weight: 400; color: var(--gray-950); overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }

/* ---------- pills (portal status pills) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 8px;
  font-size: 12px; line-height: 18px; white-space: nowrap;
  background: var(--gray-25); border: 1px solid var(--gray-50); color: var(--gray-700);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.pos { background: var(--positive-100); color: var(--positive-800); border-color: transparent; }
.pill.neg { background: var(--negative-100); color: var(--negative-800); border-color: transparent; }
.pill.warn { background: var(--warning-100); color: var(--warning-800); border-color: transparent; }
.pill.info { background: var(--info-100); color: var(--info-800); border-color: transparent; }
.pill.code { font-family: var(--mono); font-size: 11.5px; }
/* The environment badge: which Stream this guide talks to, named so DEV, STAGE and PROD cannot be confused. */
.pill.env b { font-weight: 700; letter-spacing: 0.04em; }
.pill.env.dev { background: var(--info-100); color: var(--info-800); border-color: transparent; }
.pill.env.stage { background: var(--warning-100); color: var(--warning-800); border-color: transparent; }
.pill.env.prod { background: var(--positive-100); color: var(--positive-800); border-color: transparent; }
.pill.env.down { background: var(--negative-100); color: var(--negative-800); border-color: transparent; }

/* ---------- buttons (portal btn-primary / btn-secondary) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--gray-950); cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 500 14px/1 var(--sans); color: #fff;
  background: radial-gradient(120% 120% at 50% 0%, #3d3d3d 0%, var(--gray-950) 62%);
}
.btn:hover { background: var(--gray-900); }
.btn.secondary, .btn.ghost { background: #fff; color: var(--gray-950); border-color: var(--gray-100); box-shadow: var(--shadow-sm); }
.btn.secondary:hover, .btn.ghost:hover { background: var(--gray-25); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--gray-50); color: var(--gray-300); border-color: var(--gray-50); box-shadow: none; cursor: not-allowed; }
.btn svg, .icon { width: 16px; height: 16px; flex: none; }
.btn-connect img { height: 12px; width: auto; filter: invert(1); }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--gray-950); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- shell ---------- */
/* the sidebar's grey runs the full height of the page, however long the step */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: calc(100vh - var(--bar-h));
  background: linear-gradient(90deg, var(--gray-25) 0 271px, var(--gray-200) 271px 272px, #fff 272px); }
.side {
  padding: 24px 20px; display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: var(--bar-h); align-self: start; height: calc(100vh - var(--bar-h)); overflow-y: auto;
}
.side-label { font-size: 12px; line-height: 16px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gray-600); margin-bottom: 12px; }
.stepper-toggle { display: none; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { position: relative; }
.checklist li:not(:last-child)::after {
  content: ""; position: absolute; left: 15px; top: 36px; bottom: -2px; width: 2px; background: var(--gray-100);
}
.checklist li.done:not(:last-child)::after { background: var(--brand-500); }
.checklist button {
  width: 100%; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: center; text-align: left;
  padding: 4px 6px 4px 0; margin-bottom: 10px; border: 0; background: none; cursor: pointer; color: var(--gray-800); border-radius: 8px;
}
.checklist .tile {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; position: relative; z-index: 1;
  border: 1px solid var(--gray-100); background: #fff; color: var(--gray-600); font-size: 12px; font-weight: 500;
}
.checklist li.done .tile { background: var(--brand-500); border-color: var(--brand-500); color: var(--gray-950); }
.checklist li.active .tile { border-color: var(--gray-950); color: var(--gray-950); }
.checklist .t { font-size: 14px; line-height: 20px; }
.checklist li.active .t { color: var(--gray-950); font-weight: 500; }
.checklist button:hover .t { color: var(--gray-950); }

.session { background: #fff; border: 1px solid var(--gray-100); border-radius: 8px; padding: 16px; display: grid; gap: 10px; box-shadow: var(--shadow-card); }
/* rows wrap rather than push pills past the card's edge, whatever the font's width */
.session .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--gray-600); min-width: 0; }
.session .row > * { min-width: 0; max-width: 100%; }
.session .row b { color: var(--gray-950); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.session { min-width: 0; overflow: hidden; }
.endpoint.expiring { color: var(--negative-800); }
.session .tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- content ---------- */
#content { min-width: 0; padding: 32px 32px 48px; }
.card { max-width: 880px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.step-no { font-size: 12px; line-height: 16px; color: var(--gray-600); }
.page-head h1 { font-size: 24px; line-height: 32px; font-weight: 400; }
.page-head p { color: var(--gray-600); font-size: 14px; line-height: 20px; }
.hero { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.hero h1 { font-size: 30px; line-height: 38px; font-weight: 400; letter-spacing: -0.01em; max-width: 30ch; }
.lead { color: var(--gray-800); font-size: 14px; line-height: 22px; max-width: 72ch; }
.card h3 { font-size: 16px; line-height: 24px; font-weight: 500; margin-top: 12px; }
.endpoint { color: var(--gray-600); font-size: 13px; line-height: 20px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.section { border: 1px solid var(--gray-100); border-radius: 8px; box-shadow: var(--shadow-card); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section > h3 { margin-top: 0; }
.section .sub { color: var(--gray-600); font-size: 13px; margin-top: -8px; }

dl.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); margin: 0; border: 1px solid var(--gray-50); border-radius: 8px; overflow: hidden; }
dl.kv dt, dl.kv dd { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--gray-50); }
dl.kv dt { color: var(--gray-600); background: var(--gray-25); }
dl.kv dd { overflow-wrap: anywhere; }
dl.kv dt:last-of-type, dl.kv dd:last-of-type { border-bottom: 0; }

/* ---------- notes (portal banner pattern) ---------- */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-radius: 8px; font-size: 14px; line-height: 20px;
  border: 1px solid var(--gray-100); background: var(--gray-25); color: var(--gray-950); }
.note.ok { border-color: #bfe9cf; background: var(--positive-100); }
.note.bad { border-color: #f6c9c3; background: var(--negative-100); }
.note.warn { border-color: var(--warning-200); background: var(--warning-100); }
.note > .icon { margin-top: 2px; }
.empty { border: 1px dashed var(--gray-200); border-radius: 8px; padding: 24px; text-align: center; color: var(--gray-600); }

/* ---------- code panels (portal AccountingSyncCodeBlock) ---------- */
.panel { border: 1px solid var(--gray-50); border-radius: 8px; overflow: hidden; background: #fff; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px; background: var(--gray-25); border-bottom: 1px solid var(--gray-50); font-size: 13px; color: var(--gray-600); }
.panel-head .mono { color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.code { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--gray-25); color: var(--gray-900); font-size: 12.5px; line-height: 1.7; white-space: pre; }
.panel pre.code { background: #fff; }
pre.code .k { color: var(--info-800); }
pre.code .s { color: var(--positive-800); }
pre.code .n { color: #9a5b00; }
pre.code .m { color: var(--gray-950); font-weight: 600; }
pre.code .c { color: var(--gray-500); }
.tabs { display: flex; gap: 4px; padding: 0 8px; border-bottom: 1px solid var(--gray-100); background: #fff; }
.tabs button { border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--gray-600); font-size: 13px; }
.tabs button.on { color: var(--gray-950); box-shadow: inset 0 -2px 0 var(--gray-950); }

/* ---------- checks, scope chips ---------- */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: center; }
.checks .i { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; }
.checks .i.ok { background: var(--positive-100); color: var(--positive-800); }
.checks .i.bad { background: var(--negative-100); color: var(--negative-800); }
.scopes { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- area picker: the allow page's View / View and edit ---------- */
.areas { border: 1px solid var(--gray-50); border-radius: 8px; }
.area { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--gray-50); }
.areas > .area:last-child, .areas details:last-child > .area:last-child { border-bottom: 0; }
.area .name { font-size: 14px; }
.area .name small { display: block; color: var(--gray-600); font: 12px/16px var(--mono); }
.seg { display: inline-flex; border: 1px solid var(--gray-100); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); }
.seg button { border: 0; border-right: 1px solid var(--gray-100); background: #fff; padding: 6px 12px; font-size: 13px; color: var(--gray-700); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--gray-950); color: #fff; }
.seg button.out:not(.on) { color: var(--gray-500); background: repeating-linear-gradient(135deg, #fff 0 6px, var(--gray-25) 6px 12px); }
.areas details { border-top: 1px solid var(--gray-50); }
.areas summary { padding: 10px 14px; cursor: pointer; color: var(--gray-600); font-size: 13px; }

/* ---------- overview ---------- */
.diagram { border: 1px solid var(--gray-50); border-radius: 8px; background: var(--gray-25); padding: 16px; overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 640px; height: auto; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid3 .tile { border: 1px solid var(--gray-100); border-radius: 8px; box-shadow: var(--shadow-card); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.grid3 .tile .k { font-size: 12px; color: var(--gray-600); }
.grid3 .tile h4 { font-size: 16px; line-height: 24px; font-weight: 500; }
.grid3 .tile p { color: var(--gray-600); font-size: 14px; }
ul.build { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--gray-800); line-height: 22px; }

.nav { display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--gray-50); }
footer { padding: 20px 32px 32px; color: var(--gray-600); font-size: 12px; border-top: 1px solid var(--gray-50); }

/* ---------- tablet and phone ---------- */
@media (max-width: 900px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar .logo { width: auto; }
  .crumb, .topbar .docs { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); background: #fff; }
  .side { position: static; height: auto; background: var(--gray-25); border-bottom: 1px solid var(--gray-200); padding: 12px 16px; gap: 12px; }
  .stepper-toggle {
    display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 10px 12px;
    border: 1px solid var(--gray-100); border-radius: 8px; background: #fff; cursor: pointer; text-align: left; box-shadow: var(--shadow-sm);
  }
  .stepper-toggle small { color: var(--gray-600); display: block; font-size: 12px; }
  .side .side-label { display: none; }
  .side:not(.open) .checklist, .side:not(.open) .session { display: none; }
  #content { padding: 24px 16px 40px; }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  dl.kv { grid-template-columns: minmax(0, 1fr); }
  dl.kv dt { border-bottom: 0; padding-bottom: 2px; }
  dl.kv dd { padding-top: 2px; }
  .hero h1 { font-size: 24px; line-height: 32px; }
  .area { grid-template-columns: minmax(0, 1fr); }
  .seg { justify-self: start; }
  footer { padding: 16px; }
}
@media (max-width: 480px) {
  .topbar .env { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
  .nav { flex-direction: column-reverse; }
  .nav .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- pass two: transcripts, copy, tables, toast ---------- */
pre.code { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.code.clamp { max-height: calc(14 * 1.7em + 28px); overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.tx .part + .part { border-top: 1px solid var(--gray-50); }
.part-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px 0; font-size: 12px; color: var(--gray-600); }
.part .more { margin: 0 16px 12px; font-size: 13px; }
.tools { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.explain { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-600); cursor: pointer; white-space: nowrap; }
.explain input { accent-color: var(--brand-500); margin: 0; }
.copy { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--gray-100);
  background: #fff; color: var(--gray-700); font-size: 12px; cursor: pointer; box-shadow: var(--shadow-sm); }
.copy:hover { background: var(--gray-25); color: var(--gray-950); }
.copy .icon { width: 13px; height: 13px; }
.with-copy { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tabs { align-items: center; }
.tabs-end { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; }
.tabs-end .hint { font-size: 12px; color: var(--gray-500); }
.dim { color: var(--gray-500); font-size: 13px; }
[data-expiry].expiring { color: var(--negative-800); }

.table-wrap { overflow-x: auto; border: 1px solid var(--gray-50); border-radius: 8px; }
table.calls, table.errors { width: 100%; border-collapse: collapse; font-size: 13px; }
.calls th, .errors th { text-align: left; font-weight: 400; color: var(--gray-600); background: var(--gray-25); padding: 0 12px; height: 36px; border-bottom: 1px solid var(--gray-50); white-space: nowrap; }
.calls td, .errors td { padding: 10px 12px; border-bottom: 1px solid var(--gray-50); vertical-align: middle; line-height: 18px; }
.errors td { vertical-align: top; }
.calls tr:last-child td, .errors tr:last-child td { border-bottom: 0; }
.calls .call-name { font-size: 14px; }
.calls .call-path { color: var(--gray-600); font-size: 12px; }
.calls td.go { white-space: nowrap; text-align: right; }
.calls td.go .link { margin-left: 8px; font-size: 13px; }
.calls tr.is-open td { border-bottom-color: transparent; }
.calls tr.detail > td { background: var(--gray-25); padding: 12px; }
.errors td:first-child { white-space: nowrap; color: var(--gray-600); }
.errors .pill + .pill { margin-left: 4px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; background: var(--gray-950); color: #fff;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .icon { color: var(--brand-500); }
@media (max-width: 900px) {
  .tabs-end .hint { display: none; }
  .calls th:nth-child(4), .calls td:nth-child(4) { display: none; }
}

/* ---------- step 1: the partner's own credentials (portal form controls) ---------- */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--gray-800); }
.input { height: 40px; padding: 0 12px; border: 1px solid var(--gray-100); border-radius: 8px; background: #fff; color: var(--gray-950);
  box-shadow: var(--shadow-sm); font-size: 13px; width: 100%; }
.input:focus { outline: 1px solid var(--brand-500); outline-offset: 1px; }
.input::placeholder { color: var(--gray-300); }
details.how summary { cursor: pointer; color: var(--gray-600); font-size: 13px; }
@media (max-width: 900px) { .fields { grid-template-columns: minmax(0, 1fr); } }
