:root {
  --paper: #f6f5f1;
  --surface: #ffffff;
  --ink: #18181b;
  --muted: #62626a;
  --line: #dddbd3;
  --soft: #efede7;
  --ok: #17784a;
  --warn: #9a6200;
  --bad: #b42318;
  --focus: #2f6fde;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141416;
    --surface: #1c1c1f;
    --ink: #ececee;
    --muted: #9b9ba3;
    --line: #2e2e33;
    --soft: #242428;
    --ok: #4cc38a;
    --warn: #e0a43a;
    --bad: #f0786a;
    --focus: #7aa7ff;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Top bar */
.bar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
  max-width: 1040px; margin: 0 auto; padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.id { display: flex; gap: 10px; align-items: baseline; }
.id strong { font-size: 16px; letter-spacing: -0.01em; }
.id span { color: var(--muted); }
.env { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Layout: order + environment on the left, payment methods on the right, log below. */
.layout {
  max-width: 1040px; margin: 0 auto; padding: 24px;
  display: grid; gap: 24px 32px;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  grid-template-areas: "order pay" "checks pay" "log log";
  align-items: start;
}
.order { grid-area: order; }
.pay { grid-area: pay; }
.checks { grid-area: checks; }
.log-panel { grid-area: log; }

h2 {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding-bottom: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.note { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* Form */
.row { display: flex; gap: 12px; }
.grow { flex: 1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select {
  width: 100%; min-height: 42px; padding: 8px 10px; font-size: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
input:disabled, select:disabled { opacity: 0.55; }
#amount { font-family: var(--mono); }
details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-size: 14px; }
summary span { color: var(--muted); font-size: 13px; margin-left: 6px; }
.customer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 12px; }
.customer .wide { grid-column: 1 / -1; }

/* Payment methods */
.how { font-size: 14px; color: var(--muted); margin-bottom: 14px; max-width: 60ch; }
.notice {
  font-size: 14px; padding: 10px 12px; margin-bottom: 16px;
  border-left: 3px solid var(--ink); background: var(--soft); border-radius: 0 6px 6px 0;
}
.notice.error { border-left-color: var(--bad); }
.method {
  display: grid; grid-template-columns: 1fr auto; gap: 12px 20px; align-items: center;
  padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.method + .method { margin-top: 10px; }
.method h3 { font-size: 16px; font-weight: 600; }
.method-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.wallet-mount, .status { grid-column: 1 / -1; }
.wallet-mount:empty { display: none; }
#hosted-panel { background: transparent; border-style: dashed; }

.action {
  min-height: 42px; padding: 0 16px; white-space: nowrap; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 6px;
  font-size: 14px; font-weight: 500;
}
.action.secondary { background: transparent; color: var(--ink); }
.action:hover:not(:disabled) { opacity: 0.85; }
.action:disabled { cursor: not-allowed; opacity: 0.35; }

.status {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 13px; color: var(--muted); overflow-wrap: anywhere;
  padding-top: 10px; border-top: 1px solid var(--soft);
}
.status::before {
  content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--line); transform: translateY(-1px);
}
.status[data-state="busy"]::before { background: var(--warn); }
.status[data-state="ready"]::before, .status[data-state="done"]::before { background: var(--ok); }
.status[data-state="ready"] { color: var(--ink); }
.status[data-state="done"] { color: var(--ok); font-weight: 500; }
.status[data-state="error"] { color: var(--bad); }
.status[data-state="error"]::before { background: var(--bad); }

/* Environment checks */
dl { margin: 0; font-size: 13px; }
dl > div { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--soft); }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
dd[data-state="ok"] { color: var(--ok); }
dd[data-state="warn"] { color: var(--warn); }
dd[data-state="bad"] { color: var(--bad); }
#origin { font-family: var(--mono); font-size: 12px; }

/* Log */
.log-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.log-head h2 { border: 0; margin: 0; }
.log-actions { display: flex; gap: 14px; padding-bottom: 8px; }
.link-button { background: none; border: 0; padding: 0; cursor: pointer; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover { color: var(--ink); }
pre {
  margin: 12px 0 0; padding: 14px; max-height: 380px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}

.foot {
  max-width: 1040px; margin: 0 auto; padding: 8px 24px 40px;
  display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted);
}

@media (max-width: 760px) {
  .bar, .layout, .foot { padding-left: 16px; padding-right: 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "order" "pay" "checks" "log"; gap: 28px; }
  .method { grid-template-columns: 1fr; }
  .action { width: 100%; }
}
