:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #637083;
  --line: #d9dee7;
  --primary: #116a9c;
  --primary-dark: #0d527a;
  --danger: #a43838;
  --paid: #137a4b;
  --pending: #8a6412;
  --failed: #a43838;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav form {
  margin: 0;
}

.page {
  width: min(1120px, calc(100vw - 32px));
  margin: 28px auto;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0 0 14px;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 17px;
}

.muted,
.status {
  color: var(--muted);
}

.panel,
.table-shell {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel.narrow {
  max-width: 520px;
  margin: 72px auto 0;
}

.login-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.login-panel {
  position: sticky;
  top: 18px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin-bottom: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.facts {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.grid-form,
.stack {
  display: grid;
  gap: 14px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.setup-action {
  margin-bottom: 18px;
}

.callback-window {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f6f8;
}

.callback-window div {
  display: grid;
  gap: 4px;
}

.callback-window code {
  overflow-wrap: anywhere;
  color: var(--text);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

input,
select {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkline input {
  min-height: auto;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  color: var(--primary);
}

.full {
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f5;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.badge.paid {
  background: #e4f4ec;
  color: var(--paid);
}

.badge.pending {
  background: #fff2d7;
  color: var(--pending);
}

.badge.failed,
.badge.cancelled {
  background: #f9e6e6;
  color: var(--failed);
}

.json,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.json {
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f6f8;
}

.pay-panel {
  text-align: center;
}

.amount {
  margin: 12px 0;
  font-size: 36px;
  font-weight: 800;
}

.qr-block {
  margin: 16px auto;
}

.qr-block img {
  width: min(260px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
}

@media (max-width: 760px) {
  .topbar,
  .toolbar,
  .login-grid,
  .detail-grid {
    display: grid;
  }

  .nav {
    flex-wrap: wrap;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .login-grid {
    grid-template-columns: 1fr;
  }

  .login-panel {
    position: static;
  }

  .table-shell {
    overflow-x: auto;
  }
}
