:root {
  color-scheme: dark;
  --bg: #10131a;
  --card: #181d27;
  --line: #2a3244;
  --text: #e6e9ef;
  --dim: #9aa4b8;
  --accent: #f7931a;
  --good: #3fbf7f;
  --bad: #e5534b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1rem 4rem;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 46rem;
  margin: 0 auto;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.lead {
  margin: 0 0 2rem;
  color: var(--dim);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

input {
  background: #0d1017;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  font: inherit;
  padding: 0.5rem 0.65rem;
  min-width: 8rem;
}

input[type="number"] {
  width: 9rem;
}

button {
  background: #222a38;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0.5rem 0.9rem;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1205;
  font-weight: 600;
}

.quote {
  color: var(--dim);
  min-height: 1.5rem;
}

/* The tabs above a list, and the pager under it. Both pages have lists. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.tabs button {
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
}

.tabs button.on {
  border-color: var(--accent);
  color: var(--accent);
}

.tabs .count {
  color: var(--dim);
  font-size: 0.85em;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
  color: var(--dim);
  font-size: 0.85rem;
}

/* The filters above a list: a row of labelled selects. */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--dim);
  font-size: 0.85rem;
}

.filters select {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
}

.swap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--card);
}

.swap-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.swap-id {
  color: var(--dim);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.badge {
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line);
  color: var(--dim);
}

.badge.good {
  border-color: var(--good);
  color: var(--good);
}

.badge.bad {
  border-color: var(--bad);
  color: var(--bad);
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

dt {
  color: var(--dim);
}

dd {
  margin: 0;
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.45rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--dim);
  font-weight: 500;
}

td {
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}

tr:last-child td {
  border-bottom: none;
}

tr.closed td {
  color: var(--dim);
}

/* The history is the maker's book rather than this page's swaps, so it starts
   folded away instead of pushing the swaps off the screen. */
#history summary {
  cursor: pointer;
}

#history summary h2 {
  display: inline;
  margin: 0;
}

#history details[open] summary {
  margin-bottom: 0.75rem;
}

/* The regtest-only tools at the foot of the page: they drive a stack, so they
   stay small and dim and out of the way of the swapping itself. */
.dev {
  padding: 0.9rem 1.25rem;
  font-size: 0.8rem;
}

.dev h2 {
  margin-bottom: 0.5rem;
  color: var(--dim);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dev .actions {
  margin-top: 0;
}

.dev button {
  padding: 0.3rem 0.6rem;
}

.dev .ok,
.dev .error {
  font-size: 0.8rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.error {
  color: var(--bad);
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

/* A deadline that is close enough to lose money by missing. */
.urgent {
  border-left: 3px solid var(--bad);
  padding-left: 0.6rem;
  font-weight: 600;
}

/* A bolt11 is long and wants selecting whole, not scrolling through. */
.bolt11 {
  margin: 0.5rem 0 0;
  padding: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--dim);
  font-size: 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
}

/* The link, the control that copies, and the value they act on.

   The URI is not printed: a bolt11 is 300 characters that already sit above
   this row in full, so the link only has to be clickable and the copy control
   only has to give the value a form will accept. */
.pay-row {
  align-items: center;
  display: flex;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
}

.pay-link,
.copy {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--dim);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
}

.pay-link {
  text-decoration: none;
}

.copy {
  cursor: pointer;
}

.copy:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* A value a wallet's own field wants pasted into it: no scheme, no query, and
   short enough to show in full. */
.raw {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--dim);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  margin: 0.5rem 0 0;
  overflow-wrap: anywhere;
  padding: 0.6rem;
  user-select: all;
}

/* A payment code, drawn as SVG: dark on white whatever the page is doing, and
   sized so a phone has something to read. Scanned, not admired. */
.qr {
  margin: 0.75rem 0 0;
}

.qr svg {
  background: #fff;
  border-radius: 8px;
  display: block;
  height: auto;
  max-width: 100%;
  width: 12rem;
}

/* A value that exists to be copied out whole - a preimage, an address, an
   outpoint - and that a second click would only select in part. One click
   selects all of it. */
.preimage {
  user-select: all;
}

.ok {
  color: var(--good);
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

footer {
  color: var(--dim);
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* Links on the app page: the two help pages, kept out of the way of the form
   they sit above. */
.help-links {
  color: var(--dim);
  font-size: 0.85rem;
  margin: -0.5rem 0 0;
}

.help-links span {
  margin: 0 0.35rem;
}

a {
  color: var(--accent);
}

/* Help pages: prose that is read rather than used, so it is narrower than the
   app and its headings need room above them. */
.doc {
  max-width: 40rem;
}

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 0.85rem;
}

.doc h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.2rem;
}

.doc h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1rem;
}

.doc p,
.doc li {
  color: var(--text);
}

.doc ul,
.doc ol {
  padding-left: 1.25rem;
}

.doc li {
  margin: 0.3rem 0;
}

.doc code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.doc pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0.75rem 0;
  overflow-x: auto;
  padding: 0.85rem 1rem;
}

.doc pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  white-space: pre;
}

.doc ol.steps {
  padding-left: 1.5rem;
}

.doc ol.steps li {
  margin: 0.5rem 0;
}

.doc table {
  font-size: 0.85rem;
}

.doc td {
  font-family: inherit;
  vertical-align: top;
}
