/* MAP
 * §1 Buttons & Pills         L9-L70
 * §2 Cards, Swatches & Tags  L72-L159
 * §3 Forms & Inputs          L161-L191
 * §4 Tables & Tabs           L193-L215
 * §5 Modals, Toasts & Hero   L217-L272
 */

/* §1 Buttons & Pills */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }

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

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 0 var(--space-3); font-size: 0.875rem; }
.btn-icon { width: 44px; padding: 0; }

.pill-group { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pill[aria-pressed="true"],
.pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

/* §2 Cards, Swatches & Tags */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.card-elevated {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-accent { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.badge-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.badge-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

.token-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding-inline: 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.token-num.is-top { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.credits-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
}

.skin-swatch {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(circle at 32% 28%, rgba(250, 248, 242, 0.72) 0%, rgba(250, 248, 242, 0.14) 22%, transparent 45%),
    conic-gradient(from 40deg, var(--skin-a, #E5B82E), var(--skin-b, #444954), var(--skin-a, #E5B82E));
  box-shadow: inset -6px -8px 14px rgba(14, 15, 18, 0.45), var(--shadow-sm);
}

.badge-swatch {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 2px solid var(--badge-c, var(--accent));
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--badge-c, var(--accent));
  flex-shrink: 0;
}

/* §3 Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.875rem; font-weight: 600; color: var(--text-2); }

.input, .select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.input:focus, .select:focus { border-color: var(--accent); outline: none; }
.field-error { min-height: 1.1em; font-size: 0.82rem; color: var(--danger); }

.form-error {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.9rem;
}

/* §4 Tables & Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { font-size: 0.8rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.data-table td.num, .data-table th.num { text-align: right; }

.progress-track {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); transition: width var(--dur-mid) var(--ease); }

/* §5 Modals, Toasts & Hero */
.hero-launch {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--backdrop);
  display: grid;
  place-items: center;
  padding: var(--space-4);
}
.modal-backdrop[hidden] { display: none; }

.modal-panel {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}

.toast-stack {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
}
.toast-ok { border-left-color: var(--ok); }
.toast-danger { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }
