:root {
  color-scheme: dark;
  --background: #15151a;
  --panel: #202027;
  --surface: #282831;
  --border: #373740;
  --text: #fff3e3;
  --muted: #bfb8b8;
  --accent: #ff9f18;
  --green: #a2e8b4;
  --danger: #ffb0a5;
  font: 16px/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--background); }
a { color: var(--accent); text-decoration: none; }
button, select, input, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #ffc275; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: wait; }

.bar { border-bottom: 1px solid var(--border); }
.bar-inner, .nav-inner, main { width: min(100%, 43rem); margin: auto; }
.bar-inner { min-height: 3.7rem; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-size: 1.05rem; font-weight: 800; }
.brand-icon, .shortcut-icon { display: grid; place-items: center; border-radius: .65rem; color: var(--accent); background: #4b321a; }
.brand-icon { width: 1.8rem; height: 1.8rem; }
.profile { margin-left: auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .875rem; }
#back { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; color: var(--text); background: var(--surface); border: 0; border-radius: .6rem; font-size: 1.65rem; cursor: pointer; }

main { padding: 1rem 1rem calc(6.25rem + max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px))); }
.hero { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; border: 1px solid var(--border); border-radius: 1.2rem; background: var(--panel); }
.stack, .form { display: grid; gap: .8rem; }
.hero + .stack { margin-top: 1rem; }
.card { min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 1.05rem; background: var(--panel); }
.summary { display: flex; justify-content: space-between; align-items: start; gap: .75rem; }
.summary + .actions { margin-top: .85rem; }
h1, h2, h3, p, dl { margin: 0; }
h1 { font-size: 1.55rem; line-height: 1.15; letter-spacing: -.025em; }
h2 { font-size: 1.15rem; line-height: 1.3; }
h3 { font-size: 1rem; }
.muted, dt, small { color: var(--muted); }
small, dt { font-size: .875rem; }
.amount { font-size: 1.5rem; font-weight: 800; white-space: nowrap; }
.status { font-size: .875rem; font-weight: 700; color: var(--accent); }
.status.active { color: var(--green); }
.danger { color: var(--danger); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.shortcut { display: flex; gap: .6rem; align-items: center; min-height: 3.6rem; padding: .65rem; border: 1px solid var(--border); border-radius: .9rem; background: var(--panel); color: var(--text); font-size: .9rem; font-weight: 700; }
.shortcut-icon { width: 1.85rem; height: 1.85rem; flex: 0 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 2.8rem; padding: .52rem .8rem; border: 1px solid var(--border); border-radius: .75rem; background: var(--surface); color: var(--text); font-weight: 750; text-align: center; cursor: pointer; }
.button.primary { color: #241506; background: var(--accent); border-color: var(--accent); }
.button.wide { width: 100%; }
.button:hover, .shortcut:hover { filter: brightness(1.12); }
.facts, .rows { display: grid; gap: .55rem; }
.row, .facts div { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.rows .row + .row { border-top: 1px solid var(--border); padding-top: .55rem; }
.facts dd { text-align: end; margin: 0; }
.row > :last-child { text-align: end; }
.qr { width: min(100%, 17rem); height: auto; margin: auto; border-radius: .7rem; }
.formatted { white-space: pre-wrap; overflow-wrap: anywhere; }
.link-text { overflow-wrap: anywhere; font-size: .925rem; color: var(--accent); }
.form label { display: grid; gap: .3rem; }
.form input, .form select, .form textarea { width: 100%; padding: .6rem .7rem; min-height: 2.8rem; border-radius: .65rem; border: 1px solid var(--border); background: var(--background); color: var(--text); }
.loading { color: var(--muted); padding: .85rem .2rem; }

nav { position: fixed; z-index: 1; bottom: 0; width: 100%; background: #1b1b22; border-top: 1px solid var(--border); padding-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px)); }
.nav-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: .2rem; padding: .35rem .55rem; }
.nav-inner a { display: grid; place-content: center; justify-items: center; color: var(--muted); padding: .3rem .15rem; border-radius: .65rem; font-size: .875rem; }
.nav-inner a span { font-size: 1.25rem; line-height: 1.15; }
.nav-inner a[aria-current] { color: var(--accent); background: #3b2a1b; }
#notice { position: fixed; z-index: 2; bottom: calc(5.1rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); padding: .65rem .85rem; border: 1px solid var(--border); border-radius: .75rem; background: #352d32; box-shadow: 0 .5rem 1.5rem #0006; }

@media (min-width: 40rem) {
  main, .bar-inner { padding-inline: 1.45rem; }
  .card { padding: 1.15rem; }
  .shortcut { padding-inline: .85rem; }
}
