/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #1a56db;
  --primary-light: #eff6ff;
  --primary-hover: #1547c0;
  --text:          #111827;
  --text-muted:    #6b7280;
  --text-light:    #9ca3af;
  --border:        #e5e7eb;
  --border-focus:  #93c5fd;
  --surface:       #ffffff;
  --surface-alt:   #f9fafb;
  --success:       #059669;
  --success-bg:    #ecfdf5;
  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --danger:        #ef4444;
  --danger-bg:     #fef2f2;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --font:          'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  color: var(--text);
  background: #f3f4f6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ───────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.header-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ─── Main Layout ──────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Step Bar ─────────────────────────────────────────────────── */
.steps-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 16px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  min-width: 72px;
}

.step span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-light);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.step.active .step-circle {
  background: var(--primary);
  color: #fff;
}

.step.active span { color: var(--primary); }

.step.done .step-circle {
  background: var(--success);
  color: #fff;
}

.step.done span { color: var(--success); }

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-bottom: 20px;
  max-width: 80px;
}

/* ─── Card ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 28px 28px 0;
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.card-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.card-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.card-footer.space-between { justify-content: space-between; }

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s, opacity 0.15s, box-shadow 0.15s;
  line-height: 1;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

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

.btn-primary:not(:disabled):hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(26,86,219,0.3); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:not(:disabled):hover { background: var(--primary-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-ghost:not(:disabled):hover { background: var(--surface-alt); color: var(--text); }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--surface-alt); }

/* ─── Drop Zone ────────────────────────────────────────────────── */
.drop-zone {
  margin: 24px 28px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 44px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drop-zone-icon { margin-bottom: 4px; }

.drop-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.drop-sub {
  font-size: 0.82rem;
  color: var(--text-light);
}

.drop-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ─── File Info ────────────────────────────────────────────────── */
.file-info {
  margin: -8px 28px 0;
}

.file-info-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm);
}

.file-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.file-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-info-inner > div { flex: 1; }

/* ─── Summary Row ──────────────────────────────────────────────── */
.summary-row {
  display: flex;
  gap: 12px;
  padding: 20px 28px 0;
  flex-wrap: wrap;
}

.summary-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.summary-chip .chip-count {
  font-weight: 700;
  font-size: 1rem;
}

.chip-eth  { color: #5c6bc0; border-color: #c5cae9; background: #e8eaf6; }
.chip-snt  { color: #0288d1; border-color: #b3e5fc; background: #e1f5fe; }
.chip-dai  { color: #f9a825; border-color: #ffe082; background: #fffde7; }
.chip-usdc { color: #059669; border-color: #a7f3d0; background: #ecfdf5; }
.chip-usdt { color: #0f766e; border-color: #99f6e4; background: #ecfeff; }
.chip-total { color: var(--text); }

/* ─── Table ─────────────────────────────────────────────────────── */
.table-wrap {
  margin: 20px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 380px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

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

.data-table tr.row-stablecoin td { background: #f0fdf4; }
.data-table tr.row-stablecoin:hover td { background: #dcfce7; }

.data-table td:first-child,
.data-table th:first-child {
  color: var(--text-light);
  font-size: 0.74rem;
  width: 40px;
}

.cell-address {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge-eth  { background: #e8eaf6; color: #3949ab; }
.badge-snt  { background: #e1f5fe; color: #0277bd; }
.badge-dai  { background: #fffde7; color: #f57f17; }

.token-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.token-badge.eth { background: #e8eaf6; color: #3949ab; }
.token-badge.snt { background: #e1f5fe; color: #0277bd; }
.token-badge.dai { background: #fffde7; color: #f57f17; }
.token-badge.usdc { background: #ecfdf5; color: #047857; }
.token-badge.usdt { background: #ecfeff; color: #0f766e; }

/* ─── Rates ─────────────────────────────────────────────────────── */
.rates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 24px 28px;
}

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

.rates-section {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.rates-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.rates-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.rates-dot.crypto { background: var(--primary); }
.rates-dot.fx     { background: #059669; }

.rates-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 14px;
}

.rate-rows { display: flex; flex-direction: column; gap: 12px; }

.stablecoin-note {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.rate-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rate-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s;
}

.input-wrap:focus-within { border-color: var(--primary); }

.input-prefix {
  padding: 8px 10px;
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  user-select: none;
}

.input-wrap input {
  border: none;
  outline: none;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  width: 100%;
  background: transparent;
}

/* ─── Currency Rate Table ───────────────────────────────────────── */
.currency-rates-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 10px;
}

.crate-header {
  display: grid;
  grid-template-columns: 100px 1fr 32px;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crate-row {
  display: grid;
  grid-template-columns: 100px 1fr 32px;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}
.crate-row:last-child { border-bottom: none; }

.crate-row input[type="text"],
.crate-row input[type="number"] {
  border: 1.5px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 0.82rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.crate-row input:focus { border-color: var(--primary); }

.crate-row input[type="text"] {
  font-weight: 600;
  text-transform: uppercase;
}

.crate-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.crate-remove:hover { color: var(--danger); }

/* ─── Output Stats ──────────────────────────────────────────────── */
.output-stats {
  display: flex;
  gap: 12px;
  padding: 20px 28px 0;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  flex: 1;
  min-width: 120px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ─── Download Actions ──────────────────────────────────────────── */
.download-actions {
  display: flex;
  gap: 10px;
}

.restart-wrap {
  padding: 16px 28px;
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 999;
  max-width: 480px;
  width: calc(100% - 48px);
  animation: slideUp 0.25s ease;
}

.toast-error {
  background: var(--surface);
  border: 1.5px solid #fca5a5;
  color: var(--danger);
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 1.1rem;
  line-height: 1;
  margin-left: auto;
  padding: 0;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(12px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ─── Utility ───────────────────────────────────────────────────── */
.hidden { display: none !important; }

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

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}
