:root {
  /* Technological dark theme by default (C8 demo), with a light variant below. */
  --bg: #070b16; --bg-2: #0b1224; --fg: #eef3fb; --muted: #a9b8d3; --card: rgba(17, 25, 46, .78);
  --line: #2c3b5e; --accent: #22d3ee; --accent-2: #8b5cf6; --ok: #34d399; --warn: #fbbf24; --err: #f87171;
  --code: #0d1529; --chip-ok: rgba(52, 211, 153, .14); --chip-no: rgba(248, 113, 113, .14);
  --chip-none: rgba(139, 154, 181, .14); --badge-m: rgba(251, 191, 36, .14);
  --glow: 0 0 0 1px rgba(34, 211, 238, .18), 0 10px 30px rgba(2, 6, 23, .55);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f7fb; --bg-2: #e9eef7; --fg: #0f172a; --muted: #52607a; --card: rgba(255, 255, 255, .9);
          --line: #d7dfec; --accent: #0891b2; --accent-2: #7c3aed; --ok: #047857; --warn: #b45309; --err: #b91c1c;
          --code: #eef3fa; --chip-ok: #d1fae5; --chip-no: #fee2e2; --chip-none: #e7ecf5; --badge-m: #fef3c7;
          --glow: 0 0 0 1px rgba(8, 145, 178, .14), 0 8px 24px rgba(15, 23, 42, .08); color-scheme: light; }
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--fg); font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(34, 211, 238, .12), transparent 60%),
              radial-gradient(900px 500px at 100% 0%, rgba(139, 92, 246, .12), transparent 55%),
              linear-gradient(180deg, var(--bg), var(--bg-2)) fixed; min-height: 100vh; }
header, main { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 24px; }
h1 { margin: 0 0 8px; font-size: 1.6rem; }
h2 { margin-top: 0; font-size: 1.15rem; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 16px 0; }
.lead, .muted { color: var(--muted); }
label { display: block; margin: 12px 0 4px; font-weight: 600; }
input, select { width: 100%; max-width: 420px; padding: 8px; font: inherit; color: var(--fg);
                background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
button { margin-top: 12px; padding: 8px 14px; font: inherit; color: #fff; background: var(--accent);
         border: 0; border-radius: 6px; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button + button { margin-left: 8px; }
code { background: var(--code); padding: 1px 4px; border-radius: 4px; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.error { color: var(--err); min-height: 1.5em; margin: 4px 0 0; }
.rule { border-left: 4px solid var(--warn); padding-left: 8px; }
.verdict { font-size: 1.1rem; font-weight: 700; }
.verdict.show { color: var(--warn); } .verdict.skip { color: var(--ok); }
#responses { padding-left: 20px; }
#responses li { margin-bottom: 12px; }
#responses pre { background: var(--code); padding: 8px; border-radius: 6px; overflow-x: auto; margin: 4px 0 0; font-size: .85rem; }

/* Endpoint column (Q69): main content left, endpoints right; stacked on narrow screens. */
section[data-endpoints] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 380px); column-gap: 24px; }
section[data-endpoints] > :not(aside.endpoints) { grid-column: 1; }
section[data-endpoints] > aside.endpoints { grid-column: 2; grid-row: 1 / span 30; align-self: start; }
@media (max-width: 860px) {
  section[data-endpoints] { display: block; }
  section[data-endpoints] > aside.endpoints { margin-top: 16px; }
}
aside.endpoints { border-left: 3px solid var(--line); padding-left: 12px; font-size: .85rem; }
aside.endpoints h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
aside.endpoints h3 + ul { margin-bottom: 12px; }
aside.endpoints ul { list-style: none; padding: 0; margin: 0; }
aside.endpoints li { margin-bottom: 8px; }
aside.endpoints code { word-break: break-all; }
aside.endpoints .method { font-weight: 700; margin-right: 4px; }
aside.endpoints .note { display: block; color: var(--muted); }
.sub-endpoints { margin-top: 8px; }
.sub-endpoints aside.endpoints { border-left-style: dashed; }
#cp-detail ul { margin: 4px 0 12px; }
#cp-detail code { font-size: .8rem; }
caption { caption-side: top; text-align: left; padding-bottom: 4px; }

/* Capture form (C8): built from the capture form's purposes. */
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.capture-form { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.capture-head { padding: 16px 18px 8px; border-bottom: 1px solid var(--line); }
.capture-head h3 { margin: 0; font-size: 1.1rem; }
.capture-head p { margin: 2px 0 0; }
.capture-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.capture-foot p { margin: 0; }
.choice { padding: 14px 18px; border-top: 1px solid var(--line); }
.choice:first-child { border-top: 0; }
.choice.mandatory { border-left: 4px solid var(--warn); padding-left: 14px; }
.choice-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-weight: 600; cursor: pointer; }
.choice-name { flex: 1 1 220px; }
.choice .desc { color: var(--muted); margin: 8px 0 0 52px; font-size: .92rem; }
.choice .desc p { margin: 0 0 6px; }
.choice .desc a { color: var(--accent); }
.badge, .chip { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-mandatory { background: var(--badge-m); color: var(--warn); }
.badge-optional { background: var(--chip-none); color: var(--muted); }
.chip-granted { background: var(--chip-ok); color: var(--ok); }
.chip-withdrawn { background: var(--chip-no); color: var(--err); }
.chip-not_collected, .chip-unknown { background: var(--chip-none); color: var(--muted); }
/* Toggle switch on a native checkbox: keyboard and screen readers keep working. */
input.switch { appearance: none; -webkit-appearance: none; width: 40px; max-width: 40px; height: 22px; padding: 0;
  border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; flex: 0 0 auto;
  transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s; }
input.switch:checked { background: var(--ok); }
input.switch:checked::after { transform: translateX(18px); }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.verdict.skip { padding: 10px 12px; border-radius: 8px; background: var(--chip-ok); }
.verdict.show { padding: 10px 12px; border-radius: 8px; background: var(--badge-m); }
@media (max-width: 600px) { .choice .desc { margin-left: 0; } }

/* Execution panel: always visible while scrolling, shows the latest interaction. */
.execution { position: sticky; top: 0; z-index: 10; box-shadow: 0 4px 14px rgba(0,0,0,.12); border-color: var(--accent); }
.exec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.exec-head h2 { margin: 0; }
.exec-link { margin-left: auto; color: var(--accent); font-size: .9rem; }
.exec-status { font-weight: 700; font-size: .9rem; }
.exec-status.running { color: var(--accent); }
.exec-status.ok { color: var(--ok); }
.exec-status.warn { color: var(--warn); }
.exec-status.error { color: var(--err); }
.exec-status.running::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px;
  vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .exec-status.running::before { animation: none; } }
.exec-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
@media (max-width: 860px) { .exec-body { grid-template-columns: 1fr; } }
.exec-col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 4px; }
.exec-col pre { background: var(--code); padding: 8px; border-radius: 6px; margin: 0; font-size: .78rem;
  max-height: 22vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }
#exec-onetrust { list-style: none; padding: 0; margin: 0; font-size: .82rem; max-height: 18vh; overflow: auto; }
#exec-onetrust li { margin-bottom: 6px; }
#exec-onetrust .note { display: block; color: var(--muted); }
.exec-note { font-size: .75rem; margin: 6px 0 0; }
button.busy { cursor: progress; }

.choice.locked .choice-head { cursor: default; }
input.switch:disabled { opacity: .55; cursor: not-allowed; }

/* Channel metadata (C8): simulate other sales channels. */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 16px; }
.channel-grid label { margin: 8px 0 0; font-size: .9rem; }
.channel-grid input, .channel-grid select { margin-top: 4px; }
.channel-grid input:invalid { border-color: var(--err); }
.req, .opt { font-size: .68rem; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.req { background: var(--badge-m); color: var(--warn); }
.opt { background: var(--chip-none); color: var(--muted); }
.inline { display: flex; gap: 6px; align-items: center; }
button.small { margin-top: 4px; padding: 6px 10px; font-size: .85rem; }
.channel-note { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; font-size: .9rem; background: var(--chip-none); }
.channel-note.warn { background: var(--badge-m); color: var(--warn); }

/* Execution summary: method, path, live status, progress and a clickable history. */
.exec-step { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff; }
.exec-method { font-size: .78rem; font-weight: 800; padding: 3px 8px; border-radius: 6px; color: #fff; letter-spacing: .03em; }
.exec-method.GET { background: #2f7d4f; } .exec-method.POST { background: #1f5fae; }
.exec-path { font-size: .85rem; }
.exec-status { padding: 3px 10px; border-radius: 999px; background: var(--chip-none); }
.exec-status.ok { background: var(--chip-ok); } .exec-status.warn { background: var(--badge-m); }
.exec-status.error { background: var(--chip-no); }
.exec-progress { height: 3px; margin-top: 8px; background: var(--chip-none); border-radius: 3px; overflow: hidden; }
.exec-progress span { display: block; height: 100%; width: 30%; background: var(--accent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .exec-progress span { animation: none; width: 100%; } }
.exec-history { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0 0; }
.exec-history button { margin: 0; padding: 3px 9px; font-size: .75rem; border-radius: 999px; color: var(--fg);
  background: var(--chip-none); border: 1px solid transparent; }
.exec-history button.ok { background: var(--chip-ok); } .exec-history button.warn { background: var(--badge-m); }
.exec-history button.error { background: var(--chip-no); } .exec-history button.running { background: var(--code); }
.exec-history button[aria-current="true"] { border-color: var(--accent); font-weight: 700; }
.execution.flash { animation: flash .6s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px var(--accent); } to { box-shadow: 0 4px 14px rgba(0,0,0,.12); } }
#exec-onetrust { counter-reset: call; }
#exec-onetrust li { counter-increment: call; }
#exec-onetrust li::before { content: counter(call) ". "; font-weight: 700; color: var(--muted); }
.when { font-size: .66rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }
.when.always { background: var(--chip-ok); color: var(--ok); } .when.maybe { background: var(--chip-none); color: var(--muted); }
aside.endpoints ol { padding-left: 18px; margin: 0; }
aside.endpoints ol li { margin-bottom: 8px; }

/* Receipt translated into real data. */
#form-receipt input { max-width: 360px; }
#form-receipt button { margin-top: 0; }
.receipt-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0; }
.receipt-meta dt { color: var(--muted); }
.receipt-meta dd { margin: 0; font-weight: 600; word-break: break-all; }

/* --- Modern technological look (header, panels, controls) -------------------------------- */
.brand { padding-top: 28px; }
.brand-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand-mark { width: 44px; height: 44px; flex: 0 0 auto; filter: drop-shadow(0 0 10px rgba(34, 211, 238, .35)); }
.brand h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.02em; font-weight: 800;
  background: linear-gradient(90deg, var(--fg), var(--accent) 70%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-org { margin: 2px 0 0; color: var(--muted); font-size: .9rem; letter-spacing: .02em; }
.brand-tag { margin-left: auto; font: 600 .72rem/1 var(--mono); text-transform: uppercase; letter-spacing: .12em;
  padding: 7px 10px; border-radius: 999px; color: var(--accent); border: 1px solid rgba(34, 211, 238, .35);
  background: rgba(34, 211, 238, .08); }
.lead { max-width: 900px; margin-top: 14px; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--glow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
h2 { font-size: 1.05rem; letter-spacing: .01em; }
h2::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; vertical-align: 2px;
  border-radius: 2px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 8px var(--accent); }
code, pre, .exec-path, .exec-method, #exec-request, #exec-response { font-family: var(--mono); }
code { background: var(--code); border: 1px solid var(--line); }
input, select { background: var(--code); color: var(--fg); border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .2); }
button { border-radius: 8px; font-weight: 600; color: #04121a;
  background: linear-gradient(135deg, var(--accent), #38bdf8); box-shadow: 0 6px 18px rgba(34, 211, 238, .25);
  transition: transform .12s, box-shadow .12s, filter .12s; }
button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 8px 22px rgba(34, 211, 238, .35); }
button.secondary { background: transparent; color: var(--accent); border: 1px solid rgba(34, 211, 238, .45); box-shadow: none; }
table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
th, td { border-bottom-color: var(--line); }
.execution { border-color: rgba(34, 211, 238, .45); background: linear-gradient(180deg, rgba(10, 18, 36, .92), rgba(13, 21, 41, .92)); }
@media (prefers-color-scheme: light) {
  .execution { background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(240, 246, 252, .96)); }
  button { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
}
.exec-method.GET { background: linear-gradient(135deg, #10b981, #059669); }
.exec-method.POST { background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.exec-step { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04121a; }
.exec-col pre, #responses pre { border: 1px solid var(--line); }
.capture-form { background: var(--code); }
.rule { border-left-color: var(--accent-2); }

/* Console blocks: high contrast and colored JSON (keys, strings, numbers, keywords). */
.exec-col pre, #responses pre { background: #020617; color: #f1f5f9; border: 1px solid #334155;
  font-size: .82rem; line-height: 1.5; padding: 10px 12px; }
.j-key { color: #7dd3fc; } .j-str { color: #86efac; } .j-num { color: #fcd34d; } .j-kw { color: #f0abfc; font-weight: 600; }
.exec-col h3, aside.endpoints h3 { color: #cbd5e1; }
#exec-onetrust, #exec-onetrust .note { color: #dbe4f3; }
@media (prefers-color-scheme: light) {
  .exec-col pre, #responses pre { background: #0f172a; color: #f8fafc; border-color: #1e293b; }
  .exec-col h3, aside.endpoints h3 { color: #334155; }
  #exec-onetrust, #exec-onetrust .note { color: #1e293b; }
}

/* Channel logic guide: collapsible, closed by default. */
.guide { margin: 16px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  box-shadow: var(--glow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.guide > summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; }
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary::before { content: "▸"; color: var(--accent); transition: transform .15s; }
.guide[open] > summary::before { transform: rotate(90deg); }
.guide > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 14px; }
.guide-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.guide-body h3 { font-size: .95rem; margin: 18px 0 6px; color: var(--accent); }
.guide-body li { margin-bottom: 4px; }
.guide-body table { display: table; }
.guide-body td { white-space: normal; }
.guide-lead { margin-top: 14px; }

/* Guide phases: explanation on the left, the key function on the right; stacked on narrow screens. */
.phase { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start;
  margin: 14px 0 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.phase-text h3 { margin-top: 0; }
.phase-code { position: sticky; top: 8px; }
.phase-code pre { background: #020617; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px; padding: 10px 12px;
  overflow: auto; font-size: .76rem; line-height: 1.5; max-height: 420px; margin: 0 0 10px; }
.phase-code code { background: none; border: 0; padding: 0; }
@media (max-width: 960px) { .phase { grid-template-columns: 1fr; } .phase-code { position: static; } }

.phase-code:empty { display: none; }
.phase:has(.phase-code:empty) { grid-template-columns: 1fr; }
