/* The backend wizard. Shares the tokens in styles.css; only the shape of a
   form is its own, because nothing else in this app is one. */

.setup-page { padding-bottom: 60px; }

.grow { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }

.warn-strip,
.err-strip {
  margin: 0;
  padding: 9px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.warn-strip { background: #fff8e1; color: #7a5b00; }
.err-strip { background: #fdecea; color: #a2261a; }

.wizard { max-width: 880px; margin: 0 auto; padding: 20px 18px; }

/* The three steps, always visible: a wizard that hides step 3 until step 2 is
   answered also hides what step 2 was for. */
.steps {
  display: flex;
  gap: 10px;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.steps li b {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
  font-size: 11px;
}
.steps li.done { color: var(--ink); border-color: var(--accent); }
.steps li.done b { background: var(--accent); color: #fff; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 15px; }
.card h3 { margin: 20px 0 4px; font-size: 13px; }
.lede { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.5; max-width: 62ch; }
.lede code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; }

/* Stacked, unlike the inline .field the toolbars use: these carry a note under
   them and a row of label-input-note reads as three columns of nothing. */
.setup-page .field {
  display: grid;
  gap: 4px;
  align-items: start;
  margin-bottom: 12px;
}
.setup-page .field > span { font-size: 12px; font-weight: 600; color: var(--ink); }
.setup-page .field input { width: 100%; min-width: 0; }
.setup-page .field em { font-style: normal; font-size: 11.5px; color: var(--muted); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 620px) { .pair { grid-template-columns: 1fr; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }

.row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

/* What the backend answered, step by step, whether or not it went well. */
.steps-out { list-style: none; margin: 16px 0 0; padding: 0; font-size: 12.5px; }
.steps-out li {
  display: grid;
  grid-template-columns: 18px 130px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.steps-out li b { font-weight: 600; color: var(--ink); }
.steps-out li span { color: var(--muted); word-break: break-word; }
.steps-out .mark { font-weight: 700; }
.steps-out .ok .mark { color: #1e8449; }
.steps-out .no .mark { color: #c0392b; }

.sample { margin-top: 12px; font-size: 12px; }
.sample summary { cursor: pointer; color: var(--accent); }
.sample pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  max-height: 340px;
  font-size: 11.5px;
  line-height: 1.5;
}

/* One row per field this app reads: what it is, what it is read as, and which
   of the backend's own fields arrives under it. */
.map { display: grid; gap: 0; }
.map-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px 16px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.map-row:first-child { border-top: 0; }
.map-row .what { display: grid; gap: 2px; }
.map-row .what b { font-size: 13px; font-weight: 600; }
.map-row .what em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.map-row .what code { font-size: 11px; color: var(--muted); }
.map-row select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.map-row.need select { border-color: var(--accent); }
.map-row.guessed select { background: #fffbe6; }
@media (max-width: 620px) { .map-row { grid-template-columns: 1fr; } }

.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

a.ghost {
  display: inline-block;
  text-decoration: none;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
a.ghost:hover { background: #eef3fd; }

/* The shelf of stored backends, above the steps: which one is in use, and the
   two things to do with the list. */
.stored-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; }
.setup-page .field.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.setup-page .field.inline select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-width: 260px;
}
.stored-bar button:disabled { opacity: .45; cursor: default; }

/* The readings a history request came back with, as they would be plotted. */
.readings { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12px; }
.readings th, .readings td {
  text-align: left;
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.readings th { color: var(--muted); font-weight: 600; }
.readings td.blank { color: #c0392b; font-style: italic; }

/* Anything else a request has to carry: a name, a value, and a way to be rid
   of it. */
.extras { display: grid; gap: 8px; margin: 4px 0 10px; }
.extra-row { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 8px; align-items: center; }
.extra-row input {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}
.extra-row button {
  padding: 4px 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.extra-row button:hover { color: #c0392b; filter: none; }

/* What actually went out, under the step it belongs to. */
.wire { margin: 6px 0 0; grid-column: 3; }
.wire summary { cursor: pointer; color: var(--accent); font-size: 11.5px; }
.wire pre {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* A parameter this service has a name for: the box, and a × to send nothing
   under that name at all. */
.named-line { display: grid; grid-template-columns: 1fr 22px; gap: 6px; align-items: center; }
.named-line button {
  padding: 3px 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.named-line button:hover { color: #c0392b; filter: none; }
.field.off > span { color: var(--muted); font-weight: 400; }
.field.off input { border-style: dashed; color: var(--muted); }

/* What a free parameter's value may carry. Close to the list it applies to. */
.tokens { margin: 2px 0 10px; font-size: 12px; }
.tokens code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; }

/* The request that is about to be made, above the button that makes it. */
.wire-preview {
  margin: 0 0 8px;
  padding: 9px 11px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--ink);
}
.wire-preview:empty { display: none; }
