:root {
  /* Fixed light palette in two layers. Brand colours (paper, ink, primary) are
     for recognition only; meaning colours (ok, caution, danger) are for money
     state only, always with a symbol and words. Contrast: ink on surface 14.9:1,
     muted 7.4:1, white on primary 14.9:1, ok on its tint 5.6:1, caution on its
     tint 6.1:1, danger on its tint 6.1:1. */
  color-scheme: only light;
  --paper: #f4f1ea;
  --surface: #fdfcf9;
  --ink: #1f2a24;
  --ink-muted: #4b5563;
  --rule: #e3ded3;
  --primary: #1f2a24;
  --on-primary: #ffffff;
  --focus: #c2410c;
  /* behind-the-scenes panel, after the brand banner: one orange signal, peach chips */
  --signal: #c2410c;
  --chip: #f4e1d2;
  --panel: #efeadf;
  --ok: #1e6b43;
  --ok-bg: #e7f0e8;
  --ok-line: #7fae8f;
  --caution: #7a4f05;
  --caution-bg: #f8eccb;
  --caution-line: #c9952b;
  --danger: #a3261c;
  --danger-bg: #f9e6e2;
  --danger-line: #d98b80;
  --neutral-bg: #e9e5dc;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Roboto Mono", "SF Mono", monospace;
}

* {
  box-sizing: border-box;
}

/* hidden always wins over a component's own display */
[hidden] {
  display: none !important;
}

html,
body {
  /* a pull at the top never reloads the page and ends the session */
  overscroll-behavior-y: contain;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

main {
  max-width: 30rem;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

p {
  margin: 6px 0;
}

/* brand bar: whose refunds these are, and that no real money moves */
.brand {
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--rule);
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wordmark {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.mode-pill {
  font: 700 14px/1 var(--sans);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--caution-bg);
  color: var(--caution);
}

.identity {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* every screen starts clear of the header */
.view {
  padding-top: 8px;
}

.status {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-weight: 600;
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 14px 0 6px;
}

h2 {
  font-size: 1.1rem;
  margin: 12px 0 8px;
}

.question {
  font-size: 1.45rem;
  margin: 10px 0 4px;
}

.question:focus {
  outline: none;
}

.eyebrow {
  margin: 14px 0 0;
  font: 700 14px/1.4 var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ok);
}

.lead {
  color: var(--ink-muted);
}

.footnote {
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-muted);
}

.muted {
  color: var(--ink-muted);
}

.small {
  font-size: 14px;
}

.strong {
  font-weight: 700;
}

.center {
  text-align: center;
}

.ok-text {
  color: var(--ok);
}

.caution-text {
  color: var(--caution);
}

.danger-text {
  color: var(--danger);
}

.big-number {
  margin: 4px 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.reference {
  font: 700 16px/1.4 var(--mono);
  letter-spacing: 0.02em;
}

/* cards */
.card {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 12px 16px;
  margin: 12px 0;
}

.who-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.box-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.caution-box {
  background: var(--caution-bg);
  border: 1.5px solid var(--caution-line);
}

.caution-box .box-title {
  color: var(--caution);
}

.danger-box {
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-line);
}

.danger-box .box-title {
  color: var(--danger);
}

.ok-box {
  background: var(--ok-bg);
  border: 1.5px solid var(--ok-line);
}

.held {
  background: var(--neutral-bg);
}

/* pills: one meaning each, always with words */
.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font: 700 14px/1.4 var(--sans);
  white-space: nowrap;
}

.ok-pill {
  background: var(--ok-bg);
  color: var(--ok);
}

.caution-pill {
  background: var(--caution-bg);
  color: var(--caution);
}

.danger-pill {
  background: var(--surface);
  color: var(--danger);
  border: 1.5px solid var(--danger-line);
}

.neutral-pill {
  background: var(--surface);
  color: var(--ink);
}

/* home */
.section-title {
  margin: 22px 0 6px;
  font: 700 14px/1.4 var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

button.request-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-height: 0;
  text-align: left;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 700;
}

.card-amount {
  font-variant-numeric: tabular-nums;
}

.notice .pill {
  margin-bottom: 4px;
}

/* label and value lines */
.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--rule);
  font-variant-numeric: tabular-nums;
}

.row:last-child {
  border-bottom: none;
}

.row-label {
  color: var(--ink-muted);
}

.row-value {
  text-align: right;
  font-weight: 600;
}

button.row-button {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 9px 0;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--rule);
  border-radius: 0;
  font-weight: 400;
  color: var(--ink);
  text-align: left;
}

/* payment details expand in place, without leaving the decision */
.details summary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 48px;
  cursor: pointer;
  list-style: none;
}

