/* Satchel: one stylesheet, mobile first, no inline styles.
   Class names are shared with the markup in src/web/pages.rs; keep them. */

:root {
  --page: #080d17;
  --card: #101927;
  --ink: #f2f5fa;
  --muted: #a0afc2;
  --line: #243146;
  --field: #0b1320;
  --field-line: #40506a;
  --accent: #4385ff;
  --accent-hover: #65a0ff;
  --accent-ink: #ffffff;
  --accent-soft: #142a4e;
  --ok: #7ce3b2;
  --ok-bg: #123329;
  --error: #ffb3b3;
  --error-bg: #3c202a;
  --warn-bg: #101a2c;
  --warn-ink: #a4c5ff;
  --shadow: 0 12px 32px rgb(0 0 0 / 10%);
  --radius: 1.25rem;
  --radius-small: 0.75rem;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
  accent-color: var(--accent);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Elements styled with a display value below must still hide. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at 70% 0, #102142 0, transparent 36rem), var(--page);
  min-height: 100dvh;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

/* The test-network notice on every page. */
.banner {
  padding: 0.5rem 1rem;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.4;
}

/* A "TEST NETWORK" badge: the banner's lead text, or any element with .badge-test. */
.banner strong,
.badge-test {
  display: inline-block;
  margin: 0.1rem 0.35rem 0.1rem 0;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--warn-ink);
  color: var(--warn-bg);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

header.top,
main,
footer {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding: 0 1rem;
}

header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 1.75rem;
  height: 1.75rem;
  background: url("/assets/icon.svg") center / contain no-repeat;
}

.brand:hover {
  color: var(--ink);
}

header.top nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
}

header.top nav a,
header.top nav button.link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
}

header.top nav a,
header.top nav button.link {
  text-decoration: none;
}

header.top nav a:hover,
header.top nav button.link:hover {
  text-decoration: underline;
}

main {
  padding-bottom: 2rem;
}

footer {
  padding-bottom: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

h1 {
  margin: 0.75rem 0 1rem;
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

p {
  margin: 0 0 0.75rem;
}

.card {
  margin: 0 0 1rem;
  padding: 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card > :last-child {
  margin-bottom: 0;
}

/* Forms */
label {
  display: block;
  margin: 0.9rem 0 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
}

input,
textarea,
select,
button,
.button {
  font: inherit;
  border-radius: var(--radius-small);
}

input,
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--field-line);
  background: var(--field);
  color: var(--ink);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

textarea {
  resize: vertical;
}

textarea.code,
code.wrap {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

/* Buttons: filled for the main action, outlined for the rest. */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3.25rem;
  margin-top: 1rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #326de0, #1d58cd);
  color: var(--accent-ink);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

button:hover,
.button:hover {
  border-color: #4385ff;
  background: #1e58c3;
  color: var(--accent-ink);
}

button.secondary,
.button.secondary {
  background: #152033;
  border-color: #34435a;
  color: var(--ink);
}

button.secondary:hover,
.button.secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

button.link {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

button.link:hover {
  background: none;
  color: var(--accent-hover);
}

button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* The main action of a form spans the card on phones. */
form.card > button[type="submit"],
.card form > button[type="submit"] {
  width: 100%;
}

form.inline {
  display: inline;
}

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

.actions .button,
.actions button {
  margin-top: 0;
}

.with-suffix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.with-suffix input {
  flex: 1;
  min-width: 0;
}

.with-suffix span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Wallet summary: balance and Lightning Address. */
.summary .label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.summary .balance {
  margin: 0.35rem 0 1.5rem;
  font-size: clamp(2.5rem, 11vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.summary .address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.15rem;
}

.summary .address code {
  font-size: 0.9rem;
  font-weight: 500;
}

.summary .address button {
  min-height: 2.25rem;
  margin-top: 0;
  padding: 0.3rem 0.9rem;
}

details summary {
  margin-top: 0.75rem;
  color: var(--accent);
  cursor: pointer;
}

.qr {
  display: block;
  width: 100%;
  max-width: 18rem;
  height: auto;
  margin: 0.75rem auto;
  border-radius: var(--radius-small);
  /* The code has its own white quiet zone; keep it white in dark mode. */
  background: #ffffff;
}

/* The camera preview of the QR scanner on the Send form. */
video,
video.qr {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin: 0.75rem auto;
  border-radius: var(--radius);
  background: #000000;
}

.scan button {
  margin-top: 0.5rem;
}

progress {
  width: 100%;
}

/* Status messages */
.ok {
  color: var(--ok);
  font-weight: 600;
}

.error {
  color: var(--error);
  font-weight: 600;
}

p.ok,
p.error {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-small);
}

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

form + p.ok,
form + p.error,
.card form > button + p.muted {
  margin-top: 0.75rem;
}

p.error {
  background: var(--error-bg);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.nostr-status:empty {
  display: none;
}

.nostr button {
  width: 100%;
}

ul.warnings {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

ul.warnings li {
  margin: 0.3rem 0;
}

/* Payment history */
ul.history {
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.history li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

ul.history li:first-child {
  border-top: 0;
}

ul.history .what {
  overflow-wrap: anywhere;
}

ul.history .amount {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

ul.history .amount.in {
  color: var(--ok);
}

ul.history .when,
ul.history .state {
  color: var(--muted);
  font-size: 0.8rem;
}

ul.history .state {
  text-align: right;
}

/* Definition lists stack on phones and become two columns on wider screens. */
dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem 1rem;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.9rem;
}

dd {
  margin: 0 0 0.5rem;
  overflow-wrap: anywhere;
}

/* Operator pages */
form.search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

form.search label {
  width: 100%;
  margin: 0;
}

form.search input {
  flex: 1;
  width: auto;
  min-width: 10rem;
}

form.search button {
  margin-top: 0;
}

div.table {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

th,
td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.actions input {
  width: auto;
  min-height: 2.25rem;
  padding: 0.3rem 0.45rem;
}

td.actions button {
  min-height: 2.25rem;
  margin: 0.2rem 0;
  padding: 0.3rem 0.65rem;
}

tr.frozen {
  background: var(--error-bg);
}

@media (min-width: 40rem) {
  h1 {
    font-size: 1.8rem;
  }

  .card {
    padding: 1.25rem 1.5rem;
  }

  dl {
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.25rem;
  }

  dd {
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (forced-colors: active) {
  .banner strong,
  .badge-test {
    border: 1px solid CanvasText;
  }
}

/* Wallet and payment flow */
.ui-icon { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 10; padding: .75rem; background: var(--card); }
.skip-link:focus { top: 1rem; }
header.top nav { gap: .8rem; font-size: .85rem; }
header.top nav a, header.top nav button.link { color: var(--muted); font-weight: 500; }
header.top nav a[aria-current="page"] { color: var(--ink); }
.banner { font-size: .75rem; padding: .4rem .75rem; }
.banner strong { background: transparent; color: var(--warn-ink); font-size: .65rem; padding: 0; }
.banner span { color: var(--muted); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .5rem 0 1.25rem; }
.page-heading h1 { margin: 0; font-size: 1.4rem; }
.network-badge { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .65rem; border: 1px solid #2a4778; border-radius: 999px; color: #a4c5ff; background: #102344; font-size: .72rem; font-weight: 600; margin: 0; }
.status-dot { width: .35rem; height: .35rem; border-radius: 50%; background: #6b9fff; }
.summary { background: linear-gradient(135deg, #152541, #101927 75%); padding-top: 1.75rem; }
.summary .balance { letter-spacing: -.055em; font-weight: 600; }
.balance-unit { font-size: .45em; color: var(--muted); font-weight: 400; letter-spacing: -.01em; }
.wallet-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 0 0 1.5rem; }
.wallet-tabs button { margin: 0; }
.wallet-tabs [aria-selected="false"] { background: #152033; border-color: #34435a; color: var(--muted); }
.wallet-tabs [aria-selected="true"] { background: #2567e6; border-color: #4385ff; color: #fff; }
.wallet-panel { min-width: 0; }
.field-help { font-size: .8rem; margin: .35rem 0 0; }
textarea#send-to { font-family: var(--mono); font-size: .85rem; }
.eyebrow { color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.review-amount { font-size: 2.75rem; letter-spacing: -.04em; margin: .5rem 0 .75rem; }
.review-amount span { font-size: 1.25rem; color: var(--muted); font-weight: 400; }
.review-details { display: grid; grid-template-columns: minmax(6rem, auto) minmax(0, 1fr); gap: 1rem; padding: 1.5rem 0; margin: 1.5rem 0 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.review-details dd { margin: 0; text-align: right; font-size: .9rem; }
.review-details .total { font-weight: 700; }
.payment-review form button { width: 100%; }
.empty-state { padding: 1.5rem .25rem; text-align: center; }
.empty-state > .ui-icon { color: var(--muted); width: 2rem; height: 2rem; margin-bottom: .65rem; }
.empty-state p { margin-bottom: .25rem; }
ul.history li { padding: 1rem 0; }
ul.history .what { font-size: .9rem; }
footer { text-align: center; font-size: .75rem; padding-top: 1rem; }
footer p { margin-bottom: .2rem; }
footer a { display: inline-block; margin-top: .75rem; min-height: 2.75rem; }
.landing { padding: 2.5rem .25rem 1rem; max-width: 29rem; margin: 0 auto; }
.hero-icon { display: grid; place-items: center; width: 4rem; height: 4rem; background: #102344; border: 1px solid #284d87; border-radius: 1.2rem; margin-bottom: 2rem; color: #6b9fff; }
.hero-icon .ui-icon { width: 2rem; height: 2rem; }
.landing h1 { font-size: clamp(2.4rem, 8vw, 3rem); margin: 1.25rem 0; letter-spacing: -.055em; }
.landing .lead { color: var(--muted); line-height: 1.8; font-size: 1rem; }
.landing strong { color: var(--ink); font-weight: 500; }
.address-preview { padding: 1.25rem 0; margin-top: 1rem; border-top: 1px solid var(--line); }
.address-preview span, .address-preview code { display: block; }
.address-preview code { color: var(--ink); font-size: .85rem; margin-top: .4rem; }
.hero-actions { margin-top: 2rem; }
.hero-actions .button { width: 100%; margin: 0 0 .75rem; }
.hero-actions p { text-align: center; font-size: .8rem; margin: .5rem 0 0; }
.operator-page main, .operator-page header.top, .operator-page footer { max-width: 60rem; }
@media (max-width: 25rem) {
  .card { padding: 1.15rem; }
  header.top nav { gap: .65rem; }
  .with-suffix input { flex-basis: 100%; }
  .banner span { display: none; }
}
