:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f6f8fb;
  --border: #dde3ea;
  --text: #101828;
  --text-soft: #475467;
  --primary: #155eef;
  --primary-dark: #004ee6;
  --success: #067647;
  --warning: #b54708;
  --danger: #b42318;
  --danger-deep: #7a271a;
  --muted: #98a2b3;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.06);
  --radius: 20px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  background: transparent;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.narrow-shell {
  width: min(760px, calc(100% - 32px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 28px;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.nav-logout {
  border: 0;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0;
}

.nav-logout:hover {
  color: var(--text);
}

.topnav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 32px;
  align-items: center;
  padding-top: 40px;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.hero h1 {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  max-width: 9ch;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-text {
  max-width: 36rem;
  color: var(--text-soft);
  font-size: 1.12rem;
  line-height: 1.6;
}

.hero-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

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

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

.button-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.status-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

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

.card-header h2,
.card h3 {
  margin: 0;
}

.small {
  font-size: 0.92rem;
}

.stack-lg,
.stack-md {
  display: flex;
  flex-direction: column;
}

.stack-lg {
  gap: 24px;
}

.stack-md {
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 600;
}

.field input,
.field select {
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.12);
}

.muted {
  color: var(--text-soft);
  line-height: 1.6;
}

.inline-note {
  padding: 14px 16px;
  background: var(--surface-alt);
  border-radius: 14px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.metric-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.metric-line:last-child {
  border-bottom: 0;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-muted,
.status-pending,
.status-received,
.status-converted {
  background: #eef2f6;
  color: #344054;
}

.pill-success,
.status-completed {
  background: #ecfdf3;
  color: var(--success);
}

.pill-warning,
.status-payout_pending,
.status-payout_failed {
  background: #fff7ed;
  color: var(--warning);
}

.status-failed {
  background: #fef3f2;
  color: var(--danger);
}

.status-dead_lettered {
  background: #7a271a;
  color: #fff;
}

.result-grid,
.detail-grid {
  display: grid;
  gap: 18px;
}

.result-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 0.82rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--surface-alt);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.timeline-item {
  position: relative;
  padding-left: 24px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.timeline-item.active::before {
  background: var(--primary);
}

.timeline-item.completed::before {
  background: var(--success);
}

.timeline-item.failed::before {
  background: var(--danger);
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 20px;
  width: 2px;
  height: calc(100% + 10px);
  background: var(--border);
}

.timeline-title {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ledger-entry {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--surface-alt);
}

.ledger-entry pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.feedback,
.empty-state {
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
}

.feedback-info {
  background: #eff8ff;
  color: var(--primary-dark);
}

.feedback-error {
  background: #fef3f2;
  color: var(--danger);
}

.feedback-success {
  background: #ecfdf3;
  color: var(--success);
}

.empty-state {
  background: var(--surface-alt);
  color: var(--text-soft);
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .hero,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topnav {
    flex-wrap: wrap;
  }
}