.details summary::after {
  content: "Show";
  align-self: flex-end;
  margin-top: -40px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.details[open] summary::after {
  content: "Hide";
}

.details[open] summary {
  margin-bottom: 6px;
}

/* the decision stays under the thumb while the facts scroll */
.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px -16px 0;
  padding: 8px 16px 12px;
  background: var(--paper);
  border-top: 1px solid var(--rule);
}

.actions button {
  margin-top: 0;
}

.actions p {
  flex-basis: 100%;
}

/* the done screen's next steps: one primary, one secondary, spaced and aligned */
.done-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.done-actions button {
  margin: 0;
}

label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  font: inherit;
  padding: 8px 12px;
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}

/* buttons hug their label with comfortable padding instead of stretching
   across the screen; cards and list rows that open stay full width */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 56px;
  padding: 0 24px;
  margin-top: 10px;
  font: inherit;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
}

button.primary {
  background: var(--primary);
  color: var(--on-primary);
  border: 1.5px solid var(--primary);
}

button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

button.link,
button.back {
  width: auto;
  min-height: 48px;
  margin: 4px 0 0;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

button.link {
  color: var(--primary);
}

button.back {
  color: var(--ink-muted);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* progress and problems shown where the eyes are, above the buttons */
.progress {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-weight: 600;
}

.progress.problem {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger);
}

.quote {
  margin: 6px 0 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--rule);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
}

/* the record, oldest first */
.timeline {
  list-style: none;
  margin: 16px 0;
  padding: 0;
}

.timeline-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 18px 24px;
  border-left: 2px solid var(--rule);
  margin-left: 5px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ink);
}

.timeline-item:last-child {
  border-left-color: transparent;
}

/* sending: an honest wait for PayPal's answer, no invented steps */
.sending {
  text-align: center;
  padding: 48px 0;
}

.spinner {
  display: inline-block;
  width: 56px;
  height: 56px;
  border: 5px solid var(--rule);
  border-top-color: var(--ink);
  border-radius: 999px;
  animation: turn 1s linear infinite;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.reference-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-row .link {
  margin: 0;
}

.card.center .pill {
  margin-bottom: 4px;
}

#freshness,
#live-line {
  margin: 2px 0;
}

/* loading placeholders: card shapes only, never figures */
.skeleton {
  height: 84px;
  margin: 12px 0;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--rule) 0%, var(--surface) 50%, var(--rule) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton.short {
  height: 56px;
  width: 70%;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

/* the send tracker: done is ticked, the current step is marked, the rest wait */
.tracker {
  list-style: none;
  padding: 8px 16px;
}

.tracker li {
  position: relative;
  padding: 10px 0 10px 32px;
  color: var(--ink-muted);
}

.tracker li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--rule);
  box-sizing: border-box;
}

.tracker li.active {
  color: var(--ink);
  font-weight: 700;
}

.tracker li.done {
  color: var(--ok);
  font-weight: 700;
}

.tracker li.done::before,
.tracker li.active::before {
  display: none;
}

/* notices about server-reported changes, clear of the decision buttons */
.toasts {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: min(30rem, calc(100% - 32px));
  z-index: 10;
}

.toast {
  margin: 0 0 8px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(31, 42, 36, 0.2);
  animation: rise 0.2s ease-out;
}

button.busy {
  opacity: 0.85;
}

.view:not([hidden]) {
  animation: rise 0.16s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .tracker li.active::before,
  .toast,
  .view:not([hidden]) {
    animation: none;
  }
}

/* Material icons drawn inline; size follows the text around them */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: currentColor;
}

.has-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

p.has-icon,
.box-title.has-icon {
  display: flex;
}

button.has-icon {
  display: inline-flex;
  justify-content: center;
}

button.back.has-icon,
button.link.has-icon {
  display: inline-flex;
  justify-content: flex-start;
}

.pill .icon {
  width: 16px;
  height: 16px;
}

.row-value.has-icon {
  justify-content: flex-end;
}

.tracker li .icon {
  position: absolute;
  left: 0;
  top: 11px;
}

.tracker li.done .icon {
  color: var(--ok);
}

.icon.spin {
  animation: turn 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .icon.spin {
    animation: none;
  }
}

/* Dashboard summary: four figures of the same kind in tiles of one height,
   two by two on a phone. */
.summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 12px 14px;
}

