:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warn: #f59e0b;
  --error: #ef4444;
  --step-done: #1e3a2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.status-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

.status-bar span {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.status-bar .ok {
  border-color: var(--success);
  color: var(--success);
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-tab {
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.nav-tab:hover {
  color: var(--text);
  border-color: var(--muted);
}

.nav-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.panel.active {
  display: flex;
}

.section-desc {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.flow-hint {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.card.done {
  border-color: #2d5a45;
  background: linear-gradient(180deg, var(--step-done) 0%, var(--surface) 120px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.card.done .step-num {
  background: var(--success);
}

.card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

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

button,
.btn-link {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

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

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover:not(:disabled) {
  border-color: var(--muted);
}

button.danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}

button:disabled,
.btn-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-link {
  background: var(--success);
  color: #fff;
}

.info-box {
  font-size: 0.8rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-top: 0.75rem;
  word-break: break-all;
}

.info-box strong {
  color: var(--muted);
  font-weight: 500;
}

.log {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 280px;
  overflow-y: auto;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}

.log-entry {
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.log-entry .time {
  color: var(--muted);
}

.log-entry.error {
  color: var(--error);
}

.log-entry.success {
  color: var(--success);
}

.tx-list,
.item-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tx-item,
.list-item {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
}

.tx-item:hover,
.tx-item.selected,
.list-item:hover,
.list-item.selected {
  border-color: var(--accent);
  background: var(--bg);
}

.binding-item.inactive {
  opacity: 0.7;
}

.detail-panel {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-text {
  color: var(--error);
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.badge.PROCESSING {
  background: #1e2a3a;
  color: var(--accent);
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--border);
  margin-left: 0.35rem;
}

.badge.DEPOSITED,
.badge.APPROVED {
  background: #1e3a2f;
  color: var(--success);
}

.badge.FAILED,
.badge.DECLINED {
  background: #3a1e1e;
  color: var(--error);
}