.tile-label {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.tile-value {
  margin: 2px 0 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* on a phone a tile shows only its label and figure, so the requests that
   need a decision stay above the fold; the detail lines show on a laptop */
@media (max-width: 1023px) {
  .tile .small {
    display: none;
  }

  .tile {
    padding: 10px 12px;
  }

  /* what decides comes first on a small screen: the queue, then the summary
     tiles, then the rest */
  #home-body:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  .home-top,
  .home-grid {
    display: contents;
  }

  .home-grid > .section-title:first-child,
  #empty,
  #requests,
  #demo-button,
  #cant-send-section,
  #paused-section {
    order: 1;
  }

  .summary {
    order: 2;
  }

  #done-section,
  .fold,
  #stop-control,
  #refresh-button {
    order: 3;
  }

  #refresh-button,
  #demo-button {
    align-self: flex-start;
  }
}

/* settings are for reference, so they fold away on the dashboard */
.fold {
  margin-top: 16px;
}

.fold > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
}

/* cues that show what to do instead of telling: an arrow on anything that
   opens, a caution tile when something needs the merchant, and a step guide */
.request-card {
  position: relative;
  padding-right: 44px;
}

.card-go {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  fill: var(--ink-muted);
}

.request-card:hover,
.request-card:focus-visible {
  border-color: var(--ink);
}

.request-card:hover .card-go {
  fill: var(--ink);
}

.tile.attention {
  background: var(--caution-bg);
  border-color: var(--caution-line);
}

.tile.attention .tile-label,
.tile.attention .tile-value {
  color: var(--caution);
}

.steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 2px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-muted);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--ink-muted);
  border-radius: 50%;
  font-weight: 700;
}

.steps li:not(:last-child)::after {
  content: "";
  width: 20px;
  height: 1.5px;
  background: var(--rule);
}

.steps li.current {
  color: var(--ink);
  font-weight: 700;
}

.steps li.current::before {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-primary);
}

.steps li.done::before {
  content: "\2713";
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok);
}

.fold > summary {
  list-style: none;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: auto;
  margin-right: 6px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
}

.fold[open] > summary::after {
  transform: rotate(-135deg);
}

/* the stop button moves into the top bar on a laptop */
.header-stop {
  display: none;
}

/* Laptop and desktop: the same four-screen flow (dashboard, request, check and
   fingerprint, outcome), each screen centred at a comfortable width, with the
   emergency stop in a top bar that stays in view. */
@media (min-width: 1024px) {
  main {
    max-width: 60rem;
    padding: 0 32px 48px;
  }

  .brand {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "row stop"
      "who stop";
    column-gap: 24px;
    align-items: center;
    padding: 12px 0;
    background: var(--paper);
  }

  .brand-row {
    grid-area: row;
    justify-content: flex-start;
  }

  .identity {
    grid-area: who;
  }

  .header-stop {
    grid-area: stop;
    display: block;
    max-width: 22rem;
    text-align: right;
  }

  .header-stop button {
    min-height: 48px;
    margin: 0;
  }

  .header-stop p {
    margin: 4px 0 0;
  }

  #stop-control {
    display: none;
  }

  .summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }

  .tile-value {
    font-size: 1.6rem;
  }

  #review,
  #final,
  #sending,
  #outcome,
  #paused-view,
  #activity,
  #history,
  #signin,
  #enrol {
    max-width: 44rem;
    margin: 0 auto;
  }

  .actions {
    margin: 16px 0 0;
    padding: 12px 0;
  }
}

/* the visitor's own customer message on the demo screen */
textarea {
  font: inherit;
  resize: vertical;
}

#scenario-list .request-card {
  margin-top: 10px;
}

/* --- behind the scenes (hosted demo, for technical reviewers) --------------------
   After the brand banner: spaced monospace labels, numbered stage chips, dashed
   rules, crosshair corners and one orange signal. Merchants never see it. */
.trace-toggle {
  min-height: 40px;
  margin: 0 0 0 auto;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 700 14px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* until the panel is first opened: a pulsing ring and a hand pointing at it */
/* one line always; on a narrow phone the whole switch moves under the brand */
.trace-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.trace-toggle.cue {
  border-color: var(--signal);
  animation: trace-cue-ring 1.6s ease-out infinite;
}

/* an arrow drawn in CSS, so it looks the same on every device and font */
/* inside the switch, before its label, so it never covers the header on a phone */
.trace-toggle.cue::before {
  content: "";
  display: inline-block;
  flex: none;
  width: 22px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--signal);
  clip-path: polygon(0 35%, 55% 35%, 55% 0, 100% 50%, 55% 100%, 55% 65%, 0 65%);
  animation: trace-cue-hand 0.9s ease-in-out infinite alternate;
}

@keyframes trace-cue-ring {
  0% {
    box-shadow: 0 0 0 0 rgb(194 65 12 / 55%);
  }

  100% {
    box-shadow: 0 0 0 12px rgb(194 65 12 / 0%);
  }
}

@keyframes trace-cue-hand {
  from {
    transform: translateX(-4px);
  }

  to {
    transform: translateX(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .trace-toggle.cue,
  .trace-toggle.cue::before {
    animation: none;
  }

  .trace-toggle.cue {
    box-shadow: 0 0 0 4px rgb(194 65 12 / 35%);
  }
}

.trace-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--on-primary);
}

.trace {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  padding: 20px 20px 40px;
  background: var(--panel);
  color: var(--ink);
}

.trace::before,
.trace::after {
  content: "+";
  position: absolute;
  font: 400 18px/1 var(--mono);
  color: var(--signal);
}

.trace::before {
  top: 8px;
  left: 8px;
}

.trace::after {
  top: 8px;
  right: 8px;
}

/* pinned, so Close stays in reach however far the steps have scrolled */
.trace-head {
  position: sticky;
  top: -20px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -20px -20px 0;
  padding: 20px 20px 12px;
  background: var(--panel);
  border-bottom: 1.5px dashed var(--rule);
}

.trace-kicker,
.trace-stages li,
.trace-tag,
.trace-time,
.trace-ms,
.trace-close,
.trace-detail summary {
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trace-kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.trace-pill {
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--signal);
  color: var(--on-primary);
  font: 700 14px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trace-close {
  min-height: 40px;
  margin: 0 0 0 auto;
  padding: 0 12px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
}

.trace-links {
  margin: 12px 0 0;
}

.trace-stages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 6px;
  padding: 0;
  list-style: none;
}

.trace-stages li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 8px;
  border: 1.5px dashed var(--rule);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-muted);
}

.trace-stages li span {
  flex: none;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--ink);
  font-weight: 700;
}

.trace-stages li b {
  display: grid;
  gap: 2px;
  font-weight: 700;
}

.trace-stages li small {
  font: 400 14px/1.3 var(--sans, inherit);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-muted);
}

.trace-stages li.seen {
  border-style: solid;
  color: var(--ink);
}

.trace-stages li.active {
  border-color: var(--signal);
  box-shadow: inset 0 0 0 1px var(--signal);
}

.trace-note {
  margin: 8px 0 14px;
  font-size: 14px;
  color: var(--ink-muted);
}

.trace-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-step {
  padding: 10px 0;
  border-top: 1.5px dashed var(--rule);
}

.trace-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.trace-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font: 700 14px/1 var(--mono);
  background: var(--ok-bg);
  color: var(--ok);
}

.trace-step.warn .trace-mark {
  background: var(--caution-bg);
  color: var(--caution);
}

.trace-step.fail .trace-mark {
  background: var(--danger-bg);
  color: var(--danger);
}

.trace-time,
.trace-ms {
  font-size: 14px;
  color: var(--ink-muted);
}

.trace-ms {
  margin-left: auto;
}

.trace-tag {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--chip);
  font-size: 14px;
  font-weight: 700;
}

.trace-tag.layer-paypal {
  background: var(--surface);
  border: 1px solid var(--ink);
}

/* long PayPal paths and ids break inside the panel instead of widening it */
.trace-title,
.trace-headline,
.trace-safe {
  overflow-wrap: anywhere;
}

.trace-title {
  margin: 4px 0 0;
  font-weight: 700;
}

.trace-step.fail .trace-title {
  color: var(--danger);
}

.trace-safe {
  margin: 4px 0 0;
  padding: 4px 8px;
  border-left: 3px solid var(--ink);
  background: var(--surface);
  font-weight: 700;
}

.trace-outcome {
  margin: 12px 0;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--surface);
}

.trace-outcome.warn {
  border-color: var(--caution);
}

.trace-outcome.fail {
  border-color: var(--danger);
}

.trace-outcome .trace-kicker {
  color: var(--signal);
}

.trace-headline {
  margin: 6px 0 10px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.trace-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 14px;
  margin: 0;
  font: 14px/1.4 var(--mono);
}

.trace-facts dt {
  color: var(--ink-muted);
}

.trace-facts dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.trace-detail summary {
  min-height: 32px;
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
}

.trace-detail dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 12px;
  margin: 4px 0 0;
  font: 14px/1.4 var(--mono);
}

.trace-detail dt {
  color: var(--ink-muted);
}

.trace-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* laptop: the merchant app on the left, the backend on the right */
@media (min-width: 1024px) {
  body.trace-on {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 42%);
  }

  body.trace-on .trace {
    position: sticky;
    top: 0;
    inset: auto;
    height: 100vh;
    border-left: 1.5px dashed var(--rule);
  }

  body.trace-on main {
    width: 100%;
  }
}

/* a customer's own words: kept as written, long words wrap */
.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
